@inkeep/open-knowledge 0.22.0-beta.1 → 0.22.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-DsrupZVT.mjs +2 -0
- package/dist/{dist-WvGgYUq3.mjs → dist-5JkJUoWe.mjs} +1 -1
- package/dist/{dist-BKI5bsnH.mjs → dist-CXugONRr.mjs} +5 -5
- package/dist/{gh-detect-Y9Q4N2U2.mjs → gh-detect-DR8F3B_q.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-DgMDl9bi.mjs → init-DUrLRKNf.mjs} +4 -4
- package/dist/init-r8SVrPD4.mjs +1 -0
- package/dist/{loader-tJ2suF5R.mjs → loader-CvZHOFj4.mjs} +2 -2
- package/dist/loader-Ufhdyoeh.mjs +1 -0
- package/dist/{preview-G0aEY6RA.mjs → preview-Bk6DOvAg.mjs} +2 -2
- package/dist/preview-DwGlRnFH.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-CD0E2wK7.js → ActivityModeContent-BXgtHL25.js} +1 -1
- package/dist/public/assets/{DocumentContext-BMVumFKt.js → DocumentContext-BGknAC4o.js} +1 -1
- package/dist/public/assets/{GraphPanel-DlkHHEZT.js → GraphPanel-CUNcm2WE.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DdW5vRno.js → ManagedArtifactProperties-D1Rc1vGt.js} +1 -1
- package/dist/public/assets/{PropertyPanel-Da13QlJb.js → PropertyPanel-Cg0WmIYY.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-B811Baxk.js → SettingsDialogBody-LhApNvLs.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-WYFIqPcf.js → SkillEditorActions-BQYuB-4q.js} +1 -1
- package/dist/public/assets/{SourceEditor-YSb-9WEb.js → SourceEditor-DECD54QN.js} +1 -1
- package/dist/public/assets/{TerminalPanel-PZEie26Z.js → TerminalPanel-BCJwzg1b.js} +3 -3
- package/dist/public/assets/{config-validation-events-DakUm2WT.js → config-validation-events-T94YYhV4.js} +1 -1
- package/dist/public/assets/{dist-DRCAw1CO.js → dist-Bs-tW6G8.js} +96 -96
- package/dist/public/assets/{documents-events-f8eoj_v4.js → documents-events-BNWxXfUn.js} +1 -1
- package/dist/public/assets/{index-6MnUGNtT.js → index-EQYJUQ1w.js} +22 -22
- package/dist/public/assets/{keyboard-shortcuts-D5Owsl0q.js → keyboard-shortcuts-BiM6BZIC.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-C0AbZ_6-.js → open-managed-artifact-tab-DiVI1LIM.js} +1 -1
- package/dist/public/assets/{prop-types-DZE54Al5.js → prop-types-v9vPsKcH.js} +1 -1
- package/dist/public/assets/{selection-context-Cw1eExdZ.js → selection-context-Ba9gjZXK.js} +1 -1
- package/dist/public/assets/{skill-actions-C80clBXU.js → skill-actions-BIHAh0gq.js} +1 -1
- package/dist/public/assets/{skills-api-cY4WO5Mw.js → skills-api-o3prwefH.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-B0Gd4kM8.js → target-navigation-intent-BuX7BlwO.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BvmLrTro.js → typing-burst-detector-BsSMOi_A.js} +1 -1
- package/dist/public/index.html +14 -14
- package/dist/{repair-launch-json-Bd-0adP2.mjs → repair-launch-json-Cfau-TmL.mjs} +2 -2
- package/dist/{repair-mcp-configs-BRfB5j1e.mjs → repair-mcp-configs-CwpRPK1F.mjs} +2 -2
- package/dist/{repair-skills-B9vw7CvY.mjs → repair-skills-BqkRJ8Vk.mjs} +2 -2
- package/dist/repair-skills-DNzSdyl5.mjs +1 -0
- package/dist/server-lock-8Lv6A-Xa-DCBoMd9v.mjs +1 -0
- package/dist/{server-lock-CN2YHwpP-Ca8AKq_V.mjs → server-lock-CN2YHwpP-DiysUpvV.mjs} +39 -39
- package/dist/{src-DiRKGjMG.mjs → src-RwSE84EJ.mjs} +2 -2
- package/dist/{start-DQvUku5V.mjs → start-DSZUQ5V6.mjs} +2 -2
- package/dist/start-DXnKMiHv.mjs +1 -0
- package/dist/{write-project-skill-uoYvmbMv.mjs → write-project-skill-Ba_TWxCT.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-Drk2ovig.mjs +0 -2
- package/dist/init-C3RbJchk.mjs +0 -1
- package/dist/loader-B2BydJRg.mjs +0 -1
- package/dist/preview-DmxJggRQ.mjs +0 -1
- package/dist/repair-skills-pYUxq2OX.mjs +0 -1
- package/dist/server-lock-8Lv6A-Xa-DqbpfxSh.mjs +0 -1
- package/dist/start-C2UyiEg3.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BJxTjOze.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D2bW5RZv.js","./propagation-api-Dhdns5D6.js","./ConsentDialogBody-BD48TGm2.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-DBdFRrZg.js","./dist-CPXhSDT0.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-Bt8vN5IM.js","./dist-BLu8fLv5.js","./dist-KER3mSN7.js","./collapsible-B9pRLq8V.js","./chevron-right-jyIhGBkw.js","./project-paths-CK_36JyE.js","./label-Bg6tgeFh.js","./radio-group-_aqBV1Ev.js","./dist-DEyMVsLW.js","./dist-Dpgw_p7D.js","./tooltip-D-omjYEX.js","./input-CFm7DcvJ.js","./textarea-C-Hijn80.js","./McpConsentDialogBody-XGOmuRSp.js","./mcp-consent-store-DZJQdxaS.js","./ActivityPanelDiffView-BXoGtJMu.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-
|
|
2
|
-
import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$n as o,$t as s,A as c,Ar as l,B as u,Bn as d,Bt as f,Cn as p,Cr as m,Ct as h,D as g,Dr as _,Dt as v,En as y,Et as b,F as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Hn as D,Ht as O,I as k,It as A,Jn as j,Jt as M,K as N,Kn as P,Kt as F,L as I,Lt as L,Mr as R,Mt as z,Nr as B,Nt as V,O as H,On as U,Ot as W,Pt as G,Q as K,Qn as q,Qt as J,R as Y,Rt as ee,Sn as te,St as ne,Tn as re,Tr as ie,Tt as ae,U as oe,Un as se,Ut as ce,V as le,Vn as ue,Vt as de,W as fe,Wn as pe,Wt as me,Xn as he,Xt as ge,Yn as _e,Yt as ve,Zn as ye,Zt as be,_n as xe,_r as Se,_t as Ce,a as we,an as Te,ar as Ee,at as De,bn as Oe,br as ke,bt as Ae,c as je,cn as Me,cr as Ne,ct as Pe,d as Fe,dn as Ie,dr as Le,dt as Re,en as ze,er as Be,et as Ve,f as He,fn as Ue,fr as We,ft as Ge,g as Ke,gn as qe,gr as Je,gt as Ye,h as Xe,hn as Ze,hr as Qe,ht as $e,i as et,in as tt,ir as nt,it as rt,j as it,jr as at,k as ot,kr as st,kt as ct,l as lt,ln as ut,lr as dt,lt as ft,m as pt,mn as mt,mr as ht,mt as gt,n as _t,nn as vt,o as yt,on as bt,or as xt,ot as St,p as Ct,pn as wt,pr as Tt,pt as Et,q as Dt,qn as Ot,qt as kt,r as At,rn as jt,rr as Mt,rt as Nt,s as Pt,sn as Ft,sr as It,st as Lt,t as Rt,tn as zt,tr as Bt,tt as Vt,u as Ht,un as Ut,ur as Wt,ut as Gt,v as Kt,vn as qt,vr as Jt,vt as Yt,wn as Xt,wt as Zt,xn as Qt,xr as $t,xt as en,y as tn,yn as nn,yr as rn,yt as an,z as on,zt as sn}from"./DocumentContext-BMVumFKt.js";import{n as X,r as cn,t as ln}from"./dist-CQw2y-s3.js";import{A as un,C as dn,D as fn,E as pn,O as mn,S as hn,T as gn,_ as _n,a as vn,b as yn,c as bn,d as xn,f as Sn,g as Cn,h as wn,i as Tn,k as En,l as Dn,m as On,n as kn,o as An,p as jn,r as Mn,s as Nn,t as Pn,u as Fn,v as In,w as Ln,x as Rn,y as zn}from"./panel-BbrtnF__.js";import{$r as Bn,A as Vn,Ar as Hn,Bi as Un,Cr as Wn,Ct as Gn,D as Kn,Dr as qn,Dt as Jn,E as Yn,En as Xn,F as Zn,Fn as Qn,Ft as $n,Hi as er,Ht as tr,Ii as nr,Jr as rr,K as ir,Mr as ar,Ni as or,Nr as sr,O as cr,Ot as lr,P as ur,Qr as dr,Ri as fr,Rn as pr,Rr as mr,S as hr,Sn as gr,Ui as _r,Vi as vr,Vn as yr,Vr as br,Wi as xr,Wn as Sr,Wt as Cr,Xt as wr,Yr as Tr,Yt as Er,_n as Dr,_r as Or,an as kr,bn as Ar,br as jr,cn as Mr,cr as Nr,ct as Pr,di as Fr,dn as Ir,dr as Lr,ei as Rr,fn as zr,fr as Br,gn as Vr,gr as Hr,ii as Ur,ji as Wr,jr as Gr,jt as Kr,k as qr,ki as Jr,kr as Yr,li as Xr,ln as Zr,mt as Qr,n as $r,o as ei,or as ti,pr as ni,pt as ri,r as ii,rt as ai,si as oi,t as si,ti as ci,tr as li,ui,un as di,v as fi,vn as pi,vr as mi,w as hi,wn as gi,wt as _i,x as vi,xr as yi,yr as bi,zn as xi,zr as Si}from"./dist-DRCAw1CO.js";import{t as Ci}from"./react-dom-C-oc-P2K.js";import{c as wi,l as Ti,r as Ei,t as Di,u as Oi}from"./button-DGf25ccp.js";import{a as ki,c as Ai,i as ji,l as Mi,n as Ni,o as Pi,r as Fi,s as Ii,t as Li}from"./agent-presence-CPRnxEOl.js";import{$ as Ri,B as zi,D as Bi,E as Vi,F as Hi,G as Ui,I as Wi,J as Gi,K as Ki,L as qi,M as Ji,N as Yi,P as Xi,Q as Zi,R as Qi,S as $i,T as ea,V as ta,W as na,X as ra,Y as ia,Z as aa,_t as oa,at as sa,c as ca,ct as la,dt as ua,et as da,f as fa,ft as pa,g as ma,gt as ha,h as ga,ht as _a,it as va,j as ya,lt as ba,mt as xa,nt as Sa,o as Ca,ot as wa,pt as Ta,q as Ea,r as Da,rt as Oa,s as ka,st as Aa,t as ja,tt as Ma,ut as Na,vt as Pa,w as Fa,x as Ia,yt as La,z as Ra}from"./config-validation-events-DakUm2WT.js";import{i as za,n as Ba,r as Va,t as Ha}from"./toggle-group-Bwdb9pNj.js";import{a as Ua,c as Wa,d as Ga,i as Ka,l as qa,o as Ja,r as Ya,s as Xa,t as Za,u as Qa}from"./PropertyPanel-Da13QlJb.js";import{_ as $a,a as eo,c as to,i as no,n as ro,o as io,s as ao,t as oo}from"./dialog-Bt8vN5IM.js";import{t as so}from"./chevron-down-BaPMAfbX.js";import{t as co}from"./chevron-right-jyIhGBkw.js";import{A as lo,C as uo,D as fo,E as po,F as mo,I as ho,M as go,N as _o,O as vo,P as yo,S as bo,T as xo,_ as So,a as Co,b as wo,c as To,g as Eo,h as Do,i as Oo,j as ko,k as Ao,l as jo,n as Mo,o as No,s as Po,v as Fo,w as Io,x as Lo,y as Ro}from"./prop-types-DZE54Al5.js";import{A as zo,C as Bo,D as Vo,E as Ho,O as Uo,S as Wo,T as Go,_ as Ko,a as qo,c as Jo,d as Yo,g as Xo,h as Zo,i as Qo,k as $o,l as es,m as ts,n as ns,o as rs,p as is,r as as,s as os,u as ss,v as cs,w as ls,x as us,y as ds}from"./skill-actions-C80clBXU.js";import{a as fs,c as ps,d as ms,f as hs,i as gs,l as _s,m as vs,n as ys,o as bs,p as xs,r as Ss,u as Cs}from"./config-context-DhhN0rlf.js";import{_ as ws,c as Ts,f as Es,g as Ds,h as Os,i as ks,l as As,m as js,o as Ms,p as Ns,s as Ps,t as Fs,u as Is,v as Ls,y as Rs}from"./open-managed-artifact-tab-C0AbZ_6-.js";import{i as zs,n as Bs,r as Vs,t as Hs}from"./collapsible-B9pRLq8V.js";import{a as Us,i as Ws,r as Gs,t as Ks}from"./cursor-CpjEfgnv.js";import{n as qs,r as Js,t as Ys}from"./dist-BLu8fLv5.js";import{a as Xs,c as Zs,l as Qs,n as $s,o as ec,r as tc,s as nc,u as rc}from"./documents-events-f8eoj_v4.js";import{t as ic}from"./external-link-CJXR-UFu.js";import{a as ac,d as oc,f as sc,i as cc,l as lc,o as uc,s as dc}from"./dist-CPXhSDT0.js";import{i as fc,n as pc,r as mc,t as hc}from"./tooltip-D-omjYEX.js";import{c as gc,d as _c,f as vc,g as yc,h as bc,l as xc,m as Sc,o as Cc,p as wc,s as Tc,u as Ec}from"./dist-DEyMVsLW.js";import{t as Dc}from"./checkbox-DBdFRrZg.js";import{n as Oc,r as kc,t as Ac}from"./dist-Dpgw_p7D.js";import{A as jc,B as Mc,C as Nc,D as Pc,E as Fc,F as Ic,H as Lc,I as Rc,L as zc,M as Bc,N as Vc,O as Hc,P as Uc,R as Wc,S as Gc,T as Kc,V as qc,_ as Jc,g as Yc,h as Xc,i as Zc,j as Qc,k as $c,m as el,o as tl,p as nl,r as rl,u as il,v as al,w as ol,x as sl,z as cl}from"./skills-api-cY4WO5Mw.js";import{t as ll}from"./label-Bg6tgeFh.js";import{n as ul,t as dl}from"./radio-group-_aqBV1Ev.js";import{t as fl}from"./input-CFm7DcvJ.js";import{a as pl,i as ml,n as hl,r as gl}from"./project-paths-CK_36JyE.js";import{n as _l,t as vl}from"./mcp-consent-store-DZJQdxaS.js";import{c as yl,i as bl,l as xl,o as Sl}from"./keyboard-shortcuts-D5Owsl0q.js";import{$ as Cl,At as wl,Ct as Tl,Dt as El,Ft as Dl,I as Ol,It as kl,J as Al,Mt as jl,Ot as Ml,Pt as Nl,Q as Pl,Tt as Fl,X as Il,Z as Ll,at as Rl,bt as zl,jt as Bl,k as Vl,w as Hl}from"./dist-BXTYSiRS.js";import{n as Ul}from"./dist-hRhcPaZU.js";import{c as Wl,f as Gl,g as Kl,i as ql,l as Jl,n as Yl,o as Xl,p as Zl,r as Ql,s as $l,t as eu,u as tu}from"./typing-burst-detector-BvmLrTro.js";import{t as nu}from"./target-navigation-intent-B0Gd4kM8.js";import"./textarea-C-Hijn80.js";import{c as ru,i as iu,n as au,r as ou,s as su}from"./selection-context-Cw1eExdZ.js";import{t as cu}from"./terminal-theme-BxhEvVX2.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function lu(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.21.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BJxTjOze.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function uu(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=>{Cn(e,()=>t.signal,()=>n=!0)},u=zn(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?In:_n;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?fu:du,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:du(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 du(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 fu(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var pu=class extends Sn{#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||mu(),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=jn({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),wn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function mu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var hu=class extends un{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 pu({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=gu(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=gu(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=gu(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=gu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){wn.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=>dn(t,e))}findAll(e={}){return this.getAll().filter(t=>dn(e,t))}notify(e){wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return wn.batch(()=>Promise.all(e.map(e=>e.continue().catch(gn))))}};function gu(e){return e.options.scope?.id}var _u=class extends un{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??hn(r,t),a=this.get(i);return a||(a=new xn({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(){wn.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=>Ln(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ln(e,t)):t}notify(e){wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){wn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){wn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new _u,this.#t=e.mutationCache||new hu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=En.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=On.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(fn(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=yn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return wn.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;wn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return wn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=wn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(gn).catch(gn)}invalidateQueries(e,t={}){return wn.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=wn.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(gn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(gn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(fn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(gn).catch(gn)}fetchInfiniteQuery(e){return e.behavior=uu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(gn).catch(gn)}ensureInfiniteQueryData(e){return e.behavior=uu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return On.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(Rn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{pn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Rn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{pn(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||=hn(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===mn&&(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()}},yu=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}}}})),bu=t(((e,t)=>{t.exports=yu()})),xu=t((e=>{var t=bu(),n=r(),i=Ci();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-BJxTjOze.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-D2bW5RZv.js","./propagation-api-Dhdns5D6.js","./ConsentDialogBody-BD48TGm2.js","./dist-CQw2y-s3.js","./compiler-runtime-CVnuRdak.js","./checkbox-DBdFRrZg.js","./dist-CPXhSDT0.js","./button-DGf25ccp.js","./react-dom-C-oc-P2K.js","./dialog-Bt8vN5IM.js","./dist-BLu8fLv5.js","./dist-KER3mSN7.js","./collapsible-B9pRLq8V.js","./chevron-right-jyIhGBkw.js","./project-paths-CK_36JyE.js","./label-Bg6tgeFh.js","./radio-group-_aqBV1Ev.js","./dist-DEyMVsLW.js","./dist-Dpgw_p7D.js","./tooltip-D-omjYEX.js","./input-CFm7DcvJ.js","./textarea-C-Hijn80.js","./McpConsentDialogBody-XGOmuRSp.js","./mcp-consent-store-DZJQdxaS.js","./ActivityPanelDiffView-BXoGtJMu.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-CUNcm2WE.js","./dist-Bs-tW6G8.js","./w3c-keyname-CO1Sq6Ug.js","./documents-events-BNWxXfUn.js","./toggle-group-Bwdb9pNj.js","./panel-BbrtnF__.js","./min-CBRRdG4A.js","./src-BqsPAyWV.js","./colors-Di0NygFo.js","./ordinal-DkoIOw9o.js","./init-CRMkf9sL.js","./isObjectLike-CXTdSPmv.js","./now-CEjbn_S3.js","./isSymbol-BedorAQF.js","./prop-types-v9vPsKcH.js","./target-navigation-intent-BuX7BlwO.js","./external-link-CJXR-UFu.js","./ActivityModeContent-BXgtHL25.js","./DocumentContext-BGknAC4o.js","./dist-C_ATH0cs.js","./dist-BXTYSiRS.js","./dist-Dkd2NyD9.js","./dist-wA9FGceo.js","./dist-BKvCaeVU.js","./dist-Diq9mvyh.js","./dist-Bzfgenqd2.js","./dist-hRhcPaZU.js","./dist-DisLVkiU.js","./stex-h1E98Bzt.js","./chevron-down-BaPMAfbX.js","./config-context-DhhN0rlf.js","./DocumentContext-B0sQn39F.css","./agent-presence-CPRnxEOl.js","./cursor-CpjEfgnv.js","./dist-HRxi3YvV2.js","./dist-ChteXkW7.js","./SettingsDialogBody-LhApNvLs.js","./open-managed-artifact-tab-DiVI1LIM.js","./skills-api-o3prwefH.js","./config-validation-events-T94YYhV4.js","./skill-actions-BIHAh0gq.js","./keyboard-shortcuts-BiM6BZIC.js","./ManagedArtifactProperties-D1Rc1vGt.js","./PropertyPanel-Cg0WmIYY.js","./format-iztu8fVR.js","./selection-context-Ba9gjZXK.js","./SourceEditor-DECD54QN.js","./typing-burst-detector-BsSMOi_A.js","./SkillEditorActions-BQYuB-4q.js","./TerminalPanel-BCJwzg1b.js","./terminal-theme-BxhEvVX2.js","./TerminalPanel-BrP-ENHg.css"])))=>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{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$n as o,$t as s,A as c,Ar as l,B as u,Bn as d,Bt as f,Cn as p,Cr as m,Ct as h,D as g,Dr as _,Dt as v,En as y,Et as b,F as x,Ft as S,G as C,Gn as w,Gt as T,H as E,Hn as D,Ht as O,I as k,It as A,Jn as j,Jt as M,K as N,Kn as P,Kt as F,L as I,Lt as L,Mr as R,Mt as z,Nr as B,Nt as V,O as H,On as U,Ot as W,Pt as G,Q as K,Qn as q,Qt as J,R as Y,Rt as ee,Sn as te,St as ne,Tn as re,Tr as ie,Tt as ae,U as oe,Un as se,Ut as ce,V as le,Vn as ue,Vt as de,W as fe,Wn as pe,Wt as me,Xn as he,Xt as ge,Yn as _e,Yt as ve,Zn as ye,Zt as be,_n as xe,_r as Se,_t as Ce,a as we,an as Te,ar as Ee,at as De,bn as Oe,br as ke,bt as Ae,c as je,cn as Me,cr as Ne,ct as Pe,d as Fe,dn as Ie,dr as Le,dt as Re,en as ze,er as Be,et as Ve,f as He,fn as Ue,fr as We,ft as Ge,g as Ke,gn as qe,gr as Je,gt as Ye,h as Xe,hn as Ze,hr as Qe,ht as $e,i as et,in as tt,ir as nt,it as rt,j as it,jr as at,k as ot,kr as st,kt as ct,l as lt,ln as ut,lr as dt,lt as ft,m as pt,mn as mt,mr as ht,mt as gt,n as _t,nn as vt,o as yt,on as bt,or as xt,ot as St,p as Ct,pn as wt,pr as Tt,pt as Et,q as Dt,qn as Ot,qt as kt,r as At,rn as jt,rr as Mt,rt as Nt,s as Pt,sn as Ft,sr as It,st as Lt,t as Rt,tn as zt,tr as Bt,tt as Vt,u as Ht,un as Ut,ur as Wt,ut as Gt,v as Kt,vn as qt,vr as Jt,vt as Yt,wn as Xt,wt as Zt,xn as Qt,xr as $t,xt as en,y as tn,yn as nn,yr as rn,yt as an,z as on,zt as sn}from"./DocumentContext-BGknAC4o.js";import{n as X,r as cn,t as ln}from"./dist-CQw2y-s3.js";import{A as un,C as dn,D as fn,E as pn,O as mn,S as hn,T as gn,_ as _n,a as vn,b as yn,c as bn,d as xn,f as Sn,g as Cn,h as wn,i as Tn,k as En,l as Dn,m as On,n as kn,o as An,p as jn,r as Mn,s as Nn,t as Pn,u as Fn,v as In,w as Ln,x as Rn,y as zn}from"./panel-BbrtnF__.js";import{$r as Bn,A as Vn,Ar as Hn,Bi as Un,Cr as Wn,Ct as Gn,D as Kn,Dr as qn,Dt as Jn,E as Yn,En as Xn,F as Zn,Fn as Qn,Ft as $n,Hi as er,Ht as tr,Ii as nr,Jr as rr,K as ir,Mr as ar,Ni as or,Nr as sr,O as cr,Ot as lr,P as ur,Qr as dr,Ri as fr,Rn as pr,Rr as mr,S as hr,Sn as gr,Ui as _r,Vi as vr,Vn as yr,Vr as br,Wi as xr,Wn as Sr,Wt as Cr,Xt as wr,Yr as Tr,Yt as Er,_n as Dr,_r as Or,an as kr,bn as Ar,br as jr,cn as Mr,cr as Nr,ct as Pr,di as Fr,dn as Ir,dr as Lr,ei as Rr,fn as zr,fr as Br,gn as Vr,gr as Hr,ii as Ur,ji as Wr,jr as Gr,jt as Kr,k as qr,ki as Jr,kr as Yr,li as Xr,ln as Zr,mt as Qr,n as $r,o as ei,or as ti,pr as ni,pt as ri,r as ii,rt as ai,si as oi,t as si,ti as ci,tr as li,ui,un as di,v as fi,vn as pi,vr as mi,w as hi,wn as gi,wt as _i,x as vi,xr as yi,yr as bi,zn as xi,zr as Si}from"./dist-Bs-tW6G8.js";import{t as Ci}from"./react-dom-C-oc-P2K.js";import{c as wi,l as Ti,r as Ei,t as Di,u as Oi}from"./button-DGf25ccp.js";import{a as ki,c as Ai,i as ji,l as Mi,n as Ni,o as Pi,r as Fi,s as Ii,t as Li}from"./agent-presence-CPRnxEOl.js";import{$ as Ri,B as zi,D as Bi,E as Vi,F as Hi,G as Ui,I as Wi,J as Gi,K as Ki,L as qi,M as Ji,N as Yi,P as Xi,Q as Zi,R as Qi,S as $i,T as ea,V as ta,W as na,X as ra,Y as ia,Z as aa,_t as oa,at as sa,c as ca,ct as la,dt as ua,et as da,f as fa,ft as pa,g as ma,gt as ha,h as ga,ht as _a,it as va,j as ya,lt as ba,mt as xa,nt as Sa,o as Ca,ot as wa,pt as Ta,q as Ea,r as Da,rt as Oa,s as ka,st as Aa,t as ja,tt as Ma,ut as Na,vt as Pa,w as Fa,x as Ia,yt as La,z as Ra}from"./config-validation-events-T94YYhV4.js";import{i as za,n as Ba,r as Va,t as Ha}from"./toggle-group-Bwdb9pNj.js";import{a as Ua,c as Wa,d as Ga,i as Ka,l as qa,o as Ja,r as Ya,s as Xa,t as Za,u as Qa}from"./PropertyPanel-Cg0WmIYY.js";import{_ as $a,a as eo,c as to,i as no,n as ro,o as io,s as ao,t as oo}from"./dialog-Bt8vN5IM.js";import{t as so}from"./chevron-down-BaPMAfbX.js";import{t as co}from"./chevron-right-jyIhGBkw.js";import{A as lo,C as uo,D as fo,E as po,F as mo,I as ho,M as go,N as _o,O as vo,P as yo,S as bo,T as xo,_ as So,a as Co,b as wo,c as To,g as Eo,h as Do,i as Oo,j as ko,k as Ao,l as jo,n as Mo,o as No,s as Po,v as Fo,w as Io,x as Lo,y as Ro}from"./prop-types-v9vPsKcH.js";import{A as zo,C as Bo,D as Vo,E as Ho,O as Uo,S as Wo,T as Go,_ as Ko,a as qo,c as Jo,d as Yo,g as Xo,h as Zo,i as Qo,k as $o,l as es,m as ts,n as ns,o as rs,p as is,r as as,s as os,u as ss,v as cs,w as ls,x as us,y as ds}from"./skill-actions-BIHAh0gq.js";import{a as fs,c as ps,d as ms,f as hs,i as gs,l as _s,m as vs,n as ys,o as bs,p as xs,r as Ss,u as Cs}from"./config-context-DhhN0rlf.js";import{_ as ws,c as Ts,f as Es,g as Ds,h as Os,i as ks,l as As,m as js,o as Ms,p as Ns,s as Ps,t as Fs,u as Is,v as Ls,y as Rs}from"./open-managed-artifact-tab-DiVI1LIM.js";import{i as zs,n as Bs,r as Vs,t as Hs}from"./collapsible-B9pRLq8V.js";import{a as Us,i as Ws,r as Gs,t as Ks}from"./cursor-CpjEfgnv.js";import{n as qs,r as Js,t as Ys}from"./dist-BLu8fLv5.js";import{a as Xs,c as Zs,l as Qs,n as $s,o as ec,r as tc,s as nc,u as rc}from"./documents-events-BNWxXfUn.js";import{t as ic}from"./external-link-CJXR-UFu.js";import{a as ac,d as oc,f as sc,i as cc,l as lc,o as uc,s as dc}from"./dist-CPXhSDT0.js";import{i as fc,n as pc,r as mc,t as hc}from"./tooltip-D-omjYEX.js";import{c as gc,d as _c,f as vc,g as yc,h as bc,l as xc,m as Sc,o as Cc,p as wc,s as Tc,u as Ec}from"./dist-DEyMVsLW.js";import{t as Dc}from"./checkbox-DBdFRrZg.js";import{n as Oc,r as kc,t as Ac}from"./dist-Dpgw_p7D.js";import{A as jc,B as Mc,C as Nc,D as Pc,E as Fc,F as Ic,H as Lc,I as Rc,L as zc,M as Bc,N as Vc,O as Hc,P as Uc,R as Wc,S as Gc,T as Kc,V as qc,_ as Jc,g as Yc,h as Xc,i as Zc,j as Qc,k as $c,m as el,o as tl,p as nl,r as rl,u as il,v as al,w as ol,x as sl,z as cl}from"./skills-api-o3prwefH.js";import{t as ll}from"./label-Bg6tgeFh.js";import{n as ul,t as dl}from"./radio-group-_aqBV1Ev.js";import{t as fl}from"./input-CFm7DcvJ.js";import{a as pl,i as ml,n as hl,r as gl}from"./project-paths-CK_36JyE.js";import{n as _l,t as vl}from"./mcp-consent-store-DZJQdxaS.js";import{c as yl,i as bl,l as xl,o as Sl}from"./keyboard-shortcuts-BiM6BZIC.js";import{$ as Cl,At as wl,Ct as Tl,Dt as El,Ft as Dl,I as Ol,It as kl,J as Al,Mt as jl,Ot as Ml,Pt as Nl,Q as Pl,Tt as Fl,X as Il,Z as Ll,at as Rl,bt as zl,jt as Bl,k as Vl,w as Hl}from"./dist-BXTYSiRS.js";import{n as Ul}from"./dist-hRhcPaZU.js";import{c as Wl,f as Gl,g as Kl,i as ql,l as Jl,n as Yl,o as Xl,p as Zl,r as Ql,s as $l,t as eu,u as tu}from"./typing-burst-detector-BsSMOi_A.js";import{t as nu}from"./target-navigation-intent-BuX7BlwO.js";import"./textarea-C-Hijn80.js";import{c as ru,i as iu,n as au,r as ou,s as su}from"./selection-context-Ba9gjZXK.js";import{t as cu}from"./terminal-theme-BxhEvVX2.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function lu(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.21.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-BJxTjOze.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function uu(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=>{Cn(e,()=>t.signal,()=>n=!0)},u=zn(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?In:_n;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?fu:du,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:du(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 du(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 fu(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var pu=class extends Sn{#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||mu(),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=jn({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),wn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function mu(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var hu=class extends un{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 pu({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=gu(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=gu(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=gu(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=gu(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){wn.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=>dn(t,e))}findAll(e={}){return this.getAll().filter(t=>dn(e,t))}notify(e){wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return wn.batch(()=>Promise.all(e.map(e=>e.continue().catch(gn))))}};function gu(e){return e.options.scope?.id}var _u=class extends un{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??hn(r,t),a=this.get(i);return a||(a=new xn({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(){wn.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=>Ln(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ln(e,t)):t}notify(e){wn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){wn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){wn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},vu=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new _u,this.#t=e.mutationCache||new hu,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=En.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=On.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(fn(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=yn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return wn.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;wn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return wn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=wn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(gn).catch(gn)}invalidateQueries(e,t={}){return wn.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=wn.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(gn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(gn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(fn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(gn).catch(gn)}fetchInfiniteQuery(e){return e.behavior=uu(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(gn).catch(gn)}ensureInfiniteQueryData(e){return e.behavior=uu(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return On.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(Rn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{pn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Rn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{pn(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||=hn(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===mn&&(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()}},yu=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}}}})),bu=t(((e,t)=>{t.exports=yu()})),xu=t((e=>{var t=bu(),n=r(),i=Ci();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function Y(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ee,te;function ne(e){if(ee===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||``,te=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ee+e+te}var re=!1;function ie(e,t){if(!e||re)return``;re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -21,14 +21,14 @@ Error generating stack: `+e.message+`
|
|
|
21
21
|
`}function vy(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;gy(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?_y(e,o.headerOptions):void 0)}}))}else{let s=gy(e,t,n,r,i,a,o);return s?_y(s,o?.headerOptions):void 0}}function yy(e,t,n,r,i,a){return vy(e,e,t,n,r,i,a)}function by(e){let t=e.endsWith(`
|
|
22
22
|
`),n=e.split(`
|
|
23
23
|
`).map(e=>e+`
|
|
24
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function xy(e,t){return`${e}\u0000${t}`}function Sy(e,t,n){let r=jr(e).body,i=jr(t).body;return r===i?``:yy(n,r,i,``,``,{context:3})}function Cy(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=_t(),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=xy(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=Sy(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 wy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-BXoGtJMu.js`),__vite__mapDeps([27,1,6,7,28]),import.meta.url)).ActivityPanelDiffView})),Ty=1e4,Ey=6e4;async function Dy(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function Oy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return rc._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return rc._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return rc._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return rc._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?rc._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function ky(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ay(e){return e.slice(0,7)}function jy(e){return e.type===`upstream`?rc._({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`?rc._({id:`B2DrPb`}):e.author}function My(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)(Ws,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(Ks,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ki,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Gs,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ii,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Pi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(Us,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Ny(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)(Jt,{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=Xn(i),t[1]=i,t[2]=a);let o=a,s=r?$r[o]??si[o]:si[o],c;t[3]!==s||t[4]!==i?(c=s??wr(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)(My,{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)($u,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cu,{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)(Kd,{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)(Us,{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)(Cu,{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)(Kd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Py(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Fy(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,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(Ly),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.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(Iy)},children:[r?(0,Z.jsx)(so,{className:`size-3`}):(0,Z.jsx)(co,{className:`size-3`}),r?(0,Z.jsx)(X,{id:`vLyv1R`}):(0,Z.jsx)(X,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function Iy(e){return!e}function Ly(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 Ry(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=Cy(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ms,{className:`size-3 animate-spin`}),(0,Z.jsx)(X,{id:`38foVZ`})]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(X,{id:`vvWZnu`})}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.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)(ms,{className:`size-3 animate-spin`}),(0,Z.jsx)(X,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(wy,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function zy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=cn(),d;t[0]===n.timestamp?d=t[1]:(d=Oy(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=jy(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=ky(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=Ay(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(By),b;t[8]===n?b=t[9]:(b=Py(n),t[8]=n,t[9]=b);let x=b,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useId)(),O,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>E.current?.abort(),k=[],t[10]=O,t[11]=k):(O=t[10],k=t[11]),(0,Q.useEffect)(O,k);let A;t[12]!==n.sha||t[13]!==c?(A=()=>c(n.sha),t[12]=n.sha,t[13]=c,t[14]=A):A=t[14];let j=A,M;t[15]===C?M=t[16]:(M=function(){E.current?.abort(),E.current=null,T(!1),C(!1)},t[15]=C,t[16]=M);let N=M,P;t[17]!==u||t[18]!==o||t[19]!==n.sha||t[20]!==l||t[21]!==C?(P=async function(){T(!0);let e=new AbortController;E.current=e;let t=function(){e.signal.aborted||T(!1),E.current===e&&(E.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:o,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:o,sha:n.sha,err:i}),qs.error(u({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)C(!1),l();else{let e=`HTTP ${r.status}`;try{let t=ai.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:o,sha:n.sha,status:r.status,detail:e}),qs.error(u({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=u,t[18]=o,t[19]=n.sha,t[20]=l,t[21]=C,t[22]=P):P=t[22];let F=P,I;t[23]!==n||t[24]!==r?(I=(0,Z.jsx)(Ny,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=I):I=t[25];let L=I,R=s?D:void 0,z=s?`bg-muted`:`hover:bg-muted/80`,B;t[26]===z?B=t[27]:(B=[`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`,z],t[26]=z,t[27]=B);let V=B.join(` `),H;t[28]===j?H=t[29]:(H=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},t[28]=j,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:L}),t[30]=L,t[31]=U);let W;t[32]===m?W=t[33]:(W=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:m}),t[32]=m,t[33]=W);let G;t[34]!==n.timestamp||t[35]!==f?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:f}),t[34]=n.timestamp,t[35]=f,t[36]=G):G=t[36];let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=K):K=t[37];let q;t[38]===u?q=t[39]:(q=u({id:`Yea-K5`}),t[38]=u,t[39]=q);let J;t[40]===C?J=t[41]:(J=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=J);let Y;t[42]===w?Y=t[43]:(Y=w?(0,Z.jsx)(ms,{className:`size-3 animate-spin`}):(0,Z.jsx)(Ai,{className:`size-3`}),t[42]=w,t[43]=Y);let ee;t[44]!==w||t[45]!==q||t[46]!==J||t[47]!==Y?(ee=(0,Z.jsx)(fc,{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":q,disabled:w,onClick:J,children:Y})}),t[44]=w,t[45]=q,t[46]=J,t[47]=Y,t[48]=ee):ee=t[48];let te;t[49]===u?te=t[50]:(te=u({id:`Yea-K5`}),t[49]=u,t[50]=te);let ne;t[51]===te?ne=t[52]:(ne=(0,Z.jsx)(pc,{side:`top`,children:te}),t[51]=te,t[52]=ne);let re;t[53]!==ee||t[54]!==ne?(re=(0,Z.jsxs)(hc,{children:[ee,ne]}),t[53]=ee,t[54]=ne,t[55]=re):re=t[55];let ie;t[56]!==W||t[57]!==G||t[58]!==re?(ie=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,re]}),t[56]=W,t[57]=G,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]===x?ae=t[61]:(ae=x.length>0&&(0,Z.jsx)(Fy,{summaries:x}),t[60]=x,t[61]=ae);let oe=y.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:y.join(`, `),children:y.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),se;t[62]!==ie||t[63]!==ae||t[64]!==oe?(se=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ie,ae,oe]}),t[62]=ie,t[63]=ae,t[64]=oe,t[65]=se):se=t[65];let ce;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==se?(ce=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":s,"aria-controls":R,"data-testid":`timeline-entry-expand`,className:V,onClick:j,onKeyDown:H,children:[U,se]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=se,t[73]=ce):ce=t[73];let le;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(le=s&&(0,Z.jsx)(Ry,{sha:n.sha,docName:o,cache:a,diffLayout:i,panelId:D}),t[74]=a,t[75]=i,t[76]=D,t[77]=o,t[78]=n.sha,t[79]=s,t[80]=le):le=t[80];let ue;t[81]!==ce||t[82]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ce,le]}),t[81]=ce,t[82]=le,t[83]=ue):ue=t[83];let de;t[84]!==N||t[85]!==C?(de=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=de):de=t[86];let fe;t[87]===u?fe=t[88]:(fe=u({id:`Pyp1NA`}),t[87]=u,t[88]=fe);let pe;t[89]===fe?pe=t[90]:(pe=(0,Z.jsx)(to,{children:fe}),t[89]=fe,t[90]=pe);let me;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(me={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=me):me=t[95];let he;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(he={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=he):he=t[96];let ge;t[97]===me?ge=t[98]:(ge=(0,Z.jsx)(eo,{children:(0,Z.jsx)(X,{id:`h6EvY-`,values:me,components:he})}),t[97]=me,t[98]=ge);let _e;t[99]!==pe||t[100]!==ge?(_e=(0,Z.jsxs)(ao,{children:[pe,ge]}),t[99]=pe,t[100]=ge,t[101]=_e):_e=t[101];let ve;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(X,{id:`dEgA5A`}),t[102]=ve):ve=t[102];let ye;t[103]===N?ye=t[104]:(ye=(0,Z.jsx)(Di,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:ve}),t[103]=N,t[104]=ye);let be;t[105]===F?be=t[106]:(be=()=>F(),t[105]=F,t[106]=be);let xe;t[107]===w?xe=t[108]:(xe=w?(0,Z.jsx)(ms,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=xe);let Se;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(X,{id:`yKu_3Y`}),t[109]=Se):Se=t[109];let Ce;t[110]!==w||t[111]!==be||t[112]!==xe?(Ce=(0,Z.jsxs)(Di,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:be,children:[xe,Se]}),t[110]=w,t[111]=be,t[112]=xe,t[113]=Ce):Ce=t[113];let we;t[114]!==ye||t[115]!==Ce?(we=(0,Z.jsxs)(io,{children:[ye,Ce]}),t[114]=ye,t[115]=Ce,t[116]=we):we=t[116];let Te;t[117]!==_e||t[118]!==we?(Te=(0,Z.jsxs)(no,{children:[_e,we]}),t[117]=_e,t[118]=we,t[119]=Te):Te=t[119];let Ee;t[120]!==S||t[121]!==de||t[122]!==Te?(Ee=(0,Z.jsx)(oo,{open:S,onOpenChange:de,children:Te}),t[120]=S,t[121]=de,t[122]=Te,t[123]=Ee):Ee=t[123];let De;return t[124]!==ue||t[125]!==Ee?(De=(0,Z.jsxs)(Z.Fragment,{children:[ue,Ee]}),t[124]=ue,t[125]=Ee,t[126]=De):De=t[126],De}function By(e){return e.docs}function Vy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=cn(),{resolvedTheme:o}=xr(),s=o===`dark`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h]=(0,Q.useState)(Gy),[g,_]=(0,Q.useState)(Wy),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]!==a||t[8]!==n?(w=()=>{if(!n){u([]);return}f(!0);let e=qv({baseMs:Ty,maxBackoffMs:Ey,isPaused:Uy,poll:e=>Dy(n,e,{setEntries:u,setError:m,setLoading:f,unavailableMessage:a({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},T=[n,a],t[7]=a,t[8]=n,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=!d&&!p&&l.length>0,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Nn,{children:(0,Z.jsx)(X,{id:`cklVjM`})}),t[11]=D):D=t[11];let O;t[12]!==a||t[13]!==r||t[14]!==E||t[15]!==i?(O=E&&(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsxs)(Ha,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":a({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)(Ba,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Ed,{className:`size-3.5`})}),(0,Z.jsx)(Ba,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Lu,{className:`size-3.5`})})]})}),(0,Z.jsx)(pc,{children:r===`unified`?(0,Z.jsx)(X,{id:`379t2h`}):(0,Z.jsx)(X,{id:`HXFyWD`})})]}),t[12]=a,t[13]=r,t[14]=E,t[15]=i,t[16]=O):O=t[16];let k;t[17]===O?k=t[18]:(k=(0,Z.jsxs)(An,{children:[D,O]}),t[17]=O,t[18]=k);let A;t[19]!==a||t[20]!==d?(A=d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":a({id:`o49mDZ`}),children:[1,2,3].map(Hy)}),t[19]=a,t[20]=d,t[21]=A):A=t[21];let j;t[22]!==p||t[23]!==d?(j=!d&&p&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:p})}),t[22]=p,t[23]=d,t[24]=j):j=t[24];let M;t[25]!==l||t[26]!==p||t[27]!==d?(M=!d&&!p&&l.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)(X,{id:`Ta25TG`})})}),t[25]=l,t[26]=p,t[27]=d,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==r||t[31]!==n||t[32]!==l||t[33]!==p||t[34]!==g||t[35]!==s||t[36]!==d?(N=!d&&!p&&l.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:l.map(e=>(0,Z.jsx)(zy,{entry:e,isDark:s,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[29]=h,t[30]=r,t[31]=n,t[32]=l,t[33]=p,t[34]=g,t[35]=s,t[36]=d,t[37]=N):N=t[37];let P;t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[A,j,M,N]}),t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let F;return t[43]!==k||t[44]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[k,P]}),t[43]=k,t[44]=P,t[45]=F):F=t[45],F}function Hy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(la,{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)(la,{className:`h-3 w-28`}),(0,Z.jsx)(la,{className:`h-3 w-40`})]})]},e)}function Uy(){return typeof document<`u`&&document.visibilityState===`hidden`}function Wy(){return new Set}function Gy(){return new ji(32)}var Ky=[{id:`outline`,icon:cd},{id:`links`,icon:Le},{id:`graph`,icon:pd},{id:`timeline`,icon:Iu}];function qy(e){return e===`outline`?rc._({id:`dD7NPy`}):e===`links`?rc._({id:`Rj01Fz`}):e===`graph`?rc._({id:`x2fr_j`}):rc._({id:`cklVjM`})}function Jy(){return n(()=>import(`./GraphPanel-DlkHHEZT.js`),__vite__mapDeps([29,1,30,3,7,31,32,6,10,33,20,9,11,21,22,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url)}var Yy=(0,Q.lazy)(async()=>({default:(await Jy()).GraphPanel})),Xy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CD0E2wK7.js`),__vite__mapDeps([46,1,2,47,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,61,62]),import.meta.url)).ActivityModeContent}));function Zy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=cn(),[c,l]=(0,Q.useState)(`unified`),u=Y_(),d,f,p;if(t[0]!==s||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==u){let e=u?Ky.filter($y):Ky;d=e.some(e=>e.id===i)?i:`outline`,f=o===`doc`&&e.length>1,p=f?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Ha,{type:`single`,variant:`outline`,value:d,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(Qy)})}):null,t[0]=s,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=d,t[6]=f,t[7]=p}else d=t[5],f=t[6],p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==d||t[11]!==r||t[12]!==o||t[13]!==f?(m=o===`doc`?(0,Z.jsxs)(`div`,{...f?{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`}:{},className:`min-h-0 flex-1`,children:[d===`outline`&&(0,Z.jsx)(Zl,{docName:n,isSourceMode:r}),d===`links`&&(0,Z.jsx)(Kv,{docName:n}),d===`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)(X,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Yy,{activeDocName:n})}),d===`timeline`&&(0,Z.jsx)(Vy,{docName:n,diffLayout:c,onDiffLayoutChange:l})]}):(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)(X,{id:`ONPvOb`})}),children:(0,Z.jsx)(Xy,{})})}),t[8]=c,t[9]=n,t[10]=d,t[11]=r,t[12]=o,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Qy(e){let{id:t,icon:n}=e,r=qy(t);return(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Ba,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(fc,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(pc,{side:`bottom`,children:r})]},t)}function $y(e){return e.id===`outline`}function eb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function tb(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function nb(e){return e/100*window.innerHeight}function rb(e){return e/100*window.innerWidth}function ib(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 ab({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ib(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=tb(t,i);break;case`em`:r=eb(t,i);break;case`vh`:r=nb(i);break;case`vw`:r=rb(i);break}return r}function ob(e){return parseFloat(e.toFixed(3))}function sb({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 cb(e){let{panels:t}=e,n=sb({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=ob(ab({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=ob(ab({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=ob(ab({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=ob(ab({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 lb(e,t=`Assertion error`){if(!e)throw Error(t)}function ub(e,t){return Array.from(t).sort(e===`horizontal`?db:fb)}function db(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function fb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function pb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function mb(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 hb({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}=mb(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return lb(i,`No rect found`),i}var gb;function _b(){return gb===void 0&&(gb=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),gb}function vb(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=ub(n,Array.from(t.children).filter(pb).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,hb({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=_b()?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:sb({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 yb=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)}}},bb=new Map,xb=new yb;function Sb(e){bb=new Map(bb),bb.delete(e)}function Cb(e,t){for(let[t]of bb)if(t.id===e)return t}function wb(e,t){for(let[t,n]of bb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Tb(){return bb}function Eb(e,t){return xb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Db(e,t){let n=bb.get(e);bb=new Map(bb),bb.set(e,t),xb.emit(`groupChange`,{group:e,prev:n,next:t})}function Ob(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=mb(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 kb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ab(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Ib(e),b:Ib(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();lb(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Fb(Pb(n.a)),b:Fb(Pb(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 jb=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mb(e){let t=getComputedStyle(Lb(e)??e).display;return t===`flex`||t===`inline-flex`}function Nb(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Mb(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`||jb.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Pb(e){let t=e.length;for(;t--;){let n=e[t];if(lb(n,`Missing node`),Nb(n))return n}return null}function Fb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ib(e){let t=[];for(;e;)t.push(e),e=Lb(e);return t}function Lb(e){let{parentNode:t}=e;return kb(t)?t.host:t}function Rb(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 zb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!pb(n)||n.contains(e)||e.contains(n))return!0;if(Ab(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Rb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Bb(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=vb(r),a=Ob(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&zb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Vb(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 Hb(e,t,n=0){return Math.abs(ob(e)-ob(t))<=n}function Ub(e,t){return Hb(e,t)?0:e>t?1:-1}function Wb({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(Ub(r,c)<0)if(a){let e=(i+c)/2;r=Ub(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=ob(r),r}function Gb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Hb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;lb(u!=null,`Invalid first pivot index`),lb(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];lb(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(lb(n!=null,`Previous layout not found for panel index ${t}`),Hb(n,i)){let t=o-n;Ub(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];lb(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(lb(n!=null,`Previous layout not found for panel index ${t}`),Hb(n,o)){let t=n-i;Ub(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];lb(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Ub(i,c)<0)if(e>0){let t=c-o,n=t/2;Ub(i+e,c)<0&&(e=Ub(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Ub(i-e,c)<0&&(e=Ub(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];lb(e!=null,`Previous layout not found for panel index ${r}`);let a=Wb({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];lb(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Hb(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(Vb(c,l))return i;{let t=e<0?d:u,r=s[t];lb(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Hb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];lb(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Hb(i,s)||(t-=s-i,l[r]=s),Hb(t,0))break;e>0?r--:r++}}}if(!Hb(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 Kb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Ub(e[n],t[n])!==0)return!1;return!0}function qb({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(!Hb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];lb(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];lb(i!=null,`No layout data found for index ${e}`);let o=r[e];lb(o!=null,`No layout data found for index ${e}`);let s=Wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Hb(a,0))for(let e=0;e<t.length;e++){let n=r[e];lb(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Hb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Jb({groupId:e,panelId:t}){let n=()=>{let t=Tb();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=qb({layout:Gb({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});Kb(l,p)||Db(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&&Hb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=sb({group:t});o(ob(ab({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Yb(e){e.defaultPrevented||Bb(e,Tb()).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=Jb({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Xb(e){let t=Tb();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 Zb({groupId:e}){let t=()=>{let t=Tb();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=qb({layout:e,panelConstraints:r});return n?o:(Kb(o,c)||Db(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Qb(e,t){let n=Xb(e),r=wb(n.id,!0),i=n.separators.find(t=>t.element===e);lb(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);lb(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Zb({groupId:n.id}).getLayout(),c=qb({layout:Gb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Kb(s,c)||Db(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function $b(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Xb(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,-5);break;case`End`:e.preventDefault(),Qb(t,100);break;case`Enter`:{e.preventDefault();let n=Xb(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=wb(n.id,!0),o=n.separators.find(e=>e.element===t);lb(o,`Matching separator not found`);let s=a.get(o);lb(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(lb(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Qb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Xb(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);lb(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(),Qb(t,-100);break}}var ex={cursorFlags:0,state:`inactive`},tx=new yb;function nx(){return ex}function rx(e){return tx.addListener(`change`,e)}function ix(e){let t=ex,n={...ex};n.cursorFlags=e,ex=n,tx.emit(`change`,{prev:t,next:n})}function ax(e){let t=ex;ex=e,tx.emit(`change`,{prev:t,next:e})}function ox(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Tb(),n=Bb(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)}),ax({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var sx=e=>e,cx=()=>{},lx=1,ux=2,dx=4,fx=8,px=3,mx=12,hx;function gx(){return hx===void 0&&(hx=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(hx=!0)),hx}function _x({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&&gx()){let t=(e&lx)!==0,n=(e&ux)!==0,r=(e&dx)!==0,i=(e&fx)!==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 gx()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var vx=new WeakMap;function yx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=vx.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=nx();switch(r.state){case`active`:case`hover`:{let e=_x({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}vx.set(e,{prevStyle:t,styleSheet:n})}function bx({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=Gb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Kb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?lx:ux;break;case`vertical`:s|=d<0?dx:fx;break}}else Db(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&px:c|=s&px,t.movementY===0?c|=o&mx:c|=s&mx,ix(c),yx(e)}function xx(e){let t=Tb(),n=nx();switch(n.state){case`active`:bx({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Sx(e){if(e.defaultPrevented)return;let t=nx(),n=Tb();switch(t.state){case`active`:if(e.buttons===0){ax({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=wb(e.group.id,!0);Db(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)}bx({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Bb(e,n);r.length===0?t.state!==`inactive`&&ax({cursorFlags:0,state:`inactive`}):ax({cursorFlags:0,hitRegions:r,state:`hover`}),yx(e.currentTarget);break}}}function Cx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(nx().state){case`hover`:ax({cursorFlags:0,state:`inactive`})}}function wx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=nx();switch(t.state){case`active`:ax({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(yx(e.currentTarget),t.hitRegions.forEach(e=>{let t=wb(e.group.id,!0);Db(e.group,t)}),e.preventDefault())}}function Tx(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=ob(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=ob((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ex(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=sb({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:ob(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Dx(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 Ox({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=ob(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]=ob((r[e]??0)/a*l);else{let e=ob(l/c.length);for(let t of c)u[t]=e}return u}function kx(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 Ax=new Map;function jx(e){let t=!0;lb(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=sb({group:e});if(t===0)return;let n=wb(e.id);if(!n)return;let r=cb(e),i=n.defaultLayoutDeferred?Tx(r):n.layout,a=qb({layout:Ox({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Kb(n.layout,a)&&Dx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Db(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ex(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{lb(!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=sb({group:e}),s=cb(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(kx(e.panels,l)||(l=void 0));let u=qb({layout:e.mutableState.layouts[c]??l??Tx(s),panelConstraints:s}),d=e.element.ownerDocument;Ax.set(d,(Ax.get(d)??0)+1);let f=new Map;return vb(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Db(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{lb(!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`,$b)}),Ax.get(d)===1&&(d.addEventListener(`dblclick`,Yb,!0),d.addEventListener(`pointerdown`,ox,!0),d.addEventListener(`pointerleave`,xx),d.addEventListener(`pointermove`,Sx),d.addEventListener(`pointerout`,Cx),d.addEventListener(`pointerup`,wx,!0)),function(){t=!1,Ax.set(d,Math.max(0,(Ax.get(d)??0)-1)),Sb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,$b)}),Ax.get(d)||(d.removeEventListener(`dblclick`,Yb,!0),d.removeEventListener(`pointerdown`,ox,!0),d.removeEventListener(`pointerleave`,xx),d.removeEventListener(`pointermove`,Sx),d.removeEventListener(`pointerout`,Cx),d.removeEventListener(`pointerup`,wx,!0)),a.disconnect()}}function Mx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Nx(e){let t=(0,Q.useId)();return`${e??t}`}var Px=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Fx(e){let t=(0,Q.useRef)(e);return Px(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Ix(...e){return Fx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Lx(e){let t=(0,Q.useRef)({...e});return Px(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Rx=(0,Q.createContext)(null);function zx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:sx});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Px(()=>{Object.assign(n.current,Zb({groupId:e}))})}function Bx({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=Fx(e=>{Kb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Fx(e=>{Kb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Nx(s),v=(0,Q.useRef)(null),[y,b]=Mx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Ix(v,a);zx(_,o);let C=Fx((e,t)=>{let r=nx(),i=Cb(e),a=wb(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=Lx({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=ub(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=ub(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=Cb(_),i=wb(_);r&&i&&Db(r,{...i,derivedPanelConstraints:cb(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 Px(()=>{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=jx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=wb(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Eb(_,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=Hb(t.collapsedSize,i[t.panelId]),a=Hb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=nx().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)(Rx.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})})}Bx.displayName=`Group`;function Vx(){let e=(0,Q.useContext)(Rx);return lb(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Hx(e,t){let{id:n}=Vx(),r=(0,Q.useRef)({collapse:cx,expand:cx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:cx});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Px(()=>{Object.assign(r.current,Jb({groupId:n,panelId:e}))})}function Ux({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=Nx(c),_=Lx({disabled:a}),v=(0,Q.useRef)(null),y=Ix(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Vx(),T=d!==null,E=Fx((e,t,n)=>{d?.(e,c,n)});Px(()=>{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]),Hx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Eb(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:{...Wx,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})})}Ux.displayName=`Panel`;var Wx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Gx(){return(0,Q.useRef)(null)}function Kx({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=qb({layout:Gb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=qb({layout:Gb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function qx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Nx(a),l=Lx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Ix(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Vx(),x=v===`horizontal`?`vertical`:`horizontal`;Px(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=rx(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Eb(_,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(Kx({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})}qx.displayName=`Separator`;var Jx=new Map;function Yx(e){let t=Jx.get(e);if(t)return t;let n=Xx(e);return Jx.set(e,n),n}async function Xx(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-DcLsuLkb.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-C8wyRRyC.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-C8wyRRyC.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-C8wyRRyC.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-C_ATH0cs.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([48,1,49,31,50]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-BVT8Qiu3.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-CkcupPV_.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-CDhOqkQC.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-C8wyRRyC.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BKvCaeVU.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([52,1,53,49,31,50]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Bzfgenqd2.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([54,1,49,31,50]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-C8wyRRyC.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-eVxIrt9t.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-hRhcPaZU.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([55,1,53,49,31,51,48,50,52]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-C8wyRRyC.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-CPdPC9j_.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-HRxi3YvV2.js`);return{python:e}},__vite__mapDeps([63,53,49,1,31,50]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r--HdjQNrK.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-uRCn_fnf.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-ChteXkW7.js`);return{rust:e}},__vite__mapDeps([64,49,1,31,50]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-DNxIZDy8.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CK95DLTt.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BKvCaeVU.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([52,1,53,49,31,50]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-wA9FGceo.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([51,1,48,49,31,50,52,53]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-DisLVkiU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([56,1,49,31,50]),import.meta.url)).yaml().language;default:return null}}async function Zx(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Bzfgenqd2.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([54,1,49,31,50]),import.meta.url)).json().language;if(t){let e=await Yx(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-D3zY1F-v.js`);return{toml:e}},[],import.meta.url)).toml):null}function Qx(e){let t=(0,$.c)(10),{_:n}=cn(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function $x(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(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":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function eS(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(X,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(X,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(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":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var tS=oe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),nS=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function rS(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=xr(),c=Qx(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=Jr(e),r=s===`dark`?tS:nS,i=!1,c=null;return Zx(e,t).then(e=>{if(i||!a.current)return;let t=[tu,...e?[e]:[],Il.editable.of(!0),El.readOnly.of(!0),Il.lineWrapping,r];c=new Il({state:El.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)($x,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(eS,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(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":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function iS(e){return yi(`/api/asset?path=${encodeURIComponent(e)}`)}function aS(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function oS(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=iS(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,d,f,p,m;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=l.includes(`.`)?l.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(St,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=aS(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(rS,{src:e,fileName:l,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==l||t[25]!==p||t[26]!==s?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(Pe,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Di,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(X,{id:`qFWMl-`})}),(0,Z.jsx)(Di,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{u({url:s,projectRelPath:n,ext:p.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(X,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=l,t[25]=p,t[26]=s,t[27]=h):h=t[27];let g;return t[28]!==l||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:h}),t[28]=l,t[29]=h,t[30]=g):g=t[30],g}function sS(){let e=(0,$.c)(5),{_:t}=cn(),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)(la,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(la,{className:`h-4 w-full`}),(0,Z.jsx)(la,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function cS(e){let{_:t}=cn();return e===`existing-repo`?[{id:`draft-spec`,icon:Wu,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:cd,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:pd,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Rd,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Wu,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Eu,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function lS(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=cn(),a=cS(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){is(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(uS)};t[8]===r?d=t[9]:(d=Ti(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:Ti(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)($a,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(xs,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function uS(){}var dS=`ok-ask-ai-draft-v2`,fS={doc:null,dismissed:!1};function pS(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var mS=null,hS=new Set;function gS(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function _S(){let e=pS();if(!e)return fS;try{let t=e.getItem(dS);if(!t)return fS;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?fS:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),fS}}function vS(){return mS===null&&(mS=_S()),mS}function yS(e){let t=pS();if(t)try{e&&!gS(e)?t.setItem(dS,JSON.stringify(e)):t.removeItem(dS)}catch{}}function bS(){for(let e of hS)e()}function xS(){return vS()}function SS(e){let t=e&&!gS(e)?e:null;mS={...vS(),doc:t},yS(t),bS()}function CS(){SS(null)}var wS=wi(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function TS(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=Ti(wS({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var ES=Yr;function DS(e){let t=I(e).kind;return t===`folder`||t===`asset`?t:`page`}function OS(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=cn(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=DS(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(ut,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var kS=8,AS=new Fr(`composerMentionSuggestion`);function jS(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:Go(e.docName)}var MS=br.create({name:`doc`,topNode:!0,content:`paragraph+`}),NS=br.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),PS=br.create({name:`text`,group:`inline`}),FS=br.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),IS=Si.create({name:`composerHistory`,addProseMirrorPlugins(){return[Hn(),Ur({"Mod-z":ar,"Mod-y":Gr,"Shift-Mod-z":Gr})]}}),LS=br.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,Rr(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,rc._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=Ue(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=wt(Js),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[BS(this.editor)]}});function RS(e){return[MS,NS,PS,FS,IS,LS,...e?.placeholder?[ES.configure({placeholder:e.placeholder})]:[]]}function zS(e=x){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return k(t,a).map(e=>({docName:e.docName,title:e.title,path:jS(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function BS(e){let t=zS();return te({editor:e,pluginKey:AS,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=kS}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=nn(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new D(OS,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){Oe(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function VS(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
|
|
24
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function xy(e,t){return`${e}\u0000${t}`}function Sy(e,t,n){let r=jr(e).body,i=jr(t).body;return r===i?``:yy(n,r,i,``,``,{context:3})}function Cy(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=_t(),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=xy(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=Sy(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 wy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-BXoGtJMu.js`),__vite__mapDeps([27,1,6,7,28]),import.meta.url)).ActivityPanelDiffView})),Ty=1e4,Ey=6e4;async function Dy(e,t,n){try{let r=await fetch(`/api/history?docName=${encodeURIComponent(e)}&limit=100`,{signal:t});if(!r.ok)return n.setError(n.unavailableMessage),`error`;let i=await r.json();return n.setEntries((i.entries??[]).filter(e=>e.type!==`checkpoint`)),n.setError(null),`ok`}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)throw e;return n.setError(n.unavailableMessage),console.error(`[timeline]`,e),`error`}finally{t.aborted||n.setLoading(!1)}}function Oy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return rc._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return rc._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return rc._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return rc._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?rc._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function ky(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ay(e){return e.slice(0,7)}function jy(e){return e.type===`upstream`?rc._({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`?rc._({id:`B2DrPb`}):e.author}function My(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)(Ws,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(Ks,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ki,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Gs,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ii,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Pi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(Us,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Ny(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)(Jt,{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=Xn(i),t[1]=i,t[2]=a);let o=a,s=r?$r[o]??si[o]:si[o],c;t[3]!==s||t[4]!==i?(c=s??wr(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)(My,{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)($u,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`OpenKnowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Cu,{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)(Kd,{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)(Us,{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)(Cu,{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)(Kd,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Py(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Fy(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,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c=s.length,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=l):l=t[3];let u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[l,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(Ly),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==c||t[15]!==a||t[16]!==s.length?(p=s.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(Iy)},children:[r?(0,Z.jsx)(so,{className:`size-3`}):(0,Z.jsx)(co,{className:`size-3`}),r?(0,Z.jsx)(X,{id:`vLyv1R`}):(0,Z.jsx)(X,{id:`ZptNUh`,values:{hidden:c}})]}),t[13]=r,t[14]=c,t[15]=a,t[16]=s.length,t[17]=p):p=t[17];let m;return t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function Iy(e){return!e}function Ly(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 Ry(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=Cy(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ms,{className:`size-3 animate-spin`}),(0,Z.jsx)(X,{id:`38foVZ`})]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(X,{id:`vvWZnu`})}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.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)(ms,{className:`size-3 animate-spin`}),(0,Z.jsx)(X,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(wy,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function zy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=cn(),d;t[0]===n.timestamp?d=t[1]:(d=Oy(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=jy(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=ky(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=Ay(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(By),b;t[8]===n?b=t[9]:(b=Py(n),t[8]=n,t[9]=b);let x=b,[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useId)(),O,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>E.current?.abort(),k=[],t[10]=O,t[11]=k):(O=t[10],k=t[11]),(0,Q.useEffect)(O,k);let A;t[12]!==n.sha||t[13]!==c?(A=()=>c(n.sha),t[12]=n.sha,t[13]=c,t[14]=A):A=t[14];let j=A,M;t[15]===C?M=t[16]:(M=function(){E.current?.abort(),E.current=null,T(!1),C(!1)},t[15]=C,t[16]=M);let N=M,P;t[17]!==u||t[18]!==o||t[19]!==n.sha||t[20]!==l||t[21]!==C?(P=async function(){T(!0);let e=new AbortController;E.current=e;let t=function(){e.signal.aborted||T(!1),E.current===e&&(E.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:o,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:o,sha:n.sha,err:i}),qs.error(u({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)C(!1),l();else{let e=`HTTP ${r.status}`;try{let t=ai.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:o,sha:n.sha,status:r.status,detail:e}),qs.error(u({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=u,t[18]=o,t[19]=n.sha,t[20]=l,t[21]=C,t[22]=P):P=t[22];let F=P,I;t[23]!==n||t[24]!==r?(I=(0,Z.jsx)(Ny,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=I):I=t[25];let L=I,R=s?D:void 0,z=s?`bg-muted`:`hover:bg-muted/80`,B;t[26]===z?B=t[27]:(B=[`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`,z],t[26]=z,t[27]=B);let V=B.join(` `),H;t[28]===j?H=t[29]:(H=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),j())},t[28]=j,t[29]=H);let U;t[30]===L?U=t[31]:(U=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:L}),t[30]=L,t[31]=U);let W;t[32]===m?W=t[33]:(W=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:m}),t[32]=m,t[33]=W);let G;t[34]!==n.timestamp||t[35]!==f?(G=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:f}),t[34]=n.timestamp,t[35]=f,t[36]=G):G=t[36];let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=K):K=t[37];let q;t[38]===u?q=t[39]:(q=u({id:`Yea-K5`}),t[38]=u,t[39]=q);let J;t[40]===C?J=t[41]:(J=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=J);let Y;t[42]===w?Y=t[43]:(Y=w?(0,Z.jsx)(ms,{className:`size-3 animate-spin`}):(0,Z.jsx)(Ai,{className:`size-3`}),t[42]=w,t[43]=Y);let ee;t[44]!==w||t[45]!==q||t[46]!==J||t[47]!==Y?(ee=(0,Z.jsx)(fc,{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":q,disabled:w,onClick:J,children:Y})}),t[44]=w,t[45]=q,t[46]=J,t[47]=Y,t[48]=ee):ee=t[48];let te;t[49]===u?te=t[50]:(te=u({id:`Yea-K5`}),t[49]=u,t[50]=te);let ne;t[51]===te?ne=t[52]:(ne=(0,Z.jsx)(pc,{side:`top`,children:te}),t[51]=te,t[52]=ne);let re;t[53]!==ee||t[54]!==ne?(re=(0,Z.jsxs)(hc,{children:[ee,ne]}),t[53]=ee,t[54]=ne,t[55]=re):re=t[55];let ie;t[56]!==W||t[57]!==G||t[58]!==re?(ie=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,re]}),t[56]=W,t[57]=G,t[58]=re,t[59]=ie):ie=t[59];let ae;t[60]===x?ae=t[61]:(ae=x.length>0&&(0,Z.jsx)(Fy,{summaries:x}),t[60]=x,t[61]=ae);let oe=y.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:y.join(`, `),children:y.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),se;t[62]!==ie||t[63]!==ae||t[64]!==oe?(se=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[ie,ae,oe]}),t[62]=ie,t[63]=ae,t[64]=oe,t[65]=se):se=t[65];let ce;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==se?(ce=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":s,"aria-controls":R,"data-testid":`timeline-entry-expand`,className:V,onClick:j,onKeyDown:H,children:[U,se]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=se,t[73]=ce):ce=t[73];let le;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(le=s&&(0,Z.jsx)(Ry,{sha:n.sha,docName:o,cache:a,diffLayout:i,panelId:D}),t[74]=a,t[75]=i,t[76]=D,t[77]=o,t[78]=n.sha,t[79]=s,t[80]=le):le=t[80];let ue;t[81]!==ce||t[82]!==le?(ue=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ce,le]}),t[81]=ce,t[82]=le,t[83]=ue):ue=t[83];let de;t[84]!==N||t[85]!==C?(de=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=de):de=t[86];let fe;t[87]===u?fe=t[88]:(fe=u({id:`Pyp1NA`}),t[87]=u,t[88]=fe);let pe;t[89]===fe?pe=t[90]:(pe=(0,Z.jsx)(to,{children:fe}),t[89]=fe,t[90]=pe);let me;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(me={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=me):me=t[95];let he;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(he={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=he):he=t[96];let ge;t[97]===me?ge=t[98]:(ge=(0,Z.jsx)(eo,{children:(0,Z.jsx)(X,{id:`h6EvY-`,values:me,components:he})}),t[97]=me,t[98]=ge);let _e;t[99]!==pe||t[100]!==ge?(_e=(0,Z.jsxs)(ao,{children:[pe,ge]}),t[99]=pe,t[100]=ge,t[101]=_e):_e=t[101];let ve;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(X,{id:`dEgA5A`}),t[102]=ve):ve=t[102];let ye;t[103]===N?ye=t[104]:(ye=(0,Z.jsx)(Di,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:ve}),t[103]=N,t[104]=ye);let be;t[105]===F?be=t[106]:(be=()=>F(),t[105]=F,t[106]=be);let xe;t[107]===w?xe=t[108]:(xe=w?(0,Z.jsx)(ms,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=xe);let Se;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(X,{id:`yKu_3Y`}),t[109]=Se):Se=t[109];let Ce;t[110]!==w||t[111]!==be||t[112]!==xe?(Ce=(0,Z.jsxs)(Di,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:be,children:[xe,Se]}),t[110]=w,t[111]=be,t[112]=xe,t[113]=Ce):Ce=t[113];let we;t[114]!==ye||t[115]!==Ce?(we=(0,Z.jsxs)(io,{children:[ye,Ce]}),t[114]=ye,t[115]=Ce,t[116]=we):we=t[116];let Te;t[117]!==_e||t[118]!==we?(Te=(0,Z.jsxs)(no,{children:[_e,we]}),t[117]=_e,t[118]=we,t[119]=Te):Te=t[119];let Ee;t[120]!==S||t[121]!==de||t[122]!==Te?(Ee=(0,Z.jsx)(oo,{open:S,onOpenChange:de,children:Te}),t[120]=S,t[121]=de,t[122]=Te,t[123]=Ee):Ee=t[123];let De;return t[124]!==ue||t[125]!==Ee?(De=(0,Z.jsxs)(Z.Fragment,{children:[ue,Ee]}),t[124]=ue,t[125]=Ee,t[126]=De):De=t[126],De}function By(e){return e.docs}function Vy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=cn(),{resolvedTheme:o}=xr(),s=o===`dark`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],t[0]=c):c=t[0];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h]=(0,Q.useState)(Gy),[g,_]=(0,Q.useState)(Wy),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]!==a||t[8]!==n?(w=()=>{if(!n){u([]);return}f(!0);let e=qv({baseMs:Ty,maxBackoffMs:Ey,isPaused:Uy,poll:e=>Dy(n,e,{setEntries:u,setError:m,setLoading:f,unavailableMessage:a({id:`brCtGB`})})});e.start();let t=()=>e.resume();return typeof document<`u`&&document.addEventListener(`visibilitychange`,t),()=>{e.stop(),typeof document<`u`&&document.removeEventListener(`visibilitychange`,t)}},T=[n,a],t[7]=a,t[8]=n,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=!d&&!p&&l.length>0,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Nn,{children:(0,Z.jsx)(X,{id:`cklVjM`})}),t[11]=D):D=t[11];let O;t[12]!==a||t[13]!==r||t[14]!==E||t[15]!==i?(O=E&&(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsxs)(Ha,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":a({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)(Ba,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Ed,{className:`size-3.5`})}),(0,Z.jsx)(Ba,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(Lu,{className:`size-3.5`})})]})}),(0,Z.jsx)(pc,{children:r===`unified`?(0,Z.jsx)(X,{id:`379t2h`}):(0,Z.jsx)(X,{id:`HXFyWD`})})]}),t[12]=a,t[13]=r,t[14]=E,t[15]=i,t[16]=O):O=t[16];let k;t[17]===O?k=t[18]:(k=(0,Z.jsxs)(An,{children:[D,O]}),t[17]=O,t[18]=k);let A;t[19]!==a||t[20]!==d?(A=d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":a({id:`o49mDZ`}),children:[1,2,3].map(Hy)}),t[19]=a,t[20]=d,t[21]=A):A=t[21];let j;t[22]!==p||t[23]!==d?(j=!d&&p&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:p})}),t[22]=p,t[23]=d,t[24]=j):j=t[24];let M;t[25]!==l||t[26]!==p||t[27]!==d?(M=!d&&!p&&l.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)(X,{id:`Ta25TG`})})}),t[25]=l,t[26]=p,t[27]=d,t[28]=M):M=t[28];let N;t[29]!==h||t[30]!==r||t[31]!==n||t[32]!==l||t[33]!==p||t[34]!==g||t[35]!==s||t[36]!==d?(N=!d&&!p&&l.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:l.map(e=>(0,Z.jsx)(zy,{entry:e,isDark:s,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[29]=h,t[30]=r,t[31]=n,t[32]=l,t[33]=p,t[34]=g,t[35]=s,t[36]=d,t[37]=N):N=t[37];let P;t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[A,j,M,N]}),t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let F;return t[43]!==k||t[44]!==P?(F=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[k,P]}),t[43]=k,t[44]=P,t[45]=F):F=t[45],F}function Hy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(la,{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)(la,{className:`h-3 w-28`}),(0,Z.jsx)(la,{className:`h-3 w-40`})]})]},e)}function Uy(){return typeof document<`u`&&document.visibilityState===`hidden`}function Wy(){return new Set}function Gy(){return new ji(32)}var Ky=[{id:`outline`,icon:cd},{id:`links`,icon:Le},{id:`graph`,icon:pd},{id:`timeline`,icon:Iu}];function qy(e){return e===`outline`?rc._({id:`dD7NPy`}):e===`links`?rc._({id:`Rj01Fz`}):e===`graph`?rc._({id:`x2fr_j`}):rc._({id:`cklVjM`})}function Jy(){return n(()=>import(`./GraphPanel-CUNcm2WE.js`),__vite__mapDeps([29,1,30,3,7,31,32,6,10,33,20,9,11,21,22,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url)}var Yy=(0,Q.lazy)(async()=>({default:(await Jy()).GraphPanel})),Xy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BXgtHL25.js`),__vite__mapDeps([46,1,2,47,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,61,62]),import.meta.url)).ActivityModeContent}));function Zy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=cn(),[c,l]=(0,Q.useState)(`unified`),u=Y_(),d,f,p;if(t[0]!==s||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==u){let e=u?Ky.filter($y):Ky;d=e.some(e=>e.id===i)?i:`outline`,f=o===`doc`&&e.length>1,p=f?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(Ha,{type:`single`,variant:`outline`,value:d,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(Qy)})}):null,t[0]=s,t[1]=i,t[2]=o,t[3]=a,t[4]=u,t[5]=d,t[6]=f,t[7]=p}else d=t[5],f=t[6],p=t[7];let m;t[8]!==c||t[9]!==n||t[10]!==d||t[11]!==r||t[12]!==o||t[13]!==f?(m=o===`doc`?(0,Z.jsxs)(`div`,{...f?{role:`tabpanel`,id:`panel-${d}`,"aria-labelledby":`tab-${d}`}:{},className:`min-h-0 flex-1`,children:[d===`outline`&&(0,Z.jsx)(Zl,{docName:n,isSourceMode:r}),d===`links`&&(0,Z.jsx)(Kv,{docName:n}),d===`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)(X,{id:`-lCAuQ`})}),children:(0,Z.jsx)(Yy,{activeDocName:n})}),d===`timeline`&&(0,Z.jsx)(Vy,{docName:n,diffLayout:c,onDiffLayoutChange:l})]}):(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)(X,{id:`ONPvOb`})}),children:(0,Z.jsx)(Xy,{})})}),t[8]=c,t[9]=n,t[10]=d,t[11]=r,t[12]=o,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Z.jsxs)(Z.Fragment,{children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Qy(e){let{id:t,icon:n}=e,r=qy(t);return(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Ba,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(fc,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(pc,{side:`bottom`,children:r})]},t)}function $y(e){return e.id===`outline`}function eb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function tb(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function nb(e){return e/100*window.innerHeight}function rb(e){return e/100*window.innerWidth}function ib(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 ab({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=ib(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=tb(t,i);break;case`em`:r=eb(t,i);break;case`vh`:r=nb(i);break;case`vw`:r=rb(i);break}return r}function ob(e){return parseFloat(e.toFixed(3))}function sb({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 cb(e){let{panels:t}=e,n=sb({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=ob(ab({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=ob(ab({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=ob(ab({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=ob(ab({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 lb(e,t=`Assertion error`){if(!e)throw Error(t)}function ub(e,t){return Array.from(t).sort(e===`horizontal`?db:fb)}function db(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function fb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function pb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function mb(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 hb({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}=mb(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return lb(i,`No rect found`),i}var gb;function _b(){return gb===void 0&&(gb=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),gb}function vb(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=ub(n,Array.from(t.children).filter(pb).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,hb({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=_b()?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:sb({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 yb=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)}}},bb=new Map,xb=new yb;function Sb(e){bb=new Map(bb),bb.delete(e)}function Cb(e,t){for(let[t]of bb)if(t.id===e)return t}function wb(e,t){for(let[t,n]of bb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Tb(){return bb}function Eb(e,t){return xb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Db(e,t){let n=bb.get(e);bb=new Map(bb),bb.set(e,t),xb.emit(`groupChange`,{group:e,prev:n,next:t})}function Ob(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=mb(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 kb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ab(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Ib(e),b:Ib(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();lb(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Fb(Pb(n.a)),b:Fb(Pb(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 jb=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mb(e){let t=getComputedStyle(Lb(e)??e).display;return t===`flex`||t===`inline-flex`}function Nb(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Mb(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`||jb.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Pb(e){let t=e.length;for(;t--;){let n=e[t];if(lb(n,`Missing node`),Nb(n))return n}return null}function Fb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ib(e){let t=[];for(;e;)t.push(e),e=Lb(e);return t}function Lb(e){let{parentNode:t}=e;return kb(t)?t.host:t}function Rb(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 zb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!pb(n)||n.contains(e)||e.contains(n))return!0;if(Ab(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Rb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Bb(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=vb(r),a=Ob(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&zb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Vb(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 Hb(e,t,n=0){return Math.abs(ob(e)-ob(t))<=n}function Ub(e,t){return Hb(e,t)?0:e>t?1:-1}function Wb({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(Ub(r,c)<0)if(a){let e=(i+c)/2;r=Ub(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=ob(r),r}function Gb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Hb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;lb(u!=null,`Invalid first pivot index`),lb(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];lb(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(lb(n!=null,`Previous layout not found for panel index ${t}`),Hb(n,i)){let t=o-n;Ub(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];lb(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(lb(n!=null,`Previous layout not found for panel index ${t}`),Hb(n,o)){let t=n-i;Ub(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];lb(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Ub(i,c)<0)if(e>0){let t=c-o,n=t/2;Ub(i+e,c)<0&&(e=Ub(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Ub(i-e,c)<0&&(e=Ub(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];lb(e!=null,`Previous layout not found for panel index ${r}`);let a=Wb({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];lb(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Hb(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(Vb(c,l))return i;{let t=e<0?d:u,r=s[t];lb(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Hb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];lb(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Hb(i,s)||(t-=s-i,l[r]=s),Hb(t,0))break;e>0?r--:r++}}}if(!Hb(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 Kb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Ub(e[n],t[n])!==0)return!1;return!0}function qb({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(!Hb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];lb(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];lb(i!=null,`No layout data found for index ${e}`);let o=r[e];lb(o!=null,`No layout data found for index ${e}`);let s=Wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Hb(a,0))for(let e=0;e<t.length;e++){let n=r[e];lb(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Hb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Jb({groupId:e,panelId:t}){let n=()=>{let t=Tb();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=qb({layout:Gb({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});Kb(l,p)||Db(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&&Hb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=sb({group:t});o(ob(ab({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Yb(e){e.defaultPrevented||Bb(e,Tb()).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=Jb({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Xb(e){let t=Tb();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 Zb({groupId:e}){let t=()=>{let t=Tb();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=qb({layout:e,panelConstraints:r});return n?o:(Kb(o,c)||Db(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Qb(e,t){let n=Xb(e),r=wb(n.id,!0),i=n.separators.find(t=>t.element===e);lb(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);lb(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Zb({groupId:n.id}).getLayout(),c=qb({layout:Gb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Kb(s,c)||Db(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function $b(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Xb(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Qb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Qb(t,-5);break;case`End`:e.preventDefault(),Qb(t,100);break;case`Enter`:{e.preventDefault();let n=Xb(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=wb(n.id,!0),o=n.separators.find(e=>e.element===t);lb(o,`Matching separator not found`);let s=a.get(o);lb(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(lb(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Qb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Xb(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);lb(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(),Qb(t,-100);break}}var ex={cursorFlags:0,state:`inactive`},tx=new yb;function nx(){return ex}function rx(e){return tx.addListener(`change`,e)}function ix(e){let t=ex,n={...ex};n.cursorFlags=e,ex=n,tx.emit(`change`,{prev:t,next:n})}function ax(e){let t=ex;ex=e,tx.emit(`change`,{prev:t,next:e})}function ox(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Tb(),n=Bb(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)}),ax({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var sx=e=>e,cx=()=>{},lx=1,ux=2,dx=4,fx=8,px=3,mx=12,hx;function gx(){return hx===void 0&&(hx=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(hx=!0)),hx}function _x({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&&gx()){let t=(e&lx)!==0,n=(e&ux)!==0,r=(e&dx)!==0,i=(e&fx)!==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 gx()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var vx=new WeakMap;function yx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=vx.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=nx();switch(r.state){case`active`:case`hover`:{let e=_x({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}vx.set(e,{prevStyle:t,styleSheet:n})}function bx({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=Gb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Kb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?lx:ux;break;case`vertical`:s|=d<0?dx:fx;break}}else Db(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&px:c|=s&px,t.movementY===0?c|=o&mx:c|=s&mx,ix(c),yx(e)}function xx(e){let t=Tb(),n=nx();switch(n.state){case`active`:bx({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Sx(e){if(e.defaultPrevented)return;let t=nx(),n=Tb();switch(t.state){case`active`:if(e.buttons===0){ax({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=wb(e.group.id,!0);Db(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)}bx({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Bb(e,n);r.length===0?t.state!==`inactive`&&ax({cursorFlags:0,state:`inactive`}):ax({cursorFlags:0,hitRegions:r,state:`hover`}),yx(e.currentTarget);break}}}function Cx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(nx().state){case`hover`:ax({cursorFlags:0,state:`inactive`})}}function wx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=nx();switch(t.state){case`active`:ax({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(yx(e.currentTarget),t.hitRegions.forEach(e=>{let t=wb(e.group.id,!0);Db(e.group,t)}),e.preventDefault())}}function Tx(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=ob(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=ob((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ex(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=sb({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:ob(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Dx(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 Ox({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=ob(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]=ob((r[e]??0)/a*l);else{let e=ob(l/c.length);for(let t of c)u[t]=e}return u}function kx(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 Ax=new Map;function jx(e){let t=!0;lb(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=sb({group:e});if(t===0)return;let n=wb(e.id);if(!n)return;let r=cb(e),i=n.defaultLayoutDeferred?Tx(r):n.layout,a=qb({layout:Ox({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Kb(n.layout,a)&&Dx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Db(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ex(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{lb(!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=sb({group:e}),s=cb(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(kx(e.panels,l)||(l=void 0));let u=qb({layout:e.mutableState.layouts[c]??l??Tx(s),panelConstraints:s}),d=e.element.ownerDocument;Ax.set(d,(Ax.get(d)??0)+1);let f=new Map;return vb(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Db(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{lb(!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`,$b)}),Ax.get(d)===1&&(d.addEventListener(`dblclick`,Yb,!0),d.addEventListener(`pointerdown`,ox,!0),d.addEventListener(`pointerleave`,xx),d.addEventListener(`pointermove`,Sx),d.addEventListener(`pointerout`,Cx),d.addEventListener(`pointerup`,wx,!0)),function(){t=!1,Ax.set(d,Math.max(0,(Ax.get(d)??0)-1)),Sb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,$b)}),Ax.get(d)||(d.removeEventListener(`dblclick`,Yb,!0),d.removeEventListener(`pointerdown`,ox,!0),d.removeEventListener(`pointerleave`,xx),d.removeEventListener(`pointermove`,Sx),d.removeEventListener(`pointerout`,Cx),d.removeEventListener(`pointerup`,wx,!0)),a.disconnect()}}function Mx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Nx(e){let t=(0,Q.useId)();return`${e??t}`}var Px=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Fx(e){let t=(0,Q.useRef)(e);return Px(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Ix(...e){return Fx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Lx(e){let t=(0,Q.useRef)({...e});return Px(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Rx=(0,Q.createContext)(null);function zx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:sx});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Px(()=>{Object.assign(n.current,Zb({groupId:e}))})}function Bx({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=Fx(e=>{Kb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Fx(e=>{Kb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Nx(s),v=(0,Q.useRef)(null),[y,b]=Mx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Ix(v,a);zx(_,o);let C=Fx((e,t)=>{let r=nx(),i=Cb(e),a=wb(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=Lx({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=ub(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=ub(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=Cb(_),i=wb(_);r&&i&&Db(r,{...i,derivedPanelConstraints:cb(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 Px(()=>{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=jx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=wb(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Eb(_,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=Hb(t.collapsedSize,i[t.panelId]),a=Hb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=nx().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)(Rx.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})})}Bx.displayName=`Group`;function Vx(){let e=(0,Q.useContext)(Rx);return lb(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Hx(e,t){let{id:n}=Vx(),r=(0,Q.useRef)({collapse:cx,expand:cx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:cx});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Px(()=>{Object.assign(r.current,Jb({groupId:n,panelId:e}))})}function Ux({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=Nx(c),_=Lx({disabled:a}),v=(0,Q.useRef)(null),y=Ix(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Vx(),T=d!==null,E=Fx((e,t,n)=>{d?.(e,c,n)});Px(()=>{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]),Hx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Eb(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:{...Wx,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})})}Ux.displayName=`Panel`;var Wx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Gx(){return(0,Q.useRef)(null)}function Kx({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=qb({layout:Gb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=qb({layout:Gb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function qx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Nx(a),l=Lx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Ix(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Vx(),x=v===`horizontal`?`vertical`:`horizontal`;Px(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=rx(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Eb(_,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(Kx({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})}qx.displayName=`Separator`;var Jx=new Map;function Yx(e){let t=Jx.get(e);if(t)return t;let n=Xx(e);return Jx.set(e,n),n}async function Xx(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-DcLsuLkb.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-C8wyRRyC.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-C8wyRRyC.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-C8wyRRyC.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-C_ATH0cs.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([48,1,49,31,50]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-BVT8Qiu3.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-CkcupPV_.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-CDhOqkQC.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-C8wyRRyC.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BKvCaeVU.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([52,1,53,49,31,50]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Bzfgenqd2.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([54,1,49,31,50]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-C8wyRRyC.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-eVxIrt9t.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-hRhcPaZU.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([55,1,53,49,31,51,48,50,52]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-C8wyRRyC.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-CPdPC9j_.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-HRxi3YvV2.js`);return{python:e}},__vite__mapDeps([63,53,49,1,31,50]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r--HdjQNrK.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-uRCn_fnf.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-ChteXkW7.js`);return{rust:e}},__vite__mapDeps([64,49,1,31,50]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-DNxIZDy8.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CK95DLTt.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-BKvCaeVU.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([52,1,53,49,31,50]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-wA9FGceo.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([51,1,48,49,31,50,52,53]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-DisLVkiU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([56,1,49,31,50]),import.meta.url)).yaml().language;default:return null}}async function Zx(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Bzfgenqd2.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([54,1,49,31,50]),import.meta.url)).json().language;if(t){let e=await Yx(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-BXTYSiRS.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([49,1,31]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-D3zY1F-v.js`);return{toml:e}},[],import.meta.url)).toml):null}function Qx(e){let t=(0,$.c)(10),{_:n}=cn(),r;t[0]===n?r=t[1]:(r=e=>n(e===413?{id:`C_WGy8`}:e===415?{id:`VM7H66`}:e===404?{id:`s0IDhW`}:e===400?{id:`N1mdmS`}:typeof e==`number`?{id:`96w9hU`,values:{status:e}}:{id:`ig5vUe`}),t[0]=n,t[1]=r);let i=r,{src:a,loadText:o}=e,s=(0,Q.useRef)(o),c=(0,Q.useRef)(i),l;t[2]!==o||t[3]!==i?(l=()=>{s.current=o,c.current=i},t[2]=o,t[3]=i,t[4]=l):l=t[4],(0,Q.useEffect)(l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`loading`},t[5]=u):u=t[5];let[d,f]=(0,Q.useState)(u),p,m;return t[6]!==n||t[7]!==a?(p=()=>{let e=!1,t=new AbortController;f({status:`loading`});let r=s.current;return r?(r(t.signal).then(t=>{if(!e){if(t.ok){f({status:`loaded`,content:t.text});return}f({status:`error`,message:t.message??c.current(t.status)})}}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()}):(fetch(a??``,{credentials:`same-origin`,signal:t.signal}).then(async e=>{if(!e.ok)throw Error(c.current(e.status));return e.text()}).then(t=>{e||f({status:`loaded`,content:t})}).catch(t=>{e||t instanceof Error&&t.name===`AbortError`||f({status:`error`,message:t instanceof Error?t.message:n({id:`ig5vUe`})})}),()=>{e=!0,t.abort()})},m=[a,n],t[6]=n,t[7]=a,t[8]=p,t[9]=m):(p=t[8],m=t[9]),(0,Q.useEffect)(p,m),d}function $x(e){let t=(0,$.c)(10),{fileName:n,dataAttr:r,extraAttrs:i}=e,a=`${r}-state`,o;t[0]!==r||t[1]!==a?(o={[r]:``,[a]:`loading`},t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`Md709y`,values:{fileName:n}})}),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==n||t[7]!==o||t[8]!==s?(c=(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":n,...o,...i,children:s}),t[5]=i,t[6]=n,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function eS(e){let t=(0,$.c)(16),{fileName:n,dataAttr:r,extraAttrs:i,message:a,openHref:o}=e,s=`${r}-state`,c;t[0]!==r||t[1]!==s?(c={[r]:``,[s]:`error`},t[0]=r,t[1]=s,t[2]=c):c=t[2];let l;t[3]===n?l=t[4]:(l=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(X,{id:`qdBUHP`,values:{fileName:n}})}),t[3]=n,t[4]=l);let u;t[5]===a?u=t[6]:(u=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:a}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o?(0,Z.jsx)(`a`,{href:o,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:(0,Z.jsx)(X,{id:`9npOH9`})}):null,t[7]=o,t[8]=d);let f;return t[9]!==i||t[10]!==n||t[11]!==c||t[12]!==l||t[13]!==u||t[14]!==d?(f=(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":n,...c,...i,children:[l,u,d]}),t[9]=i,t[10]=n,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f):f=t[15],f}var tS=oe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),nS=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function rS(e){let t=(0,$.c)(23),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({fileName:r,extension:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=xr(),c=Qx(i),l=c.status===`loaded`?c.content:null,u,d;t[4]!==n||t[5]!==l||t[6]!==s?(u=()=>{if(!a.current||l===null)return;let e=n.toLowerCase(),t=Jr(e),r=s===`dark`?tS:nS,i=!1,c=null;return Zx(e,t).then(e=>{if(i||!a.current)return;let t=[tu,...e?[e]:[],Il.editable.of(!0),El.readOnly.of(!0),Il.lineWrapping,r];c=new Il({state:El.create({doc:l,extensions:t}),parent:a.current}),o.current=c}),()=>{i=!0,c?.destroy(),o.current=null}},d=[l,n,s],t[4]=n,t[5]=l,t[6]=s,t[7]=u,t[8]=d):(u=t[7],d=t[8]),(0,Q.useEffect)(u,d);let f;t[9]===n?f=t[10]:(f={"data-text-viewer-extension":n},t[9]=n,t[10]=f);let p=f;if(c.status===`loading`){let e;return t[11]!==p||t[12]!==r?(e=(0,Z.jsx)($x,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p}),t[11]=p,t[12]=r,t[13]=e):e=t[13],e}if(c.status===`error`){let e;return t[14]!==p||t[15]!==c.message||t[16]!==r||t[17]!==i.src?(e=(0,Z.jsx)(eS,{fileName:r,dataAttr:`data-text-viewer`,extraAttrs:p,message:c.message,openHref:i.src}),t[14]=p,t[15]=c.message,t[16]=r,t[17]=i.src,t[18]=e):e=t[18],e}let m;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[19]=m):m=t[19];let h;return t[20]!==n||t[21]!==r?(h=(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":n,children:m}),t[20]=n,t[21]=r,t[22]=h):h=t[22],h}function iS(e){return yi(`/api/asset?path=${encodeURIComponent(e)}`)}function aS(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function oS(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=iS(n),t[0]=n,t[1]=o);let s=o,c;t[2]===n?c=t[3]:(c=n.split(`/`).pop()??n,t[2]=n,t[3]=c);let l=c,d,f,p,m;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=l.includes(`.`)?l.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==l||t[14]!==s?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(St,{src:s,title:l,fillContainer:!0})}),t[13]=l,t[14]=s,t[15]=e):e=t[15];let n;t[16]!==l||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:e}),t[16]=l,t[17]=e,t[18]=n):n=t[18],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=aS(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(rS,{src:e,fileName:l,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==l||t[25]!==p||t[26]!==s?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(Pe,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:s,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:l})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(Di,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(X,{id:`qFWMl-`})}),(0,Z.jsx)(Di,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{u({url:s,projectRelPath:n,ext:p.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(X,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=l,t[25]=p,t[26]=s,t[27]=h):h=t[27];let g;return t[28]!==l||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:h}),t[28]=l,t[29]=h,t[30]=g):g=t[30],g}function sS(){let e=(0,$.c)(5),{_:t}=cn(),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)(la,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(la,{className:`h-4 w-full`}),(0,Z.jsx)(la,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=i),i}function cS(e){let{_:t}=cn();return e===`existing-repo`?[{id:`draft-spec`,icon:Wu,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:cd,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:pd,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:Rd,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:Wu,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Eu,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function lS(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=cn(),a=cS(n),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(void 0),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>clearTimeout(c.current),u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,Q.useEffect)(l,u);let d,f;if(t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a){let e=function(e,t){is(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(uS)};t[8]===r?d=t[9]:(d=Ti(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=d),f=a.map(t=>{let n=t.icon,r=o===t.id;return(0,Z.jsxs)(`li`,{className:`group flex items-start gap-3 p-3.5`,"data-testid":`copy-prompt-${t.id}`,children:[(0,Z.jsx)(n,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-sm font-medium leading-tight text-foreground`,children:t.label}),(0,Z.jsx)(`span`,{className:`truncate text-1sm leading-relaxed text-muted-foreground`,children:t.prompt})]}),(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":i(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:Ti(`shrink-0 gap-1.5 transition-opacity focus-visible:opacity-100 uppercase font-mono`,r?`opacity-100`:`opacity-0 group-hover:opacity-100`),"data-testid":`copy-prompt-button-${t.id}`,children:[r?(0,Z.jsx)($a,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(xs,{className:`size-3.5`,"aria-hidden":`true`}),i(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=d,t[7]=f}else d=t[6],f=t[7];let p;return t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(`ul`,{className:d,children:f}),t[10]=d,t[11]=f,t[12]=p):p=t[12],p}function uS(){}var dS=`ok-ask-ai-draft-v2`,fS={doc:null,dismissed:!1};function pS(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var mS=null,hS=new Set;function gS(e){if(e===null)return!0;let t=e.content;return!Array.isArray(t)||t.length===0?!0:t.every(e=>{let t=e.content;return!Array.isArray(t)||t.length===0})}function _S(){let e=pS();if(!e)return fS;try{let t=e.getItem(dS);if(!t)return fS;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?fS:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),fS}}function vS(){return mS===null&&(mS=_S()),mS}function yS(e){let t=pS();if(t)try{e&&!gS(e)?t.setItem(dS,JSON.stringify(e)):t.removeItem(dS)}catch{}}function bS(){for(let e of hS)e()}function xS(){return vS()}function SS(e){let t=e&&!gS(e)?e:null;mS={...vS(),doc:t},yS(t),bS()}function CS(){SS(null)}var wS=wi(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function TS(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=Ti(wS({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":r,className:a,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var ES=Yr;function DS(e){let t=I(e).kind;return t===`folder`||t===`asset`?t:`page`}function OS(e){let t=(0,$.c)(14),{items:n,query:r,selectedIndex:i,onSelect:a,loading:o,error:s,hasMore:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=c===void 0?!1:c,{_:f}=cn(),p=(0,Q.useId)(),m=(0,Q.useRef)(null),h,g;t[0]===i?(h=t[1],g=t[2]):(h=()=>{(m.current?.querySelectorAll(`[role="option"]`))?.item(i)?.scrollIntoView({block:`nearest`})},g=[i],t[0]=i,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=i>=0&&i<n.length?n[i]:null,v;return t[3]!==f||t[4]!==u||t[5]!==d||t[6]!==n||t[7]!==p||t[8]!==l||t[9]!==a||t[10]!==r||t[11]!==i||t[12]!==_?(v=(0,Z.jsx)(`div`,{ref:m,className:`w-80 max-w-[min(28rem,90vw)] overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,children:l?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:f({id:`3m2GBo`})}):u?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`assertive`,children:f({id:`weP6me`})}):n.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:r.trim()===``?f({id:`0E9DR6`}):f({id:`yQyglE`})}):(0,Z.jsxs)(`div`,{role:`listbox`,id:p,"aria-label":f({id:`05n5wS`}),tabIndex:-1,className:`max-h-64 overflow-y-auto subtle-scrollbar`,children:[(0,Z.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:_?_.title:``}),n.map((e,t)=>{let n=t===i,r=DS(e.path),o=r===`folder`,s=o?`${e.path}/`:e.path;return(0,Z.jsxs)(`button`,{id:`${p}-option-${t}`,type:`button`,role:`option`,"aria-selected":n,"data-active":n,"data-mention-kind":r,"data-testid":`composer-mention-option-${e.docName}`,className:`flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left ${n?`bg-accent text-accent-foreground`:``}`,onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,Z.jsx)(ut,{path:e.path,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:e.title}),o?(0,Z.jsx)(`span`,{className:`shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:f({id:`kNqMMd`})}):null]}),(0,Z.jsx)(`span`,{className:`line-clamp-2 break-all text-xs text-muted-foreground`,children:s})]})]},e.docName)}),d?(0,Z.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,"aria-hidden":!0,children:f({id:`F1T9y_`})}):null]})}),t[3]=f,t[4]=u,t[5]=d,t[6]=n,t[7]=p,t[8]=l,t[9]=a,t[10]=r,t[11]=i,t[12]=_,t[13]=v):v=t[13],v}var kS=8,AS=new Fr(`composerMentionSuggestion`);function jS(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:Go(e.docName)}var MS=br.create({name:`doc`,topNode:!0,content:`paragraph+`}),NS=br.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),PS=br.create({name:`text`,group:`inline`}),FS=br.create({name:`hardBreak`,group:`inline`,inline:!0,selectable:!1,parseHTML(){return[{tag:`br`}]},renderHTML(){return[`br`]},addKeyboardShortcuts(){return{"Shift-Enter":()=>this.editor.commands.insertContent({type:`hardBreak`})}}}),IS=Si.create({name:`composerHistory`,addProseMirrorPlugins(){return[Hn(),Ur({"Mod-z":ar,"Mod-y":Gr,"Shift-Mod-z":Gr})]}}),LS=br.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{path:{default:``},label:{default:``}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.label||e.attrs.path);return[`span`,Rr(t,{"data-composer-mention":String(e.attrs.path??``),class:`composer-mention-chip`}),`@${n}`]},renderText({node:e}){return`@${e.attrs.path}`},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=String(e.attrs.path??``),i=String(e.attrs.label||e.attrs.path),a=document.createElement(`span`);a.className=`composer-mention-chip group/mention`,a.setAttribute(`data-composer-mention`,r),a.title=i;let o=document.createElement(`button`);o.type=`button`,o.className=`composer-mention-icon`,o.setAttribute(`aria-label`,rc._({id:`Xzy0s0`,values:{fullLabel:i}}));let s=document.createElement(`span`);s.className=`composer-mention-glyph composer-mention-glyph-icon`,s.setAttribute(`aria-hidden`,`true`),s.innerHTML=Ue(r),o.appendChild(s);let c=document.createElement(`span`);c.className=`composer-mention-glyph composer-mention-glyph-x`,c.setAttribute(`aria-hidden`,`true`),c.innerHTML=wt(Js),o.appendChild(c),o.addEventListener(`mousedown`,e=>e.preventDefault()),o.addEventListener(`click`,r=>{r.preventDefault();let i=typeof n==`function`?n():null;i!=null&&t.chain().focus().deleteRange({from:i,to:i+e.nodeSize}).run()}),a.appendChild(o);let l=document.createElement(`span`);return l.className=`composer-mention-label`,l.textContent=i,a.appendChild(l),{dom:a}}},addProseMirrorPlugins(){return[BS(this.editor)]}});function RS(e){return[MS,NS,PS,FS,IS,LS,...e?.placeholder?[ES.configure({placeholder:e.placeholder})]:[]]}function zS(e=x){let t=[],n=!1,r=null,i=!1;return{snapshot(){return{loaded:n,error:i}},async getItems(a){if(!n){r||=e();try{t=await r,n=!0,i=!1}catch(e){console.error(`[composer-mention] failed to fetch pages`,e),t=[],i=!0}finally{r=null}}return k(t,a).map(e=>({docName:e.docName,title:e.title,path:jS(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function BS(e){let t=zS();return te({editor:e,pluginKey:AS,char:`@`,items:({query:e})=>t.getItems(e),command:({editor:e,range:t,props:n})=>{try{e.chain().focus().deleteRange(t).insertContent([{type:`composerMention`,attrs:{path:n.path,label:n.title}},{type:`text`,text:` `}]).run()}catch(e){console.error(`[composer-mention] insert failed`,{item:n,range:t},e)}},render:()=>{let e=null,n=null,r=0,i={popup:null,stopAutoUpdate:null},a=null,o=null,s=e=>{n?.command(e)},c=e=>{let n=e.items??[],{loaded:i,error:a}=t.snapshot();return{items:n,query:e.query??``,selectedIndex:r,onSelect:s,loading:!i&&!a,error:a,hasMore:n.length>=kS}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=nn(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new D(OS,{props:c(t),editor:t.editor}),s.popup.appendChild(e.element),i.stopAutoUpdate=s.startAutoUpdate()},onStart(e){n=e,r=0,l(),o?.()},onUpdate(e){n=e,r=Math.min(r,Math.max(0,e.items.length-1)),l(),a?.()},onKeyDown({event:e}){if(!n)return!1;let t=n.items;if(e.key===`ArrowDown`)return t.length===0?!1:(r=(r+1)%t.length,l(),!0);if(e.key===`ArrowUp`)return t.length===0?!1:(r=(r-1+t.length)%t.length,l(),!0);if(e.key===`Enter`||e.key===`Tab`){let e=t[r];return e?(n.command(e),!0):!1}return!1},onExit(){Oe(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function VS(e){let t=[],n=new Set,r=[];return e.state.doc.forEach(e=>{let i=``;e.forEach(e=>{if(e.type.name===`composerMention`){let r=String(e.attrs.path??``);r!==``&&(i+=`@${r}`,n.has(r)||(n.add(r),t.push(r)))}else e.isText?i+=e.text??``:e.type.name===`hardBreak`&&(i+=`
|
|
25
25
|
`)}),r.push(i)}),{instruction:r.join(`
|
|
26
|
-
`).trim(),mentions:t}}function HS(e){let{instruction:t,mentions:n}=VS(e);return t===``&&n.length===0}function US(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function WS(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,f=(0,Q.useRef)(i),p=(0,Q.useRef)(a),m=(0,Q.useRef)(o),h=(0,Q.useRef)(s),g;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(g=()=>{f.current=i,p.current=a,m.current=o,h.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=g):g=t[4],(0,Q.useEffect)(g);let _;t[5]===l?_=t[6]:(_=RS({placeholder:l}),t[5]=l,t[6]=_);let v=u??void 0,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=Ti(`composer-prosemirror py-1 outline-none`),t[7]=y):y=t[7];let b;t[8]===r?b=t[9]:(b={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:y},t[8]=r,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>t.key===`Escape`?AS.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?AS.getState(e.state)?.active?!1:(h.current(),!0):!1,t[10]=x):x=t[10];let S;t[11]===b?S=t[12]:(S={attributes:b,handleKeyDown:x},t[11]=b,t[12]=S);let C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{let{editor:t}=e;f.current(HS(t)),p.current?.(t.getJSON()),m.current?.(VS(t).mentions)},t[13]=C):C=t[13];let w;t[14]!==_||t[15]!==v||t[16]!==S?(w={extensions:_,content:v,immediatelyRender:!0,editorProps:S,onUpdate:C},t[14]=_,t[15]=v,t[16]=S,t[17]=w):w=t[17];let T=pe(w),E;t[18]!==T||t[19]!==u?(E=()=>{T&&(HS(T)&&US(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),CS()),f.current(HS(T)),m.current?.(VS(T).mentions))},t[18]=T,t[19]=u,t[20]=E):E=t[20];let D;t[21]===T?D=t[22]:(D=[T],t[21]=T,t[22]=D),(0,Q.useEffect)(E,D);let O,k;t[23]===T?(O=t[24],k=t[25]):(O=()=>({focus:()=>T?.commands.focus(),blur:()=>T?.commands.blur(),clear:()=>T?.commands.clearContent(!0),setText:e=>{T&&(T.commands.setContent(e),p.current?.(T.getJSON()),m.current?.(VS(T).mentions))},getContent:()=>T?VS(T):{instruction:``,mentions:[]}}),k=[T],t[23]=T,t[24]=O,t[25]=k),(0,Q.useImperativeHandle)(n,O,k);let A;return t[26]!==c||t[27]!==T?(A=(0,Z.jsx)(d,{editor:T,className:c}),t[26]=c,t[27]=T,t[28]=A):A=t[28],A}function GS(e,t,n){return e.trim().length>0||t.length>0||n}var KS=`ok-ask-ai-agent-v2`,qS=`ok-ask-ai-default-agent-v1`,JS=`ok-preferred-agent-v1`,YS=`terminal-cli`;function XS(e){return`${YS}:${e}`}function ZS(e){return e===null?null:e===`terminal-cli`?`claude`:_i.find(t=>e===XS(t))??null}function QS(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function $S(e){let t=QS(e);if(!t)return null;try{let e=t.getItem(KS);return e===null?t.getItem(qS)??t.getItem(JS):e}catch{return null}}function eC(e,t){let n=QS(t);if(n)try{n.setItem(KS,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}}function tC(e,t){let n=Uo.filter(t=>e[t.id]?.installed===!0);if(t){let e=n.find(e=>e.id===t);if(e)return e}return n[0]??null}var nC=new Set(Uo.map(e=>e.id));function rC(e){return typeof e==`string`&&nC.has(e)}function iC(e){try{let t=$S(e);return rC(t)?t:null}catch{return null}}function aC(e,t){eC(e,t)}function oC(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:Uo.find(e=>n[e.id]?.installed===!0)?.id??null}function sC(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=cn(),{states:a,refresh:o}=ts(),{dispatch:s}=ls(),c=Vo(),l=ss(),[u,d]=(0,Q.useState)(uC),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(lC),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=cS(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=Uo.filter(T),D;t[3]===a?D=t[4]:(D=Uo.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=oC({lastUsed:iC(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),aC(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!GS(e,t,!1)){x(!0);return}let r=Xo({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),CS())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!GS(t,r,!1)){x(!0);return}aC(e);let i=Xo({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),CS())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=Ti(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Us,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:Uo.map(cC)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=Ti(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(X,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(Di,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(X,{id:`hYgDIe`})}):(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(Di,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yo,{id:Jo(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(X,{id:`4rjwLG`,values:{0:Gn[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yo,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(X,{id:`9dw5bW`,values:{0:Wo(u)}})]})}),(0,Z.jsxs)(nl,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(so,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Xc,{align:`end`,className:`min-w-[200px]`,children:[R?(0,Z.jsxs)(Yc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(al,{children:(0,Z.jsx)(X,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Jc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Yo,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,z?(0,Z.jsxs)(Z.Fragment,{children:[R?(0,Z.jsx)(sl,{}):null,(0,Z.jsxs)(Yc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(al,{children:(0,Z.jsx)(X,{id:`ALhMYW`})}),os.map(e=>{let{displayName:t}=Gn[e];return(0,Z.jsxs)(Jc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Yo,{id:Jo(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(WS,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:SS,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:w.map(e=>{let t=e.icon;return(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})}):null]})}function cC(e){return(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void Bo(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Yo,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(za,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function lC(){return xS().doc??void 0}function uC(){return iC()}var dC=3100,fC=3;function pC(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??fC;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var mC={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}},hC=[`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 gC(e,t={}){let n=t.rng??Math.random,r=t.colors??hC,i=mC[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 _C=1.8,vC=90,yC=16,bC=380,xC=.025,SC=.1,CC=.18,wC=400,TC=9.2736,EC=18.1799,DC=14.5244,OC={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function kC(e,t){let{halfWidth:n,apexLift:r}=OC[t];return`M${e-n} ${DC+.3} Q${e} ${DC-r}, ${e+n} ${DC+.3}`}function AC(e){let t=1.5,n=.3;return`M${e-t} ${DC-n} Q${e} ${DC+1.4}, ${e+t} ${DC-n}`}var jC=15,MC=15;function NC(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 PC(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=pC(g,t);_(n),y(RC),S(gC(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},dC)},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(LC),S(gC(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},dC))},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/bC)),C=-Math.max(-1,Math.min(1,b/bC))*yC,w=S*yC,T=0,E=0;if(x>=1){let e=Math.min(x/vC,1)*_C;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*SC,i+=(w-i)*SC,u.style.transform=`perspective(${wC}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*CC,o+=(E-o)*CC;let O=i*xC,k=-r*xC,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.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=Ti(`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=Ti(`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=Ti(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:TC,cy:DC,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=Ti(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let Y;t[28]===J?Y=t[29]:(Y=(0,Z.jsx)(`ellipse`,{cx:EC,cy:DC,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=Y);let ee;t[30]===I?ee=t[31]:(ee=kC(TC,I),t[30]=I,t[31]=ee);let te=(!F||T)&&`ok-blob-eye-hidden`,ne;t[32]===te?ne=t[33]:(ne=Ti(`ok-blob-happy-eye`,te),t[32]=te,t[33]=ne);let re;t[34]!==ee||t[35]!==ne?(re=(0,Z.jsx)(`path`,{d:ee,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ne}),t[34]=ee,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]===I?ie=t[38]:(ie=kC(EC,I),t[37]=I,t[38]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[39]===ae?oe=t[40]:(oe=Ti(`ok-blob-happy-eye`,ae),t[39]=ae,t[40]=oe);let se;t[41]!==ie||t[42]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[41]=ie,t[42]=oe,t[43]=se):se=t[43];let ce;t[44]===T?ce=t[45]:(ce=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:AC(TC),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:AC(EC),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ce);let le;t[46]!==K||t[47]!==Y||t[48]!==re||t[49]!==se||t[50]!==ce?(le=(0,Z.jsxs)(`g`,{ref:p,children:[K,Y,re,se,ce]}),t[46]=K,t[47]=Y,t[48]=re,t[49]=se,t[50]=ce,t[51]=le):le=t[51];let ue;t[52]!==B||t[53]!==H||t[54]!==le?(ue=(0,Z.jsxs)(`g`,{className:H,children:[U,le]},B),t[52]=B,t[53]=H,t[54]=le,t[55]=ue):ue=t[55];let de;t[56]===T?de=t[57]:(de=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=de);let fe;t[58]!==v||t[59]!==x?(fe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(FC)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=fe):fe=t[60];let pe;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==ue||t[65]!==de||t[66]!==fe?(pe=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:IC,children:[ue,de,fe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=ue,t[65]=de,t[66]=fe,t[67]=pe):pe=t[67];let me;return t[68]!==R||t[69]!==pe?(me=(0,Z.jsx)(`span`,{ref:d,className:R,children:pe}),t[68]=R,t[69]=pe,t[70]=me):me=t[70],me}function FC(e){return(0,Z.jsx)(`circle`,{cx:jC+e.originDx,cy:MC+e.originDy,r:e.size,className:`ok-blob-firework`,style:NC(e)},e.id)}function IC(e){return e.preventDefault()}function LC(e){return e+1}function RC(e){return e+1}function zC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(PC,{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 BC({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var VC=`open-knowledge:create-top-level-file`;function HC(e={}){window.dispatchEvent(new CustomEvent(VC,{detail:e}))}function UC(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(VC,t),()=>window.removeEventListener(VC,t)}function WC(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=cn(),a=$o(),{title:o,subtitle:s}=BC({isOnboarding:!1,isEmbedded:a}),c=wa(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=zC,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(lS,{scenario:`existing-repo`}):(0,Z.jsx)(sC,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(qC,{templates:u,loading:d,error:f,onSelect:KC}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(X,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(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:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Di,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:GC,children:(0,Z.jsx)(X,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(La,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function GC(){return HC({initialDir:``})}function KC(e,t){return HC({template:{folder:e,name:t}})}function qC(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=cn(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(Be,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(X,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(JC,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function JC(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=cn(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function YC(e){let t=(0,$.c)(20),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch($C);if(e)return;let r=t.ok?Kn.safeParse(n):null;r?.success?(l(ew(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ec(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(QC),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(ZC);if(!e.ok)return;let n=Kn.safeParse(t);n.success&&l(ew(n.data.documents))}).catch(XC)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;t[4]!==u||t[5]!==y||t[6]!==v?(e=v?(0,Z.jsx)(tw,{isOnboarding:y,celebrateSignal:u}):null,t[4]=u,t[5]=y,t[6]=v,t[7]=e):e=t[7];let n;return t[8]===e?n=t[9]:(n=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 sm:px-12 md:px-16 pb-8 pt-10`,children:e}),t[8]=e,t[9]=n),n}let S;t[10]!==u||t[11]!==y||t[12]!==v?(S=v?y?(0,Z.jsx)(nw,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(WC,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[10]=u,t[11]=y,t[12]=v,t[13]=S):S=t[13];let C;t[14]!==o||t[15]!==i?(C=(0,Z.jsx)(B_,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[14]=o,t[15]=i,t[16]=C):C=t[16];let w;return t[17]!==S||t[18]!==C?(w=(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:[S,C]}),t[17]=S,t[18]=C,t[19]=w):w=t[19],w}function XC(){}function ZC(){return null}function QC(e){return e+1}function $C(){return null}function ew(e){return Eo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function tw(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=cn(),a=$o(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=BC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=zC,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function nw(e){let t=(0,$.c)(28),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=cn(),a=$o(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=BC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=zC,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(lS,{scenario:`new-project`}):(0,Z.jsx)(sC,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(iw,{label:f}),t[16]=f,t[17]=p);let m;t[18]===r?m=t[19]:(m=(0,Z.jsx)(N_,{onPackSelect:r,onCreateBlankFile:rw}),t[18]=r,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;return t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==h?(g=(0,Z.jsxs)(`div`,{className:l,children:[u,d,h]}),t[23]=l,t[24]=u,t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function rw(){return HC()}function iw(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function aw(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ow(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=cn(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(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)(cw,{}),(0,Z.jsx)(la,{className:`h-7 w-full`}),(0,Z.jsx)(la,{className:`h-7 w-full`}),(0,Z.jsx)(la,{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)(X,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=aw(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await ks(n,{[e]:t});if(!r.ok){let{error:e}=r;qs.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await ks(n,{[e]:null});if(!t.ok){let{error:e}=t;qs.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Qa(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):qa[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(yr(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await ks(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await ks(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(co,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`vQIVHc`})}),t[42]=K):K=t[42];let q;t[43]===G?q=t[44]:(q=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=q);let J;t[45]===h?J=t[46]:(J=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:sw,children:h}),t[45]=h,t[46]=J);let Y;t[47]!==q||t[48]!==J?(Y=(0,Z.jsxs)(Vs,{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:[q,J]}),t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`hSBIG-`})}),t[50]=ee):ee=t[50];let te;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(te=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Xa,{keyName:e,value:t,declared:Ga(t,pr(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=te):te=t[59];let ne;t[60]!==c||t[61]!==N?(ne=c?(0,Z.jsx)(Ja,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),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)(xt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ne):ne=t[62];let re;t[63]!==te||t[64]!==ne?(re=(0,Z.jsx)(Bs,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ee,te,ne]})}),t[63]=te,t[64]=ne,t[65]=re):re=t[65];let ie;return t[66]!==H||t[67]!==Y||t[68]!==re?(ie=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Hs,{open:H,onOpenChange:U,children:[Y,re]})}),t[66]=H,t[67]=Y,t[68]=re,t[69]=ie):ie=t[69],ie}function sw(e){return e.stopPropagation()}function cw(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Yu,{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)(X,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function lw(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?rc._({id:`xOTzt5`}):t<3600?rc._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?rc._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?rc._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function uw(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function dw(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:ha,label:rc._({id:`QR5SP1`}),detail:uw(i)};case`template-edit`:return{Icon:Cs,label:rc._({id:`-LHLx7`}),detail:uw(i)};case`template-delete`:return{Icon:_s,label:rc._({id:`_gkGSK`}),detail:uw(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:wu,label:rc._({id:`KPW5WC`}),detail:`${uw(e??``)} → ${uw(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Yu,label:rc._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Yu,label:rc._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Yu,label:rc._({id:`ZQLDTl`}),detail:``};default:return{Icon:nd,label:r.replace(/-/g,` `),detail:uw(i)}}}function fw(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?rc._({id:`B2DrPb`}):e.author||rc._({id:`Ef7StM`})}function pw(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Zs(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(X,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(Be,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(la,{className:`h-8 w-full`}),(0,Z.jsx)(la,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(mw)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function mw(e){let{Icon:t,label:n,detail:r}=dw(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kd,{className:`size-3`,"aria-hidden":!0}),fw(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:lw(e.timestamp)})]},e.sha)}function hw(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function gw(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=hw(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function _w(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function vw(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:gw(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:_w(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:gw(e,t.pageTitles),children:a}}function yw(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(X,{id:`-QCLWk`})})}),(0,Z.jsx)(la,{className:`h-12 w-full`}),(0,Z.jsx)(la,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(X,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(X,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(Be,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Di,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(xt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(X,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let y;t[11]===p?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(Ra,{template:e,onCreate:()=>l(e.name),onEdit:()=>Fs(v(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Wa,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=y);let b;t[13]!==_||t[14]!==y?(b=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,y]}),t[13]=_,t[14]=y,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||s(null)},t[16]=x):x=t[16];let S;t[17]!==o||t[18]!==i?(S=(0,Z.jsx)(zi,{template:o,onOpenChange:x,onDeleted:i}),t[17]=o,t[18]=i,t[19]=S):S=t[19];let C;t[20]===p?C=t[21]:(C=new Set(p.map(bw)),t[20]=p,t[21]=C);let w;t[22]!==n||t[23]!==i?(w=e=>{i(),Fs(v(n,e))},t[22]=n,t[23]=i,t[24]=w):w=t[24];let T;t[25]!==n||t[26]!==u||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(ta,{folderPath:n,existingNames:C,open:u,onOpenChange:d,onCreated:w}),t[25]=n,t[26]=u,t[27]=C,t[28]=w,t[29]=T):T=t[29];let E=c!==null,D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||l(null)},t[30]=D):D=t[30];let O=c??void 0,k;t[31]!==a||t[32]!==n||t[33]!==E||t[34]!==O?(k=(0,Z.jsx)(g_,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[31]=a,t[32]=n,t[33]=E,t[34]=O,t[35]=k):k=t[35];let A;return t[36]!==T||t[37]!==k||t[38]!==b||t[39]!==S?(A=(0,Z.jsxs)(Z.Fragment,{children:[b,S,T,k]}),t[36]=T,t[37]=k,t[38]=b,t[39]=S,t[40]=A):A=t[40],A}function bw(e){return e.name}function xw(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=Ti(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Ti(`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 Sw(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=Ti(`[&_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 Cw(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=Ti(`[&_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 ww(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=Ti(`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 Tw(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=Ti(`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 Ew(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=Ti(`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 Dw(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return rc._({id:`xOTzt5`});if(r<60)return rc._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return rc._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?rc._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Ow(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 kw(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)(R,{className:`ml-1 size-3`}):(0,Z.jsx)(B,{className:`ml-1 size-3`}):(0,Z.jsx)(Tu,{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 Aw(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=cn(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Oo(),l=Aa(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){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)(la,{className:`size-5 rounded`}),(0,Z.jsx)(la,{className:`h-7 w-48`})]}),(0,Z.jsx)(la,{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)(la,{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)(la,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Nw)]})]}),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 v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=vw(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=Ow(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(Mw):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(hs,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Di,{onClick:()=>p(!0),children:[(0,Z.jsx)(xt,{className:`size-4`}),(0,Z.jsx)(X,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(ow,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(yw,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(pw,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=xw;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(kw,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(Tw,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(kw,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(Tw,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(Sw,{children:(0,Z.jsxs)(ww,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=Cw,b=a.length?a.map(jw):(0,Z.jsx)(ww,{children:(0,Z.jsx)(Ew,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(X,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(g_,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function jw(e){return(0,Z.jsxs)(ww,{children:[(0,Z.jsx)(Ew,{children:(0,Z.jsxs)(`a`,{href:vo(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)(Zu,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(rn,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Ew,{className:`text-muted-foreground`,children:e.kind===`file`?Dw(e.modified):`—`})]},e.path)}function Mw(e){return e===`asc`?`desc`:`asc`}function Nw(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)(la,{className:`size-4 rounded`}),(0,Z.jsx)(la,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(la,{className:`h-4 w-16`})})]},e)}function Pw(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Ku,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(X,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Dr(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Dr(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(Di,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Mi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function Fw(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Iw),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>sn(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 s;t[2]===n?s=t[3]:(s=function(){A(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]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(X,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(Di,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function Iw(){return new Set}function Lw(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=jr(r).body;s=pe,i=Ct,a=!1,o=Lt().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let f=s(l,u),[p]=(0,Q.useState)(Rw),m=(0,Q.useRef)(null),h,g;t[12]===p?(h=t[13],g=t[14]):(h=()=>{let e=m.current;if(e)return e.appendChild(p),()=>{p.parentNode===e&&e.removeChild(p)}},g=[p],t[12]=p,t[13]=h,t[14]=g),(0,Q.useLayoutEffect)(h,g);let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:m,style:{display:`contents`}})})}),t[15]=_):_=t[15];let v;t[16]===f?v=t[17]:(v=(0,Z.jsx)(d,{editor:f,className:`tiptap-editor-portal-content h-full`}),t[16]=f,t[17]=v);let y;t[18]!==p||t[19]!==v?(y=(0,ku.createPortal)(v,p),t[18]=p,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==n||t[22]!==y?(b=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[_,y]}),t[21]=n,t[22]=y,t[23]=b):b=t[23],b}function Rw(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var zw=`data-skill-markdown`;function Bw(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>tl({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=Qx(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)($x,{fileName:a,dataAttr:zw}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(eS,{fileName:a,dataAttr:zw,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(Lw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var Vw=new Set([`md`,`mdx`]);function Hw(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=Vw.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(Bw,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>tl({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(rS,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function Uw(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Ww=Uw(()=>n(()=>import(`./SettingsDialogBody-B811Baxk.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([65,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,66,8,67,21,18,19,68,33,69,62,24,45,70]),import.meta.url));function Gw(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=cn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(X,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Di,{variant:`default`,onClick:Kw,children:(0,Z.jsx)(X,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(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:[s,c]}),t[7]=s,t[8]=l),l}function Kw(){return window.location.reload()}function qw(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(g,{fallbackRender:Yw,onError:Jw,children:n}),t[0]=n,t[1]=r),r}function Jw(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function Yw(e){return(0,Z.jsx)(Gw,{...e})}function Xw(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Zw(e){let t=(0,$.c)(94),{open:n,onOpenChange:r}=e,{_:i}=cn(),{collabUrl:a}=_t(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=ys(),{desktopPresent:u}=Qi(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]!==y||t[18]!==x||t[19]!==C?(w=[y,x,C],t[17]=y,t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==_?(T={id:`user`,label:_,enabled:!0,items:w},t[21]=w,t[22]=_,t[23]=T):T=t[23];let E;t[24]===i?E=t[25]:(E=i({id:`ZWyHmq`}),t[24]=i,t[25]=E);let D;t[26]===i?D=t[27]:(D=i({id:`Nu4DdT`}),t[26]=i,t[27]=D);let O;t[28]===D?O=t[29]:(O={id:`sync`,label:D},t[28]=D,t[29]=O);let k;t[30]===i?k=t[31]:(k=i({id:`A1taO8`}),t[30]=i,t[31]=k);let A;t[32]===k?A=t[33]:(A={id:`search`,label:k},t[32]=k,t[33]=A);let j;t[34]===i?j=t[35]:(j=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],t[34]=i,t[35]=j);let M;t[36]===i?M=t[37]:(M=i({id:`iTylMl`}),t[36]=i,t[37]=M);let N;t[38]===M?N=t[39]:(N={id:`project-templates`,label:M},t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`PCSkw2`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`skills`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`3zyg_A`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`okignore`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`cs4mps`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`sharing`,label:R},t[50]=R,t[51]=z);let B;t[52]!==O||t[53]!==A||t[54]!==j||t[55]!==N||t[56]!==F||t[57]!==L||t[58]!==z?(B=[O,A,...j,N,F,L,z],t[52]=O,t[53]=A,t[54]=j,t[55]=N,t[56]=F,t[57]=L,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==h||t[61]!==E||t[62]!==B?(V={id:`project`,label:E,enabled:h,items:B},t[60]=h,t[61]=E,t[62]=B,t[63]=V):V=t[63];let H;t[64]===i?H=t[65]:(H=i({id:`nbfdhU`}),t[64]=i,t[65]=H);let U;t[66]!==i||t[67]!==u?(U=[],t[66]=i,t[67]=u,t[68]=U):U=t[68];let W;t[69]!==H||t[70]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[69]=H,t[70]=U,t[71]=W):W=t[71];let G;t[72]!==T||t[73]!==V||t[74]!==W?(G=[T,V,W],t[72]=T,t[73]=V,t[74]=W,t[75]=G):G=t[75];let K=G,q;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(to,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(X,{id:`Tz0i8g`})}),t[76]=q):q=t[76];let J;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(eo,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`RDrXh4`})}),t[77]=J):J=t[77];let Y;t[78]!==d||t[79]!==K?(Y=(0,Z.jsx)(Qw,{groups:K,activeId:d,onSelect:f}),t[78]=d,t[79]=K,t[80]=Y):Y=t[80];let ee;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(tT,{}),t[81]=ee):ee=t[81];let te=s?o:null,ne;t[82]!==d||t[83]!==c||t[84]!==l||t[85]!==te?(ne=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(qw,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(Ww,{activeId:d,userBinding:te,okignoreBinding:c,okignoreSynced:l})})})}),t[82]=d,t[83]=c,t[84]=l,t[85]=te,t[86]=ne):ne=t[86];let re;t[87]!==Y||t[88]!==ne?(re=(0,Z.jsxs)(no,{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:[q,J,Y,ne]}),t[87]=Y,t[88]=ne,t[89]=re):re=t[89];let ie;return t[90]!==r||t[91]!==n||t[92]!==re?(ie=(0,Z.jsx)(oo,{open:n,onOpenChange:r,children:re}),t[90]=r,t[91]=n,t[92]=re,t[93]=ie):ie=t[93],ie}function Qw(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=cn(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(eT,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)($w,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,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:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function $w(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Xw(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:Ti(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(X,{id:`_PACVa`}),(0,Z.jsx)(za,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function eT(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`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=Ti(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=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)(X,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;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:Ti(`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],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function tT(){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)(X,{id:`GsBUCk`})}),n=(0,Z.jsx)(la,{className:`h-5 w-32`}),r=(0,Z.jsx)(la,{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)(la,{className:`h-9 w-full`}),(0,Z.jsx)(la,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function nT(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=Ti(`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)(Bx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rT(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)(Ux,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function iT(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=Ti(`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)(qx,{"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 aT(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=Ti(`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 oT=wi(`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 sT(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=Ti(oT({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:cT,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function cT(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}wi(`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 lT(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=Ti(`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 uT(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=Ti(`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)(fl,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dT(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=cn(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(X,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(uT,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Mu,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Va,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(hc,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(qd,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Va,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(hc,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(sT,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(aT,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let K;t[52]===w?K=t[53]:(K=(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:w}),t[52]=w,t[53]=K);let q;t[54]===b?q=t[55]:(q=b({id:`oqB2ez`}),t[54]=b,t[55]=q);let J=!S,Y;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(st,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=Y):Y=t[56];let ee;t[57]!==g||t[58]!==q||t[59]!==J?(ee=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":q,disabled:J,onClick:g,children:Y})}),t[57]=g,t[58]=q,t[59]=J,t[60]=ee):ee=t[60];let te;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`oqB2ez`})}),t[61]=te):te=t[61];let ne;t[62]===ee?ne=t[63]:(ne=(0,Z.jsxs)(hc,{children:[ee,te]}),t[62]=ee,t[63]=ne);let re;t[64]===b?re=t[65]:(re=b({id:`SiUUCS`}),t[64]=b,t[65]=re);let ie=!S,ae;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(so,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ae):ae=t[66];let oe;t[67]!==h||t[68]!==re||t[69]!==ie?(oe=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":re,disabled:ie,onClick:h,children:ae})}),t[67]=h,t[68]=re,t[69]=ie,t[70]=oe):oe=t[70];let se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`SiUUCS`})}),t[71]=se):se=t[71];let ce;t[72]===oe?ce=t[73]:(ce=(0,Z.jsxs)(hc,{children:[oe,se]}),t[72]=oe,t[73]=ce);let le=a?`secondary`:`ghost`,ue;t[74]!==b||t[75]!==a?(ue=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=ue):ue=t[76];let de=a?`ok-replace-input`:void 0,fe;t[77]!==f||t[78]!==a?(fe=()=>f(!a),t[77]=f,t[78]=a,t[79]=fe):fe=t[79];let pe;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Td,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=pe):pe=t[80];let me;t[81]!==a||t[82]!==le||t[83]!==ue||t[84]!==de||t[85]!==fe?(me=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:le,size:`icon-sm`,"aria-label":ue,"aria-expanded":a,"aria-controls":de,onClick:fe,children:pe})}),t[81]=a,t[82]=le,t[83]=ue,t[84]=de,t[85]=fe,t[86]=me):me=t[86];let he;t[87]===a?he=t[88]:(he=(0,Z.jsx)(pc,{side:`bottom`,children:a?(0,Z.jsx)(X,{id:`UkQGhd`}):(0,Z.jsx)(X,{id:`1RluQD`})}),t[87]=a,t[88]=he);let ge;t[89]!==me||t[90]!==he?(ge=(0,Z.jsxs)(hc,{children:[me,he]}),t[89]=me,t[90]=he,t[91]=ge):ge=t[91];let _e;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(_e=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(X,{id:`fqSfXY`})}),(0,Z.jsx)(fl,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({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)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(Td,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`bS_boY`})})]}),(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(wd,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=_e):_e=t[100];let ve;t[101]===b?ve=t[102]:(ve=b({id:`wJo9oS`}),t[101]=b,t[102]=ve);let ye;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(Js,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=ye):ye=t[103];let be;t[104]!==y||t[105]!==ve?(be=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ve,onClick:y,children:ye})}),t[104]=y,t[105]=ve,t[106]=be):be=t[106];let xe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`yz7wBu`})}),t[107]=xe):xe=t[107];let Se;t[108]===be?Se=t[109]:(Se=(0,Z.jsxs)(hc,{children:[be,xe]}),t[108]=be,t[109]=Se);let Ce;return t[110]!==G||t[111]!==K||t[112]!==ne||t[113]!==ce||t[114]!==k||t[115]!==ge||t[116]!==_e||t[117]!==Se?(Ce=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,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:[A,G,K,ne,ce,ge,_e,Se]}),t[110]=G,t[111]=K,t[112]=ne,t[113]=ce,t[114]=k,t[115]=ge,t[116]=_e,t[117]=Se,t[118]=Ce):Ce=t[118],Ce}var fT={current:0,total:0},pT=120,mT=100;function hT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?ce(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(T,n,gT)}function gT(){return null}function _T(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,`
|
|
26
|
+
`).trim(),mentions:t}}function HS(e){let{instruction:t,mentions:n}=VS(e);return t===``&&n.length===0}function US(e){let t=e?.content;return!Array.isArray(t)||t.length===0?!1:t.some(e=>Array.isArray(e.content)&&e.content.length>0)}function WS(e){let t=(0,$.c)(29),{ref:n,ariaLabel:r,onEmptyChange:i,onContentChange:a,onMentionsChange:o,onSubmit:s,className:c,placeholder:l,initialDoc:u}=e,f=(0,Q.useRef)(i),p=(0,Q.useRef)(a),m=(0,Q.useRef)(o),h=(0,Q.useRef)(s),g;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(g=()=>{f.current=i,p.current=a,m.current=o,h.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=g):g=t[4],(0,Q.useEffect)(g);let _;t[5]===l?_=t[6]:(_=RS({placeholder:l}),t[5]=l,t[6]=_);let v=u??void 0,y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=Ti(`composer-prosemirror py-1 outline-none`),t[7]=y):y=t[7];let b;t[8]===r?b=t[9]:(b={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:y},t[8]=r,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>t.key===`Escape`?AS.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?AS.getState(e.state)?.active?!1:(h.current(),!0):!1,t[10]=x):x=t[10];let S;t[11]===b?S=t[12]:(S={attributes:b,handleKeyDown:x},t[11]=b,t[12]=S);let C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{let{editor:t}=e;f.current(HS(t)),p.current?.(t.getJSON()),m.current?.(VS(t).mentions)},t[13]=C):C=t[13];let w;t[14]!==_||t[15]!==v||t[16]!==S?(w={extensions:_,content:v,immediatelyRender:!0,editorProps:S,onUpdate:C},t[14]=_,t[15]=v,t[16]=S,t[17]=w):w=t[17];let T=pe(w),E;t[18]!==T||t[19]!==u?(E=()=>{T&&(HS(T)&&US(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),CS()),f.current(HS(T)),m.current?.(VS(T).mentions))},t[18]=T,t[19]=u,t[20]=E):E=t[20];let D;t[21]===T?D=t[22]:(D=[T],t[21]=T,t[22]=D),(0,Q.useEffect)(E,D);let O,k;t[23]===T?(O=t[24],k=t[25]):(O=()=>({focus:()=>T?.commands.focus(),blur:()=>T?.commands.blur(),clear:()=>T?.commands.clearContent(!0),setText:e=>{T&&(T.commands.setContent(e),p.current?.(T.getJSON()),m.current?.(VS(T).mentions))},getContent:()=>T?VS(T):{instruction:``,mentions:[]}}),k=[T],t[23]=T,t[24]=O,t[25]=k),(0,Q.useImperativeHandle)(n,O,k);let A;return t[26]!==c||t[27]!==T?(A=(0,Z.jsx)(d,{editor:T,className:c}),t[26]=c,t[27]=T,t[28]=A):A=t[28],A}function GS(e,t,n){return e.trim().length>0||t.length>0||n}var KS=`ok-ask-ai-agent-v2`,qS=`ok-ask-ai-default-agent-v1`,JS=`ok-preferred-agent-v1`,YS=`terminal-cli`;function XS(e){return`${YS}:${e}`}function ZS(e){return e===null?null:e===`terminal-cli`?`claude`:_i.find(t=>e===XS(t))??null}function QS(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function $S(e){let t=QS(e);if(!t)return null;try{let e=t.getItem(KS);return e===null?t.getItem(qS)??t.getItem(JS):e}catch{return null}}function eC(e,t){let n=QS(t);if(n)try{n.setItem(KS,e)}catch(e){console.warn(`[ask-ai] Failed to persist default agent:`,e)}}function tC(e,t){let n=Uo.filter(t=>e[t.id]?.installed===!0);if(t){let e=n.find(e=>e.id===t);if(e)return e}return n[0]??null}var nC=new Set(Uo.map(e=>e.id));function rC(e){return typeof e==`string`&&nC.has(e)}function iC(e){try{let t=$S(e);return rC(t)?t:null}catch{return null}}function aC(e,t){eC(e,t)}function oC(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:Uo.find(e=>n[e.id]?.installed===!0)?.id??null}function sC(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=cn(),{states:a,refresh:o}=ts(),{dispatch:s}=ls(),c=Vo(),l=ss(),[u,d]=(0,Q.useState)(uC),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(lC),[v,y]=(0,Q.useState)(!0),[b,x]=(0,Q.useState)(!1),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(e),e||x(!1)},t[0]=S):S=t[0];let C=S,w=cS(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=Uo.filter(T),D;t[3]===a?D=t[4]:(D=Uo.every(e=>a[e.id]?.installed!=null),t[3]=a,t[4]=D);let O=D,k=O&&E.length===0,A,j;t[5]!==O||t[6]!==a?(A=()=>{if(!O||f.current)return;let e=oC({lastUsed:iC(),states:a});d(t=>e===t?t:e)},j=[O,a],t[5]=O,t[6]=a,t[7]=A,t[8]=j):(A=t[7],j=t[8]),(0,Q.useEffect)(A,j);let M=function(e){f.current=!0,m(null),d(e),aC(e)},N=function(e){f.current=!0,m(e)},P=function(){if(l===null||p===null)return;let{instruction:e,mentions:t}=g.current?.getContent()??{instruction:``,mentions:[]};if(!GS(e,t,!1)){x(!0);return}let r=Xo({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),CS())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!GS(t,r,!1)){x(!0);return}aC(e);let i=Xo({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),CS())},I=function(){h?P():u!==null&&F(u)},L=function(e){g.current?.setText(e),g.current?.focus()};if(k){let e;t[9]===r?e=t[10]:(e=Ti(`flex w-full flex-wrap items-center justify-between gap-3 rounded-2xl border border-border/60 bg-card px-4 py-3`,r),t[9]=r,t[10]=e);let n;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Us,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[11]=n):n=t[11];let i;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[n,(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`3IseAk`})})]}),t[12]=i):i=t[12];let a;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:Uo.map(cC)}),t[13]=a):a=t[13];let o;return t[14]===e?o=t[15]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[14]=e,t[15]=o),o}let R=E.length>0,z=l!==null,B;t[16]===r?B=t[17]:(B=Ti(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=B);let V;t[18]===i?V=t[19]:(V=i({id:`7hctf2`}),t[18]=i,t[19]=V);let H;t[20]===i?H=t[21]:(H=i({id:`0jD-Gn`}),t[20]=i,t[21]=H);let U;t[22]!==v||t[23]!==b?(U=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(X,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=U):U=t[24];let W=u===null?(0,Z.jsx)(Di,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(X,{id:`hYgDIe`})}):(0,Z.jsxs)(TS,{children:[(0,Z.jsx)(Di,{type:`button`,onClick:()=>h?P():F(u),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:h&&p!==null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yo,{id:Jo(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(X,{id:`4rjwLG`,values:{0:Gn[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Yo,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(X,{id:`9dw5bW`,values:{0:Wo(u)}})]})}),(0,Z.jsxs)(nl,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(so,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(Xc,{align:`end`,className:`min-w-[200px]`,children:[R?(0,Z.jsxs)(Yc,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(al,{children:(0,Z.jsx)(X,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Jc,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Yo,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!h&&e.id===u?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,z?(0,Z.jsxs)(Z.Fragment,{children:[R?(0,Z.jsx)(sl,{}):null,(0,Z.jsxs)(Yc,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(al,{children:(0,Z.jsx)(X,{id:`ALhMYW`})}),os.map(e=>{let{displayName:t}=Gn[e];return(0,Z.jsxs)(Jc,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(Yo,{id:Jo(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]})]}):null]})]})]}),G;return t[25]!==W||t[26]!==U?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[U,W]}),t[25]=W,t[26]=U,t[27]=G):G=t[27],(0,Z.jsxs)(`div`,{className:B,children:[(0,Z.jsxs)(`div`,{className:`flex w-full flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[(0,Z.jsx)(WS,{ref:g,ariaLabel:V,placeholder:H,onEmptyChange:C,onContentChange:SS,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),G]}),n!==`existing-repo`&&w.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:w.map(e=>{let t=e.icon;return(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>L(e.prompt),className:`gap-1.5 rounded-md font-normal text-muted-foreground hover:text-foreground`,"data-testid":`create-suggestion-${e.id}`,children:[(0,Z.jsx)(t,{className:`size-3.5`,"aria-hidden":`true`}),e.label]},e.id)})}):null]})}function cC(e){return(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void Bo(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Yo,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(za,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function lC(){return xS().doc??void 0}function uC(){return iC()}var dC=3100,fC=3;function pC(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??fC;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var mC={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}},hC=[`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 gC(e,t={}){let n=t.rng??Math.random,r=t.colors??hC,i=mC[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 _C=1.8,vC=90,yC=16,bC=380,xC=.025,SC=.1,CC=.18,wC=400,TC=9.2736,EC=18.1799,DC=14.5244,OC={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function kC(e,t){let{halfWidth:n,apexLift:r}=OC[t];return`M${e-n} ${DC+.3} Q${e} ${DC-r}, ${e+n} ${DC+.3}`}function AC(e){let t=1.5,n=.3;return`M${e-t} ${DC-n} Q${e} ${DC+1.4}, ${e+t} ${DC-n}`}var jC=15,MC=15;function NC(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 PC(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=pC(g,t);_(n),y(RC),S(gC(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},dC)},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(LC),S(gC(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},dC))},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/bC)),C=-Math.max(-1,Math.min(1,b/bC))*yC,w=S*yC,T=0,E=0;if(x>=1){let e=Math.min(x/vC,1)*_C;T=y/x*e,E=b/x*e}let D=Math.abs(C-r)<.01&&Math.abs(w-i)<.01&&Math.abs(T-a)<.01&&Math.abs(E-o)<.01;if(!m&&D)return;l(),r+=(C-r)*SC,i+=(w-i)*SC,u.style.transform=`perspective(${wC}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(T-a)*CC,o+=(E-o)*CC;let O=i*xC,k=-r*xC,A=a+O,j=o+k;h.current.x=A,h.current.y=j,p.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.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=Ti(`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=Ti(`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=Ti(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:TC,cy:DC,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=Ti(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=J);let Y;t[28]===J?Y=t[29]:(Y=(0,Z.jsx)(`ellipse`,{cx:EC,cy:DC,rx:1.2722,ry:1.9083,className:J}),t[28]=J,t[29]=Y);let ee;t[30]===I?ee=t[31]:(ee=kC(TC,I),t[30]=I,t[31]=ee);let te=(!F||T)&&`ok-blob-eye-hidden`,ne;t[32]===te?ne=t[33]:(ne=Ti(`ok-blob-happy-eye`,te),t[32]=te,t[33]=ne);let re;t[34]!==ee||t[35]!==ne?(re=(0,Z.jsx)(`path`,{d:ee,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ne}),t[34]=ee,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]===I?ie=t[38]:(ie=kC(EC,I),t[37]=I,t[38]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[39]===ae?oe=t[40]:(oe=Ti(`ok-blob-happy-eye`,ae),t[39]=ae,t[40]=oe);let se;t[41]!==ie||t[42]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[41]=ie,t[42]=oe,t[43]=se):se=t[43];let ce;t[44]===T?ce=t[45]:(ce=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:AC(TC),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:AC(EC),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ce);let le;t[46]!==K||t[47]!==Y||t[48]!==re||t[49]!==se||t[50]!==ce?(le=(0,Z.jsxs)(`g`,{ref:p,children:[K,Y,re,se,ce]}),t[46]=K,t[47]=Y,t[48]=re,t[49]=se,t[50]=ce,t[51]=le):le=t[51];let ue;t[52]!==B||t[53]!==H||t[54]!==le?(ue=(0,Z.jsxs)(`g`,{className:H,children:[U,le]},B),t[52]=B,t[53]=H,t[54]=le,t[55]=ue):ue=t[55];let de;t[56]===T?de=t[57]:(de=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=de);let fe;t[58]!==v||t[59]!==x?(fe=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(FC)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=fe):fe=t[60];let pe;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==ue||t[65]!==de||t[66]!==fe?(pe=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:IC,children:[ue,de,fe]}),t[61]=D,t[62]=s,t[63]=z,t[64]=ue,t[65]=de,t[66]=fe,t[67]=pe):pe=t[67];let me;return t[68]!==R||t[69]!==pe?(me=(0,Z.jsx)(`span`,{ref:d,className:R,children:pe}),t[68]=R,t[69]=pe,t[70]=me):me=t[70],me}function FC(e){return(0,Z.jsx)(`circle`,{cx:jC+e.originDx,cy:MC+e.originDy,r:e.size,className:`ok-blob-firework`,style:NC(e)},e.id)}function IC(e){return e.preventDefault()}function LC(e){return e+1}function RC(e){return e+1}function zC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(PC,{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 BC({isOnboarding:e,isEmbedded:t}){return e?{title:{id:`6h4zVU`},subtitle:t?{id:`vGeNNQ`}:{id:`qpQwGC`}}:{title:{id:`FOGD7m`},subtitle:t?{id:`3DTatP`}:{id:`MqQoV-`}}}var VC=`open-knowledge:create-top-level-file`;function HC(e={}){window.dispatchEvent(new CustomEvent(VC,{detail:e}))}function UC(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(VC,t),()=>window.removeEventListener(VC,t)}function WC(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=cn(),a=$o(),{title:o,subtitle:s}=BC({isOnboarding:!1,isEmbedded:a}),c=wa(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p=zC,m=i(o),h=i(s),g;t[3]!==p||t[4]!==n||t[5]!==m||t[6]!==h?(g=(0,Z.jsx)(p,{title:m,subtitle:h,celebrateSignal:n}),t[3]=p,t[4]=n,t[5]=m,t[6]=h,t[7]=g):g=t[7];let _;t[8]===a?_=t[9]:(_=a?(0,Z.jsx)(lS,{scenario:`existing-repo`}):(0,Z.jsx)(sC,{scenario:`existing-repo`}),t[8]=a,t[9]=_);let v;t[10]!==u||t[11]!==f||t[12]!==d?(v=d||f||u.length>0?(0,Z.jsx)(qC,{templates:u,loading:d,error:f,onSelect:KC}):null,t[10]=u,t[11]=f,t[12]=d,t[13]=v):v=t[13];let y,b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(X,{id:`IajAbS`}),t[14]=y,t[15]=b):(y=t[14],b=t[15]);let x;t[16]===r?x=t[17]:(x=(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:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Di,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:GC,children:(0,Z.jsx)(X,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(La,{"aria-hidden":`true`,className:`size-3`})}})}),t[18]=S):S=t[18];let C;t[19]===x?C=t[20]:(C=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[x,S]}),t[19]=x,t[20]=C);let w;t[21]!==C||t[22]!==v?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[v,C]}),t[21]=C,t[22]=v,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==g||t[26]!==_?(T=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[g,_,w]}),t[24]=w,t[25]=g,t[26]=_,t[27]=T):T=t[27],T}function GC(){return HC({initialDir:``})}function KC(e,t){return HC({template:{folder:e,name:t}})}function qC(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=cn(),s;t[0]===o?s=t[1]:(s=o({id:`_8quCH`}),t[0]=o,t[1]=s);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`_8quCH`})}),t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==i||t[5]!==r||t[6]!==n?(l=r||i?null:(0,Z.jsx)(Be,{className:`text-2xs`,variant:`gray`,"aria-label":o({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=o,t[4]=i,t[5]=r,t[6]=n,t[7]=l):l=t[7];let u;t[8]===l?u=t[9]:(u=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,l]}),t[8]=l,t[9]=u);let d;t[10]===o?d=t[11]:(d=o({id:`irFGwu`}),t[10]=o,t[11]=d);let f;t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==n?(f=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(X,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(JC,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>a(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=i,t[13]=r,t[14]=a,t[15]=n,t[16]=f):f=t[16];let p;t[17]!==r||t[18]!==d||t[19]!==f?(p=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":d,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:f})}),t[17]=r,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==s||t[22]!==u||t[23]!==p?(m=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex w-full flex-col gap-3`,children:[u,p]}),t[21]=s,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function JC(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=cn(),o;t[0]!==n.name||t[1]!==n.title?(o=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=o):o=t[2];let s=o,c=`${n.name}.md`,l=n.source_folder===``,u;t[3]!==a||t[4]!==s||t[5]!==c||t[6]!==l||t[7]!==r?(u=a(l?{id:`89TtiD`,values:{displayTitle:s,fileName:c}}:{id:`0_J12R`,values:{displayTitle:s,fileName:c,targetLabel:r}}),t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=r,t[8]=u):u=t[8];let d=u,f;t[9]===s?f=t[10]:(f=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:s}),t[9]=s,t[10]=f);let p;t[11]===c?p=t[12]:(p=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:c}),t[11]=c,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h=`shrink-0 font-mono text-1sm ${l?`text-muted-foreground/70`:`text-muted-foreground`}`,g;t[16]!==h||t[17]!==r?(g=(0,Z.jsx)(`span`,{className:h,children:r}),t[16]=h,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==d||t[20]!==i||t[21]!==m||t[22]!==g?(_=(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,onClick:i,"aria-label":d,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[m,g]}),t[19]=d,t[20]=i,t[21]=m,t[22]=g,t[23]=_):_=t[23],_}function YC(e){let t=(0,$.c)(20),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch($C);if(e)return;let r=t.ok?Kn.safeParse(n):null;r?.success?(l(ew(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=ec(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(p.current)}},h=[],t[0]=m,t[1]=h):(m=t[0],h=t[1]),(0,Q.useEffect)(m,h);let g;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(){clearTimeout(p.current),p.current=setTimeout(()=>d(QC),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(ZC);if(!e.ok)return;let n=Kn.safeParse(t);n.success&&l(ew(n.data.documents))}).catch(XC)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;t[4]!==u||t[5]!==y||t[6]!==v?(e=v?(0,Z.jsx)(tw,{isOnboarding:y,celebrateSignal:u}):null,t[4]=u,t[5]=y,t[6]=v,t[7]=e):e=t[7];let n;return t[8]===e?n=t[9]:(n=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 sm:px-12 md:px-16 pb-8 pt-10`,children:e}),t[8]=e,t[9]=n),n}let S;t[10]!==u||t[11]!==y||t[12]!==v?(S=v?y?(0,Z.jsx)(nw,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(WC,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[10]=u,t[11]=y,t[12]=v,t[13]=S):S=t[13];let C;t[14]!==o||t[15]!==i?(C=(0,Z.jsx)(B_,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[14]=o,t[15]=i,t[16]=C):C=t[16];let w;return t[17]!==S||t[18]!==C?(w=(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:[S,C]}),t[17]=S,t[18]=C,t[19]=w):w=t[19],w}function XC(){}function ZC(){return null}function QC(e){return e+1}function $C(){return null}function ew(e){return Eo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function tw(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=cn(),a=$o(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=BC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=zC,s=i(e),c=i(r),t[0]=i,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c,t[6]=l}else o=t[3],s=t[4],c=t[5],l=t[6];let u;t[7]!==o||t[8]!==r||t[9]!==s||t[10]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:r}),t[7]=o,t[8]=r,t[9]=s,t[10]=c,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(`div`,{className:l,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function nw(e){let t=(0,$.c)(28),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=cn(),a=$o(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=BC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=zC,s=i(e),c=i(n),t[0]=i,t[1]=a,t[2]=o,t[3]=s,t[4]=c,t[5]=l}else o=t[2],s=t[3],c=t[4],l=t[5];let u;t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==c?(u=(0,Z.jsx)(o,{title:s,subtitle:c,celebrateSignal:n}),t[6]=o,t[7]=n,t[8]=s,t[9]=c,t[10]=u):u=t[10];let d;t[11]===a?d=t[12]:(d=a?(0,Z.jsx)(lS,{scenario:`new-project`}):(0,Z.jsx)(sC,{scenario:`new-project`}),t[11]=a,t[12]=d);let f;t[13]!==i||t[14]!==a?(f=i(a?{id:`GubkSu`}:{id:`xeXS4P`}),t[13]=i,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(iw,{label:f}),t[16]=f,t[17]=p);let m;t[18]===r?m=t[19]:(m=(0,Z.jsx)(N_,{onPackSelect:r,onCreateBlankFile:rw}),t[18]=r,t[19]=m);let h;t[20]!==p||t[21]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[p,m]}),t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;return t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==h?(g=(0,Z.jsxs)(`div`,{className:l,children:[u,d,h]}),t[23]=l,t[24]=u,t[25]=d,t[26]=h,t[27]=g):g=t[27],g}function rw(){return HC()}function iw(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function aw(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function ow(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=cn(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),[u,d]=(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)(cw,{}),(0,Z.jsx)(la,{className:`h-7 w-full`}),(0,Z.jsx)(la,{className:`h-7 w-full`}),(0,Z.jsx)(la,{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)(X,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.frontmatterLocal?f=t[4]:(f=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=f);let p=f,m;t[5]===r.data.folder.path?m=t[6]:(m=aw(r.data.folder.path),t[5]=r.data.folder.path,t[6]=m);let h=m,g;t[7]===p?g=t[8]:(g=Object.keys(p),t[7]=p,t[8]=g);let _=g,v;t[9]!==a||t[10]!==n||t[11]!==i?(v=async function(e,t){let r=await ks(n,{[e]:t});if(!r.ok){let{error:e}=r;qs.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},t[9]=a,t[10]=n,t[11]=i,t[12]=v):v=t[12];let y=v,b;t[13]!==a||t[14]!==n||t[15]!==i?(b=async function(e){let t=await ks(n,{[e]:null});if(!t.ok){let{error:e}=t;qs.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},t[13]=a,t[14]=n,t[15]=i,t[16]=b):b=t[16];let x=b,S;t[17]!==y||t[18]!==p?(S=function(e,t){let n=p[e];y(e,Qa(n,t))},t[17]=y,t[18]=p,t[19]=S):S=t[19];let C=S,w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){l({name:``,type:`text`,value:``,error:null}),s(!1)},t[20]=w):w=t[20];let T=w,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):qa[e];return{...t,type:e,value:n,error:null}})},t[21]=E):E=t[21];let D=E,O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){l(t=>t&&{...t,value:e})},t[22]=O):O=t[22];let k=O,A;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(t=>t&&{...t,name:e,error:null})},t[23]=A):A=t[23];let j=A,M;t[24]!==a||t[25]!==c||t[26]!==n||t[27]!==i||t[28]!==p?(M=async function(e){if(!c)return;let t=e??c.value,r=c.name.trim();if(!r){l({...c,value:t,error:a({id:`8_brI5`})});return}if(yr(t)){l({...c,value:t,error:a({id:`hXUWyd`})});return}if(Object.hasOwn(p,r)){l({...c,value:t,error:a({id:`CTJLpz`,values:{trimmed:r}})});return}let o=await ks(n,{[r]:t});if(!o.ok){l({...c,value:t,error:o.error});return}l(null),i()},t[24]=a,t[25]=c,t[26]=n,t[27]=i,t[28]=p,t[29]=M):M=t[29];let N=M,P;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){d({key:e,draft:e,error:null})},t[30]=P):P=t[30];let F=P,I;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){d(t=>t&&{...t,draft:e,error:null})},t[31]=I):I=t[31];let L=I,R;t[32]!==a||t[33]!==n||t[34]!==i||t[35]!==p||t[36]!==u?(R=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:a({id:`8_brI5`})});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:a({id:`CTJLpz`,values:{trimmed:e}})});return}let t=p[u.key],r=await ks(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},t[32]=a,t[33]=n,t[34]=i,t[35]=p,t[36]=u,t[37]=R):R=t[37];let z=R,B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){d(null)},t[38]=B):B=t[38];let V=B,H=!o,U;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>s(!e),t[39]=U):U=t[39];let W=`size-3 transition-transform ${o?``:`rotate-90`}`,G;t[40]===W?G=t[41]:(G=(0,Z.jsx)(co,{className:W,"aria-hidden":!0}),t[40]=W,t[41]=G);let K;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`vQIVHc`})}),t[42]=K):K=t[42];let q;t[43]===G?q=t[44]:(q=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[G,K]}),t[43]=G,t[44]=q);let J;t[45]===h?J=t[46]:(J=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:sw,children:h}),t[45]=h,t[46]=J);let Y;t[47]!==q||t[48]!==J?(Y=(0,Z.jsxs)(Vs,{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:[q,J]}),t[47]=q,t[48]=J,t[49]=Y):Y=t[49];let ee;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`hSBIG-`})}),t[50]=ee):ee=t[50];let te;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(te=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(Xa,{keyName:e,value:t,declared:Ga(t,pr(t)),rename:{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:L,onCommit:z,onCancel:V},badge:null,onCommit:t=>void y(e,t),onChangeType:t=>C(e,t),onRemove:()=>void x(e)},e)}),t[51]=c,t[52]=y,t[53]=z,t[54]=_,t[55]=p,t[56]=x,t[57]=u,t[58]=C,t[59]=te):te=t[59];let ne;t[60]!==c||t[61]!==N?(ne=c?(0,Z.jsx)(Ja,{draft:c,onChangeName:j,onChangeType:D,onChangeValue:k,onCommit:e=>void N(e),onCancel:()=>l(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>T(),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)(xt,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ne):ne=t[62];let re;t[63]!==te||t[64]!==ne?(re=(0,Z.jsx)(Bs,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ee,te,ne]})}),t[63]=te,t[64]=ne,t[65]=re):re=t[65];let ie;return t[66]!==H||t[67]!==Y||t[68]!==re?(ie=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Hs,{open:H,onOpenChange:U,children:[Y,re]})}),t[66]=H,t[67]=Y,t[68]=re,t[69]=ie):ie=t[69],ie}function sw(e){return e.stopPropagation()}function cw(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Yu,{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)(X,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function lw(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?rc._({id:`xOTzt5`}):t<3600?rc._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?rc._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?rc._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function uw(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function dw(e){let t=e.message,n=t.indexOf(`: `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+2);switch(r){case`template-create`:return{Icon:ha,label:rc._({id:`QR5SP1`}),detail:uw(i)};case`template-edit`:return{Icon:Cs,label:rc._({id:`-LHLx7`}),detail:uw(i)};case`template-delete`:return{Icon:_s,label:rc._({id:`_gkGSK`}),detail:uw(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:wu,label:rc._({id:`KPW5WC`}),detail:`${uw(e??``)} → ${uw(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Yu,label:rc._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Yu,label:rc._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Yu,label:rc._({id:`ZQLDTl`}),detail:``};default:return{Icon:nd,label:r.replace(/-/g,` `),detail:uw(i)}}}function fw(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?rc._({id:`B2DrPb`}):e.author||rc._({id:`Ef7StM`})}function pw(e){let t=(0,$.c)(15),{folderPath:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[c,l]=(0,Q.useState)(!1),u,d;if(t[1]===n?(u=t[2],d=t[3]):(u=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){l(!0),s(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),l(!1),s(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),l(!0),s(!1))}};s(!0),t();let r=Zs(t);return()=>{e=!0,r()}},d=[n],t[1]=n,t[2]=u,t[3]=d),(0,Q.useEffect)(u,d),c||!o&&i.length===0)return null;let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(X,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(Be,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=p);let m;t[7]===p?m=t[8]:(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[f,p]}),t[7]=p,t[8]=m);let h;t[9]!==i||t[10]!==o?(h=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:o?(0,Z.jsxs)(`div`,{className:`space-y-2`,role:`status`,"aria-busy":`true`,children:[(0,Z.jsx)(la,{className:`h-8 w-full`}),(0,Z.jsx)(la,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(mw)})}),t[9]=i,t[10]=o,t[11]=h):h=t[11];let g;return t[12]!==m||t[13]!==h?(g=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function mw(e){let{Icon:t,label:n,detail:r}=dw(e);return(0,Z.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm`,children:[(0,Z.jsx)(t,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,Z.jsx)(`span`,{className:`text-foreground`,children:n}),r?(0,Z.jsx)(`code`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:r}):null]}),(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Kd,{className:`size-3`,"aria-hidden":!0}),fw(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:lw(e.timestamp)})]},e.sha)}function hw(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function gw(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=hw(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function _w(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function vw(e,t){let n=e===``?``:`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:gw(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:_w(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:gw(e,t.pageTitles),children:a}}function yw(e){let t=(0,$.c)(41),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(X,{id:`-QCLWk`})})}),(0,Z.jsx)(la,{className:`h-12 w-full`}),(0,Z.jsx)(la,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(X,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let f;t[3]===r.data.folder.templates_available?f=t[4]:(f=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=f);let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(X,{id:`-QCLWk`})}),t[5]=m):m=t[5];let h;t[6]===p.length?h=t[7]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m,(0,Z.jsx)(Be,{className:`text-xs`,variant:`secondary`,children:p.length})]}),t[6]=p.length,t[7]=h);let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Di,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(xt,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(X,{id:`G1Gw0v`})]}),t[8]=g):g=t[8];let _;t[9]===h?_=t[10]:(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[h,g]}),t[9]=h,t[10]=_);let y;t[11]===p?y=t[12]:(y=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(Ra,{template:e,onCreate:()=>l(e.name),onEdit:()=>Fs(v(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(Wa,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=y);let b;t[13]!==_||t[14]!==y?(b=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,y]}),t[13]=_,t[14]=y,t[15]=b):b=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||s(null)},t[16]=x):x=t[16];let S;t[17]!==o||t[18]!==i?(S=(0,Z.jsx)(zi,{template:o,onOpenChange:x,onDeleted:i}),t[17]=o,t[18]=i,t[19]=S):S=t[19];let C;t[20]===p?C=t[21]:(C=new Set(p.map(bw)),t[20]=p,t[21]=C);let w;t[22]!==n||t[23]!==i?(w=e=>{i(),Fs(v(n,e))},t[22]=n,t[23]=i,t[24]=w):w=t[24];let T;t[25]!==n||t[26]!==u||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(ta,{folderPath:n,existingNames:C,open:u,onOpenChange:d,onCreated:w}),t[25]=n,t[26]=u,t[27]=C,t[28]=w,t[29]=T):T=t[29];let E=c!==null,D;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||l(null)},t[30]=D):D=t[30];let O=c??void 0,k;t[31]!==a||t[32]!==n||t[33]!==E||t[34]!==O?(k=(0,Z.jsx)(g_,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[31]=a,t[32]=n,t[33]=E,t[34]=O,t[35]=k):k=t[35];let A;return t[36]!==T||t[37]!==k||t[38]!==b||t[39]!==S?(A=(0,Z.jsxs)(Z.Fragment,{children:[b,S,T,k]}),t[36]=T,t[37]=k,t[38]=b,t[39]=S,t[40]=A):A=t[40],A}function bw(e){return e.name}function xw(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=Ti(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Ti(`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 Sw(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=Ti(`[&_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 Cw(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=Ti(`[&_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 ww(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=Ti(`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 Tw(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=Ti(`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 Ew(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=Ti(`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 Dw(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return rc._({id:`xOTzt5`});if(r<60)return rc._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return rc._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?rc._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Ow(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 kw(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)(R,{className:`ml-1 size-3`}):(0,Z.jsx)(B,{className:`ml-1 size-3`}):(0,Z.jsx)(Tu,{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 Aw(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=cn(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Oo(),l=Aa(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(a){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)(la,{className:`size-5 rounded`}),(0,Z.jsx)(la,{className:`h-7 w-48`})]}),(0,Z.jsx)(la,{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)(la,{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)(la,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Nw)]})]}),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 v,y,b,x,S,C,w,T,E,D,O;if(t[7]!==r||t[8]!==u||t[9]!==l||t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==s||t[14]!==o||t[15]!==d||t[16]!==g||t[17]!==m){let e=vw(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=Ow(e.children,m,g),f=e.title||(n===``?r({id:`3aeN7X`}):e.title),k;t[29]===m?k=t[30]:(k=function(e){e===m?_(Mw):(h(e),_(`asc`))},t[29]=m,t[30]=k);let A=k;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(hs,{className:`size-5 text-muted-foreground`}),t[31]=j):j=t[31];let M=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:f})]}),N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsxs)(Di,{onClick:()=>p(!0),children:[(0,Z.jsx)(xt,{className:`size-4`}),(0,Z.jsx)(X,{id:`isRobC`})]}),t[32]=N):N=t[32],t[33]===M?w=t[34]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[M,N]})}),t[33]=M,t[34]=w),t[35]!==u||t[36]!==n||t[37]!==d?(T=(0,Z.jsx)(ow,{folderPath:n,state:u,onChange:d}),t[35]=u,t[36]=n,t[37]=d,t[38]=T):T=t[38],t[39]!==u||t[40]!==l||t[41]!==n||t[42]!==d?(E=(0,Z.jsx)(yw,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[39]=u,t[40]=l,t[41]=n,t[42]=d,t[43]=E):E=t[43],t[44]===n?D=t[45]:(D=(0,Z.jsx)(pw,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=xw;let P=m===`name`?g===`asc`?`ascending`:`descending`:`none`,F;t[46]===r?F=t[47]:(F=r({id:`6YtxFj`}),t[46]=r,t[47]=F);let I;t[48]!==A||t[49]!==g||t[50]!==m||t[51]!==F?(I=(0,Z.jsx)(kw,{label:F,sortKey:`name`,activeKey:m,activeDir:g,onSort:A}),t[48]=A,t[49]=g,t[50]=m,t[51]=F,t[52]=I):I=t[52];let L;t[53]!==P||t[54]!==I?(L=(0,Z.jsx)(Tw,{"aria-sort":P,children:I}),t[53]=P,t[54]=I,t[55]=L):L=t[55];let R=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,z;t[56]===r?z=t[57]:(z=r({id:`tgWuMB`}),t[56]=r,t[57]=z);let B;t[58]!==A||t[59]!==g||t[60]!==m||t[61]!==z?(B=(0,Z.jsx)(kw,{label:z,sortKey:`modified`,activeKey:m,activeDir:g,onSort:A}),t[58]=A,t[59]=g,t[60]=m,t[61]=z,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,Z.jsx)(Tw,{className:`w-32`,"aria-sort":R,children:B}),t[63]=R,t[64]=B,t[65]=V):V=t[65],t[66]!==L||t[67]!==V?(x=(0,Z.jsx)(Sw,{children:(0,Z.jsxs)(ww,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=Cw,b=a.length?a.map(jw):(0,Z.jsx)(ww,{children:(0,Z.jsx)(Ew,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(X,{id:`Pkw7J9`})})}),t[7]=r,t[8]=u,t[9]=l,t[10]=n,t[11]=i,t[12]=c,t[13]=s,t[14]=o,t[15]=d,t[16]=g,t[17]=m,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=O}else v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],O=t[28];let k;t[69]!==v||t[70]!==b?(k=(0,Z.jsx)(v,{children:b}),t[69]=v,t[70]=b,t[71]=k):k=t[71];let A;t[72]!==y||t[73]!==k||t[74]!==x?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[72]=y,t[73]=k,t[74]=x,t[75]=A):A=t[75];let j;t[76]!==A||t[77]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[76]=A,t[77]=S,t[78]=j):j=t[78];let M;t[79]!==j||t[80]!==C||t[81]!==w||t[82]!==T||t[83]!==E||t[84]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,T,E,D,j]}),t[79]=j,t[80]=C,t[81]=w,t[82]=T,t[83]=E,t[84]=D,t[85]=M):M=t[85];let N;t[86]!==M||t[87]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[86]=M,t[87]=O,t[88]=N):N=t[88];let P;t[89]!==f||t[90]!==l||t[91]!==n?(P=(0,Z.jsx)(g_,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[89]=f,t[90]=l,t[91]=n,t[92]=P):P=t[92];let F;return t[93]!==N||t[94]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[93]=N,t[94]=P,t[95]=F):F=t[95],F}function jw(e){return(0,Z.jsxs)(ww,{children:[(0,Z.jsx)(Ew,{children:(0,Z.jsxs)(`a`,{href:vo(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)(Zu,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(rn,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(Ew,{className:`text-muted-foreground`,children:e.kind===`file`?Dw(e.modified):`—`})]},e.path)}function Mw(e){return e===`asc`?`desc`:`asc`}function Nw(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)(la,{className:`size-4 rounded`}),(0,Z.jsx)(la,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(la,{className:`h-4 w-16`})})]},e)}function Pw(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l,u;t[0]===o?(l=t[1],u=t[2]):(l=()=>{o?s.current?.focus():c.current?.focus()},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(Ku,{className:`size-9`,"aria-hidden":`true`})}),t[3]=d):d=t[3];let f=o?void 0:-1,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(X,{id:`P3hnm0`}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsx)(`h2`,{ref:c,id:`large-file-title`,tabIndex:f,className:`text-2xl font-light text-balance outline-none`,children:p}),t[5]=f,t[6]=m);let h;t[7]===r?h=t[8]:(h=Dr(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Dr(i),t[9]=i,t[10]=g);let _;t[11]!==n||t[12]!==h||t[13]!==g?(_=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`GJH-AT`,values:{0:h,1:g,docName:n}})}),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[m,_]}),t[15]=m,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==o?(y=o?(0,Z.jsxs)(Di,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(Mi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=y):y=t[20];let b;return t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[d,v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function Fw(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Iw),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>sn(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 s;t[2]===n?s=t[3]:(s=function(){A(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]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(X,{id:`dEgA5A`}),t[5]=u):u=t[5];let d;return t[6]===c?d=t[7]:(d=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(Di,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:u})]}),t[6]=c,t[7]=d),d}function Iw(){return new Set}function Lw(e){let t=(0,$.c)(24),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=jr(r).body;s=pe,i=Ct,a=!1,o=Lt().parseWithFallback(e),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c={attributes:{class:`pt-4 pb-4`}},t[5]=c):c=t[5];let l;t[6]!==i||t[7]!==a||t[8]!==o?(l={extensions:i,editable:a,content:o,editorProps:c},t[6]=i,t[7]=a,t[8]=o,t[9]=l):l=t[9];let u;t[10]===r?u=t[11]:(u=[r],t[10]=r,t[11]=u);let f=s(l,u),[p]=(0,Q.useState)(Rw),m=(0,Q.useRef)(null),h,g;t[12]===p?(h=t[13],g=t[14]):(h=()=>{let e=m.current;if(e)return e.appendChild(p),()=>{p.parentNode===e&&e.removeChild(p)}},g=[p],t[12]=p,t[13]=h,t[14]=g),(0,Q.useLayoutEffect)(h,g);let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:m,style:{display:`contents`}})})}),t[15]=_):_=t[15];let v;t[16]===f?v=t[17]:(v=(0,Z.jsx)(d,{editor:f,className:`tiptap-editor-portal-content h-full`}),t[16]=f,t[17]=v);let y;t[18]!==p||t[19]!==v?(y=(0,ku.createPortal)(v,p),t[18]=p,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==n||t[22]!==y?(b=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":n,"data-skill-markdown-viewer":``,"data-skill-markdown-viewer-state":`loaded`,children:[_,y]}),t[21]=n,t[22]=y,t[23]=b):b=t[23],b}function Rw(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var zw=`data-skill-markdown`;function Bw(e){let t=(0,$.c)(12),{scope:n,name:r,path:i,fileName:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==n?(o={loadText:e=>tl({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=Qx(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)($x,{fileName:a,dataAttr:zw}),t[4]=a,t[5]=e),e}if(s.status===`error`){let e;return t[6]!==s.message||t[7]!==a?(e=(0,Z.jsx)(eS,{fileName:a,dataAttr:zw,message:s.message}),t[6]=s.message,t[7]=a,t[8]=e):e=t[8],e}let c;return t[9]!==s.content||t[10]!==a?(c=(0,Z.jsx)(Lw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var Vw=new Set([`md`,`mdx`]);function Hw(e){let t=(0,$.c)(19),{scope:n,name:r,path:i}=e,a;t[0]===i?a=t[1]:(a=i.split(`/`).pop()??i,t[0]=i,t[1]=a);let o=a,s=o.lastIndexOf(`.`),c,l;if(t[2]!==s||t[3]!==o?(c=s>=0?o.slice(s+1).toLowerCase():``,l=Vw.has(c),t[2]=s,t[3]=o,t[4]=c,t[5]=l):(c=t[4],l=t[5]),l){let e;return t[6]!==o||t[7]!==r||t[8]!==i||t[9]!==n?(e=(0,Z.jsx)(Bw,{scope:n,name:r,path:i,fileName:o}),t[6]=o,t[7]=r,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}let u;t[11]!==r||t[12]!==i||t[13]!==n?(u=e=>tl({scope:n,name:r,path:i},e),t[11]=r,t[12]=i,t[13]=n,t[14]=u):u=t[14];let d;return t[15]!==c||t[16]!==o||t[17]!==u?(d=(0,Z.jsx)(rS,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function Uw(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Ww=Uw(()=>n(()=>import(`./SettingsDialogBody-LhApNvLs.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([65,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,66,8,67,21,18,19,68,33,69,62,24,45,70]),import.meta.url));function Gw(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=cn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(X,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Di,{variant:`default`,onClick:Kw,children:(0,Z.jsx)(X,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(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:[s,c]}),t[7]=s,t[8]=l),l}function Kw(){return window.location.reload()}function qw(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(g,{fallbackRender:Yw,onError:Jw,children:n}),t[0]=n,t[1]=r),r}function Jw(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function Yw(e){return(0,Z.jsx)(Gw,{...e})}function Xw(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Zw(e){let t=(0,$.c)(94),{open:n,onOpenChange:r}=e,{_:i}=cn(),{collabUrl:a}=_t(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=ys(),{desktopPresent:u}=Qi(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g=typeof window<`u`&&window.okDesktop!=null,_;t[3]===i?_=t[4]:(_=i({id:`7PzzBU`}),t[3]=i,t[4]=_);let v;t[5]===i?v=t[6]:(v=i({id:`Q6hhn8`}),t[5]=i,t[6]=v);let y;t[7]===v?y=t[8]:(y={id:`preferences`,label:v},t[7]=v,t[8]=y);let b;t[9]===i?b=t[10]:(b=i({id:`4KmEoC`}),t[9]=i,t[10]=b);let x;t[11]===b?x=t[12]:(x={id:`hotkeys`,label:b},t[11]=b,t[12]=x);let S;t[13]===i?S=t[14]:(S=i({id:`AeXO77`}),t[13]=i,t[14]=S);let C;t[15]===S?C=t[16]:(C={id:`account`,label:S},t[15]=S,t[16]=C);let w;t[17]!==y||t[18]!==x||t[19]!==C?(w=[y,x,C],t[17]=y,t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==_?(T={id:`user`,label:_,enabled:!0,items:w},t[21]=w,t[22]=_,t[23]=T):T=t[23];let E;t[24]===i?E=t[25]:(E=i({id:`ZWyHmq`}),t[24]=i,t[25]=E);let D;t[26]===i?D=t[27]:(D=i({id:`Nu4DdT`}),t[26]=i,t[27]=D);let O;t[28]===D?O=t[29]:(O={id:`sync`,label:D},t[28]=D,t[29]=O);let k;t[30]===i?k=t[31]:(k=i({id:`A1taO8`}),t[30]=i,t[31]=k);let A;t[32]===k?A=t[33]:(A={id:`search`,label:k},t[32]=k,t[33]=A);let j;t[34]===i?j=t[35]:(j=g?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],t[34]=i,t[35]=j);let M;t[36]===i?M=t[37]:(M=i({id:`iTylMl`}),t[36]=i,t[37]=M);let N;t[38]===M?N=t[39]:(N={id:`project-templates`,label:M},t[38]=M,t[39]=N);let P;t[40]===i?P=t[41]:(P=i({id:`PCSkw2`}),t[40]=i,t[41]=P);let F;t[42]===P?F=t[43]:(F={id:`skills`,label:P},t[42]=P,t[43]=F);let I;t[44]===i?I=t[45]:(I=i({id:`3zyg_A`}),t[44]=i,t[45]=I);let L;t[46]===I?L=t[47]:(L={id:`okignore`,label:I},t[46]=I,t[47]=L);let R;t[48]===i?R=t[49]:(R=i({id:`cs4mps`}),t[48]=i,t[49]=R);let z;t[50]===R?z=t[51]:(z={id:`sharing`,label:R},t[50]=R,t[51]=z);let B;t[52]!==O||t[53]!==A||t[54]!==j||t[55]!==N||t[56]!==F||t[57]!==L||t[58]!==z?(B=[O,A,...j,N,F,L,z],t[52]=O,t[53]=A,t[54]=j,t[55]=N,t[56]=F,t[57]=L,t[58]=z,t[59]=B):B=t[59];let V;t[60]!==h||t[61]!==E||t[62]!==B?(V={id:`project`,label:E,enabled:h,items:B},t[60]=h,t[61]=E,t[62]=B,t[63]=V):V=t[63];let H;t[64]===i?H=t[65]:(H=i({id:`nbfdhU`}),t[64]=i,t[65]=H);let U;t[66]!==i||t[67]!==u?(U=[],t[66]=i,t[67]=u,t[68]=U):U=t[68];let W;t[69]!==H||t[70]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[69]=H,t[70]=U,t[71]=W):W=t[71];let G;t[72]!==T||t[73]!==V||t[74]!==W?(G=[T,V,W],t[72]=T,t[73]=V,t[74]=W,t[75]=G):G=t[75];let K=G,q;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(to,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(X,{id:`Tz0i8g`})}),t[76]=q):q=t[76];let J;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(eo,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`RDrXh4`})}),t[77]=J):J=t[77];let Y;t[78]!==d||t[79]!==K?(Y=(0,Z.jsx)(Qw,{groups:K,activeId:d,onSelect:f}),t[78]=d,t[79]=K,t[80]=Y):Y=t[80];let ee;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(tT,{}),t[81]=ee):ee=t[81];let te=s?o:null,ne;t[82]!==d||t[83]!==c||t[84]!==l||t[85]!==te?(ne=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(qw,{children:(0,Z.jsx)(Q.Suspense,{fallback:ee,children:(0,Z.jsx)(Ww,{activeId:d,userBinding:te,okignoreBinding:c,okignoreSynced:l})})})}),t[82]=d,t[83]=c,t[84]=l,t[85]=te,t[86]=ne):ne=t[86];let re;t[87]!==Y||t[88]!==ne?(re=(0,Z.jsxs)(no,{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:[q,J,Y,ne]}),t[87]=Y,t[88]=ne,t[89]=re):re=t[89];let ie;return t[90]!==r||t[91]!==n||t[92]!==re?(ie=(0,Z.jsx)(oo,{open:n,onOpenChange:r,children:re}),t[90]=r,t[91]=n,t[92]=re,t[93]=ie):ie=t[93],ie}function Qw(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=cn(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(eT,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)($w,{}),t[9]=c):c=t[9];let l;return t[10]!==o||t[11]!==s?(l=(0,Z.jsxs)(`nav`,{"aria-label":o,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:[s,c]}),t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function $w(){let e=(0,$.c)(4),t=typeof window<`u`?window.okDesktop??null:null,n=t?.appVersion;if(!t||!n)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Xw(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:Ti(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(X,{id:`_PACVa`}),(0,Z.jsx)(za,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function eT(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`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=Ti(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=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)(X,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;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:Ti(`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],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function tT(){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)(X,{id:`GsBUCk`})}),n=(0,Z.jsx)(la,{className:`h-5 w-32`}),r=(0,Z.jsx)(la,{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)(la,{className:`h-9 w-full`}),(0,Z.jsx)(la,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function nT(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=Ti(`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)(Bx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rT(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)(Ux,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function iT(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=Ti(`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)(qx,{"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 aT(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=Ti(`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 oT=wi(`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 sT(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=Ti(oT({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:cT,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function cT(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}wi(`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 lT(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=Ti(`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 uT(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=Ti(`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)(fl,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dT(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=cn(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(X,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(uT,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Mu,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Va,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(hc,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(qd,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Va,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(hc,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(sT,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(aT,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let K;t[52]===w?K=t[53]:(K=(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:w}),t[52]=w,t[53]=K);let q;t[54]===b?q=t[55]:(q=b({id:`oqB2ez`}),t[54]=b,t[55]=q);let J=!S,Y;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(st,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=Y):Y=t[56];let ee;t[57]!==g||t[58]!==q||t[59]!==J?(ee=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":q,disabled:J,onClick:g,children:Y})}),t[57]=g,t[58]=q,t[59]=J,t[60]=ee):ee=t[60];let te;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`oqB2ez`})}),t[61]=te):te=t[61];let ne;t[62]===ee?ne=t[63]:(ne=(0,Z.jsxs)(hc,{children:[ee,te]}),t[62]=ee,t[63]=ne);let re;t[64]===b?re=t[65]:(re=b({id:`SiUUCS`}),t[64]=b,t[65]=re);let ie=!S,ae;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(so,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ae):ae=t[66];let oe;t[67]!==h||t[68]!==re||t[69]!==ie?(oe=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":re,disabled:ie,onClick:h,children:ae})}),t[67]=h,t[68]=re,t[69]=ie,t[70]=oe):oe=t[70];let se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`SiUUCS`})}),t[71]=se):se=t[71];let ce;t[72]===oe?ce=t[73]:(ce=(0,Z.jsxs)(hc,{children:[oe,se]}),t[72]=oe,t[73]=ce);let le=a?`secondary`:`ghost`,ue;t[74]!==b||t[75]!==a?(ue=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=ue):ue=t[76];let de=a?`ok-replace-input`:void 0,fe;t[77]!==f||t[78]!==a?(fe=()=>f(!a),t[77]=f,t[78]=a,t[79]=fe):fe=t[79];let pe;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(pe=(0,Z.jsx)(Td,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=pe):pe=t[80];let me;t[81]!==a||t[82]!==le||t[83]!==ue||t[84]!==de||t[85]!==fe?(me=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:le,size:`icon-sm`,"aria-label":ue,"aria-expanded":a,"aria-controls":de,onClick:fe,children:pe})}),t[81]=a,t[82]=le,t[83]=ue,t[84]=de,t[85]=fe,t[86]=me):me=t[86];let he;t[87]===a?he=t[88]:(he=(0,Z.jsx)(pc,{side:`bottom`,children:a?(0,Z.jsx)(X,{id:`UkQGhd`}):(0,Z.jsx)(X,{id:`1RluQD`})}),t[87]=a,t[88]=he);let ge;t[89]!==me||t[90]!==he?(ge=(0,Z.jsxs)(hc,{children:[me,he]}),t[89]=me,t[90]=he,t[91]=ge):ge=t[91];let _e;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(_e=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(X,{id:`fqSfXY`})}),(0,Z.jsx)(fl,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({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)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(Td,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`bS_boY`})})]}),(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(wd,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=_e):_e=t[100];let ve;t[101]===b?ve=t[102]:(ve=b({id:`wJo9oS`}),t[101]=b,t[102]=ve);let ye;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(Js,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=ye):ye=t[103];let be;t[104]!==y||t[105]!==ve?(be=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ve,onClick:y,children:ye})}),t[104]=y,t[105]=ve,t[106]=be):be=t[106];let xe;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`yz7wBu`})}),t[107]=xe):xe=t[107];let Se;t[108]===be?Se=t[109]:(Se=(0,Z.jsxs)(hc,{children:[be,xe]}),t[108]=be,t[109]=Se);let Ce;return t[110]!==G||t[111]!==K||t[112]!==ne||t[113]!==ce||t[114]!==k||t[115]!==ge||t[116]!==_e||t[117]!==Se?(Ce=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,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:[A,G,K,ne,ce,ge,_e,Se]}),t[110]=G,t[111]=K,t[112]=ne,t[113]=ce,t[114]=k,t[115]=ge,t[116]=_e,t[117]=Se,t[118]=Ce):Ce=t[118],Ce}var fT={current:0,total:0},pT=120,mT=100;function hT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?ce(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(T,n,gT)}function gT(){return null}function _T(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,`
|
|
27
27
|
`,`
|
|
28
28
|
`).trim();return i.length===0||i.length>pT||i.includes(`
|
|
29
29
|
`)?null:i}function vT(e){let t=$e(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function yT(e,t){return e.current===t.current&&e.total===t.total}function bT(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(fT)}function xT(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=fe(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 ST(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=hT(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)(fT),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(wT))},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(CT)},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(fT);return}if(!u.open||r){i.commands.clearFindMatches(),p(fT);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=vT(i);p(t=>yT(t,e)?t:e)},mT);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=$e(i.state),t=vT(i);p(e=>yT(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=_T(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(xl(t,`find`)){t.preventDefault(),u.open?bT(i,d,p):e(!1);return}if(xl(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=xl(t,`find-next`),n=xl(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&xT(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),bT(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=$e(i.state),t=vT(i);p(e=>yT(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(){bT(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()&&xT(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()&&xT(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)&&xT(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)&&xT(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let Y;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(Y=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(dT,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=Y):Y=t[80],Y}function CT(e){return{...e,open:!1,activeIndex:0}}function wT(e){return{...e,activeIndex:0}}var TT=300;function ET(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Wl),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Wl);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Jl(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,TT)};return n.observe(s),()=>{r=!0,n.unobserve(s),a&&clearTimeout(a)}},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Q.useEffect)(a,o),r}function DT(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function OT(e){let t=(0,$.c)(8),{poolEntries:n}=_t(),r;t[0]!==e||t[1]!==n?(r=e?n.find(t=>t.docName===e)??null:null,t[0]=e,t[1]=n,t[2]=r):r=t[2];let i=r?.provider??null,a;t[3]===i?a=t[4]:(a=()=>DT(i),t[3]=i,t[4]=a);let[o,s]=(0,Q.useState)(a),c,l;return t[5]===i?(c=t[6],l=t[7]):(c=()=>{if(!i){s(null);return}let e=i.document.getMap(`lifecycle`);s(DT(i));let t=()=>s(DT(i));return e.observe(t),()=>{e.unobserve(t)}},l=[i],t[5]=i,t[6]=c,t[7]=l),(0,Q.useEffect)(c,l),o}function kT(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Ql(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)($l,r)}var AT=`ok-doc-panel-width-v1`;function jT(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function MT(e){try{let t=(e??localStorage).getItem(AT);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?jT(n):320}catch{return 320}}function NT(e,t){try{(t??localStorage).setItem(AT,String(jT(e)))}catch{}}function PT(){try{return typeof localStorage>`u`?320:MT()}catch{return 320}}var FT=1024,IT=1280,LT={left:FT,right:IT};function RT(e,t,n){return e==null?t>=LT[n]?`above`:`below`:`embedded`}function zT(e){return e===`above`?`open`:`collapsed`}var BT=`ok-sidebar-pins-v2`;function VT(e){return e===`open`||e===`collapsed`}function HT(e){return e===`above`||e===`below`||e===`embedded`}function UT(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!HT(e)||!VT(t[e]))return!1;return!0}function WT(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return UT(n.left)&&(r.left=n.left),UT(n.right)&&(r.right=n.right),r}function GT(e){try{let t=(e??localStorage).getItem(BT);return t==null?{}:WT(t)}catch{return{}}}function KT(e,t){try{t.setItem(BT,JSON.stringify(e))}catch{}}function qT(e,t,n){return n[e]?.[t]??zT(t)}function JT(e,t,n,r){let i=r??localStorage,a=GT(i);return a[e]={...a[e],[t]:n},KT(a,i),a}function YT(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`?XT: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 XT(e){return e===`synced`?`synced`:`connected`}function ZT(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function QT(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=cn(),a,o;t[0]!==i||t[1]!==n?(a=ZT(n),o=i({id:`hnq8fP`,values:{label:a}}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=o,c=`composer-context-chip-file-${n}`,l;t[4]===r?l=t[5]:(l=e=>{(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),r())},t[4]=r,t[5]=l);let u;t[6]===n?u=t[7]:(u=(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 inline-flex size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,children:(0,Z.jsx)(ut,{path:n,className:`size-3`})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Js,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=d):d=t[8];let f;t[9]!==r||t[10]!==s||t[11]!==l||t[12]!==u?(f=(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":s,onClick:r,onKeyDown:l,className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[u,d]}),t[9]=r,t[10]=s,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===a?p=t[15]:(p=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),t[14]=a,t[15]=p);let m;return t[16]!==n||t[17]!==c||t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`span`,{"data-testid":c,title:n,className:`group/chip inline-flex max-w-[14rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[f,p]}),t[16]=n,t[17]=c,t[18]=f,t[19]=p,t[20]=m):m=t[20],m}function $T(e){let t=(0,$.c)(11),{files:n,onRemoveFile:r,className:i,children:a}=e;if(n.length===0&&a==null)return null;let o;t[0]===i?o=t[1]:(o=Ti(`flex flex-wrap items-center gap-1`,i),t[0]=i,t[1]=o);let s;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,Z.jsx)(QT,{path:e,onRemove:()=>r(e)},e),t[5]=r,t[6]=e),s=n.map(e),t[2]=n,t[3]=r,t[4]=s}else s=t[4];let c;return t[7]!==a||t[8]!==o||t[9]!==s?(c=(0,Z.jsxs)(`div`,{className:o,"data-testid":`composer-context-chips`,children:[s,a]}),t[7]=a,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function eE(e){let t=(0,$.c)(35),{primary:n,onPrimary:r,primaryDisabled:i,installedTargets:a,selectedTargetId:o,onSelectTarget:s,terminal:c,terminals:l,menuEmptyState:u,onMenuOpenChange:d,menuAlign:f,triggerAriaLabel:p,testIds:m}=e,h=i===void 0?!1:i,g=f===void 0?`end`:f,{_}=cn(),v=a.length>0,y=l&&l.length>0?l:null,b=y!=null||c!=null,x=v||b,S;t[0]===m?S=t[1]:(S=e=>typeof m.terminal==`function`?m.terminal(e):m.terminal,t[0]=m,t[1]=S);let C=S,w;t[2]!==r||t[3]!==n||t[4]!==h||t[5]!==m.primary?(w=(0,Z.jsx)(Di,{type:`button`,variant:`outline`,className:`gap-1.5`,disabled:h,onClick:r,"data-testid":m.primary,children:n}),t[2]=r,t[3]=n,t[4]=h,t[5]=m.primary,t[6]=w):w=t[6];let T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(so,{"aria-hidden":`true`,className:`size-3.5 text-muted-foreground`}),t[7]=T):T=t[7];let E;t[8]!==m.trigger||t[9]!==p?(E=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`outline`,size:`icon`,"aria-label":p,"data-testid":m.trigger,children:T})}),t[8]=m.trigger,t[9]=p,t[10]=E):E=t[10];let D;t[11]!==_||t[12]!==y||t[13]!==x||t[14]!==a||t[15]!==u||t[16]!==s||t[17]!==o||t[18]!==v||t[19]!==b||t[20]!==c||t[21]!==C||t[22]!==m?(D=x?(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsxs)(Yc,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(al,{children:(0,Z.jsx)(X,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Jc,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(Yo,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),o===e.id?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,b?(0,Z.jsxs)(Z.Fragment,{children:[v?(0,Z.jsx)(sl,{}):null,(0,Z.jsxs)(Yc,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(al,{children:(0,Z.jsx)(X,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(Jc,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(Yo,{id:Jo(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(Jc,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(Yo,{id:Jo(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(X,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)($a,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]})]}):null]}):u,t[11]=_,t[12]=y,t[13]=x,t[14]=a,t[15]=u,t[16]=s,t[17]=o,t[18]=v,t[19]=b,t[20]=c,t[21]=C,t[22]=m,t[23]=D):D=t[23];let O;t[24]!==g||t[25]!==D||t[26]!==m.menu?(O=(0,Z.jsx)(Xc,{align:g,className:`min-w-[200px]`,"data-testid":m.menu,children:D}),t[24]=g,t[25]=D,t[26]=m.menu,t[27]=O):O=t[27];let k;t[28]!==d||t[29]!==E||t[30]!==O?(k=(0,Z.jsxs)(nl,{onOpenChange:d,children:[E,O]}),t[28]=d,t[29]=E,t[30]=O,t[31]=k):k=t[31];let A;return t[32]!==w||t[33]!==k?(A=(0,Z.jsxs)(TS,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}var tE=5200,nE=500;function rE(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function iE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(aE),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);n(e.matches);let t=e=>n(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function aE(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function oE(e,t){let n=(0,$.c)(9),[r,i]=(0,Q.useState)(0),[a,o]=(0,Q.useState)(!0),s,c;if(n[0]!==t||n[1]!==a?(s=()=>{if(!t)return;if(a){let e=setTimeout(()=>o(!1),tE);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(sE),o(!0)},nE);return()=>clearTimeout(e)},c=[a,t],n[0]=t,n[1]=a,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,Q.useEffect)(s,c),!t){let t=e[0]??``,r;return n[4]===t?r=n[5]:(r={text:t,visible:!0},n[4]=t,n[5]=r),r}let l=e[e.length>0?r%e.length:0]??``,u;return n[6]!==l||n[7]!==a?(u={text:l,visible:a},n[6]=l,n[7]=a,n[8]=u):u=n[8],u}function sE(e){return e+1}function cE(e){let t=(0,$.c)(149),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=cn(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=iE(),m=Vo(),{states:h}=ts(),{dispatch:g}=ls(),_=ss(),[v]=(0,Q.useState)(vE),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!0),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),[D]=(0,Q.useState)(_E),O,k;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(O=()=>{if(u||n==null)return;let e=document.documentElement,t=hE,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=ce(n),t=E.current;if(!(!e||e.isDestroyed||!t))try{let n=e.view,r=n.coordsAtPos(e.state.selection.head).bottom-(t.getBoundingClientRect().top-28);if(r<=0)return;let i=n.dom.closest(`.editor-doc-scroll`);i instanceof HTMLElement&&(i.scrollTop+=r)}catch{}})},a=E.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+24}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},k=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=O,t[5]=k):(O=t[4],k=t[5]),(0,Q.useEffect)(O,k);let A=(0,Q.useRef)(c),j=(0,Q.useRef)(s),M;t[6]!==c||t[7]!==s?(M=()=>{A.current=c,j.current=s},t[6]=c,t[7]=s,t[8]=M):M=t[8],(0,Q.useEffect)(M);let N,P;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>Yl(()=>{A.current?j.current?.():T.current?.focus()}),P=[],t[9]=N,t[10]=P):(N=t[9],P=t[10]),(0,Q.useEffect)(N,P);let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=[],t[11]=F):F=t[11],(0,Q.useEffect)(pE,F);let I=(0,Q.useRef)(!1),L,R;t[12]===c?(L=t[13],R=t[14]):(L=()=>{if(!I.current){I.current=!0;return}c||T.current?.focus()},R=[c],t[12]=c,t[13]=L,t[14]=R),(0,Q.useEffect)(L,R);let z;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(z=[],t[15]=z):z=t[15];let[B,V]=(0,Q.useState)(z),[H,U]=(0,Q.useState)(fE),W;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(W=[],t[16]=W):W=t[16];let[G,K]=(0,Q.useState)(W),q;t[17]!==n||t[18]!==u?(q=u||n==null?``:Go(n),t[17]=n,t[18]=u,t[19]=q):q=t[19];let J=q,Y,ee;t[20]!==J||t[21]!==H||t[22]!==u||t[23]!==x?(Y=()=>{u||x||V(e=>e.includes(J)||H.has(J)?e:[...e,J])},ee=[u,x,J,H],t[20]=J,t[21]=H,t[22]=u,t[23]=x,t[24]=Y,t[25]=ee):(Y=t[24],ee=t[25]),(0,Q.useEffect)(Y,ee);let te;t[26]!==H||t[27]!==u||t[28]!==i||t[29]!==G||t[30]!==B?(te=u?i&&!H.has(i)&&!G.includes(i)?[i]:[]:B.filter(e=>!H.has(e)&&!G.includes(e)),t[26]=H,t[27]=u,t[28]=i,t[29]=G,t[30]=B,t[31]=te):te=t[31];let ne=te,re=Ya(d,f),ie=Ya(d,`frontmatter`),[ae,oe]=(0,Q.useState)(null),[se,le]=(0,Q.useState)(!1),ue,de;t[32]===re?(ue=t[33],de=t[34]):(ue=()=>{re&&oe(re)},de=[re],t[32]=re,t[33]=ue,t[34]=de),(0,Q.useEffect)(ue,de);let fe,pe;t[35]===ie?(fe=t[36],pe=t[37]):(fe=()=>{ie&&oe(ie)},pe=[ie],t[35]=ie,t[36]=fe,t[37]=pe),(0,Q.useEffect)(fe,pe);let me=y??v,he;t[38]!==me||t[39]!==_?(he=_===null?null:ZS(me),t[38]=me,t[39]=_,t[40]=he):he=t[40];let ge=he,_e=ge!==null,ve;t[41]!==me||t[42]!==_e||t[43]!==h?(ve=_e?null:tC(h,me),t[41]=me,t[42]=_e,t[43]=h,t[44]=ve):ve=t[44];let ye=ve,be=!C&&(!x||ae!==null)&&(_e||ye!==null),xe;t[45]===h?xe=t[46]:(xe=Uo.filter(e=>h[e.id]?.installed===!0),t[45]=h,t[46]=xe);let Se=xe,Ce;t[47]===h?Ce=t[48]:(Ce=Uo.some(e=>h[e.id]?.installed==null),t[47]=h,t[48]=Ce);let we=Ce,Te=_===null?void 0:_i.map(e=>{let{displayName:t}=Gn[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:ge===e,onSelect:()=>Pe(e)}}),Ee;t[49]===l?Ee=t[50]:(Ee=l({id:`KYSocE`}),t[49]=l,t[50]=Ee);let De;t[51]===l?De=t[52]:(De=l({id:`7Ongq0`}),t[51]=l,t[52]=De);let Oe;t[53]===l?Oe=t[54]:(Oe=l({id:`HPTPGr`}),t[53]=l,t[54]=Oe);let ke;t[55]===l?ke=t[56]:(ke=l({id:`qiRoLb`}),t[55]=l,t[56]=ke);let Ae;t[57]!==Ee||t[58]!==De||t[59]!==Oe||t[60]!==ke?(Ae=[Ee,De,Oe,ke],t[57]=Ee,t[58]=De,t[59]=Oe,t[60]=ke,t[61]=Ae):Ae=t[61];let je=oE(Ae,!p&&x&&!c),Me;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{b(e.id),eC(e.id)},t[62]=Me):Me=t[62];let Ne=Me,Pe=e=>{let t=XS(e);b(t),eC(t)},Fe;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=()=>{T.current?.clear(),oe(null),le(!1),V([]),U(new Set),CS()},t[63]=Fe):Fe=t[63];let Ie=Fe,Le;t[64]!==l||t[65]!==g||t[66]!==ye||t[67]!==ge||t[68]!==_?(Le=e=>{if(e===null){qs.error(l({id:`y8B54M`}));return}if(ge!==null&&_!==null){try{_.launchInTerminal(e,ge)}catch{qs.error(l({id:`jBVUXo`}));return}Ie();return}ye!==null&&(w(!0),g(ye.id,e).finally(()=>{w(!1),Ie()}))},t[64]=l,t[65]=g,t[66]=ye,t[67]=ge,t[68]=_,t[69]=Le):Le=t[69];let Re=Le,ze;t[70]!==J||t[71]!==be||t[72]!==Re||t[73]!==n||t[74]!==ne||t[75]!==u||t[76]!==i||t[77]!==ae||t[78]!==m?(ze=()=>{if(!be)return;let{instruction:e,mentions:t}=T.current?.getContent()??{instruction:``,mentions:[]};if(u){Re(Zo({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...ne,...t])].filter(e=>e!==i)}));return}let r=ae?ru(ae):void 0,a=ae?.docName??null,o=ae?a:ne.includes(J)?n??null:null,s=o===null?null:Go(o);Re(Zo({docName:o,workspace:m,instruction:e,mentions:[...new Set([...ne,...t])].filter(e=>e!==s),selection:r}))},t[70]=J,t[71]=be,t[72]=Re,t[73]=n,t[74]=ne,t[75]=u,t[76]=i,t[77]=ae,t[78]=m,t[79]=ze):ze=t[79];let Be=ze;if(c)return null;let Ve=``,He=``;if(ae){let e;t[80]===ae?e=t[81]:(e=iu(ae,Go(ae.docName).split(`/`).pop()??``),t[80]=ae,t[81]=e),Ve=e;let n;t[82]===ae.markdown?n=t[83]:(n=au(ae.markdown),t[82]=ae.markdown,t[83]=n),He=n}let Ue;t[84]!==l||t[85]!==u||t[86]!==o?(Ue=u?null:(0,Z.jsx)(Di,{type:`button`,variant:`outline`,"aria-label":l({id:`EWX92Z`}),onClick:()=>o?.(),"data-testid":`ask-ai-collapse`,className:`-top-2.5 -translate-x-1/2 absolute left-1/2 z-10 h-5 w-10 rounded-md p-0 text-muted-foreground opacity-0 shadow-sm transition-opacity hover:text-foreground focus-visible:opacity-100 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,Z.jsx)(so,{className:`size-3.5`,"aria-hidden":!0})}),t[84]=l,t[85]=u,t[86]=o,t[87]=Ue):Ue=t[87];let We;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(We=e=>U(t=>{let n=new Set(t);return n.add(e),n}),t[88]=We):We=t[88];let Ge;t[89]!==l||t[90]!==Ve||t[91]!==He||t[92]!==ae||t[93]!==se?(Ge=ae?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ve,className:`group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs`,children:[(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{oe(null),le(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(Hd,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-100 transition-opacity duration-150 ease-out group-hover/chip:opacity-0 group-focus-within/chip:opacity-0 motion-reduce:transition-none`,"aria-hidden":!0}),(0,Z.jsx)(Js,{className:`absolute top-1/2 left-1/2 size-3 -translate-x-1/2 -translate-y-1/2 opacity-0 transition-opacity duration-150 ease-out group-hover/chip:opacity-100 group-focus-within/chip:opacity-100 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,"aria-expanded":se,"aria-label":l(se?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>le(dE),"data-testid":`composer-selection-peek`,className:`h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:Ve})})]}),se&&He!==``?(0,Z.jsx)(`p`,{className:`max-h-24 w-full basis-full overflow-y-auto whitespace-pre-wrap text-2xs text-muted-foreground/80 subtle-scrollbar`,"data-testid":`composer-selection-preview`,children:He}):null]}):null,t[89]=l,t[90]=Ve,t[91]=He,t[92]=ae,t[93]=se,t[94]=Ge):Ge=t[94];let Ke;t[95]!==ne||t[96]!==Ge?(Ke=(0,Z.jsx)($T,{files:ne,onRemoveFile:We,children:Ge}),t[95]=ne,t[96]=Ge,t[97]=Ke):Ke=t[97];let qe;t[98]===l?qe=t[99]:(qe=l({id:`xWEvuo`}),t[98]=l,t[99]=qe);let Je;t[100]!==D||t[101]!==Be||t[102]!==qe?(Je=(0,Z.jsx)(WS,{ref:T,ariaLabel:qe,onEmptyChange:S,onContentChange:SS,onMentionsChange:K,onSubmit:Be,initialDoc:D,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[100]=D,t[101]=Be,t[102]=qe,t[103]=Je):Je=t[103];let Ye;t[104]!==x||t[105]!==p||t[106]!==je?(Ye=x?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:Ti(`pointer-events-none absolute inset-0 truncate px-0 py-1 text-base text-muted-foreground/60 md:text-sm`,!p&&`transition-opacity duration-500 ease-in-out`,je.visible?`opacity-100`:`opacity-0`),children:je.text}):null,t[104]=x,t[105]=p,t[106]=je,t[107]=Ye):Ye=t[107];let Xe;t[108]!==Je||t[109]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[Je,Ye]}),t[108]=Je,t[109]=Ye,t[110]=Xe):Xe=t[110];let Ze;t[111]!==ye||t[112]!==ge?(Ze=ge===null?ye?(0,Z.jsx)(Yo,{id:ye.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(Yo,{id:Jo(ge),className:`size-4`,"aria-hidden":!0}),t[111]=ye,t[112]=ge,t[113]=Ze):Ze=t[113];let Qe;t[114]!==ye||t[115]!==ge?(Qe=(0,Z.jsx)(`span`,{children:ge===null?ye?(0,Z.jsx)(X,{id:`nUNZL4`,values:{0:ye.displayName}}):(0,Z.jsx)(X,{id:`F-vBv0`}):(0,Z.jsx)(X,{id:`ti6aF_`,values:{0:Gn[ge].displayName}})}),t[114]=ye,t[115]=ge,t[116]=Qe):Qe=t[116];let $e;t[117]===C?$e=t[118]:($e=C?(0,Z.jsx)(ms,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[117]=C,t[118]=$e);let et;t[119]!==Ze||t[120]!==Qe||t[121]!==$e?(et=(0,Z.jsxs)(Z.Fragment,{children:[Ze,Qe,$e]}),t[119]=Ze,t[120]=Qe,t[121]=$e,t[122]=et):et=t[122];let tt=!be,nt=_e?null:ye?.id??null,rt;t[123]===we?rt=t[124]:(rt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:we?(0,Z.jsx)(X,{id:`EcR0fl`}):(0,Z.jsx)(X,{id:`l6OXqI`})}),t[123]=we,t[124]=rt);let it;t[125]===l?it=t[126]:(it=l({id:`nskygk`}),t[125]=l,t[126]=it);let at;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(at={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:uE,terminal:lE},t[127]=at):at=t[127];let ot;t[128]!==Te||t[129]!==Ne||t[130]!==Se||t[131]!==Be||t[132]!==et||t[133]!==tt||t[134]!==nt||t[135]!==rt||t[136]!==it?(ot=(0,Z.jsx)(eE,{primary:et,onPrimary:Be,primaryDisabled:tt,installedTargets:Se,selectedTargetId:nt,onSelectTarget:Ne,terminals:Te,menuEmptyState:rt,triggerAriaLabel:it,testIds:at}),t[128]=Te,t[129]=Ne,t[130]=Se,t[131]=Be,t[132]=et,t[133]=tt,t[134]=nt,t[135]=rt,t[136]=it,t[137]=ot):ot=t[137];let st;t[138]!==Xe||t[139]!==ot?(st=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[Xe,ot]}),t[138]=Xe,t[139]=ot,t[140]=st):st=t[140];let ct;t[141]!==Ue||t[142]!==Ke||t[143]!==st?(ct=(0,Z.jsxs)(`div`,{ref:E,className:`pointer-events-auto group relative flex flex-col gap-1.5 rounded-2xl border border-border/60 bg-card px-3 py-2 shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[Ue,Ke,st]}),t[141]=Ue,t[142]=Ke,t[143]=st,t[144]=ct):ct=t[144];let lt=ct;if(u){let e;return t[145]===lt?e=t[146]:(e=(0,Z.jsx)(`div`,{className:`shrink-0 pt-2 pb-3`,"data-testid":`bottom-composer`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-4xl px-6`,children:lt})}),t[145]=lt,t[146]=e),e}let ut;return t[147]===lt?ut=t[148]:(ut=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 editor-content-aligned bg-gradient-to-t from-background from-65% via-background to-transparent pt-10 pb-2`,"data-testid":`bottom-composer`,children:lt}),t[147]=lt,t[148]=ut),ut}function lE(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function uE(e){return`ask-ai-agent-option-${e}`}function dE(e){return!e}function fE(){return new Set}function pE(){let e=mE;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function mE(e){xl(e,`open-ask-ai`)&&(rE(e.target)||(e.preventDefault(),eu()))}function hE(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(gE);if(e.length===0)return;let t=!1,n=()=>{t=!0};window.addEventListener(`wheel`,n,{passive:!0}),window.addEventListener(`touchstart`,n,{passive:!0});let r=performance.now(),i=()=>{if(t||performance.now()-r>=300){window.removeEventListener(`wheel`,n),window.removeEventListener(`touchstart`,n);return}for(let t of e)t.scrollTop=t.scrollHeight-t.clientHeight;requestAnimationFrame(i)};requestAnimationFrame(i)}function gE(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function _E(){return xS().doc??void 0}function vE(){return $S()}function yE(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop&&e.activeDocName!==null}function bE(e){return!e.terminalVisible&&!e.isEmbedded&&e.isDesktop}function xE(e,t={}){let n=De(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var SE=200,CE=`Outside any block`;function wE(e){let t=(0,$.c)(5),{editor:n}=e,r=tn(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?TE(n,r):o.current?CE:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},SE),()=>{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 TE(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=xE(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=xE(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 EE(){let[e]=(0,Q.useState)(gr);return e}function DE({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:pi(e.display_name),color:wr(e.id,Zn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:wr(e.id,Zn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function OE(e,t){return e>t}function kE(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.isChangeOrigin===!0?!0:`snapshot`in t&&`prevSnapshot`in t&&t.snapshot===null&&t.prevSnapshot===null}var AE=3,jE=6e4;function ME(e,t){let n=0;for(let r of e)t-r<jE&&(n+=1);return n<AE}var NE=new Map;function PE(e,t){for(let n of e.changed.keys()){let e=n;for(;e!=null;){if(e===t)return!0;let n=e._item;e=n==null?null:n.parent}}return!1}function FE(e){let t=y.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function IE(e){let{fragment:t,docName:n,onWedged:r}=e,i=0,a=0,o=!1,s=!1,c=!1,l=null,u=new WeakSet,d=e=>{let t=y.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){Ot.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-prosemirror-changed`}),console.warn(`[binding-staleness-guard] ySync binding on "${n}" exposes no _prosemirrorChanged — write-back gate disarmed (vendored y-tiptap contract change?)`);return}if(u.has(t))return;u.add(t);let r=t._prosemirrorChanged.bind(t);t._prosemirrorChanged=e=>{OE(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!OE(i,a)||l!==null&&FE(l.state))return;o=!0;let e=Date.now();for(let[t,n]of NE)n.every(t=>e-t>=jE)&&NE.delete(t);let t=(NE.get(n)??[]).filter(t=>e-t<jE);if(!ME(t,e)){NE.set(n,t),Ot.count(`ok/editor/binding-wedge-rate-capped`,{docName:n}),console.warn(`[binding-staleness-guard] wedge on "${n}" rate-capped (externalSeq=${i}, appliedSeq=${a}) — publication gate stays closed, no further recycle`);return}t.push(e),NE.set(n,t),console.warn(`[binding-staleness-guard] wedged binding on "${n}" — Y→PM apply missing (externalSeq=${i}, appliedSeq=${a})`);try{r({externalSeq:i,appliedSeq:a})}catch(e){o=!1,Ot.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==y&&PE(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ui({state:{init:()=>null,apply:e=>(kE(e.getMeta(y))&&(a=i,o&&Ot.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!OE(i,a)||FE(t)?!0:e.getMeta(y)!==void 0,view:e=>{let r=t.doc;return r==null?(Ot.count(`ok/editor/binding-guard-disarmed`,{docName:n,reason:`no-ydoc`}),console.error(`[binding-staleness-guard] fragment has no Y.Doc for "${n}" — staleness guard disarmed`),{}):(s=!0,l=e,d(e.state),r.off(`beforeObserverCalls`,p),r.on(`beforeObserverCalls`,p),{destroy:()=>{s=!1,l=null,r.off(`beforeObserverCalls`,p)}})}})}function LE(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 RE=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&&Bn(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(Ec(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Sc(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(wc(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Cc(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(bc(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Tc(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_c(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(vc(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=ci(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Xr){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 sr){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():LE(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&xc(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()}},zE=e=>new ui({key:typeof e.pluginKey==`string`?new Fr(e.pluginKey):e.pluginKey,view:t=>new RE({view:t,...e})});Si.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[zE({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 BE=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 rr(e,{textSerializers:Tr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ec(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Sc(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(wc(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Cc(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(bc(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Tc(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(_c(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(vc(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=ci(this.view,e.from,e.to);xc({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()}},VE=e=>new ui({key:typeof e.pluginKey==`string`?new Fr(e.pluginKey):e.pluginKey,view:t=>new BE({view:t,...e})});Si.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[VE({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 HE(e,t){return e??new Fr(t)}var UE=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,WE=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),GE=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(`.`)),KE=new Set([`children`,`className`,`style`]),qE=new Set([`tabIndex`]),JE=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),YE={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function XE(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function ZE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function QE(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||JE.has(e)}function $E(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function eD(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:YE[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function tD(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 nD(e){return qE.has(e)}function rD(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function iD(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 aD(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||GE.has(e)?String(t):`${t}px`}function oD(e,t){WE.has(t)||e.style.removeProperty($E(t))}function sD(e,t,n){WE.has(t)||e.style.setProperty($E(t),aD(t,n))}function cD(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(KE.has(r)||!QE(r)||XE(r,t[r])||XE(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=ZE(r);if(a==null||a===!1){nD(r)&&iD(e,r),e.removeAttribute(o);return}if(a===!0){nD(r)&&rD(e,r,!0),e.setAttribute(o,``);return}if(nD(r)){rD(e,r,a);return}e.setAttribute(o,String(a))})}function lD(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function uD(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){oD(e,t);return}sD(e,t,a)}})}function dD(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(!XE(t,n))return;let{eventName:i,options:a}=eD(t),o=t=>{n(tD(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function fD(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);UE(()=>{let i=n.current;return lD(e,i.className,t.className),uD(e,i.style,t.style),cD(e,i,t),r.current=dD(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 pD=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)(HE(e,`bubbleMenu`)).current;fD(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=se(),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=zE({...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,ku.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)(HE(e,`floatingMenu`)).current;fD(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=se(),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=VE({...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,ku.createPortal)(s,u.current)});var mD=[{name:`paragraph`,label:`Text`,icon:bd,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Je,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Qe,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:ht,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Ne,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:Wt,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:dt,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:Ee,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:jd,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function hD(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:gD},t[0]=n,t[1]=r);let{current:i,activeStates:a}=w(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)(so,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Kc,{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=mD.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Jc,{className:r?`bg-accent text-accent-foreground`:``,onSelect:()=>{e.command(n)},children:[(0,Z.jsx)(t,{className:`size-4`}),(0,Z.jsx)(`span`,{children:e.label})]},e.name)}),t[10]=a,t[11]=n,t[12]=d):d=t[12];let f;t[13]===d?f=t[14]:(f=(0,Z.jsx)(Xc,{align:`start`,sideOffset:8,className:`w-44 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto subtle-scrollbar`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==u||t[16]!==f?(p=(0,Z.jsxs)(nl,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function gD(e){let t=Object.fromEntries(mD.map(t=>[t.name,t.isActive(e.editor)]));return{current:mD.find(e=>t[e.name])??mD[0],activeStates:t}}function _D(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function vD(e){let t=(0,$.c)(2),{shortcutEnabled:n}=e,r=n===void 0?!1:n,i=dr(),a=$o();if(!i||a)return null;let o;return t[0]===r?o=t[1]:(o=(0,Z.jsx)(yD,{shortcutEnabled:r}),t[0]=r,t[1]=o),o}function yD(e){let t=(0,$.c)(5),{shortcutEnabled:n}=e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=()=>{let e=e=>{n&&xl(e,`edit-with-ai`)&&(_D(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),eu()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},i=[n],t[0]=n,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(sa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[3]=a):a=t[3];let o;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(Z.Fragment,{children:[a,(0,Z.jsxs)(Di,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,onClick:bD,children:[(0,Z.jsx)(Us,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(X,{id:`xWEvuo`})})]})]}),t[4]=o):o=t[4],o}function bD(){return eu()}function xD(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 SD(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:ft(typeof n.src==`string`?n.src:``)}function CD(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 wD(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=cn(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:TD},t[0]=n,t[1]=i),w(i)===null)return null;let a;t[2]===r?a=t[3]:(a=r({id:`WcWS__`}),t[2]=r,t[3]=a);let o;t[4]===n?o=t[5]:(o=e=>{e.preventDefault();let t=xD(n);t&&CD(t,SD(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Pa,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":a,className:`text-accent-foreground`,onMouseDown:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(pc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`WcWS__`})}),t[10]=l):l=t[10];let u;return t[11]===c?u=t[12]:(u=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(hc,{children:[c,l]})}),t[11]=c,t[12]=u),u}function TD(e){return xD(e.editor)}function ED(e){return xD(e)!==null}function DD(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function OD(e){let{from:t,to:n}=e.state.selection,r=!1;return e.state.doc.nodesBetween(t,n,e=>e.type.name===`footnoteReference`?(r=!0,!1):!0),r}function kD(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function AD(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=cn(),i;t[0]===n?i=t[1]:(i={editor:n,selector:jD},t[0]=n,t[1]=i);let a=w(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!DD(n)||n.state.selection.empty||kD(n)||OD(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=li(Er(n.state.doc)),o=Vr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(o,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=a,t[3]=n,t[4]=o):o=t[4];let s=o,c;t[5]===r?c=t[6]:(c=r({id:`sIGbBZ`}),t[5]=r,t[6]=c);let l;t[7]===s?l=t[8]:(l=e=>{e.preventDefault(),s()},t[7]=s,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Mt,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==c||t[12]!==l?(d=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":c,onMouseDown:l,disabled:a,children:u})}),t[10]=a,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;t[14]===r?f=t[15]:(f=r({id:`sIGbBZ`}),t[14]=r,t[15]=f);let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(pc,{side:`bottom`,sideOffset:8,children:f}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(hc,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function jD(e){let t=e.editor;return!!(!DD(t)||t.state.selection.empty||kD(t)||OD(t))}var MD=`img, .ok-embed, .ok-video`,ND=220,PD=`cubic-bezier(0.23, 1, 0.32, 1)`,FD=`ok-image-align-flip`,ID=.5;function LD(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function RD(){return typeof requestAnimationFrame==`function`}function zD(e){return e?e.querySelector(MD):null}function BD(e,t){if(LD()||!RD()){t();return}let n=zD(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=zD(e);if(!t)return;for(let e of t.getAnimations())e.id===FD&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<ID)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:ND,easing:PD,fill:`none`});i.id=FD})}var VD=[{value:`left`,label:`Align left`,icon:Vd},{value:`center`,label:`Align center`,icon:zd},{value:`right`,label:`Align right`,icon:Bd}];function HD(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Kt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function UD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:WD},t[0]=n,t[1]=r);let i=w(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=VD.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{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(!Kt.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(Xr.create(u.doc,s)),BD(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(pc,{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 WD(e){return HD(e.editor)}function GD(e){return HD(e)!==null}var KD=[{name:`bold`,icon:Du,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:rd,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:Wd,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:Id,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:ie,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:td,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function qD(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:JD},t[0]=n,t[1]=r);let i=w(r),a;t[2]!==i||t[3]!==n?(a=KD.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{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)(pc,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Dt,{"aria-label":Sl(e.shortcutId),children:bl(e.shortcutId)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function JD(e){return Object.fromEntries(KD.map(t=>[t.name,t.isActive(e.editor)]))}function YD(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=cn(),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),{folderPaths:l,loading:u,pages:d}=Oo(),f;t[0]===n?f=t[1]:(f=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=n.getAttributes(`link`).href??``,t[2]=n,t[3]=m);let h=m,g;t[4]===n?g=t[5]:(g=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=g);let _=g,v,y;t[6]===n?(v=t[7],y=t[8]):(v=()=>{let e=function(){n.state.selection.empty&&a(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},y=[n],t[6]=n,t[7]=v,t[8]=y),(0,Q.useEffect)(v,y);let b,x;t[9]===i?(b=t[10],x=t[11]):(b=()=>{i&&requestAnimationFrame(()=>c.current?.focus())},x=[i],t[9]=i,t[10]=b,t[11]=x),(0,Q.useEffect)(b,x);let S;t[12]!==n||t[13]!==p||t[14]!==o?(S=function(){o.trim()?n.chain().focus().setLink({href:o.trim()}).run():p&&n.chain().focus().unsetLink().run(),a(!1)},t[12]=n,t[13]=p,t[14]=o,t[15]=S):S=t[15];let C=S,w;t[16]===n?w=t[17]:(w=function(){n.chain().focus().unsetLink().run(),a(!1)},t[16]=n,t[17]=w);let T=w,E;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){s(Y(e.path,null))},t[18]=E):E=t[18];let D=E,O;t[19]!==C||t[20]!==n?(O=function(e){e.key===`Enter`&&(e.preventDefault(),C()),e.key===`Escape`&&(e.preventDefault(),a(!1),n.chain().focus().run())},t[19]=C,t[20]=n,t[21]=O):O=t[21];let k=O;if(i){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==l||t[27]!==k||t[28]!==u||t[29]!==d||t[30]!==e||t[31]!==n||t[32]!==o?(i=(0,Z.jsx)(ot,{ref:c,type:`text`,placeholder:e,value:o,pages:d,folderPaths:l,loading:u,onValueChange:s,onSuggestionSelect:D,onKeyDown:k,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=l,t[27]=k,t[28]=u,t[29]=d,t[30]=e,t[31]=n,t[32]=o,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let f;t[36]===C?f=t[37]:(f=()=>{C()},t[36]=C,t[37]=f);let m;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(Bu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=m):m=t[38];let g;t[39]!==a||t[40]!==f?(g=(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:f,children:m}),t[39]=a,t[40]=f,t[41]=g):g=t[41];let _;t[42]!==i||t[43]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,g]}),t[42]=i,t[43]=g,t[44]=_):_=t[44];let v;t[45]!==r||t[46]!==h||t[47]!==p||t[48]!==T?(v=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),on(h)},children:(0,Z.jsx)(za,{className:`size-3.5`})})}),(0,Z.jsx)(pc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`2vIPtm`})})]}),(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),T()},children:(0,Z.jsx)(_s,{className:`size-3.5`})})}),(0,Z.jsx)(pc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`484LKL`})})]})]}),t[45]=r,t[46]=h,t[47]=p,t[48]=T,t[49]=v):v=t[49];let y;return t[50]!==_||t[51]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,v]}),t[50]=_,t[51]=v,t[52]=y):y=t[52],y}let A;t[53]===r?A=t[54]:(A=r({id:`p0Iq25`}),t[53]=r,t[54]=A);let j=p?`bg-accent text-primary`:`text-accent-foreground`,M;t[55]===_?M=t[56]:(M=e=>{e.preventDefault(),s(_()),a(!0)},t[55]=_,t[56]=M);let N;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(ad,{className:`size-3.5`}),t[57]=N):N=t[57];let P;t[58]!==A||t[59]!==j||t[60]!==M?(P=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-xs`,"aria-label":A,className:j,onMouseDown:M,children:N})}),t[58]=A,t[59]=j,t[60]=M,t[61]=P):P=t[61];let F;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(X,{id:`yzF66j`}),t[62]=F):F=t[62];let I;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(pc,{side:`bottom`,sideOffset:8,children:[F,(0,Z.jsx)(Dt,{children:bl(`command-palette`)})]}),t[63]=I):I=t[63];let L;return t[64]===P?L=t[65]:(L=(0,Z.jsxs)(hc,{children:[P,I]}),t[64]=P,t[65]=L),L}function XD({editor:e}){if($e(e.state).query||e.isActive(`codeBlock`))return!1;if(GD(e)||ED(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 ZD(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:nO},t[0]=n,t[1]=l);let u=w(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:tO},t[2]=n,t[3]=d);let f=w(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return ci(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=gc(e,t,()=>{xc(e,t,{placement:`top`,strategy:`fixed`,middleware:[wc(8),Ec(),Sc({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(eO)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s($D)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(UD,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(wD,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(hD,{editor:n}),(0,Z.jsx)(sa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(qD,{editor:n},o),(0,Z.jsx)(sa,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(YD,{editor:n},`${o}-link`),(0,Z.jsx)(AD,{editor:n},`${o}-footnote`),(0,Z.jsx)(vD,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(pD,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:QD,shouldShow:XD,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function QD(){return document.body}function $D(e){return e+1}function eO(){}function tO(e){return ED(e.editor)}function nO(e){return GD(e.editor)}var rO=56,iO=`0 2px 4px rgba(0, 0, 0, 0.08)`,aO=150,oO=globalThis.ScrollTimeline;function sO(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+rO);return{startOffset:o,endOffset:o+a,maxShift:a}}var cO=new WeakMap;function lO(e){let t=cO.get(e);if(t){for(let e of t.animations)e.cancel();cO.delete(e)}}function uO(e){for(let t of Array.from(e.cells))lO(t)}var dO=e=>e.cellIndex===0?`3`:`2`;function fO(e,t){return pO(e,t,e=>({transform:`translateY(${e}px)`}))}function pO(e,t,n){if(!(t>0))return[{offset:0,...n(0)},{offset:1,...n(0)}];let r=t=>Math.max(0,Math.min(t-e.startOffset,e.maxShift));return Array.from(new Set([0,e.startOffset/t,e.endOffset/t,1].map(e=>Math.max(0,Math.min(e,1))))).sort((e,t)=>e-t).map(e=>({offset:e,...n(r(e*t))}))}function mO(e,t,n,r){if(!(t>0))return[{...n,offset:0},{...n,offset:1}];let i=e.startOffset/t;if(i<=0)return[{...r,offset:0},{...r,offset:1}];if(i>=1)return[{...n,offset:0},{...n,offset:1}];let a=Math.min(i+1/t,1);return[{...n,offset:0},{...n,offset:i},{...r,offset:a},{...r,offset:1}]}function hO(e,t,n){return mO(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:iO})}function gO(e,t){return mO(e,t,{opacity:`0`},{opacity:`1`})}function _O(e,t,n,r){let i=dO(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=cO.get(e);if(o?.key===a)return;if(o)for(let e of o.animations)e.cancel();let s={timeline:t,fill:`both`,easing:`linear`},c=e.animate(fO(n,r),s),l=e.animate(hO(n,r,i),s),u=e.animate(gO(n,r),{...s,pseudoElement:`::before`});cO.set(e,{key:a,animations:[c,l,u]})}function vO(e,t){let n=dO(e),r=`in|${t}|${n}`,i=cO.get(e);if(i?.key===r)return;if(i)for(let e of i.animations)e.cancel();let a=e.animate([{transform:`translateY(${t}px)`,zIndex:n,boxShadow:iO}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});cO.set(e,{key:r,animations:[a,o]})}function yO(e,t,n,r){let i=e.getBoundingClientRect().top,a=e.scrollTop,o=e.scrollHeight-e.clientHeight,s=t.querySelectorAll(`.tableWrapper`);for(let e of s){r?.(e);let t=e.querySelector(`table`);if(!t)continue;let s=t.querySelector(`tbody`)?.rows[0];if(!s||!Array.from(s.cells).some(e=>e.tagName===`TH`))continue;let c=t.getBoundingClientRect(),l=s.getBoundingClientRect(),u=sO(a,i,c.top,c.height,l.height);if(!u){uO(s);continue}if(n){if(o<=0){uO(s);continue}for(let e of Array.from(s.cells))_O(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+rO){uO(s);continue}for(let e of Array.from(s.cells))vO(e,d)}}var bO=Si.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ui({key:new Fr(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||yO(t,e.dom,n,u)},l=()=>{r??=requestAnimationFrame(()=>{r=null,c()})};function u(e){s.has(e)||(s.add(e),e.addEventListener(`contentvisibilityautostatechange`,l))}let d=()=>{if(n){i??l(),i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,c()},aO);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&oO)try{n=new oO({source:t,axis:`block`})}catch{n=null}t?.addEventListener(`scroll`,d,{passive:!0}),t&&typeof ResizeObserver<`u`&&(a=new ResizeObserver(l),a.observe(t),a.observe(e.dom)),c()}}),{update(e,t){t.doc.eq(e.state.doc)||c()},destroy(){o=!0,t?.removeEventListener(`scroll`,d),a?.disconnect(),r!=null&&cancelAnimationFrame(r),i!=null&&clearTimeout(i);for(let e of s)e.removeEventListener(`contentvisibilityautostatechange`,l);s.clear();for(let t of e.dom.querySelectorAll(`.tableWrapper > table > tbody > tr:first-child`))uO(t)}}}})]}}),xO=`application/x-open-knowledge-sidebar-item+json`,SO={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function CO(e){return JSON.stringify(e)}function wO(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Ao(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:fo(e.assetPath)}:{target:Po(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:vo(e.docName)}}function TO(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(xO);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!EO(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!DO(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function EO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function DO(e){return typeof e==`string`&&Object.hasOwn(SO,e)}function OO(e,t){return(n,r)=>{let i=r,a=TO(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function kO(e,t){let n=wO(e);t(n.target,{tabBehavior:`append`}),go(n.hash)}function AO(e){return[...e?[{label:`Toggle header column`,icon:Ru,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:Mi,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:La,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:_s,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Qu,run:e=>e.chain().focus().deleteTable().run()}]}function jO(e){return[...e?[{label:`Toggle header row`,icon:Ld,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:R,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:B,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:_s,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Qu,run:e=>e.chain().focus().deleteTable().run()}]}function MO(e){if(!e.isEditable||$e(e.state).query)return null;let{state:t,view:n}=e,r=t.selection.$from,i=-1;for(let e=r.depth;e>0;e--){let t=r.node(e).type.spec.tableRole;if(t===`cell`||t===`header_cell`){i=r.before(e);break}}if(i<0)return null;let a=n.nodeDOM(i);if(!(a instanceof HTMLTableCellElement))return null;let o=a.closest(`table`),s=a.closest(`tr`),c=a.closest(`.ProseMirror`);if(!o||!s||!c)return null;let l=Array.prototype.indexOf.call(o.rows,s),u=a.cellIndex,d=o.rows[0]?.cells[u],f=o.rows[l]?.cells[0];return!d||!f?null:{columnAnchor:d,rowAnchor:f,isFirstColumn:u===0,isFirstRow:l===0}}function NO(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return gc(r,e,()=>{xc(r,e,{strategy:`absolute`,placement:t,middleware:[wc(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(PO)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?Hu:oa,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(sl,{}),(0,Z.jsxs)(Jc,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(Xc,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(nl,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function PO(){}function FO(e){let t=(0,$.c)(18),{editor:n}=e,[r,i]=(0,Q.useState)(null),a,o;if(t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=()=>i(e=>{let t=MO(n);return e&&t&&e.columnAnchor===t.columnAnchor&&e.rowAnchor===t.rowAnchor?e:t});return e(),n.on(`selectionUpdate`,e),n.on(`update`,e),()=>{n.off(`selectionUpdate`,e),n.off(`update`,e)}},o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),!r)return null;let s=r.columnAnchor,c;t[3]===r.isFirstColumn?c=t[4]:(c=AO(r.isFirstColumn),t[3]=r.isFirstColumn,t[4]=c);let l;t[5]!==r.columnAnchor||t[6]!==n||t[7]!==c?(l=(0,Z.jsx)(NO,{editor:n,anchor:s,axis:`column`,items:c}),t[5]=r.columnAnchor,t[6]=n,t[7]=c,t[8]=l):l=t[8];let u=r.rowAnchor,d;t[9]===r.isFirstRow?d=t[10]:(d=jO(r.isFirstRow),t[9]=r.isFirstRow,t[10]=d);let f;t[11]!==r.rowAnchor||t[12]!==n||t[13]!==d?(f=(0,Z.jsx)(NO,{editor:n,anchor:u,axis:`row`,items:d}),t[11]=r.rowAnchor,t[12]=n,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{className:`ok-table-cell-handle-layer`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function IO(e){let{fragment:t,docName:n}=e,r=!1,i=!1,a=!1,o=()=>{r=!0},s=e=>{console.warn(`[walk-currency] ${e} at view init — stale pre-warm cannot be invalidated: a remote edit that landed in the construct→mount gap will not render, and the first local transaction may silently erase it from the CRDT for every peer and disk (vendored y-tiptap contract change? re-verify y-tiptap.cjs:263-268)`)},c=()=>{i&&(i=!1,t.unobserveDeep(o))},l=e=>{let t=y.getState(e.state)?.binding;if(!t){Ot.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){Ot.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}Ot.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return Si.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ui({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var LO=new WeakMap;function RO(e){let t=document.createElement(`span`);t.classList.add(`collaboration-cursor__caret`),t.style.borderColor=e.color;let n=document.createElement(`div`);return n.classList.add(`collaboration-cursor__label`),n.style.backgroundColor=e.color,n.style.color=di(e.color),n.textContent=e.name,t.append(n),t}var zO={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},BO=100,VO=100,HO=3,UO=250;function WO(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function GO(e,t){let n=fe(e);if(!n||t.contains(n.dom))return!1;if(!WO(e))return console.warn(`[TiptapEditor] TipTap EditorContent binding fields missing; detached editor repair skipped`),!1;let r=e;if(r.contentComponent==null)return!1;try{n.setProps({nodeViews:{}})}catch{}return r.contentComponent=null,r.isEditorContentInitialized=!1,!0}function KO(){let e=new ir({extensions:mi});return{mdManager:e,text:Vt({mdManager:e}),html:Ve({mdManager:e}),paste:rt({mdManager:e}),drop:Nt({mdManager:e})}}function qO(e,t){return t?{collaboration:it.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[IO({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:it.configure({document:e.document}),guard:[]}}function JO(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=qO(t,r);return[...Ct.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),ES.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,Si.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[Ge]}}),Si.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[re(e,{cursorBuilder:RO})]}}),Si.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[IE({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,bO]}function YO(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{LO.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=LO.get(e);if(LO.delete(e),r==null)return;let i=performance.now();Ot(`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:OO(n.drop,e.onSidebarDrop)},extensions:Oh(JO(e))}}function XO(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=YO({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:c,onWedged:a,onSidebarDrop:o}),u=l.onBeforeCreate;return{...l,onBeforeCreate:e=>{u?.(e);let{editor:t}=e,{doc:n,mapping:r}=Xt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var ZO=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(zO),c=EE(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=_t(),p=n.configuration.name??``,[m]=(0,Q.useState)(KO),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new mr(XO({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;Ot(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{kO(e,f)}})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=m,t[1]=p,t[2]=f,t[3]=r,t[4]=n,t[5]=d,t[6]=h):h=t[6];let[g]=(0,Q.useState)(h),_,v;if(t[7]!==g||t[8]!==p||t[9]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=de(p)??crypto.randomUUID();_=Q.use,v=ee({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{z(y)},S=[y],t[12]=y,t[13]=x,t[14]=S),(0,Q.useEffect)(x,S);let C;return t[15]!==u||t[16]!==p||t[17]!==b||t[18]!==c||t[19]!==i||t[20]!==a||t[21]!==l||t[22]!==n?(C=(0,Z.jsx)(QO,{provider:n,isSourceMode:i,docName:p,activeDocName:u,identity:c,principal:l,editor:b,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[15]=u,t[16]=p,t[17]=b,t[18]=c,t[19]=i,t[20]=a,t[21]=l,t[22]=n,t[23]=C):C=t[23],C},QO=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,y;t[3]!==c||t[4]!==f?(v=()=>{GO(c,f)&&h($O)},y=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=y):(v=t[5],y=t[6]),(0,Q.useEffect)(v,y);let b;t[7]!==c||t[8]!==n.configuration.name?(b=()=>(gt(c,n.configuration.name??null),()=>{gt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=b):b=t[9];let x;t[10]!==c||t[11]!==n?(x=[c,n],t[10]=c,t[11]=n,t[12]=x):x=t[12],(0,Q.useEffect)(b,x);let S;t[13]!==c||t[14]!==n.configuration.name?(S=()=>{let e=n.configuration.name;if(e)return me(e,c),()=>F(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=S):S=t[15];let C;t[16]!==c||t[17]!==n?(C=[c,n],t[16]=c,t[17]=n,t[18]=C):C=t[18],(0,Q.useEffect)(S,C);let w;t[19]!==c||t[20]!==n.configuration.name?(w=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,ql(e,`wysiwyg`,Xl(c)),ou(e,`wysiwyg`,su(c,e))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),ql(e,`wysiwyg`,null),ou(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=w):w=t[21];let T;t[22]!==c||t[23]!==n?(T=[c,n],t[22]=c,t[23]=n,t[24]=T):T=t[24],(0,Q.useEffect)(w,T);let E;t[25]!==c||t[26]!==n.configuration.name?(E=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=E):E=t[27];let D;t[28]!==c||t[29]!==n?(D=[c,n],t[28]=c,t[29]=n,t[30]=D):D=t[30],(0,Q.useEffect)(E,D);let O,k;t[31]===c?(O=t[32],k=t[33]):(O=()=>{let e=ek,t=null,n=()=>{if(t||c.isDestroyed)return;let n=fe(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 fe(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},k=[c],t[31]=c,t[32]=O,t[33]=k),(0,Q.useEffect)(O,k);let A,j;t[34]!==i||t[35]!==c?(A=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!fe(c))return;e=!0;let t=V(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})),Ot(`ok/editor/selection-restore-failed`,{docName:i,message:n})}ct(i)};if(fe(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},j=[c,i],t[34]=i,t[35]=c,t[36]=A,t[37]=j):(A=t[36],j=t[37]),(0,Q.useEffect)(A,j);let M,N;t[38]!==u||t[39]!==n.document||t[40]!==l?(M=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{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)},Vn)};c(zO);let f=()=>{if(zr(e),!gi(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`?gi(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)}},N=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=M,t[42]=N):(M=t[41],N=t[42]),(0,Q.useEffect)(M,N);let P,I;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(P=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<BO){e+=1,t=window.setTimeout(p,VO);return}r=null,o=null,e=0},u=function(e){let t=fe(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=HO,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,UO)))};t=window.setTimeout(o,UO)};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=bo(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),p()},h=function(){if(i===a){if(r){p();return}m()}};return m(),n.on(`synced`,h),c.on(`transaction`,h),window.addEventListener(`hashchange`,m),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,h),c.off(`transaction`,h),window.removeEventListener(`hashchange`,m)}},I=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=P,t[48]=I):(P=t[47],I=t[48]),(0,Q.useEffect)(P,I);let L,R;t[49]===c?(L=t[50],R=t[51]):(L=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=fe(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(Gl,e),()=>window.removeEventListener(Gl,e)},R=[c],t[49]=c,t[50]=L,t[51]=R),(0,Q.useEffect)(L,R);let z;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(z=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:DE({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[52]=a,t[53]=i,t[54]=o,t[55]=r,t[56]=s,t[57]=n.awareness,t[58]=z):z=t[58];let B;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(B=[n,i,a,o,s,r],t[59]=a,t[60]=i,t[61]=o,t[62]=r,t[63]=s,t[64]=n,t[65]=B):B=t[65],(0,Q.useEffect)(z,B);let H,U;t[66]!==c||t[67]!==r?(H=()=>(Qt(c,r),()=>{Qt(c,!1)}),U=[c,r],t[66]=c,t[67]=r,t[68]=H,t[69]=U):(H=t[68],U=t[69]),(0,Q.useEffect)(H,U);let W;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(W=!r&&(0,Z.jsx)(ZD,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=W):W=t[74];let G;t[75]!==c||t[76]!==r?(G=!r&&(0,Z.jsx)(FO,{editor:c}),t[75]=c,t[76]=r,t[77]=G):G=t[77];let K;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=K):K=t[78];let q;t[79]!==c||t[80]!==m?(q=(0,Z.jsx)(d,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=q):q=t[81];let J;t[82]!==f||t[83]!==q?(J=(0,ku.createPortal)(q,f),t[82]=f,t[83]=q,t[84]=J):J=t[84];let Y;t[85]===c?Y=t[86]:(Y=(0,Z.jsx)(wE,{editor:c}),t[85]=c,t[86]=Y);let ee;t[87]===c?ee=t[88]:(ee=Gt(c),t[87]=c,t[88]=ee);let te;t[89]===ee.store?te=t[90]:(te=(0,Z.jsx)(Re,{store:ee.store}),t[89]=ee.store,t[90]=te);let ne;return t[91]!==W||t[92]!==G||t[93]!==J||t[94]!==Y||t[95]!==te||t[96]!==l?(ne=(0,Z.jsxs)(`div`,{ref:l,className:`tiptap-editor h-full`,"data-agent-flash-state":`idle`,"data-agent-flash-count":`0`,"data-agent-flash-position":`append`,"data-agent-flash-agent-id":``,children:[W,G,K,J,Y,te]}),t[91]=W,t[92]=G,t[93]=J,t[94]=Y,t[95]=te,t[96]=l,t[97]=ne):ne=t[97],ne};function $O(e){return e+1}function ek(){return C()}var tk=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 nk(e,t,n,r,i,a){if(e==r)return[];let o=fk(e,t,n,r,i,a),s=pk(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 tk(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new tk(t,t+o,i,i),new tk(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 tk(t,t,i,i+o),new tk(n,n,i+o+c,a)]}if(c==1||l==1)return[new tk(t,n,i,a)];let u=hk(e,t,n,r,i,a);if(u){let[o,s,c]=u;return nk(e,t,o,r,i,s).concat(nk(e,o+c,n,r,s+c,a))}return ok(e,t,n,r,i,a)}var rk=1e9,ik=0,ak=!1;function ok(e,t,n,r,i,a){let o=n-t,s=a-i;if(rk<1e9&&Math.min(o,s)>rk*16||ik>0&&Date.now()>ik)return Math.min(o,s)>rk*64?[new tk(t,n,i,a)]:gk(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);ck.reset(c),lk.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:lk,f=d?null:ck;for(let p=0;p<c;p++){if(p>rk||ik>0&&!(p&63)&&Date.now()>ik)return gk(e,t,n,r,i,a);let m=ck.advance(p,o,s,c,d,!1,l)||lk.advance(p,o,s,c,f,!0,u);if(m)return uk(e,t,n,t+m[0],r,i,a,i+m[1])}return[new tk(t,n,i,a)]}var sk=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}},ck=new sk,lk=new sk;function uk(e,t,n,r,i,a,o,s){let c=!1;return!jk(e,r)&&++r==n&&(c=!0),!jk(i,s)&&++s==o&&(c=!0),c?[new tk(t,n,a,o)]:nk(e,t,r,i,a,s).concat(nk(e,r,n,i,s,o))}function dk(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function fk(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=dk(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-+!jk(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function pk(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=dk(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-+!jk(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function mk(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;;){jk(e,s)||s++;let u=s+o;if(jk(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=fk(e,u,n,r,i+f+d.length,a),c=pk(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 hk(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=hk(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:mk(e,t,n,r,i,a,Math.floor(o/4),-1)}function gk(e,t,n,r,i,a){ak=!0;let o=n-t,s=a-i,c;if(o<s){let s=mk(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=mk(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new tk(t,n,i,a)];let[l,u,d]=c;return nk(e,t,l,r,i,u).concat(nk(e,l+d,n,r,u+d,a))}function _k(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 tk(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function vk(e,t,n){for(;;){_k(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=fk(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new tk(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=pk(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new tk(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 tk(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 tk(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function yk(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=Ek(t,a.fromA,l),f=Tk(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 tk(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Tk(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new tk(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Ek(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new tk(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Ok(n,a.fromB,a.toB),r,o=t<0?-1:Dk(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Ok(t,a.fromA,a.toA),r,o=n<0?-1:Dk(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return _k(e,3),e}var bk;try{bk=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function xk(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Sk(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!xk(n):bk?!kk(n)||t==e.length-1?+!!bk.test(String.fromCharCode(n)):bk.test(e.slice(t,t+2))?2:0:0}function Ck(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!xk(n):bk?!Ak(n)||t==1?+!!bk.test(String.fromCharCode(n)):bk.test(e.slice(t-2,t))?2:0:0}var wk=8;function Tk(e,t,n){if(t==e.length||!Ck(e,t))return t;for(let r=t,i=t+n,a=0;a<wk;a++){let t=Sk(e,r);if(!t||r+t>i)return r;r+=t}return t}function Ek(e,t,n){if(!t||!Sk(e,t))return t;for(let r=t,i=t-n,a=0;a<wk;a++){let t=Ck(e,r);if(!t||r-t<i)return r;r-=t}return t}function Dk(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Ok(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var kk=e=>e>=55296&&e<=56319,Ak=e=>e>=56320&&e<=57343;function jk(e,t){return!t||t==e.length||!kk(e.charCodeAt(t-1))||!Ak(e.charCodeAt(t))}function Mk(e,t,n){let r=n?.override;return r?r(e,t):(rk=(n?.scanLimit??1e9)>>1,ik=n?.timeout?Date.now()+n.timeout:0,ak=!1,vk(e,t,nk(e,0,e.length,t,0,t.length)))}function Nk(){return!ak}function Pk(e,t,n){return yk(Mk(e,t,n),e,t)}var Fk=Ml.define({combine:e=>e[0]}),Ik=Nl.define(),Lk=Ml.define(),Rk=Dl.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Ik)&&(e=n.value);for(let n of t.state.facet(Lk))e=n(e,t);return e}});function zk(e){let t=e.field(Rk,!1);if(!t)return null;let n=e.facet(Fk);return{chunks:t,side:n?n.side:null}}var Bk=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Uk(Pk(e.toString(),t.toString(),n),e,t,0,0,Nk())}static updateA(e,t,n,r,i){return qk(Kk(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return qk(Kk(e,r,!1,t.length),e,t,n,i)}};function Vk(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 Hk(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 Uk(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Vk(c.fromA+r,c.fromB+i,t,n),[d,f]=Hk(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]=Vk(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]=Hk(a.toA+r,a.toB+i,t,n),s++}o.push(new Bk(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Wk=1e3;function Gk(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 Kk(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>Wk&&([l,d]=Gk(e,a-Wk,n,!0)),o<t.length-Wk&&([u,f]=Gk(e,o+Wk,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function qk(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=Pk(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Uk(h,n,r,d,f,Nk()))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 Jk={scanLimit:500},Yk=Pl.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=aA(e))}update(e){(e.docChanged||e.viewportChanged||Zk(e.startState,e.state)||Qk(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=aA(e.view))}},{decorations:e=>e.deco}),Xk=wl.low(Rl({class:`cm-changeGutter`,markers:e=>e.plugin(Yk)?.gutter||Bl.empty}));function Zk(e,t){return e.field(Rk,!1)!=t.field(Rk,!1)}function Qk(e,t){return e.facet(Fk)!=t.facet(Fk)}var $k=Al.line({class:`cm-changedLine`}),eA=Al.mark({class:`cm-changedText`}),tA=Al.mark({tagName:`ins`,class:`cm-insertedLine`}),nA=Al.mark({tagName:`del`,class:`cm-deletedLine`}),rA=new class extends Ll{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function iA(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,$k),i.add(o,s,n?nA:tA),a&&a.add(o,o,rA);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,$k),a&&a.add(u,u,rA);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,eA),s<t)c++;else break}u=t}}}function aA(e){let t=e.state.field(Rk),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Fk),o=n==`a`,s=new jl,c=i?new jl: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))&&iA(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var oA=class extends Cl{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}},sA=Nl.define({map:(e,t)=>e.map(t)}),cA=Dl.define({create:()=>Al.none,update:(e,t)=>{for(let e of t.effects)if(e.is(sA))return e.value;return e.map(t.changes)},provide:e=>Il.decorations.from(e)}),lA=.01;function uA(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 dA(e,t,n){let r=new jl,i=new jl,a=e.state.field(cA).iter(),o=t.state.field(cA).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<-lA?(l-=n,r.add(s,s,Al.widget({widget:new oA(-n),block:!0,side:-1}))):n>lA&&(u+=n,i.add(c,c,Al.widget({widget:new oA(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<lA?r.add(e.state.doc.length,e.state.doc.length,Al.widget({widget:new oA(-p),block:!0,side:1})):p>lA&&i.add(t.state.doc.length,t.state.doc.length,Al.widget({widget:new oA(p),block:!0,side:1}));let m=r.finish(),h=i.finish();uA(m,e.state.field(cA))||e.dispatch({effects:sA.of(m)}),uA(h,t.state.field(cA))||t.dispatch({effects:sA.of(h)})}var fA=Nl.define({map:(e,t)=>t.mapPos(e)}),pA=class extends Cl{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:fA.of(n)});let{side:r,sibling:i}=e.state.facet(Fk);i&&i().dispatch({effects:fA.of(mA(n,e.state.field(Rk),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function mA(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 hA=Dl.define({create(e){return Al.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(fA)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>Il.decorations.from(e)});function gA({margin:e=3,minSize:t=4}){return hA.init(n=>_A(n,e,t))}function _A(e,t,n){let r=new jl,i=e.facet(Fk).side==`a`,a=e.field(Rk),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,Al.replace({widget:new pA(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var vA=Il.styleModule.of(new zl({".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`}})),yA=Il.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`}}),bA=new Fl,xA=new Fl,SA=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Jk;let t=[wl.low(Yk),yA,vA,cA,Il.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(sA)))&&this.measure()})],n=[Fk.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Xk);let r=El.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Il.editorAttributes.of({class:`cm-merge-a`}),xA.of(n),t]}),i=[Fk.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Xk);let a=El.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Il.editorAttributes.of({class:`cm-merge-b`}),xA.of(i),t]});this.chunks=Bk.build(r.doc,a.doc,this.diffConf);let o=[Rk.init(()=>this.chunks),bA.of(e.collapseUnchanged?gA(e.collapseUnchanged):[])];r=r.update({effects:Nl.appendConfig.of(o)}).state,a=a.update({effects:Nl.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 Il({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Il({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),Tl.empty(e[0].startState.doc.length));this.chunks=t==this.a?Bk.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Bk.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Ik.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Ik.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(Fk),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(xA.reconfigure([Fk.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Xk:[]])),a.push(xA.reconfigure([Fk.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Xk:[]]))}if(r){let t=bA.reconfigure(e.collapseUnchanged?gA(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(){dA(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=CA(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=CA(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 CA(e){let t=e.nextSibling;return e.remove(),t}var wA=new class extends Ll{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},TA=wl.low(Rl({class:`cm-changeGutter`,markers:e=>e.plugin(Yk)?.gutter||Bl.empty,widgetMarker:(e,t)=>t instanceof AA?wA:null}));function EA(e){let t=typeof e.original==`string`?kl.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Jk;return[wl.low(Yk),FA,yA,Il.editorAttributes.of({class:`cm-merge-b`}),Lk.of((e,t)=>{let r=t.effects.find(e=>e.is(DA));return r&&(e=Bk.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Bk.updateB(e,t.state.field(OA),t.newDoc,t.changes,n)),e}),Fk.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?VA:void 0,side:`b`}),OA.init(()=>t),e.gutter===!1?[]:TA,e.collapseUnchanged?gA(e.collapseUnchanged):[],Rk.init(e=>Bk.build(t,e.doc,n))]}var DA=Nl.define(),OA=Dl.define({create:()=>kl.empty,update(e,t){for(let n of t.effects)n.is(DA)&&(e=n.value.doc);return e}}),kA=new WeakMap,AA=class extends Cl{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 jA(e,t,n){let r=kA.get(t.changes);if(r)return r;let i=Al.widget({block:!0,side:-1,widget:new AA(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Fk),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(),MA(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),NA(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(OA).sliceString(t.fromA,t.endA),u=a&&e.facet(Vl),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;Ol(t,{style:t=>Hl(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 kA.set(t.changes,i),i}function MA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Rk).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(OA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Tl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:DA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function NA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Rk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(OA).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 PA(e){let t=new jl;for(let n of e.field(Rk)){let r=e.facet(Fk).overrideChunk&&LA(e,n);t.add(n.fromB,n.fromB,jA(e,n,!!r))}return t.finish()}var FA=Dl.define({create:e=>PA(e),update(e,t){return t.state.field(Rk,!1)==t.startState.field(Rk,!1)?e:PA(t.state)},provide:e=>Il.decorations.from(e)}),IA=new WeakMap;function LA(e,t){let n=IA.get(t);if(n!==void 0)return n;n=null;let r=e.field(OA),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(Al.widget({widget:new RA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(eA.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return IA.set(t,n),n}var RA=class extends Cl{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}},zA=new class extends Ll{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},BA=Al.line({class:`cm-inlineChangedLine`});function VA(e,t,n,r){let i=LA(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,zA),n.add(o.from,o.from,BA);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var HA=oe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),UA=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),WA=Il.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function GA({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function KA(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=cn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=xr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?HA:UA,u=[Il.editable.of(!1),El.readOnly.of(!0)],g=[tu,Ul(),...u,l,Il.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Il({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=GA({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Il({doc:d,extensions:[tu,Ul(),Il.editable.of(!1),l,WA,Il.lineWrapping,EA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Il.updateListener.of(e=>{let t=zk(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=zk(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new SA({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Il({doc:d,extensions:[...g,EA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},T=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof Il)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof Il)||K(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):rc._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,ku.createPortal)((0,Z.jsx)(Di,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Di,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(X,{id:`XyOUTJ`})}),(0,Z.jsx)(Di,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(Di,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(X,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function qA(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 JA(e,t){return qA(e,`content`,t)}async function YA(e){return qA(e,`mine`)}async function XA(e){return qA(e,`theirs`)}async function ZA(e){return qA(e,`delete`)}async function QA(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function $A(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=cn(),{conflicts:i,loading:a}=qi(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>po(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),QA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await JA(c,e);t.ok||qs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),qs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(KA,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(ZA),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Di,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===C?u=t[36]:(u=()=>void C(XA),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Di,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let h;t[44]!==i||t[45]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(KA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(YA),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(Di,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(ZA),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(Di,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(KA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function ej(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Ht(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 tj=`__back-nav__`;function nj(e){return e instanceof je||e instanceof yt||e instanceof we||e instanceof et||e instanceof Pt||e instanceof S?e.docName:null}function rj(e){if(e instanceof je){let t=e.docName;return{title:rc._({id:`Jejur6`}),summary:rc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:rc._({id:`V7QxyT`}),summary:rc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof we){let t=e.docName;return{title:rc._({id:`1di5fu`}),summary:rc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:rc._({id:`wvbc1r`}),summary:rc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Pt)return{title:rc._({id:`Gfr4fu`}),summary:rc._({id:`UW2Fg3`})};if(e instanceof S){let t=e.docName;return{title:rc._({id:`vv7kpg`}),summary:rc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:rc._({id:`W5A0Ly`});return{title:rc._({id:`29VNqC`}),summary:t}}function ij(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=rj(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(PC,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(X,{id:`KDw4GX`}),t[12]=v):v=t[12];let y;t[13]===r?y=t[14]:(y=(0,Z.jsx)(Di,{ref:d,variant:`default`,onClick:r,children:v}),t[13]=r,t[14]=y);let b;t[15]!==i||t[16]!==u||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(b=u?(0,Z.jsx)(Di,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(nj(n)??i),o(a),r(tj))},children:(0,Z.jsx)(X,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=u,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==_?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[m,_,x]}),t[25]=x,t[26]=_,t[27]=S):S=t[27],S}function aj(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)(ij,{...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]===tj){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}: ${rj(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(g,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function oj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ni(t);return{map:n,keys:Br(t),parseError:r}}function sj(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>oj(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=$n(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=pt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(cj,{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)(lj,{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 cj(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 lj(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var uj=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-DdW5vRno.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([71,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,66,67,21,72,8,73,74,45,24]),import.meta.url)).ManagedArtifactProperties})),dj=j(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function fj(e){let t=e.threshold??dj;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function pj(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var mj=j(`ACTIVITY_MOUNT_LIMIT`,3);function hj(){return n(()=>import(`./SourceEditor-YSb-9WEb.js`),__vite__mapDeps([75,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,76,34,74,70]),import.meta.url)}var gj=(0,Q.lazy)(async()=>({default:(await hj()).SourceEditor}));function _j(e,t,n){if(n<=0)return[];let r=e.filter(e=>!He(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 vj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:rc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?rc._({id:`Sc1bKE`,values:{docName:e}}):rc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:rc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:rc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?rc._({id:`bmC18N`,values:{docName:e}}):rc._({id:`pAgkuZ`,values:{docName:e}})}:null}function yj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(P,{name:`activity-pool`,children:(0,Z.jsx)(bj,{...e})}),t[0]=e,t[1]=n),n}function bj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=_t(),{pages:u,loading:d}=Oo(),p=_j(c,n,mj),m=(0,Q.useRef)(``),h=p.map(xj).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(m.current===h)return;let e=m.current?m.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)f(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;O(e,t&&t.length>0?t:crypto.randomUUID())}Ot(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),m.current=h,G(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Dj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Sr(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=p.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function xj(e){return e.docName}function Sj(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&&Ot(`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&&(Ot(`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&&Ot(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Cj(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)(sS,{}),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)(gj,{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 wj(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)(zo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ms,{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:Tj,children:[(0,Z.jsx)(zo,{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 Tj(){return window.location.reload()}function Ej(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function Dj(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=vj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=OT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,b]=(0,Q.useState)(!i),x,S;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},S=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C=fj({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==g?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&Ot(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=g,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>V(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==g?(N=()=>{pj({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(Ot(`ok/cold/first-toggle`,{docName:n.docName,mountId:de(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=g,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==A?(R=f?(0,Z.jsx)(wj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(aj,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(Ej,{html:A}):(0,Z.jsx)(sS,{}),children:(0,Z.jsx)(ej,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)($A,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Sr(n.docName)||ae(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(uj,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sj,{provider:n.provider}),(0,Z.jsx)(Za,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Cj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(ZO,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=A,t[44]=R):R=t[44];let z;t[45]!==r||t[46]!==L||t[47]!==R?(z=(0,Z.jsx)(Sj,{isActive:r,initialScrollTop:L,children:R}),t[45]=r,t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;return t[49]!==F||t[50]!==I||t[51]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[49]=F,t[50]=I,t[51]=z,t[52]=B):B=t[52],B}function Oj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function kj(e){let{value:t,unit:n}=Oj(e);return n===`rem`?t*16:t}function Aj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var jj=3600*24*7;function Mj(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?Nj:m,O=g===void 0?jj: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=kj(b),J;t[6]===x?J=t[7]:(J=kj(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:kj(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=Oj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(Y,t)),u=Aj(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(Y,u)),f=Aj(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},re=[i,a,D,q,Y,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function Nj(){}var Pj=3600*24*7,Fj=`18rem`,Ij=`3rem`,Lj=`app-file-sidebar`,Rj=`14.625rem`,zj=`32rem`,Bj=`sidebar_width`,Vj=/^\d+(?:\.\d+)?(?:rem|px)$/,Hj=Q.createContext(null);function Uj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Bj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Vj.test(n)?n:e}function Wj(){let e=Q.use(Hj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Gj(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?Fj:c,[u]=Q.useState(qj),d;t[8]===u?d=t[9]:(d=()=>RT(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Uj(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=GT();return qT(`left`,RT(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),JT(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(Kj)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${FT}px)`),t=()=>{let e=RT(u,window.innerWidth,`left`);p(e),C(qT(`left`,e,GT())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(Lj)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{xl(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":Ij,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Ti(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(Hj.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function Kj(e){return!e}function qj(){return Ir()}function Jj(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=cn(),{state:f,isDraggingRail:p}=Wj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Ti(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=Ti(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=Ti(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:Lj,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function Yj(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=cn(),{toggleSidebar:o,state:s}=Wj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Sl(`toggle-files-sidebar`);c=Di,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=Lj,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=Ti(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(It,{}):(0,Z.jsx)(gd,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function Xj(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=cn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Wj(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:Rj,maxResizeWidth:zj,setIsDraggingRail:m,widthCookieName:Bj,widthCookieMaxAge:Pj},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=Mj(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=Ti(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function Zj(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=Wj(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=Ti(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Qj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`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 $j(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=Ti(`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 eM(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=Ti(`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 tM(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=Ti(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nM(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ei:`div`,o;t[4]===n?o=t[5]:(o=Ti(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function rM(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ei:`button`,o;t[4]===n?o=t[5]:(o=Ti(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function iM(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=Ti(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aM(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=Ti(`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 oM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`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 sM=wi(`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 cM(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?Ei:`button`,{state:m}=Wj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Ti(sM({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(fc,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(pc,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(hc,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function lM(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Ei:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=Ti(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function uM(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=Ti(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fM(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Ei:`a`,d;t[6]===n?d=t[7]:(d=Ti(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function pM(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function mM(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Qr.safeParse(t);return n.success?n.data.currentBranch??null:null}var hM=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:pM({fetchBranch:mM,subscribeToEvent:Xs}),gM=hM.subscribe,_M=hM.getSnapshot;function vM(){return(0,Q.useSyncExternalStore)(gM,_M,_M)}function yM(){let e=(0,$.c)(6),t=vM(),n=Vo(),{state:r}=Wj(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Wi(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function bM(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=cn(),c=yM();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(Us,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(st,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(xM,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function xM(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(pc,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Jt,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function SM(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=cn(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=Ti(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function CM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`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 wM(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=Ti(`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 TM(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=Ti(`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 EM(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=Ti(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(co,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var DM=1,OM=2,kM=4;function AM(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ti(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:Zt(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>kM?[...u.slice(0,DM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(DM,-OM)},...u.slice(-OM).map((e,t)=>d(e,u.length-OM+t))]:u.map((e,t)=>d(e,t));a=SM,t[8]===r?c=t[9]:(c=Ti(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=CM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(jM)}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 jM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(EM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(wM,{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)(Hu,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(wM,{className:`min-w-0`,children:(0,Z.jsx)(TM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var MM={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`},NM=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`,...MM,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},PM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},FM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function IM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=cn(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fc,{children:(0,Z.jsx)(FM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Ba,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(hc,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(PM,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Ba,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(pc,{side:`bottom`,children:a?(0,Z.jsx)(X,{id:`G-JBA1`}):(0,Z.jsx)(X,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(hc,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(Ha,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var LM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-WYFIqPcf.js`);return{SkillEditorActions:e}},__vite__mapDeps([77,1,30,3,7,31,6,10,67,20,9,11,32,12,13,21,16,58,69,18,59,62,23]),import.meta.url)).SkillEditorActions}));function RM(e){let t=(0,$.c)(79),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,{_:u}=cn(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=bl(`toggle-document-panel`),t[0]=d):d=t[0];let f=d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==o||t[9]!==i){let e=Sl(`toggle-document-panel`),d;t[25]===n?d=t[26]:(d=n?ti(n):null,t[25]=n,t[26]=d);let f=d,O;t[27]===n?O=t[28]:(O=n?ae(n):null,t[27]=n,t[28]=O);let k=O,A;t[29]!==f||t[30]!==k?(A=f?.kind===`skill`?{scope:f.scope,name:f.name}:k?{scope:`project`,name:k}:null,t[29]=f,t[30]=k,t[31]=A):A=t[31];let j=A;_=`editor-toolbar`,v=`pointer-events-none absolute inset-x-0 top-0 z-10`;let M;t[32]!==n||t[33]!==j?(M=j?null:(0,Z.jsx)(AM,{docName:n}),t[32]=n,t[33]=j,t[34]=M):M=t[34];let N;t[35]===M?N=t[36]:(N=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:M}),t[35]=M,t[36]=N);let P;t[37]!==r||t[38]!==a||t[39]!==i?(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(IM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[37]=r,t[38]=a,t[39]=i,t[40]=P):P=t[40],t[41]!==N||t[42]!==P?(y=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[N,P]})}),t[41]=N,t[42]=P,t[43]=y):y=t[43],D=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[44]===j?h=t[45]:(h=j?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(LM,{scope:j.scope,name:j.name})}):null,t[44]=j,t[45]=h),t[46]!==u||t[47]!==s||t[48]!==o?(g=o&&(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,"aria-label":u({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(fc,{children:(0,Z.jsx)(sd,{})})}),(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`81H_23`})})]}),t[46]=u,t[47]=s,t[48]=o,t[49]=g):g=t[49],m=hc,p=Di,b=``,x=`ghost`,S=`icon`,C=l,w=!c,T=`doc-panel`,E=u(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=u,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=o,t[9]=i,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T,t[23]=E,t[24]=D}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22],E=t[23],D=t[24];let O;t[50]===c?O=t[51]:(O=(0,Z.jsx)(fc,{children:c?(0,Z.jsx)(vd,{}):(0,Z.jsx)(_d,{})}),t[50]=c,t[51]=O);let k;t[52]!==p||t[53]!==O||t[54]!==b||t[55]!==x||t[56]!==S||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E?(k=(0,Z.jsx)(p,{"data-doc-panel-toggle":b,variant:x,size:S,onClick:C,"aria-expanded":w,"aria-controls":T,"aria-label":E,asChild:!0,children:O}),t[52]=p,t[53]=O,t[54]=b,t[55]=x,t[56]=S,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=k):k=t[61];let A;t[62]===c?A=t[63]:(A=(0,Z.jsx)(pc,{side:`bottom`,children:c?(0,Z.jsx)(X,{id:`KFdXwz`,values:{panelShortcut:f}}):(0,Z.jsx)(X,{id:`MsuXaI`,values:{panelShortcut:f}})}),t[62]=c,t[63]=A);let j;t[64]!==m||t[65]!==k||t[66]!==A?(j=(0,Z.jsxs)(m,{children:[k,A]}),t[64]=m,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==D?(M=(0,Z.jsxs)(`div`,{className:D,children:[h,g,j]}),t[68]=h,t[69]=g,t[70]=j,t[71]=D,t[72]=M):M=t[72];let N;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[73]=N):N=t[73];let P;return t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==M?(P=(0,Z.jsxs)(`div`,{"data-testid":_,className:v,children:[y,M,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=M,t[78]=P):P=t[78],P}function zM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function BM(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=Ti(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(yp,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var VM=wi(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function HM(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Ti(VM({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(bp,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function UM(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=Ti(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xp,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WM(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=Ti(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Sp,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var GM=`ok-terminal-height-v1`,KM=1/3,qM=.5;function JM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*qM))}function YM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*KM)}function XM(e,t){let n=JM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(YM(t),n)}function ZM(){return typeof window>`u`?0:window.innerHeight}function QM(e,t){try{let n=e??localStorage,r=t??ZM(),i=n.getItem(GM);if(i==null)return XM(YM(r),r);let a=Number.parseInt(i,10);return XM(Number.isFinite(a)?a:YM(r),r)}catch{return 240}}function $M(e,t,n){try{let r=t??localStorage,i=n??ZM();r.setItem(GM,String(XM(e,i)))}catch{}}function eN(){try{return typeof localStorage>`u`?240:QM()}catch{return 240}}var tN=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-PZEie26Z.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([78,1,30,3,7,31,6,10,13,11,79,80]),import.meta.url));function nN(e){let t=(0,$.c)(13),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o}=e,s=a===void 0?null:a,c=o===void 0?null:o,{enabled:l,synced:u}=Xi(),d=Hi(),{_:f}=cn(),p=u&&l===!1,m;t[0]!==f||t[1]!==d?(m=function(){if(d===null){qs.error(f({id:`V_6bJ4`}));return}let e=d(!0);e.ok||qs.error(f({id:`jKd3AP`,values:{0:e.error}}))},t[0]=f,t[1]=d,t[2]=m):m=t[2];let h=m;if(u&&!p){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==c||t[5]!==n||t[6]!==s||t[7]!==r||t[8]!==i?(a=(0,Z.jsx)(g,{fallbackRender:iN,onError:rN,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(tN,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:s,adoptPtyId:c})})}),t[4]=c,t[5]=n,t[6]=s,t[7]=r,t[8]=i,t[9]=a):a=t[9],a}let _;return t[10]!==h||t[11]!==p?(_=p?(0,Z.jsx)(sN,{onEnable:h}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[10]=h,t[11]=p,t[12]=_):_=t[12],_}function rN(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function iN(e){return(0,Z.jsx)(aN,{...e})}function aN(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=cn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(Di,{onClick:oN,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function oN(){return window.location.reload()}function sN(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=cn(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(Di,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function cN(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,onNew:o,onClose:s,children:c,className:l}=e,{_:u}=cn(),d;t[0]===l?d=t[1]:(d=Ti(`flex min-h-0 min-w-0 flex-1 flex-col`,l),t[0]=l,t[1]=d);let f;t[2]===u?f=t[3]:(f=u({id:`1MGRQl`}),t[2]=u,t[3]=f);let p;if(t[4]!==u||t[5]!==r||t[6]!==s||t[7]!==a||t[8]!==n){let e;t[10]!==u||t[11]!==r||t[12]!==s||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:Ti(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(UM,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:Ti(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,Z.jsx)(Js,{"aria-hidden":`true`})})]},e.id)},t[10]=u,t[11]=r,t[12]=s,t[13]=a,t[14]=e):e=t[14],p=n.map(e),t[4]=u,t[5]=r,t[6]=s,t[7]=a,t[8]=n,t[9]=p}else p=t[9];let m;t[15]!==f||t[16]!==p?(m=(0,Z.jsx)(HM,{variant:`line`,"aria-label":f,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:p}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;t[18]===u?h=t[19]:(h=u({id:`AB4qw9`}),t[18]=u,t[19]=h);let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(xt,{"aria-hidden":`true`}),t[20]=g):g=t[20];let _;t[21]!==o||t[22]!==h?(_=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":h,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:o,children:g})}),t[21]=o,t[22]=h,t[23]=_):_=t[23];let v;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(pc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`AB4qw9`})}),t[24]=v):v=t[24];let y;t[25]===_?y=t[26]:(y=(0,Z.jsxs)(hc,{children:[_,v]}),t[25]=_,t[26]=y);let b;t[27]!==m||t[28]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[m,y]}),t[27]=m,t[28]=y,t[29]=b):b=t[29];let x;return t[30]!==r||t[31]!==c||t[32]!==i||t[33]!==d||t[34]!==b?(x=(0,Z.jsxs)(BM,{value:r,onValueChange:i,className:d,children:[b,c]}),t[30]=r,t[31]=c,t[32]=i,t[33]=d,t[34]=b,t[35]=x):x=t[35],x}var lN=`terminal-dock-panel`;function uN(e){return`terminal-session-${e}`}function dN(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function fN(e){let t=(0,$.c)(85),{bridge:n,children:r,visible:i,onVisibleChange:a,launch:o}=e,s=o===void 0?null:o,{_:c}=cn(),{resolvedTheme:l}=xr(),u=Gx(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!i),m=typeof n.terminal?.list==`function`,h;t[0]!==m||t[1]!==s||t[2]!==i?(h=()=>!m&&i?[{id:uN(1),launch:s,title:null,adoptPtyId:null}]:[],t[0]=m,t[1]=s,t[2]=i,t[3]=h):h=t[3];let[g,_]=(0,Q.useState)(h),v;t[4]!==m||t[5]!==i?(v=()=>!m&&i?uN(1):``,t[4]=m,t[5]=i,t[6]=v):v=t[6];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(!m),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(y),T=(0,Q.useRef)(g),E=(0,Q.useRef)(!m&&i?1:0),D=(0,Q.useRef)(i&&s?s.nonce:null),O=(0,Q.useRef)(i),k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e){E.current+=1;let t=uN(E.current);_(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),b(t)},t[7]=k):k=t[7];let A=k,j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e,t){let n=t.trim()===``?null:t.trim();_(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[8]=j):j=t[8];let M=j,N=(0,Q.useRef)(A),P;t[9]!==y||t[10]!==a?(P=function(e){let t=T.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>dN(e))}_(r),r.length===0&&(a(!1),d.current?.focus())},t[9]=y,t[10]=a,t[11]=P):P=t[11];let F=P,I=(0,Q.useRef)(gN),L;t[12]!==y||t[13]!==F||t[14]!==g?(L=()=>{N.current=A,w.current=y,T.current=g,I.current=()=>{y!==``&&F(y)}},t[12]=y,t[13]=F,t[14]=g,t[15]=L):L=t[15],(0,Q.useEffect)(L);let[R]=(0,Q.useState)(hN),z=(0,Q.useRef)(R),[B,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(W=function(e){U.current!=null&&clearTimeout(U.current),U.current=setTimeout(()=>{$M(e),U.current=null},100)},t[16]=W):W=t[16];let G=W,K=(0,Q.useRef)(null),q,J;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>()=>{U.current!=null&&clearTimeout(U.current),K.current!=null&&(window.removeEventListener(`pointerup`,K.current),K.current=null)},q=[],t[17]=q,t[18]=J):(q=t[17],J=t[18]),(0,Q.useEffect)(J,q);let Y,ee;t[19]!==s||t[20]!==x||t[21]!==g.length||t[22]!==i?(Y=()=>{if(!x)return;let e=O.current;if(O.current=i,s!=null&&s.nonce!==D.current){D.current=s.nonce,N.current(s);return}i&&!e&&g.length===0&&N.current(null)},ee=[i,s,g.length,x],t[19]=s,t[20]=x,t[21]=g.length,t[22]=i,t[23]=Y,t[24]=ee):(Y=t[23],ee=t[24]),(0,Q.useEffect)(Y,ee);let te;t[25]===n.terminal?te=t[26]:(te=()=>{if(typeof n.terminal?.list!=`function`||C.current)return;C.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(mN);E.current=e.length,_(e),b(e[0]?.id??``)}S(!0)}})(),()=>{e=!0,C.current=!1}},t[25]=n.terminal,t[26]=te);let ne;t[27]===n?ne=t[28]:(ne=[n],t[27]=n,t[28]=ne),(0,Q.useEffect)(te,ne);let re,ie;t[29]===n?(re=t[30],ie=t[31]):(re=()=>n.onMenuAction(e=>{e===`new-terminal`?N.current(null):e===`kill-terminal`&&I.current()}),ie=[n],t[29]=n,t[30]=re,t[31]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(lN)?.contains(document.activeElement))return;let t=T.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>dN(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},oe=[],t[32]=ae,t[33]=oe):(ae=t[32],oe=t[33]),(0,Q.useEffect)(ae,oe);let se;t[34]!==n.editor||t[35]!==g.length?(se=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[34]=n.editor,t[35]=g.length,t[36]=se):se=t[36];let ce;t[37]!==n||t[38]!==g.length?(ce=[n,g.length],t[37]=n,t[38]=g.length,t[39]=ce):ce=t[39],(0,Q.useEffect)(se,ce);let le,ue;t[40]!==u||t[41]!==i?(le=()=>{let e=u.current;e!=null&&(i?e.resize(`${z.current}px`):e.collapse())},ue=[i,u],t[40]=u,t[41]=i,t[42]=le,t[43]=ue):(le=t[42],ue=t[43]),(0,Q.useEffect)(le,ue);let de,fe;t[44]===f?(de=t[45],fe=t[46]):(de=()=>{f&&document.getElementById(lN)?.contains(document.activeElement)&&d.current?.focus()},fe=[f],t[44]=f,t[45]=de,t[46]=fe),(0,Q.useLayoutEffect)(de,fe);let pe,me;t[47]===f?(pe=t[48],me=t[49]):(pe=()=>{f||dN(w.current)},me=[f],t[47]=f,t[48]=pe,t[49]=me),(0,Q.useEffect)(pe,me);let he;if(t[50]!==c||t[51]!==g){let e;t[53]===c?e=t[54]:(e=(e,t)=>({id:e.id,label:e.title??c({id:`OVjNeX`,values:{0:t+1}})}),t[53]=c,t[54]=e),he=g.map(e),t[50]=c,t[51]=g,t[52]=he}else he=t[52];let ge=he,_e=B||void 0,ve;t[55]===r?ve=t[56]:(ve=(0,Z.jsx)(rT,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:d,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[55]=r,t[56]=ve);let ye;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(iT,{withHandle:!0,onPointerDown:()=>{V(!0),H.current=!0;let e=()=>{V(!1),H.current=!1,window.removeEventListener(`pointerup`,e),K.current=null};K.current=e,window.addEventListener(`pointerup`,e)}}),t[57]=ye):ye=t[57];let be;t[58]===l?be=t[59]:(be=cu(l),t[58]=l,t[59]=be);let xe;t[60]===be.background?xe=t[61]:(xe={backgroundColor:be.background},t[60]=be.background,t[61]=xe);let Se=i?`${R}px`:0,Ce;t[62]!==a||t[63]!==i?(Ce=e=>{let t=e.asPercentage===0;p(t),H.current&&(t&&i?a(!1):!t&&!i&&a(!0),e.inPixels>0&&(z.current=e.inPixels,G(e.inPixels)))},t[62]=a,t[63]=i,t[64]=Ce):Ce=t[64];let we=!B&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Te;t[65]===we?Te=t[66]:(Te=Ti(`flex flex-col`,we),t[65]=we,t[66]=Te);let Ee;t[67]!==y||t[68]!==n||t[69]!==F||t[70]!==g||t[71]!==ge?(Ee=g.length>0?(0,Z.jsx)(cN,{sessions:ge,activeSessionId:y,onSelect:b,onTabActivate:pN,onNew:()=>A(null),onClose:F,className:`h-full`,children:g.map(e=>(0,Z.jsx)(WM,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(nN,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onTitleChange:t=>M(e.id,t),onClose:()=>F(e.id)})},e.id))}):null,t[67]=y,t[68]=n,t[69]=F,t[70]=g,t[71]=ge,t[72]=Ee):Ee=t[72];let De;t[73]!==f||t[74]!==u||t[75]!==xe||t[76]!==Se||t[77]!==Ce||t[78]!==Te||t[79]!==Ee?(De=(0,Z.jsx)(rT,{id:lN,style:xe,panelRef:u,defaultSize:Se,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:Ce,inert:f,className:Te,children:Ee}),t[73]=f,t[74]=u,t[75]=xe,t[76]=Se,t[77]=Ce,t[78]=Te,t[79]=Ee,t[80]=De):De=t[80];let Oe;return t[81]!==_e||t[82]!==ve||t[83]!==De?(Oe=(0,Z.jsxs)(nT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":_e,children:[ve,ye,De]}),t[81]=_e,t[82]=ve,t[83]=De,t[84]=Oe):Oe=t[84],Oe}function pN(e){return queueMicrotask(()=>dN(e))}function mN(e,t){return{id:uN(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function hN(){return eN()}function gN(){}var _N=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CD0E2wK7.js`),__vite__mapDeps([46,1,2,47,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,61,62]),import.meta.url)).ActivityModeContent})),vN=`300px`,yN=`600px`;function bN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(SN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(xN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(P,{name:`editor-area`,children:(0,Z.jsxs)(Ka,{children:[n,r]})}),t[3]=n,t[4]=i),i}function xN(){let e=(0,$.c)(5),t=Zi(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(Zw,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function SN(e){let t=(0,$.c)(187),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalLaunch:l}=e,u=s===void 0?!1:s,d=l===void 0?null:l,{_:f}=cn(),{activeDocName:p,activeProvider:m,activeTarget:h,recycleDocument:g,docPanelMode:_,docPanelAgentId:v,docPanelExpandSignal:y}=_t(),{openDocumentTransition:b}=At(),{requestAddProperty:x}=Ua(),S=ET(m,p),C=kT(p,n===`source`?`source`:`wysiwyg`),w=YT(m),T=w===`connected`||w===`synced`,E=OT(p)===`conflict`,[D,O]=(0,Q.useState)(!1),k,A;t[0]!==m||t[1]!==D?(k=()=>{m!=null&&!D&&O(!0)},A=[m,D],t[0]=m,t[1]=D,t[2]=k,t[3]=A):(k=t[2],A=t[3]),(0,Q.useEffect)(k,A);let j=(0,Q.useDeferredValue)(p),M=h?.kind===`missing`,N=!!p&&h?.kind!==`folder`,P;t[4]!==f||t[5]!==M?(P=M?f({id:`K-a33w`}):void 0,t[4]=f,t[5]=M,t[6]=P):P=t[6];let F=P,[I]=(0,Q.useState)(EN),R=I!==null,[z]=(0,Q.useState)(TN),B;t[7]===I?B=t[8]:(B=()=>RT(I,window.innerWidth,`right`),t[7]=I,t[8]=B);let[V,H]=(0,Q.useState)(B),U=(0,Q.useRef)(V),W,G;t[9]===V?(W=t[10],G=t[11]):(W=()=>{U.current=V},G=[V],t[9]=V,t[10]=W,t[11]=G),(0,Q.useEffect)(W,G);let K=Gx(),q;t[12]===V?q=t[13]:(q=()=>qT(`right`,V,GT())===`collapsed`,t[12]=V,t[13]=q);let[J]=(0,Q.useState)(q),[Y,ee]=(0,Q.useState)(J),te=(0,Q.useRef)(Y),ne,re;t[14]===Y?(ne=t[15],re=t[16]):(ne=()=>{te.current=Y},re=[Y],t[14]=Y,t[15]=ne,t[16]=re),(0,Q.useEffect)(ne,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(wN),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{NT(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==K?(ge=function(){if(K.current==null)return;let e=U.current;Y?(JT(`right`,e,`open`),K.current?.expand()):(JT(`right`,e,`collapsed`),K.current?.collapse())},t[20]=Y,t[21]=K,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==I||t[24]!==K?(ve=()=>{let e=window.matchMedia(`(min-width: ${IT}px)`),t=()=>{let e=RT(I,window.innerWidth,`right`);H(e);let t=qT(`right`,e,GT())===`collapsed`;ee(t),t?K.current?.collapse():K.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[I,K],t[23]=I,t[24]=K,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==R||t[29]!==K?(be=()=>{if(me==null||R)return;let e=new ResizeObserver(()=>{te.current||oe.current||K.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,R,K],t[27]=me,t[28]=R,t[29]=K,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==a||t[33]!==K?(Se=()=>{let e=e=>{a(e),K.current?.expand()},t=r_();return t&&e(t),a_(t=>{r_(),e(t)})},Ce=[a,K],t[32]=a,t[33]=K,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==y||t[37]!==K?(we=()=>{y!==0&&K.current?.expand()},Te=[y,K],t[36]=y,t[37]=K,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{xl(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(!1),Be=h?.kind===`large-file`?h.docName:p,Ve,He;t[52]===Be?(Ve=t[53],He=t[54]):(Ve=()=>{if(Be&&Be!==Pe.current){let e=Pe.current;Pe.current=Be,Le(e)}},He=[Be],t[52]=Be,t[53]=Ve,t[54]=He),(0,Q.useEffect)(Ve,He);let Ue;t[55]===b?Ue=t[56]:(Ue=function(e){let t=vo(e);window.location.hash===t?b(e):window.location.hash=t},t[55]=b,t[56]=Ue);let We=Ue,Ge,Ke=null;if(h?.kind===`large-file`){let e;t[57]!==We||t[58]!==Ie?(e=Ie?{previousDocName:Ie,onNavigateBack:We}:void 0,t[57]=We,t[58]=Ie,t[59]=e):e=t[59];let n;t[60]!==h.docName||t[61]!==h.limit||t[62]!==h.size||t[63]!==e?(n=(0,Z.jsx)(Pw,{docName:h.docName,size:h.size,limit:h.limit,backNav:e}),t[60]=h.docName,t[61]=h.limit,t[62]=h.size,t[63]=e,t[64]=n):n=t[64],Ge=n}else if(h?.kind===`folder`){let e;t[65]!==z||t[66]!==R||t[67]!==u?(e=bE({terminalVisible:u,isEmbedded:R,isDesktop:z}),t[65]=z,t[66]=R,t[67]=u,t[68]=e):e=t[68];let n=e,r;t[69]===h.folderPath?r=t[70]:(r=(0,Z.jsx)(Aw,{folderPath:h.folderPath}),t[69]=h.folderPath,t[70]=r);let i;t[71]!==h.folderPath||t[72]!==n?(i=n?(0,Z.jsx)(cE,{folderPath:h.folderPath}):null,t[71]=h.folderPath,t[72]=n,t[73]=i):i=t[73];let a;if(t[74]!==r||t[75]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[74]=r,t[75]=i,t[76]=a):a=t[76],Ge=a,_===`agent`&&v!==null){let e;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(iT,{withHandle:!0}),t[77]=e):e=t[77];let n;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(rT,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ONPvOb`})}),children:(0,Z.jsx)(_N,{showBackButton:!1})})})]}),t[78]=n):n=t[78],Ke=n}}else if(h?.kind===`asset`){let e;t[79]!==h.assetPath||t[80]!==h.mediaKind?(e=(0,Z.jsx)(oS,{assetPath:h.assetPath,mediaKind:h.mediaKind},h.assetPath),t[79]=h.assetPath,t[80]=h.mediaKind,t[81]=e):e=t[81],Ge=e}else if(h?.kind===`skill-file`){let e=`${h.scope}/${h.name}/${h.path}`,n;t[82]!==h.name||t[83]!==h.path||t[84]!==h.scope||t[85]!==e?(n=(0,Z.jsx)(Hw,{scope:h.scope,name:h.name,path:h.path},e),t[82]=h.name,t[83]=h.path,t[84]=h.scope,t[85]=e,t[86]=n):n=t[86],Ge=n}else if(!m||!p)if((typeof window<`u`?Io(window.location.hash):null)!==null)if(o!=null&&D){let e;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sS,{}),t[87]=e):e=t[87],Ge=e;let n;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(iT,{withHandle:!0,disabled:!0}),t[88]=n):n=t[88];let r=J?0:`${se}px`,i;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[89]=i):i=t[89];let a;t[90]===r?a=t[91]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(rT,{id:`doc-panel`,defaultSize:r,minSize:vN,maxSize:yN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[90]=r,t[91]=a),Ke=a}else{let e;return t[92]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sS,{}),t[92]=e):e=t[92],e}else{let e;t[93]===u?e=t[94]:(e=(0,Z.jsx)(YC,{terminalVisible:u}),t[93]=u,t[94]=e),Ge=e}else{let e=n===`source`,o=!T,s=Y,c;t[95]!==p||t[96]!==x?(c=function(){p&&x(p)},t[95]=p,t[96]=x,t[97]=c):c=t[97];let l=c,d;t[98]!==p||t[99]!==z||t[100]!==R||t[101]!==u?(d=yE({terminalVisible:u,isEmbedded:R,isDesktop:z,activeDocName:p}),t[98]=p,t[99]=z,t[100]=R,t[101]=u,t[102]=d):d=t[102];let f=d,m=j??p,h=Ie??void 0,v;t[103]!==F||t[104]!==e||t[105]!==We||t[106]!==g||t[107]!==m||t[108]!==h?(v=(0,Z.jsx)(yj,{activeDocName:m,isSourceMode:e,editorPlaceholder:F,previousDocName:h,onNavigateBack:We,onRecycle:g}),t[103]=F,t[104]=e,t[105]=We,t[106]=g,t[107]=m,t[108]=h,t[109]=v):v=t[109];let y;t[110]!==p||t[111]!==e?(y=(0,Z.jsx)(ST,{activeDocName:p,isSourceMode:e}),t[110]=p,t[111]=e,t[112]=y):y=t[112];let b;t[113]!==p||t[114]!==j?(b=zM({activeDocName:p,deferredActiveDocName:j,mountResolved:p!==null&&L(p),syncResolved:p!==null&&Fe(p)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(sS,{}),p===null?null:(0,Z.jsx)(Fw,{docName:p})]}):null,t[113]=p,t[114]=j,t[115]=b):b=t[115];let w;t[116]!==v||t[117]!==y||t[118]!==b?(w=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[v,y,b]}),t[116]=v,t[117]=y,t[118]=b,t[119]=w):w=t[119];let D;t[120]!==p||t[121]!==E||t[122]!==s||t[123]!==e||t[124]!==r||t[125]!==l||t[126]!==o||t[127]!==_e?(D=!E&&(0,Z.jsx)(RM,{activeDocName:p,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[120]=p,t[121]=E,t[122]=s,t[123]=e,t[124]=r,t[125]=l,t[126]=o,t[127]=_e,t[128]=D):D=t[128];let O;t[129]!==p||t[130]!==Re||t[131]!==e||t[132]!==f?(O=f?(0,Z.jsx)(cE,{docName:p,surface:e?`source`:`wysiwyg`,dismissed:Re,onDismiss:()=>ze(!0),onReopen:()=>ze(!1)}):null,t[129]=p,t[130]=Re,t[131]=e,t[132]=f,t[133]=O):O=t[133];let k;t[134]!==w||t[135]!==D||t[136]!==O?(k=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[w,D,O]}),t[134]=w,t[135]=D,t[136]=O,t[137]=k):k=t[137];let A;t[138]!==Re||t[139]!==f?(A=f&&Re?{onReopen:()=>ze(!1)}:null,t[138]=Re,t[139]=f,t[140]=A):A=t[140];let M;t[141]!==C||t[142]!==N||t[143]!==S||t[144]!==A?(M=(0,Z.jsx)(bM,{stats:S,selectionStats:C,showStats:N,composerBadge:A}),t[141]=C,t[142]=N,t[143]=S,t[144]=A,t[145]=M):M=t[145];let P;t[146]!==k||t[147]!==M?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[k,M]}),t[146]=k,t[147]=M,t[148]=P):P=t[148],Ge=P;let I=R&&Y,B;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[149]=B):B=t[149];let V;t[150]===I?V=t[151]:(V=(0,Z.jsx)(iT,{withHandle:!0,disabled:I,onPointerDown:B}),t[150]=I,t[151]=V);let H=J?0:`${se}px`,U;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{ee(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[152]=U):U=t[152];let W=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[153]===W?G=t[154]:(G=Ti(`flex flex-col bg-muted/20`,W),t[153]=W,t[154]=G);let q;t[155]!==p||t[156]!==i||t[157]!==_||t[158]!==e||t[159]!==a?(q=(0,Z.jsx)(Zy,{docName:p,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:_}),t[155]=p,t[156]=i,t[157]=_,t[158]=e,t[159]=a,t[160]=q):q=t[160];let te;t[161]!==Y||t[162]!==K||t[163]!==H||t[164]!==G||t[165]!==q?(te=(0,Z.jsx)(rT,{id:`doc-panel`,panelRef:K,defaultSize:H,minSize:vN,maxSize:yN,collapsible:!0,collapsedSize:0,onResize:U,inert:Y,className:G,children:q}),t[161]=Y,t[162]=K,t[163]=H,t[164]=G,t[165]=q,t[166]=te):te=t[166];let ne;t[167]!==V||t[168]!==te?(ne=(0,Z.jsxs)(Z.Fragment,{children:[V,te]}),t[167]=V,t[168]=te,t[169]=ne):ne=t[169],Ke=ne}let qe;t[170]!==c||t[171]!==o||t[172]!==d||t[173]!==u||t[174]!==Ge?(qe=o==null?Ge:(0,Z.jsx)(fN,{bridge:o,visible:u,onVisibleChange:c??CN,launch:d,children:Ge}),t[170]=c,t[171]=o,t[172]=d,t[173]=u,t[174]=Ge,t[175]=qe):qe=t[175];let Je=qe,Ye=ie||void 0,Xe;t[176]!==J||t[177]!==Ke?(Xe=Ke!=null&&!J?{}:{defaultSize:`100%`},t[176]=J,t[177]=Ke,t[178]=Xe):Xe=t[178];let Ze=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Qe;t[179]!==Je||t[180]!==Xe||t[181]!==Ze?(Qe=(0,Z.jsx)(rT,{minSize:`30%`,...Xe,className:Ze,children:Je}),t[179]=Je,t[180]=Xe,t[181]=Ze,t[182]=Qe):Qe=t[182];let $e;return t[183]!==Ke||t[184]!==Ye||t[185]!==Qe?($e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(nT,{orientation:`horizontal`,"data-dragging":Ye,children:[Qe,Ke]})}),t[183]=Ke,t[184]=Ye,t[185]=Qe,t[186]=$e):$e=t[186],$e}function CN(){}function wN(){return PT()}function TN(){return typeof window<`u`&&window.okDesktop!=null}function EN(){return Ir()}function DN(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 ON(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 kN=1e3,AN=!1;function jN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function MN(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:Li(i)?a=i:(a=void 0,AN||(AN=!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`&&(jN({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=ON(i),{current:c,crossDoc:l}=a?Ni(a,n,Date.now()):{current:[],crossDoc:[]},u=NN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>DN(e.current,p)&&DN(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,kN);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function NN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var PN=`sync-status`;function FN(e,t){let n=(0,$.c)(6),{_:r}=cn(),i=zh(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){qs.dismiss(PN);return}o.current=!0,qs.warning(r({id:`HGNCsl`}),{id:PN,duration:1/0})}else o.current&&e===`synced`&&(o.current=!1,qs.success(r({id:`GhjUB_`}),{id:PN,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var IN=4,LN=3,RN={Bird:Eu,Cat:Nu,Dog:Vu,Fish:qu,Mouse:Cd,Rabbit:Sd,Shrimp:kd,Snail:Ad,Squirrel:Nd,Turtle:Ud};Object.freeze(Object.keys(RN));function zN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(RN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var BN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function VN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=cn(),o=zN(n),s=o.kind===`animal`?RN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=kr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=di(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(pc,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(hc,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function HN(e){let t=BN[e.icon];return e.displayName||t||rc._({id:`iEQQyu`})}function UN(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 WN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=cn(),{activeDocName:s}=_t(),{presence:c,agentId:l}=n,u=HN(c),d=UN(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(Fi,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(Fi,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(fc,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(pc,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(hc,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function GN(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:s}=e,c;t[0]!==n||t[1]!==i?(c=i?rc._({id:`9euN0m`,values:{count:n}}):rc._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=c):c=t[2];let l=c,u=i?`true`:void 0,d;t[3]!==n||t[4]!==l||t[5]!==u?(d=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":u,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":l,children:[`+`,n]})}),t[3]=n,t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;if(t[7]!==i||t[8]!==s||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==s||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(VN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(WN,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:s},e.agentId),t[12]=i,t[13]=s,t[14]=a,t[15]=e):e=t[15],f=r.map(e),t[7]=i,t[8]=s,t[9]=r,t[10]=a,t[11]=f}else f=t[11];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(q,{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:f})}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(he,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function KN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(VN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(WN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function qN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=_t(),{current:s,crossDoc:c}=MN(t,r,n);if(FN(YT(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,IN),n;e[6]===s?n=e[7]:(n=s.slice(IN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,LN),d;e[8]===c?d=e[9]:(d=c.slice(LN),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>KN(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(GN,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>KN(e,p,!0,m)),f.length>0?(0,Z.jsx)(GN,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var JN=`.md`,YN=/\.(md|mdx)$/i;function XN(e,t=JN){return`${e}${t}`}function ZN(e){return TP(e).replace(YN,``)}function QN(e){return Ro(e)?tP(e.path):So(e)?e.path:XN(e.docName,e.docExt)}function $N(e){let t=TP(e).match(YN);return t?`.${t[1].toLowerCase()}`:void 0}function eP(e){return TP(e)}function tP(e){let t=TP(e.trim());return t?`${t}/`:``}function nP(e){return e.endsWith(`/`)?eP(e):ZN(e)}function rP(e){return e.map(QN)}function iP(e){return[...e].sort().join(`\0`)}function aP(e){return iP(rP(e))}function oP(e){let t=new Set;for(let n of e){let e=(Ro(n)||So(n)?n.path:n.docName).split(`/`).filter(Boolean);if(e.includes(`.ok`))continue;if(Ro(n)){let e=tP(n.path);e&&t.add(e)}let r=Ro(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function sP(e){if(!e)return[];let t=TP(e.replace(YN,``)).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 cP(e,t,n){let r=$N(e);if(r)return r;let i=n.find(e=>Fo(e)&&e.docName===t);return i?i.docExt??JN:wP(e).includes(`.`)?void 0:JN}function lP(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!So(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function uP(e,t,n){if($N(e))return null;let r=n.find(e=>So(e)&&e.path===t);return r?r.path:wP(e).includes(`.`)?t:lP(t,n)}function dP(e,t){let n=e.kind===`directory`,r=n?eP(e.path):ZN(e.path);if(n)return{kind:`folder`,name:TP(wP(e.path)).replace(YN,``),path:r,treePath:pP(e.path,!0)};let i=uP(e.path,r,t);if(i)return{kind:`asset`,name:TP(wP(i)),path:i,treePath:i};let a=cP(e.path,r,t);return{kind:`file`,name:TP(wP(e.path)).replace(YN,``),path:r,treePath:pP(e.path,!1),docExt:a}}function fP(e){return e.kind===`directory`?eP(e.path):e.path}function pP(e,t){return t?tP(e):YN.test(e)?e:`${e}${JN}`}function mP(e,t,n){let r=tP(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${JN}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function hP(e,t){return e===`file`?pP(t,!1):`${eP(t)}/index${JN}`}function gP(e,t){return t.kind===`root`||t.directoryPath==null?wP(e):`${t.directoryPath}${wP(e)}`}function _P(e,t){if(t)return eP(tP(e));let n=ZN(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function vP(e,t){let n=eP(tP(e));return n?`${n}/${t}`:t}function yP(e,t,n){e.append(`parentDocName`,vP(t,n)),e.append(`placement`,`parent-dir`)}function bP(e,t){return(t.path??vP(e,t.src)).replace(/^\/+/,``)}function xP(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function SP(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function CP(e,t){let n=mt(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:ZN(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:or(i),modified:r,size:t.size}}function wP(e){let t=TP(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function TP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function EP(e,t){return t.trim()}function DP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function OP(e,t){let n=EP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function kP(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(Fo(e)){let t=s.get(XN(e.docName,e.docExt));if(t){let n=wo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:or(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Ro(e))return{...e,path:IP(e.path,n)};if(So(e)){let t=s.get(e.path);return t&&Ze(t)?{kind:`document`,docName:ZN(t),docExt:mt(t),size:e.size,modified:e.modified}:{...e,path:t??IP(e.path,n)}}return e})}function AP(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Fo(e)?!i.has(e.docName)&&!BP(e.docName,n):Ro(e)?!BP(e.path,n):So(e)?!a.has(e.path)&&!BP(e.path,n):!0)}function jP(e,t){if(e.kind!==`asset`||t.some(t=>So(t)&&t.path===e.path))return e;let n=lP(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function MP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>LP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Fo(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=>Ro(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(Fo(i)){let e=zP(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Ro(i)){let e=RP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function NP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function PP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function FP(e,t){let n=e.kind===`file`?XN(e.path,e.docExt):e.path;return Ho(t.contentDir,n,t.pathSeparator)}function IP(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 LP(e,t){return Fo(e)&&Fo(t)?e.docName===t.docName:Ro(e)&&Ro(t)||So(e)&&So(t)?e.path===t.path:!1}function RP(e,t,n){return e===t?n:zP(e,t,n)}function zP(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function BP(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function VP(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)(Gf,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function HP(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=Ti(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Kf,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UP(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)(Yf,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function WP(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(tp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function GP(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=Ti(`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)(qf,{children:(0,Z.jsx)(Jf,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KP(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=Ti(`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)(Zf,{"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 qP(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=Ti(`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)(co,{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)(np,{"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 JP(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=Ti(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(rp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YP(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=Ti(`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)($f,{children:(0,Z.jsx)($a,{})})}),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)(Qf,{"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 XP(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Ti(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Xf,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function ZP(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=Ti(`-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)(ep,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var QP=`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`,$P=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,eF={start:[Ns.Space],cancel:[Ns.Esc],end:[Ns.Space,Ns.Enter]};function tF(e){return Ti(QP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function nF(e){return e?void 0:-1}function rF({className:e,isDragging:t}){return Ti(e,t&&$P)}function iF(e){return e.code===Ns.Enter&&e.target===e.currentTarget}function aF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&iF(e)?`activate-tab`:`delegate-sortable`}function oF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Rs.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function sF(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function cF(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var lF=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return Ds(e)},uF=[`.md`,`.mdx`],dF=`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`,fF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,pF=Ti(fF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),mF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function hF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function gF(e){let t=vo(e);window.location.hash!==t&&(window.location.hash=t)}function _F(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function vF(e,t){let n=[t,...uF].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 yF(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Is(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=oF({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=aF({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=rF({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function bF(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=an(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=an(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(HP,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(X,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(KP,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(X,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(KP,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(X,{id:`U2Kx6T`}):(0,Z.jsx)(X,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(KP,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZP,{}),(0,Z.jsx)(KP,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(X,{id:`SYfHmN`}):(0,Z.jsx)(X,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(GP,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(VP,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function xF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=cn();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)(xd,{"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]===i?u=t[14]:(u=tF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=nF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Js,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function SF(e){let t=(0,$.c)(1),{docName:n}=e;if(OT(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(yo,{"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 CF(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=_t(),{_:T}=cn(),{pageMeta:E}=Oo(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==i?(U=n??(i?h(i):t?Yt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=U):U=e[3];let G=U,K;e[4]!==r||e[5]!==G||e[6]!==m||e[7]!==g||e[8]!==v?(K=m?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:G?`${G}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=G,e[6]=m,e[7]=g,e[8]=v,e[9]=K):K=e[9];let q=K,Y,ee;e[10]===t?(Y=e[11],ee=e[12]):(Y=()=>{H.current=t},ee=[t],e[10]=t,e[11]=Y,e[12]=ee),(0,Q.useEffect)(Y,ee);let te,ne;e[13]===q?(te=e[14],ne=e[15]):(te=()=>{q&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[q],e[13]=q,e[14]=te,e[15]=ne),(0,Q.useEffect)(te,ne);let re,ie;e[16]===A?(re=e[17],ie=e[18]):(re=()=>{A&&(R.current?.focus(),R.current?.select())},ie=[A],e[16]=A,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==A?(ae=()=>{!A||v.includes(A.tabId)||(B.current=!0,V.current=null,j(null),N(``),F(null),L(!1))},oe=[v,A],e[19]=v,e[20]=A,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},ce=function(){B.current=!0,V.current=null,j(null),N(``),F(null),L(!1)},le=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=A?.docName;if(!e){ce();return}let t=EP(`file`,vF(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===V.current){R.current?.focus();return}if(!DP(t)){F(T({id:`P8yDjG`})),R.current?.focus();return}let i=OP({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await J(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=s(Pr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,l=NP(o,a);W(a);let u=!0;try{let e=PP(a,f(),p);await Promise.all(e.map(e=>c(e))),x(a),$s([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),qs.error(T({id:`MUBR8r`}))}B.current=!0,j(null),N(``),F(null),L(!1),z.current=!1,V.current=null,u&&l&&l!==o&&gF(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=cF(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==l||e[30]!==d||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:As,keyboardCodes:eF},e[34]=ye):ye=e[34];let be=Ls(ws(Os,ve),ws(js,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(sF(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(Te=function(e){we();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(Ps([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=Ti(`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]`,ue&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=_F,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=Ti(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=Es,Me=lF,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=Ms,Fe;e[44]===w?Fe=e[45]:(Fe=[...w],e[44]=w,e[45]=Fe);let Ie=Ts,Le=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(bF,{tabId:e,canPin:!1,openTabs:w,closeTab:l,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(yF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Ti(dF,t?fF:pF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:mF,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(X,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:tF(t),tabIndex:nF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Js,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=en(e),n=e===G,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=Zt(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(bF,{tabId:e,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(yF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ti(dF,n?fF:pF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:mF,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:Ti(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Ti(`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)(xF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=Zt(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(bF,{tabId:e,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(yF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ti(dF,n?fF:pF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:mF,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:Ti(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Ti(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(xF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let s=t.docName,c=E.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Zt(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=A?.tabId===e,v=`editor-tab-rename-error-${hF(s)}`;return(0,Z.jsx)(bF,{disabled:_,tabId:e,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(yF,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ti(dF,n?fF:pF,_&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(aT,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(uT,{ref:R,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?v:void 0,"aria-busy":I||void 0,title:P??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(vF(e.target.value,c)),F(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(sT,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(lT,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),P?(0,Z.jsx)(`span`,{id:v,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:mF,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(SF,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(xF,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Re;e[46]!==Pe||e[47]!==Fe||e[48]!==Ie||e[49]!==Le?(Re=(0,Z.jsx)(Pe,{items:Fe,strategy:Ie,children:Le}),e[46]=Pe,e[47]=Fe,e[48]=Ie,e[49]=Le,e[50]=Re):Re=e[50];let ze;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==Re||e[60]!==he?(ze=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:Re}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=Re,e[60]=he,e[61]=ze):ze=e[61];let Be;e[62]===T?Be=e[63]:(Be=T({id:`3YvS-c`}),e[62]=T,e[63]=Be);let Ve;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Z.jsx)(xt,{"aria-hidden":`true`}),e[64]=Ve):Ve=e[64];let He;e[65]!==_||e[66]!==Be?(He=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Be,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ve})}),e[65]=_,e[66]=Be,e[67]=He):He=e[67];let Ue;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`3YvS-c`})}),e[68]=Ue):Ue=e[68];let We;e[69]===He?We=e[70]:(We=(0,Z.jsxs)(hc,{children:[He,Ue]}),e[69]=He,e[70]=We);let Ge;e[71]!==Ae||e[72]!==ze||e[73]!==We?(Ge=(0,Z.jsxs)(`div`,{className:Ae,children:[ze,We]}),e[71]=Ae,e[72]=ze,e[73]=We,e[74]=Ge):Ge=e[74];let Ke;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ge?(Ke=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ge}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ge,e[79]=Ke):Ke=e[79],Ke}var wF=(e,t,n)=>{if(e&&`reportValidity`in e){let r=ea(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},TF=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?wF(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>wF(t,n,e))}},EF=(e,t)=>{t.shouldUseNativeValidation&&TF(e,t);let n={};for(let r in e){let i=ea(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(DF(t.names||Object.keys(e),r)){let e=Object.assign({},ea(n,r));Vi(e,`root`,a),Vi(n,r,e)}else Vi(n,r,a)}return n},DF=(e,t)=>{let n=OF(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>OF(e).match(`^${n}\\.\\d+`))};function OF(e){return e.replace(/[\[\]]/g,``)}function kF(){return kF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kF.apply(null,arguments)}function AF(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function jF(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Fa(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function MF(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(kF({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Fa(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function NF(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(AF(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&TF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:EF(jF(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(AF(function(){return Promise.resolve((n.mode===`sync`?Un:vr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&TF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof er}(e))return{values:{},errors:EF(MF(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var PF=`https://openknowledge.ai/api/subscribe`;async function FF(e){try{let t=await fetch(PF,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e}),signal:AbortSignal.timeout(15e3)});return t.ok?{ok:!0}:t.status===400?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${t.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function IF(e){let t=(0,$.c)(47),{title:n,description:r,onSuccess:i,onDismiss:a,autoFocus:o,className:s}=e,{_:c}=cn(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f,p;t[0]===l?(f=t[1],p=t[2]):(f=()=>{l&&d.current?.focus()},p=[l],t[0]=l,t[1]=f,t[2]=p),(0,Q.useEffect)(f,p);let m,h;if(t[3]!==c){let e=fr({email:nr({message:c({id:`Wq6Wcm`})})});h=Bi,m=NF(e),t[3]=c,t[4]=m,t[5]=h}else m=t[4],h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={email:``},t[6]=g):g=t[6];let _;t[7]===m?_=t[8]:(_={resolver:m,defaultValues:g},t[7]=m,t[8]=_);let v=h(_),{isSubmitting:y}=v.formState,b=v.formState.errors.email?.message??v.formState.errors.root?.message,x;t[9]!==c||t[10]!==v||t[11]!==i?(x=async function(e){v.clearErrors(`root`);let t=await FF(e.email);if(t.ok){u(!0),i?.();return}if(t.reason===`invalid`){v.setError(`email`,{message:c({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){v.setError(`root`,{message:c({id:`4mLBx9`})});return}v.setError(`root`,{message:c({id:`fWsBTs`})})},t[9]=c,t[10]=v,t[11]=i,t[12]=x):x=t[12];let S=x,C;t[13]===s?C=t[14]:(C=Ti(`flex flex-col gap-3`,s),t[13]=s,t[14]=C);let w=l?-1:void 0,T;t[15]!==l||t[16]!==n?(T=l?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)($a,{className:`size-4 text-primary`}),(0,Z.jsx)(X,{id:`PIMM5l`})]}):n??(0,Z.jsx)(X,{id:`GzPQ2f`}),t[15]=l,t[16]=n,t[17]=T):T=t[17];let E;t[18]!==T||t[19]!==w?(E=(0,Z.jsx)(`p`,{ref:d,tabIndex:w,className:`text-base font-medium leading-tight text-foreground focus:outline-none`,children:T}),t[18]=T,t[19]=w,t[20]=E):E=t[20];let D;t[21]!==r||t[22]!==l?(D=l?(0,Z.jsx)(X,{id:`pBROkv`}):r??(0,Z.jsx)(X,{id:`WmPbvm`}),t[21]=r,t[22]=l,t[23]=D):D=t[23];let O;t[24]===D?O=t[25]:(O=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,role:`status`,children:D}),t[24]=D,t[25]=O);let k;t[26]!==E||t[27]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E,O]}),t[26]=E,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==c||t[30]!==a?(A=a?(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon`,onClick:a,"aria-label":c({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(Js,{className:`size-4`})}):null,t[29]=c,t[30]=a,t[31]=A):A=t[31];let j;t[32]!==k||t[33]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[k,A]}),t[32]=k,t[33]=A,t[34]=j):j=t[34];let M;t[35]!==c||t[36]!==o||t[37]!==b||t[38]!==v||t[39]!==y||t[40]!==S||t[41]!==l?(M=l?null:(0,Z.jsxs)(`form`,{onSubmit:v.handleSubmit(S),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)($i,{control:v.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(aT,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(sT,{className:`pl-2.5`,children:(0,Z.jsx)(ud,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(uT,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:o,placeholder:c({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":c({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Di,{type:`submit`,disabled:y,className:`mr-1 ml-auto text-1sm`,"data-testid":`subscribe-submit`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`lCC_D5`})})]}):(0,Z.jsx)(X,{id:`EDl9kS`})})]})}}),b?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:b}):null]}),t[35]=c,t[36]=o,t[37]=b,t[38]=v,t[39]=y,t[40]=S,t[41]=l,t[42]=M):M=t[42];let N;return t[43]!==j||t[44]!==M||t[45]!==C?(N=(0,Z.jsxs)(`div`,{className:C,children:[j,M]}),t[43]=j,t[44]=M,t[45]=C,t[46]=N):N=t[46],N}function LF(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 RF(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 zF=`https://github.com/inkeep/open-knowledge`,BF=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:at},{label:{id:`PCNIuJ`},href:`${zF}/issues/new`,icon:Fu},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:mo}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:LF},{label:`X (Twitter)`,href:`https://x.com/OpenKnowledgeAI`,icon:RF},{label:`GitHub`,href:zF,icon:tm}]}],VF=`${zF}/releases`,HF=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function UF(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var WF=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=cn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=UF(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Pd,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},GF=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=cn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>ic(e,o),l=e=>ic(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:HF,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},KF=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},qF=()=>{let e=(0,$.c)(28),{_:t}=cn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]!==n||e[1]!==s?(l=()=>{if(!n||s!==null)return;let e=new AbortController;return Ar({signal:e.signal}).then(e=>{e!==null&&c(e)}),()=>e.abort()},u=[n,s],e[0]=n,e[1]=s,e[2]=l,e[3]=u):(l=e[2],u=e[3]),(0,Q.useEffect)(l,u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{r(e),e||a(!1)},e[4]=d):d=e[4];let f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(_,{className:`size-4`}),e[5]=f):f=e[5];let p;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[f,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`s-MGs7`})})]})})}),e[6]=p):p=e[6];let m;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(hc,{children:[p,(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`s-MGs7`})})]}),e[7]=m):m=e[7];let h;e[8]!==t||e[9]!==s?(h=BF.map((e,n)=>(0,Z.jsxs)(`div`,{className:Ti(n>0&&`mt-3`),children:[(0,Z.jsx)(KF,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(GF,{link:e,trailing:e.href===zF&&s!==null?(0,Z.jsx)(WF,{count:s}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=s,e[10]=h):h=e[10];let g;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(KF,{children:(0,Z.jsx)(X,{id:`arUUsK`})}),e[11]=g):g=e[11];let v;e[12]===t?v=e[13]:(v=t({id:`arUUsK`}),e[12]=t,e[13]=v);let y;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(GF,{link:{label:{id:`3ePd3I`},href:VF,icon:fd}}),e[14]=y):y=e[14];let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,className:Ti(HF,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(ud,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(X,{id:`EDl9kS`})]})}),e[15]=b):b=e[15];let x;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(q,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(IF,{autoFocus:!0,onDismiss:()=>a(!1)})}),e[16]=x):x=e[16];let S;e[17]===i?S=e[18]:(S=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[y,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(he,{open:i,onOpenChange:a,children:[b,x]})})]}),e[17]=i,e[18]=S);let C;e[19]!==S||e[20]!==v?(C=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[g,(0,Z.jsx)(`nav`,{"aria-label":v,children:S})]}),e[19]=S,e[20]=v,e[21]=C):C=e[21];let w;e[22]!==C||e[23]!==h?(w=(0,Z.jsxs)(q,{align:`end`,className:`w-56 p-3`,children:[h,C]}),e[22]=C,e[23]=h,e[24]=w):w=e[24];let T;return e[25]!==n||e[26]!==w?(T=(0,Z.jsxs)(he,{open:n,onOpenChange:d,children:[m,w]}),e[25]=n,e[26]=w,e[27]=T):T=e[27],T},JF=50,YF=()=>{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,Ww.preload()},JF))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=ra)},l=(0,Z.jsx)(Dd,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(fc,{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:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(hc,{children:[u,(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},XF=`https://openknowledge.ai/docs/features/share`;function ZF(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=cn(),{status:a}=ia(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Yi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:is,toastSuccess:aI,toastError:iI,logEvent:rI});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{qs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,v=c!==null,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{e||l(null)},t[10]=y):y=t[10];let b;t[11]!==i||t[12]!==n?.kind?(b=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=b):b=t[13];let x=o||m,S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Od,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(X,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==g||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:g,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=g,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(fl,{ref:u,readOnly:!0,value:D,onFocus:nI,onClick:tI,onContextMenu:eI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(H,{copyContent:A,clipboardWrite:is,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(`a`,{href:XF,target:`_blank`,rel:`noopener noreferrer`,onClick:$F,onAuxClick:QF,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(X,{id:`aByJ8j`})]}),t[34]=P):P=t[34];let F;t[35]!==E||t[36]!==N?(F=(0,Z.jsxs)(q,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,P]}),t[35]=E,t[36]=N,t[37]=F):F=t[37];let I;return t[38]!==w||t[39]!==F||t[40]!==v?(I=(0,Z.jsxs)(he,{open:v,onOpenChange:y,children:[w,F]}),t[38]=w,t[39]=F,t[40]=v,t[41]=I):I=t[41],I}function QF(e){return ic(e,XF)}function $F(e){return ic(e,XF)}function eI(e){return e.currentTarget.select()}function tI(e){return e.currentTarget.select()}function nI(e){return e.currentTarget.select()}function rI(e){return console.log(e)}function iI(e){e!==`Link ready but could not copy to clipboard.`&&qs.error(e)}function aI(e){return qs.success(e)}function oI(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=cn(),{activeDocName:o,activeTarget:s}=_t(),c=o?ti(o):null,{state:l,isDraggingRail:u}=Wj(),d=Y_(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=bl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=bl(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Ji(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=ya(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Ji(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=Ti(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Yj,{className:Ti(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(pc,{children:l===`expanded`?(0,Z.jsx)(X,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(X,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Ti(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(nt,{"aria-hidden":`true`})})}),(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(sa,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(CF,{})]}),E;t[9]===T?E=t[10]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[9]=T,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=Ti(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=D):D=t[11];let O;t[12]!==h||t[13]!==g||t[14]!==v||t[15]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(Ia,{open:h,onOpenChange:g})]}),t[12]=h,t[13]=g,t[14]=v,t[15]=d,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==n?(k=(0,Z.jsx)(ma,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(qN,{}),j=(0,Z.jsx)(sa,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(Tp,{}),t[20]=A,t[21]=j,t[22]=M):(A=t[20],j=t[21],M=t[22]);let N;t[23]===d?N=t[24]:(N=!d&&(0,Z.jsx)(YF,{}),t[23]=d,t[24]=N);let P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(qF,{}),t[25]=P):P=t[25];let F;t[26]!==O||t[27]!==k||t[28]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[26]=O,t[27]=k,t[28]=N,t[29]=F):F=t[29];let I;return t[30]!==F||t[31]!==x||t[32]!==w||t[33]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[30]=F,t[31]=x,t[32]=w,t[33]=E,t[34]=I):I=t[34],I}var sI=`open-knowledge:terminal-launch`;function cI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(sI,{detail:{prompt:e,cli:t}}))}function lI(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(sI,n),()=>t.removeEventListener(sI,n)}function uI(e){let t=(0,$.c)(56),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=kv(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Ky[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),[S,C]=(0,Q.useState)(null),w=(0,Q.useRef)(0),T=Gi(),{projectConfig:E,projectLocalConfig:D,projectLocalSynced:O,projectSynced:k}=ys(),{activeDocName:A}=_t(),j=T?.hasRemote,M=T?.pushPermission?.checkStatus,N;t[2]!==m||t[3]!==E||t[4]!==D||t[5]!==O||t[6]!==k||t[7]!==j||t[8]!==M?(N=Nv({autoSyncOnboardingDismissed:m,hasRemote:j,projectLocalSynced:O,projectSynced:k,projectLocalConfig:D,projectConfig:E,pushPermissionCheckStatus:M}),t[2]=m,t[3]=E,t[4]=D,t[5]=O,t[6]=k,t[7]=j,t[8]=M,t[9]=N):N=t[9];let P=N,F,I;t[10]===A?(F=t[11],I=t[12]):(F=()=>{let e=function(e){let t=e.detail;t&&A&&Kl(A,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(xv,e),()=>window.removeEventListener(xv,e)},I=[A],t[10]=A,t[11]=F,t[12]=I),(0,Q.useEffect)(F,I);let L,R;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?v(pI):e===`new-terminal`&&v(!0)})},R=[],t[13]=L,t[14]=R):(L=t[13],R=t[14]),(0,Q.useEffect)(L,R);let z,B;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{if(window.okDesktop!=null)return;let e=function(e){xl(e,`toggle-terminal-panel`)&&(e.preventDefault(),v(fI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},z=[],t[15]=z,t[16]=B):(z=t[15],B=t[16]),(0,Q.useEffect)(B,z);let V,H;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>lI((e,t)=>{v(!0),w.current+=1,C({prompt:e,cli:t,nonce:w.current})}),H=[],t[17]=V,t[18]=H):(V=t[17],H=t[18]),(0,Q.useEffect)(V,H);let U,W;t[19]===_?(U=t[20],W=t[21]):(U=()=>{_||C(null)},W=[_],t[19]=_,t[20]=U,t[21]=W),(0,Q.useEffect)(U,W);let G,K;t[22]!==y||t[23]!==_?(G=()=>{window.okDesktop!=null&&y&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:_})},K=[_,y],t[22]=y,t[23]=_,t[24]=G,t[25]=K):(G=t[24],K=t[25]),(0,Q.useEffect)(G,K);let q,J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){b(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(x.current=!0,v(!0))}).catch(dI).finally(()=>{t||b(!0)}),()=>{t=!0}},J=[],t[26]=q,t[27]=J):(q=t[26],J=t[27]),(0,Q.useEffect)(q,J);let Y,ee;t[28]===_?(Y=t[29],ee=t[30]):(Y=()=>{if(window.okDesktop!=null){if(x.current){x.current=!1;return}_&&Ea()}},ee=[_],t[28]=_,t[29]=Y,t[30]=ee),(0,Q.useEffect)(Y,ee),Av(T?.pausedReason);let te;t[31]===a?te=t[32]:(te=function(e){s(e),a(e)},t[31]=a,t[32]=te);let ne=te,re,ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{d(`auth`),l(!0)},ie=()=>{d(`identity`),l(!0)},t[33]=re,t[34]=ie):(re=t[33],ie=t[34]);let ae;t[35]===r?ae=t[36]:(ae=(0,Z.jsx)(oI,{onSignIn:re,onSetIdentity:ie,onOpenSearch:r}),t[35]=r,t[36]=ae);let oe;t[37]!==f||t[38]!==o||t[39]!==ne||t[40]!==S||t[41]!==_?(oe=(0,Z.jsx)(bN,{editorMode:o,onModeChange:ne,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:_,onTerminalVisibleChange:v,terminalLaunch:S}),t[37]=f,t[38]=o,t[39]=ne,t[40]=S,t[41]=_,t[42]=oe):oe=t[42];let se=u===`identity`,ce;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{l(!1)},t[43]=ce):ce=t[43];let le;t[44]!==c||t[45]!==se?(le=(0,Z.jsx)(ua,{open:c,onOpenChange:l,identityPrompt:se,onSuccess:ce}),t[44]=c,t[45]=se,t[46]=le):le=t[46];let ue;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>h(!0),t[47]=ue):ue=t[47];let de;t[48]===P?de=t[49]:(de=(0,Z.jsx)(jv,{open:P,onResolved:ue}),t[48]=P,t[49]=de);let fe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(vv,{}),t[50]=fe):fe=t[50];let pe;return t[51]!==ae||t[52]!==oe||t[53]!==le||t[54]!==de?(pe=(0,Z.jsxs)(Z.Fragment,{children:[ae,oe,le,de,fe]}),t[51]=ae,t[52]=oe,t[53]=le,t[54]=de,t[55]=pe):pe=t[55],pe}function dI(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function fI(e){return!e}function pI(e){return!e}function mI(e){let t=vo(po(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function hI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=qi();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(yo,{"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)(yo,{"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(gI),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 gI(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:()=>mI(e.file),children:[(0,Z.jsx)(yo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var _I=`<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;Ol(t,{style:t=>Hl(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 kA.set(t.changes,i),i}function MA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Rk).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(OA);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Tl.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:DA.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function NA(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Rk).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(OA).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 PA(e){let t=new jl;for(let n of e.field(Rk)){let r=e.facet(Fk).overrideChunk&&LA(e,n);t.add(n.fromB,n.fromB,jA(e,n,!!r))}return t.finish()}var FA=Dl.define({create:e=>PA(e),update(e,t){return t.state.field(Rk,!1)==t.startState.field(Rk,!1)?e:PA(t.state)},provide:e=>Il.decorations.from(e)}),IA=new WeakMap;function LA(e,t){let n=IA.get(t);if(n!==void 0)return n;n=null;let r=e.field(OA),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(Al.widget({widget:new RA(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(eA.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return IA.set(t,n),n}var RA=class extends Cl{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}},zA=new class extends Ll{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},BA=Al.line({class:`cm-inlineChangedLine`});function VA(e,t,n,r){let i=LA(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,zA),n.add(o.from,o.from,BA);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var HA=oe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),UA=E({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),WA=Il.theme({".cm-deletedChunk .cm-chunkButtons":{display:`flex`,gap:`0.25rem`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button']":{margin:`0`,border:`1px solid transparent`,borderRadius:`min(var(--radius-md), 10px)`,color:`var(--primary-foreground)`},".cm-deletedChunk .cm-chunkButtons button[data-slot='button'][data-variant='destructive']":{color:`var(--destructive)`}});function GA({addControl:e,nextId:t,removeControl:n,root:r}){return(i,a)=>{let o=document.createElement(`span`);o.className=`inline-flex`;let s=t();return e({id:s,host:o,type:i,action:a}),queueMicrotask(()=>{r.contains(o)||n(s)}),o}}function KA(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=cn(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=xr(),g=(0,Q.useRef)(c),_=(0,Q.useRef)(l),[v,y]=(0,Q.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[0]=b):b=t[0];let[x,S]=(0,Q.useState)(b),C;t[1]!==l||t[2]!==c?(C=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=C):C=t[3],(0,Q.useEffect)(C);let w,T;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(w=()=>{let e=f.current;if(!e)return;S([]);let t=new Map,r=!1,s=e=>{r||!t.delete(e)||S(t=>t.filter(t=>t.id!==e))},c=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||s(n)});c.observe(e,{childList:!0,subtree:!0});let l=h===`dark`?HA:UA,u=[Il.editable.of(!1),El.readOnly.of(!0)],g=[tu,Ul(),...u,l,Il.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Il({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=GA({addControl:e=>{r||(t.set(e.id,e.host),S(t=>[...t,e]))},nextId:()=>(m.current+=1,m.current),removeControl:s,root:e}),a=new Il({doc:d,extensions:[tu,Ul(),Il.editable.of(!1),l,WA,Il.lineWrapping,EA({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Il.updateListener.of(e=>{let t=zk(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=zk(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new SA({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Il({doc:d,extensions:[...g,EA({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,c.disconnect(),p.current&&=(p.current.destroy(),null)}},T=[n,d,i,h,a,o],t[4]=a,t[5]=d,t[6]=i,t[7]=n,t[8]=o,t[9]=h,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){let e=p.current;!e||!(e instanceof Il)||g.current?.(e.state.doc.toString())},t[12]=E):E=t[12];let D=E,O;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=p.current;!e||!(e instanceof Il)||K(e)},t[13]=O):O=t[13];let k=O,A=v===0,j;t[14]!==u||t[15]!==v?(j=v===null?``:v===0?u({id:`lPzyrU`}):rc._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=j):j=t[16];let M=j,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=N):N=t[17];let P;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,ku.createPortal)((0,Z.jsx)(Di,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?u({id:`g3UF2V`}):u({id:`1t_NnN`})}),e.host,e.id),t[21]=u,t[22]=e),P=x.map(e),t[18]=u,t[19]=x,t[20]=P}else P=t[20];let F;t[23]!==A||t[24]!==a||t[25]!==M||t[26]!==l||t[27]!==c?(F=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${A?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:M}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Di,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(X,{id:`XyOUTJ`})}),(0,Z.jsx)(Di,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:k,children:`Undo`}),c&&(0,Z.jsx)(Di,{variant:`default`,size:`sm`,disabled:!A,onClick:D,children:(0,Z.jsx)(X,{id:`Lcehxn`})})]})]}),t[23]=A,t[24]=a,t[25]=M,t[26]=l,t[27]=c,t[28]=F):F=t[28];let I;return t[29]!==F||t[30]!==P?(I=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[N,P,F]}),t[29]=F,t[30]=P,t[31]=I):I=t[31],I}async function qA(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 JA(e,t){return qA(e,`content`,t)}async function YA(e){return qA(e,`mine`)}async function XA(e){return qA(e,`theirs`)}async function ZA(e){return qA(e,`delete`)}async function QA(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}&source=ytext`);if(!t.ok){let n;try{let e=await t.json();typeof e.detail==`string`?n=e.detail:typeof e.title==`string`&&(n=e.title)}catch{}return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:t.status,detail:n})),null}let n=await t.json(),r=n.kind===`delete-modify`||n.kind===`modify-delete`||n.kind===`both-modified`?n.kind:`both-modified`;return n.kind!==r&&console.warn(JSON.stringify({event:`conflict-kind-missing-fallback`,file:e,receivedKind:n.kind??null})),{base:n.base??``,ours:n.ours??``,theirs:n.theirs??``,kind:r}}catch(t){return console.warn(JSON.stringify({event:`conflict-content-fetch-failed`,file:e,status:null,detail:t instanceof Error?t.message:String(t)})),null}}function $A(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=cn(),{conflicts:i,loading:a}=qi(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>po(e.file)===n,t[3]=n,t[4]=e),o=i.find(e),t[0]=i,t[1]=n,t[2]=o}else o=t[2];let s=o,c=s?.file??`${n}.md`,[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h,g;t[5]===n?(h=t[6],g=t[7]):(h=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),g=[n],t[5]=n,t[6]=h,t[7]=g),(0,Q.useEffect)(h,g);let _=a||s===void 0,v,y;t[8]!==_||t[9]!==c?(v=()=>{if(_)return;let e=!1;return u(null),f(!1),QA(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},y=[c,_],t[8]=_,t[9]=c,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,Q.useEffect)(v,y);let b;t[12]!==r||t[13]!==c?(b=async function(e){let t=await JA(c,e);t.ok||qs.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=b):b=t[14];let x=b,S;t[15]!==r||t[16]!==c?(S=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),qs.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=S):S=t[17];let C=S;if(d){let e;return t[18]===c?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ajz9F8`,values:{filePath:c}})}),t[18]=c,t[19]=e),e}if(l===null){let e;return t[20]===c?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`DF1MtZ`,values:{filePath:c}})}),t[20]=c,t[21]=e),e}if(l.kind===`delete-modify`){let e;t[22]===l.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(KA,{oldContent:``,newContent:l.theirs,layout:`unified`,previewMode:!0})}),t[22]=l.theirs,t[23]=e);let n;t[24]===c?n=t[25]:(n={filePath:c},t[24]=c,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===C?a=t[30]:(a=()=>void C(ZA),t[29]=C,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Di,{type:`button`,variant:`destructive`,disabled:p,onClick:a,children:o}),t[32]=p,t[33]=a,t[34]=s):s=t[34];let u;t[35]===C?u=t[36]:(u=()=>void C(XA),t[35]=C,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Di,{type:`button`,variant:`default`,disabled:p,onClick:u,children:d}),t[38]=p,t[39]=u,t[40]=f):f=t[40];let m;t[41]!==s||t[42]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[41]=s,t[42]=f,t[43]=m):m=t[43];let h;t[44]!==i||t[45]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=h):h=t[46];let g;return t[47]!==h||t[48]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[47]=h,t[48]=e,t[49]=g):g=t[49],g}if(l.kind===`modify-delete`){let e;t[50]===l.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(KA,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[50]=l.ours,t[51]=e);let n;t[52]===c?n=t[53]:(n={filePath:c},t[52]=c,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===C?a=t[58]:(a=()=>void C(YA),t[57]=C,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(X,{id:`0NA4b3`}),t[59]=o):o=t[59];let s;t[60]!==p||t[61]!==a?(s=(0,Z.jsx)(Di,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[60]=p,t[61]=a,t[62]=s):s=t[62];let u;t[63]===C?u=t[64]:(u=()=>void C(ZA),t[63]=C,t[64]=u);let d;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(X,{id:`qSxaOz`}),t[65]=d):d=t[65];let f;t[66]!==p||t[67]!==u?(f=(0,Z.jsx)(Di,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[66]=p,t[67]=u,t[68]=f):f=t[68];let m;t[69]!==s||t[70]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[69]=s,t[70]=f,t[71]=m):m=t[71];let h;t[72]!==i||t[73]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=h):h=t[74];let g;return t[75]!==h||t[76]!==e?(g=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,h]}),t[75]=h,t[76]=e,t[77]=g):g=t[77],g}let w;t[78]===x?w=t[79]:(w=e=>void x(e),t[78]=x,t[79]=w);let T;return t[80]!==l.ours||t[81]!==l.theirs||t[82]!==w?(T=(0,Z.jsx)(KA,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:w}),t[80]=l.ours,t[81]=l.theirs,t[82]=w,t[83]=T):T=t[83],T}function ej(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Ht(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 tj=`__back-nav__`;function nj(e){return e instanceof je||e instanceof yt||e instanceof we||e instanceof et||e instanceof Pt||e instanceof S?e.docName:null}function rj(e){if(e instanceof je){let t=e.docName;return{title:rc._({id:`Jejur6`}),summary:rc._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof yt){let t=e.docName;return{title:rc._({id:`V7QxyT`}),summary:rc._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof we){let t=e.docName;return{title:rc._({id:`1di5fu`}),summary:rc._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:rc._({id:`wvbc1r`}),summary:rc._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof Pt)return{title:rc._({id:`Gfr4fu`}),summary:rc._({id:`UW2Fg3`})};if(e instanceof S){let t=e.docName;return{title:rc._({id:`vv7kpg`}),summary:rc._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:rc._({id:`W5A0Ly`});return{title:rc._({id:`29VNqC`}),summary:t}}function ij(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=rj(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(PC,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(X,{id:`KDw4GX`}),t[12]=v):v=t[12];let y;t[13]===r?y=t[14]:(y=(0,Z.jsx)(Di,{ref:d,variant:`default`,onClick:r,children:v}),t[13]=r,t[14]=y);let b;t[15]!==i||t[16]!==u||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(b=u?(0,Z.jsx)(Di,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(nj(n)??i),o(a),r(tj))},children:(0,Z.jsx)(X,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=u,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==b||t[23]!==y?(x=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[y,b]}),t[22]=b,t[23]=y,t[24]=x):x=t[24];let S;return t[25]!==x||t[26]!==_?(S=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[m,_,x]}),t[25]=x,t[26]=_,t[27]=S):S=t[27],S}function aj(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)(ij,{...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]===tj){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}: ${rj(e).title}`,e)},t[9]=n,t[10]=u);let d;return t[11]!==o||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u?(d=(0,Z.jsx)(g,{fallbackRender:s,resetKeys:c,onReset:l,onError:u,children:o}),t[11]=o,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16],d}function oj(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=ni(t);return{map:n,keys:Br(t),parseError:r}}function sj(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>oj(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=$n(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=pt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(cj,{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)(lj,{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 cj(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 lj(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var uj=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-D1Rc1vGt.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([71,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,66,67,21,72,8,73,74,45,24]),import.meta.url)).ManagedArtifactProperties})),dj=j(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function fj(e){let t=e.threshold??dj;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function pj(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var mj=j(`ACTIVITY_MOUNT_LIMIT`,3);function hj(){return n(()=>import(`./SourceEditor-DECD54QN.js`),__vite__mapDeps([75,1,47,2,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,76,34,74,70]),import.meta.url)}var gj=(0,Q.lazy)(async()=>({default:(await hj()).SourceEditor}));function _j(e,t,n){if(n<=0)return[];let r=e.filter(e=>!He(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 vj(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:rc._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?rc._({id:`Sc1bKE`,values:{docName:e}}):rc._({id:`ovIGrT`,values:{docName:e}}),actionLabel:rc._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:rc._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?rc._({id:`bmC18N`,values:{docName:e}}):rc._({id:`pAgkuZ`,values:{docName:e}})}:null}function yj(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(P,{name:`activity-pool`,children:(0,Z.jsx)(bj,{...e})}),t[0]=e,t[1]=n),n}function bj(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=_t(),{pages:u,loading:d}=Oo(),p=_j(c,n,mj),m=(0,Q.useRef)(``),h=p.map(xj).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(m.current===h)return;let e=m.current?m.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)f(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;O(e,t&&t.length>0?t:crypto.randomUUID())}Ot(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),m.current=h,G(t)},[h,n]);let y;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(y=e=>(0,Z.jsx)(Dj,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Sr(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let b=p.map(y),x;return t[13]===b?x=t[14]:(x=(0,Z.jsx)(Z.Fragment,{children:b}),t[13]=b,t[14]=x),x}function xj(e){return e.docName}function Sj(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&&Ot(`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&&(Ot(`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&&Ot(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`editor-doc-scroll subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Cj(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)(sS,{}),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)(gj,{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 wj(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)(zo,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ms,{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:Tj,children:[(0,Z.jsx)(zo,{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 Tj(){return window.location.reload()}function Ej(e){let t=(0,$.c)(2),{html:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`tiptap-editor h-full pointer-events-none`,"aria-hidden":`true`,children:(0,Z.jsx)(`div`,{className:`tiptap ProseMirror tiptap-editor-portal-content`,dangerouslySetInnerHTML:{__html:n}})}),t[0]=n,t[1]=r),r}function Dj(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=vj(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=OT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[y,b]=(0,Q.useState)(!i),x,S;t[5]!==i||t[6]!==_||t[7]!==y?(x=()=>{i&&!_?v(!0):!i&&!y&&b(!0)},S=[i,_,y],t[5]=i,t[6]=_,t[7]=y,t[8]=x,t[9]=S):(x=t[8],S=t[9]),(0,Q.useEffect)(x,S);let C=fj({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:y}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==g?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&Ot(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=g,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>V(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==g?(N=()=>{pj({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&(Ot(`ok/cold/first-toggle`,{docName:n.docName,mountId:de(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=g,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==A?(R=f?(0,Z.jsx)(wj,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(aj,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(Ej,{html:A}):(0,Z.jsx)(sS,{}),children:(0,Z.jsx)(ej,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)($A,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Sr(n.docName)||ae(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(uj,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(sj,{provider:n.provider}),(0,Z.jsx)(Za,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Cj,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(ZO,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=A,t[44]=R):R=t[44];let z;t[45]!==r||t[46]!==L||t[47]!==R?(z=(0,Z.jsx)(Sj,{isActive:r,initialScrollTop:L,children:R}),t[45]=r,t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;return t[49]!==F||t[50]!==I||t[51]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[49]=F,t[50]=I,t[51]=z,t[52]=B):B=t[52],B}function Oj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function kj(e){let{value:t,unit:n}=Oj(e);return n===`rem`?t*16:t}function Aj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var jj=3600*24*7;function Mj(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?Nj:m,O=g===void 0?jj: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=kj(b),J;t[6]===x?J=t[7]:(J=kj(x),t[6]=x,t[7]=J);let Y=J,ee;t[8]!==E||t[9]!==k?(ee=function(e){E&&(P.current=!0,j.current=H.current?0:kj(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ee):ee=t[10];let te=ee,ne,re;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==Y||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=Oj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(Y,t)),u=Aj(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(Y,u)),f=Aj(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},re=[i,a,D,q,Y,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=Y,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=re):(ne=t[24],re=t[25]),(0,Q.useEffect)(ne,re);let ie;return t[26]===te?ie=t[27]:(ie={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=ie),ie}function Nj(){}var Pj=3600*24*7,Fj=`18rem`,Ij=`3rem`,Lj=`app-file-sidebar`,Rj=`14.625rem`,zj=`32rem`,Bj=`sidebar_width`,Vj=/^\d+(?:\.\d+)?(?:rem|px)$/,Hj=Q.createContext(null);function Uj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${Bj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Vj.test(n)?n:e}function Wj(){let e=Q.use(Hj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Gj(e){let t=(0,$.c)(58),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=c===void 0?Fj:c,[u]=Q.useState(qj),d;t[8]===u?d=t[9]:(d=()=>RT(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>Uj(l),t[10]=l,t[11]=m);let[h,g]=Q.useState(m),[_,v]=Q.useState(!1),[y,b]=Q.useState(!1),x;t[12]===u?x=t[13]:(x=()=>{let e=GT();return qT(`left`,RT(u,window.innerWidth,`left`),e)===`open`},t[12]=u,t[13]=x);let[S,C]=Q.useState(x),w=i??S,T;t[14]!==w||t[15]!==f||t[16]!==o?(T=e=>{let t=typeof e==`function`?e(w):e;o?o(t):C(t),JT(`left`,f,t?`open`:`collapsed`)},t[14]=w,t[15]=f,t[16]=o,t[17]=T):T=t[17];let E=T,D;t[18]===E?D=t[19]:(D=function(){E(Kj)},t[18]=E,t[19]=D);let O=D,k=Q.useRef(w),A;t[20]===w?A=t[21]:(A=()=>{k.current=w},t[20]=w,t[21]=A),Q.useLayoutEffect(A);let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){window.innerWidth>=1024||k.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||b(!0))},t[22]=j):j=t[22];let M=j,N,P;t[23]===u?(N=t[24],P=t[25]):(P=()=>{let e=window.matchMedia(`(min-width: ${FT}px)`),t=()=>{let e=RT(u,window.innerWidth,`left`);p(e),C(qT(`left`,e,GT())===`open`)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},N=[u],t[23]=u,t[24]=N,t[25]=P),Q.useEffect(P,N);let F,I;t[26]===w?(F=t[27],I=t[28]):(F=()=>{w||document.getElementById(Lj)?.contains(document.activeElement)&&document.querySelector(`[data-sidebar="trigger"]`)?.focus()},I=[w],t[26]=w,t[27]=F,t[28]=I),Q.useLayoutEffect(F,I);let L,R;t[29]!==w||t[30]!==f||t[31]!==E?(L=()=>{if(f===`above`||!w)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||E(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},R=[f,w,E],t[29]=w,t[30]=f,t[31]=E,t[32]=L,t[33]=R):(L=t[32],R=t[33]),Q.useEffect(L,R);let z,B;t[34]===O?(z=t[35],B=t[36]):(z=()=>{if(typeof window<`u`&&window.okDesktop!=null)return;let e=e=>{xl(e,`toggle-files-sidebar`)&&(e.preventDefault(),O())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},B=[O],t[34]=O,t[35]=z,t[36]=B),Q.useEffect(z,B);let V=w?`expanded`:`collapsed`,H;t[37]!==_||t[38]!==w||t[39]!==E||t[40]!==y||t[41]!==V||t[42]!==O||t[43]!==h?(H={state:V,open:w,setOpen:E,toggleSidebar:O,width:h,setWidth:g,isDraggingRail:_,setIsDraggingRail:v,showPushPulse:y,setShowPushPulse:b,notifySidebarFileSelected:M},t[37]=_,t[38]=w,t[39]=E,t[40]=y,t[41]=V,t[42]=O,t[43]=h,t[44]=H):H=t[44];let U;t[45]!==s||t[46]!==h?(U={"--sidebar-width":h,"--sidebar-width-icon":Ij,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=Ti(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[48]=r,t[49]=G);let K;t[50]!==n||t[51]!==a||t[52]!==W||t[53]!==G?(K=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:W,className:G,...a,children:n}),t[50]=n,t[51]=a,t[52]=W,t[53]=G,t[54]=K):K=t[54];let q;return t[55]!==H||t[56]!==K?(q=(0,Z.jsx)(Hj.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function Kj(e){return!e}function qj(){return Ir()}function Jj(e){let t=(0,$.c)(39),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{_:d}=cn(),{state:f,isDraggingRail:p}=Wj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Ti(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}let m=f===`collapsed`?u:``,h=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,g;t[14]===h?g=t[15]:(g=Ti(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,h,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=h,t[15]=g);let _;t[16]===g?_=t[17]:(_=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:g}),t[16]=g,t[17]=_);let v;t[18]===d?v=t[19]:(v=d({id:`07q4Qk`}),t[18]=d,t[19]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[20]!==r||t[21]!==y?(b=Ti(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=y,t[22]=b):b=t[22];let x;t[23]===n?x=t[24]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=x);let S;t[25]!==i||t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==v?(S=(0,Z.jsx)(`nav`,{id:Lj,"aria-label":v,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[25]=i,t[26]=c,t[27]=b,t[28]=x,t[29]=v,t[30]=S):S=t[30];let C;return t[31]!==p||t[32]!==c||t[33]!==f||t[34]!==S||t[35]!==m||t[36]!==_||t[37]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":f,"data-collapsible":m,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":p,children:[_,S]}),t[31]=p,t[32]=c,t[33]=f,t[34]=S,t[35]=m,t[36]=_,t[37]=l,t[38]=C):C=t[38],C}function Yj(e){let t=(0,$.c)(34),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{_:a}=cn(),{toggleSidebar:o,state:s}=Wj(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=Sl(`toggle-files-sidebar`);c=Di,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=Lj,h=a(s===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[14]===n?g=t[15]:(g=Ti(n),t[14]=n,t[15]=g);let _;t[16]!==r||t[17]!==o?(_=e=>{r?.(e),o()},t[16]=r,t[17]=o,t[18]=_):_=t[18];let v;t[19]===s?v=t[20]:(v=s===`expanded`?(0,Z.jsx)(It,{}):(0,Z.jsx)(gd,{}),t[19]=s,t[20]=v);let y;return t[21]!==c||t[22]!==i||t[23]!==l||t[24]!==v||t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==m||t[30]!==h||t[31]!==g||t[32]!==_?(y=(0,Z.jsx)(c,{"data-sidebar":l,"data-slot":u,variant:d,size:f,"aria-expanded":p,"aria-controls":m,"aria-label":h,className:g,onClick:_,...i,children:v}),t[21]=c,t[22]=i,t[23]=l,t[24]=v,t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=m,t[30]=h,t[31]=g,t[32]=_,t[33]=y):y=t[33],y}function Xj(e){let t=(0,$.c)(32),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{_:l}=cn(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=Wj(),h=f===`collapsed`,g;t[6]!==s||t[7]!==c||t[8]!==m||t[9]!==d||t[10]!==h||t[11]!==u||t[12]!==p?(g={direction:`right`,enableDrag:s,enableToggle:c,onResize:d,onToggle:u,currentWidth:p,isCollapsed:h,minResizeWidth:Rj,maxResizeWidth:zj,setIsDraggingRail:m,widthCookieName:Bj,widthCookieMaxAge:Pj},t[6]=s,t[7]=c,t[8]=m,t[9]=d,t[10]=h,t[11]=u,t[12]=p,t[13]=g):g=t[13];let{dragRef:_,handleMouseDown:v}=Mj(g),y;t[14]!==l||t[15]!==f?(y=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=l,t[15]=f,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==r?(b=e=>{r?.(e),e.defaultPrevented||v(e)},t[17]=v,t[18]=r,t[19]=b):b=t[19];let x;t[20]!==l||t[21]!==f?(x=l(f===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=l,t[21]=f,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=Ti(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=S);let C;return t[25]!==_||t[26]!==i||t[27]!==y||t[28]!==b||t[29]!==x||t[30]!==S?(C=(0,Z.jsx)(`button`,{ref:_,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":y,tabIndex:-1,onMouseDown:b,title:x,className:S,...i}),t[25]=_,t[26]=i,t[27]=y,t[28]=b,t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function Zj(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onAnimationEnd:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showPushPulse:a,setShowPushPulse:o}=Wj(),s;t[4]!==r||t[5]!==o?(s=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&o(!1)},t[4]=r,t[5]=o,t[6]=s):s=t[6];let c=s,l=a?``:void 0,u;t[7]===n?u=t[8]:(u=Ti(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,n),t[7]=n,t[8]=u);let d;return t[9]!==c||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":l,onAnimationEnd:c,className:u,...i}),t[9]=c,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Qj(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`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 $j(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=Ti(`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 eM(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=Ti(`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 tM(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=Ti(`relative flex w-full min-w-0 flex-col p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nM(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ei:`div`,o;t[4]===n?o=t[5]:(o=Ti(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function rM(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?Ei:`button`,o;t[4]===n?o=t[5]:(o=Ti(`absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(a,{"data-slot":`sidebar-group-action`,"data-sidebar":`group-action`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function iM(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=Ti(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aM(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=Ti(`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 oM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`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 sM=wi(`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 cM(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?Ei:`button`,{state:m}=Wj(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=Ti(sM({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=h):h=t[11];let g;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==h?(g=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:h,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=h,t[17]=g):g=t[17];let _=g;if(!c)return _;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let v;t[20]===_?v=t[21]:(v=(0,Z.jsx)(fc,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(pc,{side:`right`,align:`center`,hidden:y,...c}),t[22]=y,t[23]=c,t[24]=b):b=t[24];let x;return t[25]!==v||t[26]!==b?(x=(0,Z.jsxs)(hc,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function lM(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?Ei:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=Ti(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,Z.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function uM(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=Ti(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`group/menu-sub-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-sub-item`,"data-sidebar":`menu-sub-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fM(e){let t=(0,$.c)(14),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({asChild:i,size:a,isActive:o,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=i===void 0?!1:i,c=a===void 0?`md`:a,l=o===void 0?!1:o,u=s?Ei:`a`,d;t[6]===n?d=t[7]:(d=Ti(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-hover hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-hover active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-active:hover:bg-sidebar-accent [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,n),t[6]=n,t[7]=d);let f;return t[8]!==u||t[9]!==l||t[10]!==r||t[11]!==c||t[12]!==d?(f=(0,Z.jsx)(u,{"data-slot":`sidebar-menu-sub-button`,"data-sidebar":`menu-sub-button`,"data-size":c,"data-active":l,className:d,...r}),t[8]=u,t[9]=l,t[10]=r,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function pM(e){let t=null,n=!1,r=new Set;function i(e){if(e!==t){t=e;for(let e of r)e()}}e.subscribeToEvent(i);async function a(){if(!n){n=!0;try{i(await e.fetchBranch())}catch{}}}return{getSnapshot:()=>t,subscribe(e){return r.add(e),a(),()=>{r.delete(e)}}}}async function mM(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Qr.safeParse(t);return n.success?n.data.currentBranch??null:null}var hM=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:pM({fetchBranch:mM,subscribeToEvent:Xs}),gM=hM.subscribe,_M=hM.getSnapshot;function vM(){return(0,Q.useSyncExternalStore)(gM,_M,_M)}function yM(){let e=(0,$.c)(6),t=vM(),n=Vo(),{state:r}=Wj(),i=typeof window<`u`?window.okDesktop:void 0;if(i&&r===`expanded`)return null;let a;e[0]===n?a=e[1]:(a=i?.config.projectName??(n&&Wi(n.contentDir)||null),e[0]=n,e[1]=a);let o=a,s=i?.config.projectPath??n?.contentDir??null;if(o===null&&t===null)return null;let c;return e[2]!==t||e[3]!==o||e[4]!==s?(c={projectName:o,projectPath:s,branch:t},e[2]=t,e[3]=o,e[4]=s,e[5]=c):c=e[5],c}function bM(e){let t=(0,$.c)(27),{stats:n,selectionStats:r,showStats:i,composerBadge:a}=e,o=i===void 0?!0:i,{_:s}=cn(),c=yM();if(!o&&c===null&&a==null)return null;let l=r??n,u=r!=null,{words:d,chars:f,tokens:p}=l,m;t[0]!==s||t[1]!==u||t[2]!==o?(m=s(o?u?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=s,t[1]=u,t[2]=o,t[3]=m):m=t[3];let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=h):h=t[4];let g;t[5]!==s||t[6]!==a?(g=a?(0,Z.jsxs)(Di,{type:`button`,variant:`outline`,onClick:a.onReopen,"data-testid":`ask-ai-reopen-badge`,className:`-translate-x-1/2 absolute bottom-0 left-1/2 z-10 h-auto gap-1 rounded-md rounded-b-none bg-card px-2.5 py-0.5 text-2xs font-normal text-muted-foreground shadow-sm hover:text-foreground active:not-aria-[haspopup]:translate-y-0`,children:[(0,Z.jsx)(Us,{className:`size-3`,"aria-hidden":!0}),s({id:`xWEvuo`}),(0,Z.jsx)(st,{className:`size-3`,"aria-hidden":!0})]}):null,t[5]=s,t[6]=a,t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=c===null?null:(0,Z.jsx)(xM,{identity:c}),t[8]=c,t[9]=_);let v;t[10]===_?v=t[11]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[10]=_,t[11]=v);let y;t[12]!==s||t[13]!==l.chars||t[14]!==l.tokens||t[15]!==l.words||t[16]!==f||t[17]!==u||t[18]!==o||t[19]!==p||t[20]!==d?(y=o?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[u?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:s({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.words.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`gljvbT`,values:{words:d}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.chars.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`d5rK4X`,values:{chars:f}})]}),(0,Z.jsxs)(`span`,{children:[l.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:l.tokens.toLocaleString()}),` `,(0,Z.jsx)(X,{id:`uynXup`,values:{tokens:p}})]})]}):null,t[12]=s,t[13]=l.chars,t[14]=l.tokens,t[15]=l.words,t[16]=f,t[17]=u,t[18]=o,t[19]=p,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==m||t[23]!==g||t[24]!==v||t[25]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":m,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[h,g,v,y]}),t[22]=m,t[23]=g,t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function xM(e){let t=(0,$.c)(8),{identity:n}=e,{projectName:r,projectPath:i,branch:a}=n,o;t[0]!==r||t[1]!==i?(o=r===null?null:i?(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(pc,{side:`top`,className:`max-w-xs break-all`,children:i})]}):(0,Z.jsx)(`span`,{className:`truncate`,"data-testid":`editor-footer-project-name`,children:r}),t[0]=r,t[1]=i,t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=a===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,"data-testid":`editor-footer-branch`,children:[(0,Z.jsx)(Jt,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:a})]}),t[3]=a,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,Z.jsxs)(Z.Fragment,{children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function SM(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:i}=cn(),a;t[3]===i?a=t[4]:(a=i({id:`3__SjS`}),t[3]=i,t[4]=a);let o;t[5]===n?o=t[6]:(o=Ti(n),t[5]=n,t[6]=o);let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,Z.jsx)(`nav`,{"aria-label":a,"data-slot":`breadcrumb`,className:o,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function CM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Ti(`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 wM(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=Ti(`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 TM(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=Ti(`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 EM(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=Ti(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(co,{}),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:a,...i,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}var DM=1,OM=2,kM=4;function AM(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ti(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:Zt(n,``).prefix.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>kM?[...u.slice(0,DM).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(DM,-OM)},...u.slice(-OM).map((e,t)=>d(e,u.length-OM+t))]:u.map((e,t)=>d(e,t));a=SM,t[8]===r?c=t[9]:(c=Ti(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=CM,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(jM)}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 jM(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(EM,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(wM,{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)(Hu,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(wM,{className:`min-w-0`,children:(0,Z.jsx)(TM,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var MM={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`},NM=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`,...MM,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},PM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},FM=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)(NM,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function IM(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=cn(),s=n?`source`:`wysiwyg`,c;t[0]===r?c=t[1]:(c=e=>{e&&r(e)},t[0]=r,t[1]=c);let l;t[2]===o?l=t[3]:(l=o({id:`n7aopT`}),t[2]=o,t[3]=l);let u;t[4]===o?u=t[5]:(u=o({id:`ur2XSb`}),t[4]=o,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(fc,{children:(0,Z.jsx)(FM,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(Ba,{value:`wysiwyg`,"aria-label":u,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:d}),t[7]=u,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(hc,{children:[f,p]}),t[10]=f,t[11]=m);let h;t[12]===o?h=t[13]:(h=o({id:`xbdtfY`}),t[12]=o,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(PM,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Ba,{value:`source`,"aria-label":h,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:g})})}),t[15]=a,t[16]=h,t[17]=_):_=t[17];let v;t[18]===a?v=t[19]:(v=(0,Z.jsx)(pc,{side:`bottom`,children:a?(0,Z.jsx)(X,{id:`G-JBA1`}):(0,Z.jsx)(X,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(hc,{children:[_,v]}),t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==s||t[25]!==c||t[26]!==l||t[27]!==m?(b=(0,Z.jsxs)(Ha,{type:`single`,value:s,onValueChange:c,"aria-label":l,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[m,y]}),t[23]=y,t[24]=s,t[25]=c,t[26]=l,t[27]=m,t[28]=b):b=t[28],b}var LM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-BQYuB-4q.js`);return{SkillEditorActions:e}},__vite__mapDeps([77,1,30,3,7,31,6,10,67,20,9,11,32,12,13,21,16,58,69,18,59,62,23]),import.meta.url)).SkillEditorActions}));function RM(e){let t=(0,$.c)(79),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,{_:u}=cn(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=bl(`toggle-document-panel`),t[0]=d):d=t[0];let f=d,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[1]!==u||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==o||t[9]!==i){let e=Sl(`toggle-document-panel`),d;t[25]===n?d=t[26]:(d=n?ti(n):null,t[25]=n,t[26]=d);let f=d,O;t[27]===n?O=t[28]:(O=n?ae(n):null,t[27]=n,t[28]=O);let k=O,A;t[29]!==f||t[30]!==k?(A=f?.kind===`skill`?{scope:f.scope,name:f.name}:k?{scope:`project`,name:k}:null,t[29]=f,t[30]=k,t[31]=A):A=t[31];let j=A;_=`editor-toolbar`,v=`pointer-events-none absolute inset-x-0 top-0 z-10`;let M;t[32]!==n||t[33]!==j?(M=j?null:(0,Z.jsx)(AM,{docName:n}),t[32]=n,t[33]=j,t[34]=M):M=t[34];let N;t[35]===M?N=t[36]:(N=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:M}),t[35]=M,t[36]=N);let P;t[37]!==r||t[38]!==a||t[39]!==i?(P=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(IM,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[37]=r,t[38]=a,t[39]=i,t[40]=P):P=t[40],t[41]!==N||t[42]!==P?(y=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[N,P]})}),t[41]=N,t[42]=P,t[43]=y):y=t[43],D=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[44]===j?h=t[45]:(h=j?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(LM,{scope:j.scope,name:j.name})}):null,t[44]=j,t[45]=h),t[46]!==u||t[47]!==s||t[48]!==o?(g=o&&(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,"aria-label":u({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(fc,{children:(0,Z.jsx)(sd,{})})}),(0,Z.jsx)(pc,{side:`bottom`,children:(0,Z.jsx)(X,{id:`81H_23`})})]}),t[46]=u,t[47]=s,t[48]=o,t[49]=g):g=t[49],m=hc,p=Di,b=``,x=`ghost`,S=`icon`,C=l,w=!c,T=`doc-panel`,E=u(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=u,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=o,t[9]=i,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w,t[22]=T,t[23]=E,t[24]=D}else p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21],T=t[22],E=t[23],D=t[24];let O;t[50]===c?O=t[51]:(O=(0,Z.jsx)(fc,{children:c?(0,Z.jsx)(vd,{}):(0,Z.jsx)(_d,{})}),t[50]=c,t[51]=O);let k;t[52]!==p||t[53]!==O||t[54]!==b||t[55]!==x||t[56]!==S||t[57]!==C||t[58]!==w||t[59]!==T||t[60]!==E?(k=(0,Z.jsx)(p,{"data-doc-panel-toggle":b,variant:x,size:S,onClick:C,"aria-expanded":w,"aria-controls":T,"aria-label":E,asChild:!0,children:O}),t[52]=p,t[53]=O,t[54]=b,t[55]=x,t[56]=S,t[57]=C,t[58]=w,t[59]=T,t[60]=E,t[61]=k):k=t[61];let A;t[62]===c?A=t[63]:(A=(0,Z.jsx)(pc,{side:`bottom`,children:c?(0,Z.jsx)(X,{id:`KFdXwz`,values:{panelShortcut:f}}):(0,Z.jsx)(X,{id:`MsuXaI`,values:{panelShortcut:f}})}),t[62]=c,t[63]=A);let j;t[64]!==m||t[65]!==k||t[66]!==A?(j=(0,Z.jsxs)(m,{children:[k,A]}),t[64]=m,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==h||t[69]!==g||t[70]!==j||t[71]!==D?(M=(0,Z.jsxs)(`div`,{className:D,children:[h,g,j]}),t[68]=h,t[69]=g,t[70]=j,t[71]=D,t[72]=M):M=t[72];let N;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[73]=N):N=t[73];let P;return t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==M?(P=(0,Z.jsxs)(`div`,{"data-testid":_,className:v,children:[y,M,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=M,t[78]=P):P=t[78],P}function zM(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function BM(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`horizontal`:i,o;t[4]===n?o=t[5]:(o=Ti(`group/tabs flex gap-2 data-horizontal:flex-col`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(yp,{"data-slot":`tabs`,"data-orientation":a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var VM=wi(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function HM(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Ti(VM({variant:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o||t[9]!==a?(s=(0,Z.jsx)(bp,{"data-slot":`tabs-list`,"data-variant":a,className:o,...r}),t[7]=r,t[8]=o,t[9]=a,t[10]=s):s=t[10],s}function UM(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=Ti(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xp,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WM(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=Ti(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Sp,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var GM=`ok-terminal-height-v1`,KM=1/3,qM=.5;function JM(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*qM))}function YM(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*KM)}function XM(e,t){let n=JM(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(YM(t),n)}function ZM(){return typeof window>`u`?0:window.innerHeight}function QM(e,t){try{let n=e??localStorage,r=t??ZM(),i=n.getItem(GM);if(i==null)return XM(YM(r),r);let a=Number.parseInt(i,10);return XM(Number.isFinite(a)?a:YM(r),r)}catch{return 240}}function $M(e,t,n){try{let r=t??localStorage,i=n??ZM();r.setItem(GM,String(XM(e,i)))}catch{}}function eN(){try{return typeof localStorage>`u`?240:QM()}catch{return 240}}var tN=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-BCJwzg1b.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([78,1,30,3,7,31,6,10,13,11,79,80]),import.meta.url));function nN(e){let t=(0,$.c)(13),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o}=e,s=a===void 0?null:a,c=o===void 0?null:o,{enabled:l,synced:u}=Xi(),d=Hi(),{_:f}=cn(),p=u&&l===!1,m;t[0]!==f||t[1]!==d?(m=function(){if(d===null){qs.error(f({id:`V_6bJ4`}));return}let e=d(!0);e.ok||qs.error(f({id:`jKd3AP`,values:{0:e.error}}))},t[0]=f,t[1]=d,t[2]=m):m=t[2];let h=m;if(u&&!p){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[3]=e):e=t[3];let a;return t[4]!==c||t[5]!==n||t[6]!==s||t[7]!==r||t[8]!==i?(a=(0,Z.jsx)(g,{fallbackRender:iN,onError:rN,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(tN,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:s,adoptPtyId:c})})}),t[4]=c,t[5]=n,t[6]=s,t[7]=r,t[8]=i,t[9]=a):a=t[9],a}let _;return t[10]!==h||t[11]!==p?(_=p?(0,Z.jsx)(sN,{onEnable:h}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[10]=h,t[11]=p,t[12]=_):_=t[12],_}function rN(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function iN(e){return(0,Z.jsx)(aN,{...e})}function aN(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=cn(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===r?o=t[4]:(o=r({id:`6MnZEC`}),t[3]=r,t[4]=o);let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[5]=a,t[6]=s);let c;t[7]===r?c=t[8]:(c=r({id:`HpK_8d`}),t[7]=r,t[8]=c);let l;t[9]===c?l=t[10]:(l=(0,Z.jsx)(Di,{onClick:oN,children:c}),t[9]=c,t[10]=l);let u;return t[11]!==o||t[12]!==s||t[13]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":o,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[s,l]}),t[11]=o,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function oN(){return window.location.reload()}function sN(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=cn(),i;t[0]===r?i=t[1]:(i=r({id:`_XWY2J`}),t[0]=r,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`oYepHb`}),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:a}),t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=r({id:`v2ZW0K`}),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==s?(c=(0,Z.jsx)(Di,{onClick:n,children:s}),t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;t[11]===r?l=t[12]:(l=r({id:`ICoNYz`}),t[11]=r,t[12]=l);let u;t[13]===l?u=t[14]:(u=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:l}),t[13]=l,t[14]=u);let d;return t[15]!==i||t[16]!==o||t[17]!==c||t[18]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":i,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[o,c,u]}),t[15]=i,t[16]=o,t[17]=c,t[18]=u,t[19]=d):d=t[19],d}function cN(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,onNew:o,onClose:s,children:c,className:l}=e,{_:u}=cn(),d;t[0]===l?d=t[1]:(d=Ti(`flex min-h-0 min-w-0 flex-1 flex-col`,l),t[0]=l,t[1]=d);let f;t[2]===u?f=t[3]:(f=u({id:`1MGRQl`}),t[2]=u,t[3]=f);let p;if(t[4]!==u||t[5]!==r||t[6]!==s||t[7]!==a||t[8]!==n){let e;t[10]!==u||t[11]!==r||t[12]!==s||t[13]!==a?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:Ti(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(UM,{value:e.id,onClick:()=>a?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:Ti(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,Z.jsx)(Js,{"aria-hidden":`true`})})]},e.id)},t[10]=u,t[11]=r,t[12]=s,t[13]=a,t[14]=e):e=t[14],p=n.map(e),t[4]=u,t[5]=r,t[6]=s,t[7]=a,t[8]=n,t[9]=p}else p=t[9];let m;t[15]!==f||t[16]!==p?(m=(0,Z.jsx)(HM,{variant:`line`,"aria-label":f,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:p}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;t[18]===u?h=t[19]:(h=u({id:`AB4qw9`}),t[18]=u,t[19]=h);let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(xt,{"aria-hidden":`true`}),t[20]=g):g=t[20];let _;t[21]!==o||t[22]!==h?(_=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":h,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:o,children:g})}),t[21]=o,t[22]=h,t[23]=_):_=t[23];let v;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(pc,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(X,{id:`AB4qw9`})}),t[24]=v):v=t[24];let y;t[25]===_?y=t[26]:(y=(0,Z.jsxs)(hc,{children:[_,v]}),t[25]=_,t[26]=y);let b;t[27]!==m||t[28]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[m,y]}),t[27]=m,t[28]=y,t[29]=b):b=t[29];let x;return t[30]!==r||t[31]!==c||t[32]!==i||t[33]!==d||t[34]!==b?(x=(0,Z.jsxs)(BM,{value:r,onValueChange:i,className:d,children:[b,c]}),t[30]=r,t[31]=c,t[32]=i,t[33]=d,t[34]=b,t[35]=x):x=t[35],x}var lN=`terminal-dock-panel`;function uN(e){return`terminal-session-${e}`}function dN(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function fN(e){let t=(0,$.c)(85),{bridge:n,children:r,visible:i,onVisibleChange:a,launch:o}=e,s=o===void 0?null:o,{_:c}=cn(),{resolvedTheme:l}=xr(),u=Gx(),d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!i),m=typeof n.terminal?.list==`function`,h;t[0]!==m||t[1]!==s||t[2]!==i?(h=()=>!m&&i?[{id:uN(1),launch:s,title:null,adoptPtyId:null}]:[],t[0]=m,t[1]=s,t[2]=i,t[3]=h):h=t[3];let[g,_]=(0,Q.useState)(h),v;t[4]!==m||t[5]!==i?(v=()=>!m&&i?uN(1):``,t[4]=m,t[5]=i,t[6]=v):v=t[6];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(!m),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(y),T=(0,Q.useRef)(g),E=(0,Q.useRef)(!m&&i?1:0),D=(0,Q.useRef)(i&&s?s.nonce:null),O=(0,Q.useRef)(i),k;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(e){E.current+=1;let t=uN(E.current);_(n=>[...n,{id:t,launch:e,title:null,adoptPtyId:null}]),b(t)},t[7]=k):k=t[7];let A=k,j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(e,t){let n=t.trim()===``?null:t.trim();_(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[8]=j):j=t[8];let M=j,N=(0,Q.useRef)(A),P;t[9]!==y||t[10]!==a?(P=function(e){let t=T.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>dN(e))}_(r),r.length===0&&(a(!1),d.current?.focus())},t[9]=y,t[10]=a,t[11]=P):P=t[11];let F=P,I=(0,Q.useRef)(gN),L;t[12]!==y||t[13]!==F||t[14]!==g?(L=()=>{N.current=A,w.current=y,T.current=g,I.current=()=>{y!==``&&F(y)}},t[12]=y,t[13]=F,t[14]=g,t[15]=L):L=t[15],(0,Q.useEffect)(L);let[R]=(0,Q.useState)(hN),z=(0,Q.useRef)(R),[B,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(W=function(e){U.current!=null&&clearTimeout(U.current),U.current=setTimeout(()=>{$M(e),U.current=null},100)},t[16]=W):W=t[16];let G=W,K=(0,Q.useRef)(null),q,J;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>()=>{U.current!=null&&clearTimeout(U.current),K.current!=null&&(window.removeEventListener(`pointerup`,K.current),K.current=null)},q=[],t[17]=q,t[18]=J):(q=t[17],J=t[18]),(0,Q.useEffect)(J,q);let Y,ee;t[19]!==s||t[20]!==x||t[21]!==g.length||t[22]!==i?(Y=()=>{if(!x)return;let e=O.current;if(O.current=i,s!=null&&s.nonce!==D.current){D.current=s.nonce,N.current(s);return}i&&!e&&g.length===0&&N.current(null)},ee=[i,s,g.length,x],t[19]=s,t[20]=x,t[21]=g.length,t[22]=i,t[23]=Y,t[24]=ee):(Y=t[23],ee=t[24]),(0,Q.useEffect)(Y,ee);let te;t[25]===n.terminal?te=t[26]:(te=()=>{if(typeof n.terminal?.list!=`function`||C.current)return;C.current=!0;let e=!1;return(async()=>{let t;try{t=await n.terminal.list()??[]}catch(e){console.error(`[terminal] reload session list() failed; cold-starting:`,e),t=[]}if(!e){if(t.length>0){let e=t.map(mN);E.current=e.length,_(e),b(e[0]?.id??``)}S(!0)}})(),()=>{e=!0,C.current=!1}},t[25]=n.terminal,t[26]=te);let ne;t[27]===n?ne=t[28]:(ne=[n],t[27]=n,t[28]=ne),(0,Q.useEffect)(te,ne);let re,ie;t[29]===n?(re=t[30],ie=t[31]):(re=()=>n.onMenuAction(e=>{e===`new-terminal`?N.current(null):e===`kill-terminal`&&I.current()}),ie=[n],t[29]=n,t[30]=re,t[31]=ie),(0,Q.useEffect)(re,ie);let ae,oe;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ae=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(lN)?.contains(document.activeElement))return;let t=T.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>dN(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},oe=[],t[32]=ae,t[33]=oe):(ae=t[32],oe=t[33]),(0,Q.useEffect)(ae,oe);let se;t[34]!==n.editor||t[35]!==g.length?(se=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[34]=n.editor,t[35]=g.length,t[36]=se):se=t[36];let ce;t[37]!==n||t[38]!==g.length?(ce=[n,g.length],t[37]=n,t[38]=g.length,t[39]=ce):ce=t[39],(0,Q.useEffect)(se,ce);let le,ue;t[40]!==u||t[41]!==i?(le=()=>{let e=u.current;e!=null&&(i?e.resize(`${z.current}px`):e.collapse())},ue=[i,u],t[40]=u,t[41]=i,t[42]=le,t[43]=ue):(le=t[42],ue=t[43]),(0,Q.useEffect)(le,ue);let de,fe;t[44]===f?(de=t[45],fe=t[46]):(de=()=>{f&&document.getElementById(lN)?.contains(document.activeElement)&&d.current?.focus()},fe=[f],t[44]=f,t[45]=de,t[46]=fe),(0,Q.useLayoutEffect)(de,fe);let pe,me;t[47]===f?(pe=t[48],me=t[49]):(pe=()=>{f||dN(w.current)},me=[f],t[47]=f,t[48]=pe,t[49]=me),(0,Q.useEffect)(pe,me);let he;if(t[50]!==c||t[51]!==g){let e;t[53]===c?e=t[54]:(e=(e,t)=>({id:e.id,label:e.title??c({id:`OVjNeX`,values:{0:t+1}})}),t[53]=c,t[54]=e),he=g.map(e),t[50]=c,t[51]=g,t[52]=he}else he=t[52];let ge=he,_e=B||void 0,ve;t[55]===r?ve=t[56]:(ve=(0,Z.jsx)(rT,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:d,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[55]=r,t[56]=ve);let ye;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,Z.jsx)(iT,{withHandle:!0,onPointerDown:()=>{V(!0),H.current=!0;let e=()=>{V(!1),H.current=!1,window.removeEventListener(`pointerup`,e),K.current=null};K.current=e,window.addEventListener(`pointerup`,e)}}),t[57]=ye):ye=t[57];let be;t[58]===l?be=t[59]:(be=cu(l),t[58]=l,t[59]=be);let xe;t[60]===be.background?xe=t[61]:(xe={backgroundColor:be.background},t[60]=be.background,t[61]=xe);let Se=i?`${R}px`:0,Ce;t[62]!==a||t[63]!==i?(Ce=e=>{let t=e.asPercentage===0;p(t),H.current&&(t&&i?a(!1):!t&&!i&&a(!0),e.inPixels>0&&(z.current=e.inPixels,G(e.inPixels)))},t[62]=a,t[63]=i,t[64]=Ce):Ce=t[64];let we=!B&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Te;t[65]===we?Te=t[66]:(Te=Ti(`flex flex-col`,we),t[65]=we,t[66]=Te);let Ee;t[67]!==y||t[68]!==n||t[69]!==F||t[70]!==g||t[71]!==ge?(Ee=g.length>0?(0,Z.jsx)(cN,{sessions:ge,activeSessionId:y,onSelect:b,onTabActivate:pN,onNew:()=>A(null),onClose:F,className:`h-full`,children:g.map(e=>(0,Z.jsx)(WM,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(nN,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onTitleChange:t=>M(e.id,t),onClose:()=>F(e.id)})},e.id))}):null,t[67]=y,t[68]=n,t[69]=F,t[70]=g,t[71]=ge,t[72]=Ee):Ee=t[72];let De;t[73]!==f||t[74]!==u||t[75]!==xe||t[76]!==Se||t[77]!==Ce||t[78]!==Te||t[79]!==Ee?(De=(0,Z.jsx)(rT,{id:lN,style:xe,panelRef:u,defaultSize:Se,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:Ce,inert:f,className:Te,children:Ee}),t[73]=f,t[74]=u,t[75]=xe,t[76]=Se,t[77]=Ce,t[78]=Te,t[79]=Ee,t[80]=De):De=t[80];let Oe;return t[81]!==_e||t[82]!==ve||t[83]!==De?(Oe=(0,Z.jsxs)(nT,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":_e,children:[ve,ye,De]}),t[81]=_e,t[82]=ve,t[83]=De,t[84]=Oe):Oe=t[84],Oe}function pN(e){return queueMicrotask(()=>dN(e))}function mN(e,t){return{id:uN(t+1),launch:null,title:null,adoptPtyId:e.ptyId}}function hN(){return eN()}function gN(){}var _N=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BXgtHL25.js`),__vite__mapDeps([46,1,2,47,48,49,31,50,51,52,53,54,55,56,57,20,9,10,7,11,30,3,32,6,4,15,12,13,22,14,58,16,43,59,23,60,61,62]),import.meta.url)).ActivityModeContent})),vN=`300px`,yN=`600px`;function bN(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(SN,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(xN,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(P,{name:`editor-area`,children:(0,Z.jsxs)(Ka,{children:[n,r]})}),t[3]=n,t[4]=i),i}function xN(){let e=(0,$.c)(5),t=Zi(),n;e[0]===t?n=e[1]:(n=e=>{e||t.close()},e[0]=t,e[1]=n);let r;return e[2]!==t.open||e[3]!==n?(r=(0,Z.jsx)(Zw,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function SN(e){let t=(0,$.c)(187),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalLaunch:l}=e,u=s===void 0?!1:s,d=l===void 0?null:l,{_:f}=cn(),{activeDocName:p,activeProvider:m,activeTarget:h,recycleDocument:g,docPanelMode:_,docPanelAgentId:v,docPanelExpandSignal:y}=_t(),{openDocumentTransition:b}=At(),{requestAddProperty:x}=Ua(),S=ET(m,p),C=kT(p,n===`source`?`source`:`wysiwyg`),w=YT(m),T=w===`connected`||w===`synced`,E=OT(p)===`conflict`,[D,O]=(0,Q.useState)(!1),k,A;t[0]!==m||t[1]!==D?(k=()=>{m!=null&&!D&&O(!0)},A=[m,D],t[0]=m,t[1]=D,t[2]=k,t[3]=A):(k=t[2],A=t[3]),(0,Q.useEffect)(k,A);let j=(0,Q.useDeferredValue)(p),M=h?.kind===`missing`,N=!!p&&h?.kind!==`folder`,P;t[4]!==f||t[5]!==M?(P=M?f({id:`K-a33w`}):void 0,t[4]=f,t[5]=M,t[6]=P):P=t[6];let F=P,[I]=(0,Q.useState)(EN),R=I!==null,[z]=(0,Q.useState)(TN),B;t[7]===I?B=t[8]:(B=()=>RT(I,window.innerWidth,`right`),t[7]=I,t[8]=B);let[V,H]=(0,Q.useState)(B),U=(0,Q.useRef)(V),W,G;t[9]===V?(W=t[10],G=t[11]):(W=()=>{U.current=V},G=[V],t[9]=V,t[10]=W,t[11]=G),(0,Q.useEffect)(W,G);let K=Gx(),q;t[12]===V?q=t[13]:(q=()=>qT(`right`,V,GT())===`collapsed`,t[12]=V,t[13]=q);let[J]=(0,Q.useState)(q),[Y,ee]=(0,Q.useState)(J),te=(0,Q.useRef)(Y),ne,re;t[14]===Y?(ne=t[15],re=t[16]):(ne=()=>{te.current=Y},re=[Y],t[14]=Y,t[15]=ne,t[16]=re),(0,Q.useEffect)(ne,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(wN),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{NT(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==K?(ge=function(){if(K.current==null)return;let e=U.current;Y?(JT(`right`,e,`open`),K.current?.expand()):(JT(`right`,e,`collapsed`),K.current?.collapse())},t[20]=Y,t[21]=K,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==I||t[24]!==K?(ve=()=>{let e=window.matchMedia(`(min-width: ${IT}px)`),t=()=>{let e=RT(I,window.innerWidth,`right`);H(e);let t=qT(`right`,e,GT())===`collapsed`;ee(t),t?K.current?.collapse():K.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[I,K],t[23]=I,t[24]=K,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==R||t[29]!==K?(be=()=>{if(me==null||R)return;let e=new ResizeObserver(()=>{te.current||oe.current||K.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,R,K],t[27]=me,t[28]=R,t[29]=K,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==a||t[33]!==K?(Se=()=>{let e=e=>{a(e),K.current?.expand()},t=r_();return t&&e(t),a_(t=>{r_(),e(t)})},Ce=[a,K],t[32]=a,t[33]=K,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==y||t[37]!==K?(we=()=>{y!==0&&K.current?.expand()},Te=[y,K],t[36]=y,t[37]=K,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{xl(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Ie,Le]=(0,Q.useState)(null),[Re,ze]=(0,Q.useState)(!1),Be=h?.kind===`large-file`?h.docName:p,Ve,He;t[52]===Be?(Ve=t[53],He=t[54]):(Ve=()=>{if(Be&&Be!==Pe.current){let e=Pe.current;Pe.current=Be,Le(e)}},He=[Be],t[52]=Be,t[53]=Ve,t[54]=He),(0,Q.useEffect)(Ve,He);let Ue;t[55]===b?Ue=t[56]:(Ue=function(e){let t=vo(e);window.location.hash===t?b(e):window.location.hash=t},t[55]=b,t[56]=Ue);let We=Ue,Ge,Ke=null;if(h?.kind===`large-file`){let e;t[57]!==We||t[58]!==Ie?(e=Ie?{previousDocName:Ie,onNavigateBack:We}:void 0,t[57]=We,t[58]=Ie,t[59]=e):e=t[59];let n;t[60]!==h.docName||t[61]!==h.limit||t[62]!==h.size||t[63]!==e?(n=(0,Z.jsx)(Pw,{docName:h.docName,size:h.size,limit:h.limit,backNav:e}),t[60]=h.docName,t[61]=h.limit,t[62]=h.size,t[63]=e,t[64]=n):n=t[64],Ge=n}else if(h?.kind===`folder`){let e;t[65]!==z||t[66]!==R||t[67]!==u?(e=bE({terminalVisible:u,isEmbedded:R,isDesktop:z}),t[65]=z,t[66]=R,t[67]=u,t[68]=e):e=t[68];let n=e,r;t[69]===h.folderPath?r=t[70]:(r=(0,Z.jsx)(Aw,{folderPath:h.folderPath}),t[69]=h.folderPath,t[70]=r);let i;t[71]!==h.folderPath||t[72]!==n?(i=n?(0,Z.jsx)(cE,{folderPath:h.folderPath}):null,t[71]=h.folderPath,t[72]=n,t[73]=i):i=t[73];let a;if(t[74]!==r||t[75]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[r,i]}),t[74]=r,t[75]=i,t[76]=a):a=t[76],Ge=a,_===`agent`&&v!==null){let e;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(iT,{withHandle:!0}),t[77]=e):e=t[77];let n;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(rT,{id:`agent-panel`,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ONPvOb`})}),children:(0,Z.jsx)(_N,{showBackButton:!1})})})]}),t[78]=n):n=t[78],Ke=n}}else if(h?.kind===`asset`){let e;t[79]!==h.assetPath||t[80]!==h.mediaKind?(e=(0,Z.jsx)(oS,{assetPath:h.assetPath,mediaKind:h.mediaKind},h.assetPath),t[79]=h.assetPath,t[80]=h.mediaKind,t[81]=e):e=t[81],Ge=e}else if(h?.kind===`skill-file`){let e=`${h.scope}/${h.name}/${h.path}`,n;t[82]!==h.name||t[83]!==h.path||t[84]!==h.scope||t[85]!==e?(n=(0,Z.jsx)(Hw,{scope:h.scope,name:h.name,path:h.path},e),t[82]=h.name,t[83]=h.path,t[84]=h.scope,t[85]=e,t[86]=n):n=t[86],Ge=n}else if(!m||!p)if((typeof window<`u`?Io(window.location.hash):null)!==null)if(o!=null&&D){let e;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sS,{}),t[87]=e):e=t[87],Ge=e;let n;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(iT,{withHandle:!0,disabled:!0}),t[88]=n):n=t[88];let r=J?0:`${se}px`,i;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[89]=i):i=t[89];let a;t[90]===r?a=t[91]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(rT,{id:`doc-panel`,defaultSize:r,minSize:vN,maxSize:yN,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[90]=r,t[91]=a),Ke=a}else{let e;return t[92]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sS,{}),t[92]=e):e=t[92],e}else{let e;t[93]===u?e=t[94]:(e=(0,Z.jsx)(YC,{terminalVisible:u}),t[93]=u,t[94]=e),Ge=e}else{let e=n===`source`,o=!T,s=Y,c;t[95]!==p||t[96]!==x?(c=function(){p&&x(p)},t[95]=p,t[96]=x,t[97]=c):c=t[97];let l=c,d;t[98]!==p||t[99]!==z||t[100]!==R||t[101]!==u?(d=yE({terminalVisible:u,isEmbedded:R,isDesktop:z,activeDocName:p}),t[98]=p,t[99]=z,t[100]=R,t[101]=u,t[102]=d):d=t[102];let f=d,m=j??p,h=Ie??void 0,v;t[103]!==F||t[104]!==e||t[105]!==We||t[106]!==g||t[107]!==m||t[108]!==h?(v=(0,Z.jsx)(yj,{activeDocName:m,isSourceMode:e,editorPlaceholder:F,previousDocName:h,onNavigateBack:We,onRecycle:g}),t[103]=F,t[104]=e,t[105]=We,t[106]=g,t[107]=m,t[108]=h,t[109]=v):v=t[109];let y;t[110]!==p||t[111]!==e?(y=(0,Z.jsx)(ST,{activeDocName:p,isSourceMode:e}),t[110]=p,t[111]=e,t[112]=y):y=t[112];let b;t[113]!==p||t[114]!==j?(b=zM({activeDocName:p,deferredActiveDocName:j,mountResolved:p!==null&&L(p),syncResolved:p!==null&&Fe(p)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(sS,{}),p===null?null:(0,Z.jsx)(Fw,{docName:p})]}):null,t[113]=p,t[114]=j,t[115]=b):b=t[115];let w;t[116]!==v||t[117]!==y||t[118]!==b?(w=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[v,y,b]}),t[116]=v,t[117]=y,t[118]=b,t[119]=w):w=t[119];let D;t[120]!==p||t[121]!==E||t[122]!==s||t[123]!==e||t[124]!==r||t[125]!==l||t[126]!==o||t[127]!==_e?(D=!E&&(0,Z.jsx)(RM,{activeDocName:p,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[120]=p,t[121]=E,t[122]=s,t[123]=e,t[124]=r,t[125]=l,t[126]=o,t[127]=_e,t[128]=D):D=t[128];let O;t[129]!==p||t[130]!==Re||t[131]!==e||t[132]!==f?(O=f?(0,Z.jsx)(cE,{docName:p,surface:e?`source`:`wysiwyg`,dismissed:Re,onDismiss:()=>ze(!0),onReopen:()=>ze(!1)}):null,t[129]=p,t[130]=Re,t[131]=e,t[132]=f,t[133]=O):O=t[133];let k;t[134]!==w||t[135]!==D||t[136]!==O?(k=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[w,D,O]}),t[134]=w,t[135]=D,t[136]=O,t[137]=k):k=t[137];let A;t[138]!==Re||t[139]!==f?(A=f&&Re?{onReopen:()=>ze(!1)}:null,t[138]=Re,t[139]=f,t[140]=A):A=t[140];let M;t[141]!==C||t[142]!==N||t[143]!==S||t[144]!==A?(M=(0,Z.jsx)(bM,{stats:S,selectionStats:C,showStats:N,composerBadge:A}),t[141]=C,t[142]=N,t[143]=S,t[144]=A,t[145]=M):M=t[145];let P;t[146]!==k||t[147]!==M?(P=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[k,M]}),t[146]=k,t[147]=M,t[148]=P):P=t[148],Ge=P;let I=R&&Y,B;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[149]=B):B=t[149];let V;t[150]===I?V=t[151]:(V=(0,Z.jsx)(iT,{withHandle:!0,disabled:I,onPointerDown:B}),t[150]=I,t[151]=V);let H=J?0:`${se}px`,U;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>{ee(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[152]=U):U=t[152];let W=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,G;t[153]===W?G=t[154]:(G=Ti(`flex flex-col bg-muted/20`,W),t[153]=W,t[154]=G);let q;t[155]!==p||t[156]!==i||t[157]!==_||t[158]!==e||t[159]!==a?(q=(0,Z.jsx)(Zy,{docName:p,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:_}),t[155]=p,t[156]=i,t[157]=_,t[158]=e,t[159]=a,t[160]=q):q=t[160];let te;t[161]!==Y||t[162]!==K||t[163]!==H||t[164]!==G||t[165]!==q?(te=(0,Z.jsx)(rT,{id:`doc-panel`,panelRef:K,defaultSize:H,minSize:vN,maxSize:yN,collapsible:!0,collapsedSize:0,onResize:U,inert:Y,className:G,children:q}),t[161]=Y,t[162]=K,t[163]=H,t[164]=G,t[165]=q,t[166]=te):te=t[166];let ne;t[167]!==V||t[168]!==te?(ne=(0,Z.jsxs)(Z.Fragment,{children:[V,te]}),t[167]=V,t[168]=te,t[169]=ne):ne=t[169],Ke=ne}let qe;t[170]!==c||t[171]!==o||t[172]!==d||t[173]!==u||t[174]!==Ge?(qe=o==null?Ge:(0,Z.jsx)(fN,{bridge:o,visible:u,onVisibleChange:c??CN,launch:d,children:Ge}),t[170]=c,t[171]=o,t[172]=d,t[173]=u,t[174]=Ge,t[175]=qe):qe=t[175];let Je=qe,Ye=ie||void 0,Xe;t[176]!==J||t[177]!==Ke?(Xe=Ke!=null&&!J?{}:{defaultSize:`100%`},t[176]=J,t[177]=Ke,t[178]=Xe):Xe=t[178];let Ze=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Qe;t[179]!==Je||t[180]!==Xe||t[181]!==Ze?(Qe=(0,Z.jsx)(rT,{minSize:`30%`,...Xe,className:Ze,children:Je}),t[179]=Je,t[180]=Xe,t[181]=Ze,t[182]=Qe):Qe=t[182];let $e;return t[183]!==Ke||t[184]!==Ye||t[185]!==Qe?($e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(nT,{orientation:`horizontal`,"data-dragging":Ye,children:[Qe,Ke]})}),t[183]=Ke,t[184]=Ye,t[185]=Qe,t[186]=$e):$e=t[186],$e}function CN(){}function wN(){return PT()}function TN(){return typeof window<`u`&&window.okDesktop!=null}function EN(){return Ir()}function DN(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 ON(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 kN=1e3,AN=!1;function jN(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function MN(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:Li(i)?a=i:(a=void 0,AN||(AN=!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`&&(jN({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=ON(i),{current:c,crossDoc:l}=a?Ni(a,n,Date.now()):{current:[],crossDoc:[]},u=NN,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>DN(e.current,p)&&DN(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,kN);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function NN(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var PN=`sync-status`;function FN(e,t){let n=(0,$.c)(6),{_:r}=cn(),i=zh(),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(t),c,l;n[0]!==r||n[1]!==t||n[2]!==i||n[3]!==e?(c=()=>{if(s.current!==t&&(s.current=t,a.current=!1,o.current=!1),t)if(e===`synced`&&(a.current=!0),e===`disconnected`&&a.current){if(i){qs.dismiss(PN);return}o.current=!0,qs.warning(r({id:`HGNCsl`}),{id:PN,duration:1/0})}else o.current&&e===`synced`&&(o.current=!1,qs.success(r({id:`GhjUB_`}),{id:PN,duration:3e3}))},l=[e,t,r,i],n[0]=r,n[1]=t,n[2]=i,n[3]=e,n[4]=c,n[5]=l):(c=n[4],l=n[5]),(0,Q.useEffect)(c,l)}var IN=4,LN=3,RN={Bird:Eu,Cat:Nu,Dog:Vu,Fish:qu,Mouse:Cd,Rabbit:Sd,Shrimp:kd,Snail:Ad,Squirrel:Nd,Turtle:Ud};Object.freeze(Object.keys(RN));function zN(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(RN,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var BN={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function VN(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=cn(),o=zN(n),s=o.kind===`animal`?RN[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=kr(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=di(n.color),t[2]=n.color,t[3]=u);let d=u,f=n.name,p;t[4]!==a||t[5]!==i||t[6]!==f?(p=i>1?a({id:`qAhFeg`,values:{userName:f,tabCount:i}}):f,t[4]=a,t[5]=i,t[6]=f,t[7]=p):p=t[7];let m=p,h;t[8]!==a||t[9]!==i||t[10]!==f?(h=i>1?a({id:`BEkF-P`,values:{userName:f,tabCount:i}}):f,t[8]=a,t[9]=i,t[10]=f,t[11]=h):h=t[11];let g=h,_;t[12]===n.color?_=t[13]:(_={backgroundColor:n.color},t[12]=n.color,t[13]=_);let v;t[14]!==s||t[15]!==d||t[16]!==l?(v=s?(0,Z.jsx)(s,{size:18,color:d,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:d},children:l}),t[14]=s,t[15]=d,t[16]=l,t[17]=v):v=t[17];let y;t[18]!==g||t[19]!==r||t[20]!==_||t[21]!==v?(y=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":g,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:_,children:v})}),t[18]=g,t[19]=r,t[20]=_,t[21]=v,t[22]=y):y=t[22];let b;t[23]===m?b=t[24]:(b=(0,Z.jsx)(pc,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(hc,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function HN(e){let t=BN[e.icon];return e.displayName||t||rc._({id:`iEQQyu`})}function UN(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 WN(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=cn(),{activeDocName:s}=_t(),{presence:c,agentId:l}=n,u=HN(c),d=UN(c.mode),f=!r&&d,p=c.currentDoc&&c.currentDoc!==`(connected)`?c.currentDoc:null,m=s!==null||p!==null,h=m?`cursor-pointer`:`cursor-default opacity-50`,g=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,_=f&&!i?`ring-primary/40 animate-pulse`:``,v;t[0]!==h||t[1]!==g||t[2]!==_?(v=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,h,g,_].filter(Boolean),t[0]=h,t[1]=g,t[2]=_,t[3]=v):v=t[3];let y=v.join(` `),b=r?`true`:void 0,x=i?`true`:void 0,S=m?void 0:`true`,C;t[4]!==c.mode||t[5]!==b||t[6]!==x||t[7]!==S?(C={"data-presence-badge":`agent`,"data-presence-mode":c.mode,"data-presence-crossdoc":b,"data-presence-scoped":x,"data-presence-inert":S},t[4]=c.mode,t[5]=b,t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=C,T=o(r&&p?{id:`b4AQFK`,values:{tooltipName:u,realCurrentDoc:p}}:{id:`RfHNf8`,values:{tooltipName:u}}),E;t[9]!==l||t[10]!==T||t[11]!==w||t[12]!==m||t[13]!==a||t[14]!==c.color||t[15]!==c.icon||t[16]!==p||t[17]!==y||t[18]!==u?(E=m?(0,Z.jsx)(`button`,{type:`button`,...w,"aria-label":T,className:y,style:{backgroundColor:c.color},onClick:()=>a(l,p),children:(0,Z.jsx)(Fi,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...w,role:`img`,"aria-label":u,className:y,style:{backgroundColor:c.color},children:(0,Z.jsx)(Fi,{icon:c.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=l,t[10]=T,t[11]=w,t[12]=m,t[13]=a,t[14]=c.color,t[15]=c.icon,t[16]=p,t[17]=y,t[18]=u,t[19]=E):E=t[19];let D=E,O;t[20]===D?O=t[21]:(O=(0,Z.jsx)(fc,{asChild:!0,children:D}),t[20]=D,t[21]=O);let k;t[22]===u?k=t[23]:(k=(0,Z.jsx)(`span`,{className:`font-medium`,children:u}),t[22]=u,t[23]=k);let A;t[24]!==r||t[25]!==p?(A=r&&p?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`Wh0im4`,values:{realCurrentDoc:p}})}):null,t[24]=r,t[25]=p,t[26]=A):A=t[26];let j;t[27]!==k||t[28]!==A?(j=(0,Z.jsxs)(pc,{className:`flex flex-col gap-0.5`,children:[k,A]}),t[27]=k,t[28]=A,t[29]=j):j=t[29];let M;return t[30]!==O||t[31]!==j?(M=(0,Z.jsxs)(hc,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function GN(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:s}=e,c;t[0]!==n||t[1]!==i?(c=i?rc._({id:`9euN0m`,values:{count:n}}):rc._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=c):c=t[2];let l=c,u=i?`true`:void 0,d;t[3]!==n||t[4]!==l||t[5]!==u?(d=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":u,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":l,children:[`+`,n]})}),t[3]=n,t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;if(t[7]!==i||t[8]!==s||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==s||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(VN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(WN,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:s},e.agentId),t[12]=i,t[13]=s,t[14]=a,t[15]=e):e=t[15],f=r.map(e),t[7]=i,t[8]=s,t[9]=r,t[10]=a,t[11]=f}else f=t[11];let p;t[16]===f?p=t[17]:(p=(0,Z.jsx)(q,{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:f})}),t[16]=f,t[17]=p);let m;return t[18]!==d||t[19]!==p?(m=(0,Z.jsxs)(he,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function KN(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(VN,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(WN,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function qN(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=_t(),{current:s,crossDoc:c}=MN(t,r,n);if(FN(YT(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,IN),n;e[6]===s?n=e[7]:(n=s.slice(IN),e[6]=s,e[7]=n);let r=n,u=c.slice(0,LN),d;e[8]===c?d=e[9]:(d=c.slice(LN),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>KN(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(GN,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>KN(e,p,!0,m)),f.length>0?(0,Z.jsx)(GN,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var JN=`.md`,YN=/\.(md|mdx)$/i;function XN(e,t=JN){return`${e}${t}`}function ZN(e){return TP(e).replace(YN,``)}function QN(e){return Ro(e)?tP(e.path):So(e)?e.path:XN(e.docName,e.docExt)}function $N(e){let t=TP(e).match(YN);return t?`.${t[1].toLowerCase()}`:void 0}function eP(e){return TP(e)}function tP(e){let t=TP(e.trim());return t?`${t}/`:``}function nP(e){return e.endsWith(`/`)?eP(e):ZN(e)}function rP(e){return e.map(QN)}function iP(e){return[...e].sort().join(`\0`)}function aP(e){return iP(rP(e))}function oP(e){let t=new Set;for(let n of e){let e=(Ro(n)||So(n)?n.path:n.docName).split(`/`).filter(Boolean);if(e.includes(`.ok`))continue;if(Ro(n)){let e=tP(n.path);e&&t.add(e)}let r=Ro(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function sP(e){if(!e)return[];let t=TP(e.replace(YN,``)).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 cP(e,t,n){let r=$N(e);if(r)return r;let i=n.find(e=>Fo(e)&&e.docName===t);return i?i.docExt??JN:wP(e).includes(`.`)?void 0:JN}function lP(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!So(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function uP(e,t,n){if($N(e))return null;let r=n.find(e=>So(e)&&e.path===t);return r?r.path:wP(e).includes(`.`)?t:lP(t,n)}function dP(e,t){let n=e.kind===`directory`,r=n?eP(e.path):ZN(e.path);if(n)return{kind:`folder`,name:TP(wP(e.path)).replace(YN,``),path:r,treePath:pP(e.path,!0)};let i=uP(e.path,r,t);if(i)return{kind:`asset`,name:TP(wP(i)),path:i,treePath:i};let a=cP(e.path,r,t);return{kind:`file`,name:TP(wP(e.path)).replace(YN,``),path:r,treePath:pP(e.path,!1),docExt:a}}function fP(e){return e.kind===`directory`?eP(e.path):e.path}function pP(e,t){return t?tP(e):YN.test(e)?e:`${e}${JN}`}function mP(e,t,n){let r=tP(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${JN}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function hP(e,t){return e===`file`?pP(t,!1):`${eP(t)}/index${JN}`}function gP(e,t){return t.kind===`root`||t.directoryPath==null?wP(e):`${t.directoryPath}${wP(e)}`}function _P(e,t){if(t)return eP(tP(e));let n=ZN(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function vP(e,t){let n=eP(tP(e));return n?`${n}/${t}`:t}function yP(e,t,n){e.append(`parentDocName`,vP(t,n)),e.append(`placement`,`parent-dir`)}function bP(e,t){return(t.path??vP(e,t.src)).replace(/^\/+/,``)}function xP(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function SP(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function CP(e,t){let n=mt(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:ZN(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:or(i),modified:r,size:t.size}}function wP(e){let t=TP(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function TP(e){return e.endsWith(`/`)?e.slice(0,-1):e}function EP(e,t){return t.trim()}function DP(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function OP(e,t){let n=EP(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function kP(e,t,n=[],r=[],i=[]){if(t.length===0&&n.length===0&&r.length===0&&i.length===0)return e;let a=new Map(t.map(e=>[e.fromDocName,e.toDocName])),o=new Map(i.map(e=>[e.toDocName,e.docExt])),s=new Map(r.map(e=>[e.fromPath,e.toPath]));return e.map(e=>{if(Fo(e)){let t=s.get(XN(e.docName,e.docExt));if(t){let n=wo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:or(n),size:e.size,modified:e.modified,referencedBy:[]}}let n=a.get(e.docName)??e.docName;return{...e,docName:n,docExt:o.get(n)??e.docExt}}if(Ro(e))return{...e,path:IP(e.path,n)};if(So(e)){let t=s.get(e.path);return t&&Ze(t)?{kind:`document`,docName:ZN(t),docExt:mt(t),size:e.size,modified:e.modified}:{...e,path:t??IP(e.path,n)}}return e})}function AP(e,t,n,r=[]){if(t.length===0&&!n&&r.length===0)return e;let i=new Set(t),a=new Set(r);return e.filter(e=>Fo(e)?!i.has(e.docName)&&!BP(e.docName,n):Ro(e)?!BP(e.path,n):So(e)?!a.has(e.path)&&!BP(e.path,n):!0)}function jP(e,t){if(e.kind!==`asset`||t.some(t=>So(t)&&t.path===e.path))return e;let n=lP(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function MP(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>LP(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Fo(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=>Ro(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(Fo(i)){let e=zP(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Ro(i)){let e=RP(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function NP(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function PP(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function FP(e,t){let n=e.kind===`file`?XN(e.path,e.docExt):e.path;return Ho(t.contentDir,n,t.pathSeparator)}function IP(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 LP(e,t){return Fo(e)&&Fo(t)?e.docName===t.docName:Ro(e)&&Ro(t)||So(e)&&So(t)?e.path===t.path:!1}function RP(e,t,n){return e===t?n:zP(e,t,n)}function zP(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function BP(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function VP(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)(Gf,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function HP(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=Ti(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Kf,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UP(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)(Yf,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function WP(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(tp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function GP(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=Ti(`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)(qf,{children:(0,Z.jsx)(Jf,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function KP(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=Ti(`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)(Zf,{"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 qP(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=Ti(`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)(co,{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)(np,{"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 JP(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=Ti(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg data-[state=closed]:overflow-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0 subtle-scrollbar`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(rp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YP(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=Ti(`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)($f,{children:(0,Z.jsx)($a,{})})}),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)(Qf,{"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 XP(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Ti(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(Xf,{"data-slot":`context-menu-label`,"data-inset":r,className:a,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function ZP(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=Ti(`-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)(ep,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var QP=`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`,$P=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,eF={start:[Ns.Space],cancel:[Ns.Esc],end:[Ns.Space,Ns.Enter]};function tF(e){return Ti(QP,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function nF(e){return e?void 0:-1}function rF({className:e,isDragging:t}){return Ti(e,t&&$P)}function iF(e){return e.code===Ns.Enter&&e.target===e.currentTarget}function aF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&iF(e)?`activate-tab`:`delegate-sortable`}function oF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Rs.Transform.toString(r?{...r,scaleX:1,scaleY:1}:null),transition:i,flexBasis:a??n?.flexBasis,maxWidth:a??n?.maxWidth,minWidth:a??n?.minWidth,opacity:n?.opacity,width:a??n?.width,zIndex:t?20:n?.zIndex}}function sF(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function cF(e){return({activeNodeRect:t,transform:n})=>{let r={...n,y:0};if(!e||!t)return r;let i=e.left-t.left,a=e.right-t.right;return r.x=Math.min(Math.max(r.x,i),a),r}}var lF=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(r){let e=1/0,i=-1/0,a=null,o=null;for(let r of t){let t=n.get(r.id);t&&(t.left<e&&(e=t.left,a=r),t.right>i&&(i=t.right,o=r))}if(!Number.isFinite(e)||!Number.isFinite(i))return[];let s=r.x<e?a:r.x>i?o:null;if(s)return[{id:s.id,data:{droppableContainer:s,value:0}}]}return Ds(e)},uF=[`.md`,`.mdx`],dF=`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`,fF=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,pF=Ti(fF,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),mF=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function hF(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function gF(e){let t=vo(e);window.location.hash!==t&&(window.location.hash=t)}function _F(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function vF(e,t){let n=[t,...uF].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 yF(e){let t=(0,$.c)(37),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({activateFromKeyboard:n,className:r,tabId:l,disabled:i,onKeyDown:a,ref:o,style:s,...c}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u;t[9]!==i||t[10]!==l?(u={id:l,disabled:i},t[9]=i,t[10]=l,t[11]=u):u=t[11];let{attributes:d,listeners:f,rect:p,setNodeRef:m,transform:h,transition:g,isDragging:_}=Is(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=oF({activeWidth:v,isDragging:_,outerStyle:s,transform:h,transition:g}),t[12]=_,t[13]=s,t[14]=v,t[15]=h,t[16]=g,t[17]=y):y=t[17];let b=y,x;t[18]!==o||t[19]!==m?(x=function(e){m(e),typeof o==`function`?o(e):o&&`current`in o&&(o.current=e)},t[18]=o,t[19]=m,t[20]=x):x=t[20];let S=x,C=f?.onKeyDown,w;t[21]!==n||t[22]!==_||t[23]!==a||t[24]!==C?(w=function(e){a?.(e);let t=aF({event:e,hasKeyboardActivation:!!n,isDragging:_});if(t!==`ignore`){if(t===`activate-tab`&&n){e.preventDefault(),n();return}C?.(e)}},t[21]=n,t[22]=_,t[23]=a,t[24]=C,t[25]=w):w=t[25];let T=w,E;t[26]!==r||t[27]!==_?(E=rF({className:r,isDragging:_}),t[26]=r,t[27]=_,t[28]=E):E=t[28];let D;return t[29]!==d||t[30]!==S||t[31]!==T||t[32]!==f||t[33]!==c||t[34]!==b||t[35]!==E?(D=(0,Z.jsx)(`div`,{ref:S,"data-editor-tab-sortable":``,className:E,style:b,...c,...d,...f,onKeyDown:T}),t[29]=d,t[30]=S,t[31]=T,t[32]=f,t[33]=c,t[34]=b,t[35]=E,t[36]=D):D=t[36],D}function bF(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=an(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=an(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y;t[13]===n?y=t[14]:(y=(0,Z.jsx)(HP,{asChild:!0,children:n}),t[13]=n,t[14]=y);let b;t[15]!==r||t[16]!==u?(b=()=>r(u),t[15]=r,t[16]=u,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(X,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(KP,{disabled:m,onSelect:b,children:x}),t[19]=m,t[20]=b,t[21]=S):S=t[21];let C=g.length===0,w;t[22]!==i||t[23]!==g?(w=()=>{i(g)},t[22]=i,t[23]=g,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(X,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(KP,{disabled:C,onSelect:w,children:T}),t[26]=C,t[27]=w,t[28]=E):E=t[28];let D=v.length===0,O;t[29]!==v||t[30]!==i?(O=()=>{i(v)},t[29]=v,t[30]=i,t[31]=O):O=t[31];let k;t[32]===l.length?k=t[33]:(k=l.length?(0,Z.jsx)(X,{id:`U2Kx6T`}):(0,Z.jsx)(X,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(KP,{disabled:D,"data-testid":`editor-tab-context-close-all`,onSelect:O,children:k}),t[34]=D,t[35]=O,t[36]=k,t[37]=A):A=t[37];let j;t[38]!==f||t[39]!==m||t[40]!==c||t[41]!==u||t[42]!==d?(j=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZP,{}),(0,Z.jsx)(KP,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(X,{id:`SYfHmN`}):(0,Z.jsx)(X,{id:`3pU8e-`})})]}),t[38]=f,t[39]=m,t[40]=c,t[41]=u,t[42]=d,t[43]=j):j=t[43];let M;t[44]!==E||t[45]!==A||t[46]!==j||t[47]!==S?(M=(0,Z.jsxs)(GP,{className:`min-w-40`,children:[S,E,A,j]}),t[44]=E,t[45]=A,t[46]=j,t[47]=S,t[48]=M):M=t[48];let N;return t[49]!==M||t[50]!==y?(N=(0,Z.jsxs)(VP,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function xF(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:i,isPinned:a,tabId:o,unpinTab:s}=e,{_:c}=cn();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)(xd,{"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]===i?u=t[14]:(u=tF(i),t[13]=i,t[14]=u);let d;t[15]===i?d=t[16]:(d=nF(i),t[15]=i,t[16]=d);let f;t[17]!==r||t[18]!==o?(f=e=>{e.stopPropagation(),r(o)},t[17]=r,t[18]=o,t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Js,{"aria-hidden":`true`}),t[20]=p):p=t[20];let m;return t[21]!==l||t[22]!==u||t[23]!==d||t[24]!==f?(m=(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":l,"data-testid":`editor-tab-close-button`,className:u,tabIndex:d,onClick:f,children:p}),t[21]=l,t[22]=u,t[23]=d,t[24]=f,t[25]=m):m=t[25],m}function SF(e){let t=(0,$.c)(1),{docName:n}=e;if(OT(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(yo,{"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 CF(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=_t(),{_:T}=cn(),{pageMeta:E}=Oo(),D=(0,Q.useRef)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(``),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(t),U;e[0]!==n||e[1]!==t||e[2]!==i?(U=n??(i?h(i):t?Yt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=U):U=e[3];let G=U,K;e[4]!==r||e[5]!==G||e[6]!==m||e[7]!==g||e[8]!==v?(K=m?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:G?`${G}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=G,e[6]=m,e[7]=g,e[8]=v,e[9]=K):K=e[9];let q=K,Y,ee;e[10]===t?(Y=e[11],ee=e[12]):(Y=()=>{H.current=t},ee=[t],e[10]=t,e[11]=Y,e[12]=ee),(0,Q.useEffect)(Y,ee);let te,ne;e[13]===q?(te=e[14],ne=e[15]):(te=()=>{q&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[q],e[13]=q,e[14]=te,e[15]=ne),(0,Q.useEffect)(te,ne);let re,ie;e[16]===A?(re=e[17],ie=e[18]):(re=()=>{A&&(R.current?.focus(),R.current?.select())},ie=[A],e[16]=A,e[17]=re,e[18]=ie),(0,Q.useEffect)(re,ie);let ae,oe;e[19]!==v||e[20]!==A?(ae=()=>{!A||v.includes(A.tabId)||(B.current=!0,V.current=null,j(null),N(``),F(null),L(!1))},oe=[v,A],e[19]=v,e[20]=A,e[21]=ae,e[22]=oe):(ae=e[21],oe=e[22]),(0,Q.useEffect)(ae,oe);let se=function(e,t){let n=t.split(`/`);B.current=!1,V.current=null,j({docName:t,tabId:e}),N(n[n.length-1]),F(null)},ce=function(){B.current=!0,V.current=null,j(null),N(``),F(null),L(!1)},le=async function(){if(B.current){B.current=!1;return}if(z.current)return;let e=A?.docName;if(!e){ce();return}let t=EP(`file`,vF(M,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){ce();return}if(t===V.current){R.current?.focus();return}if(!DP(t)){F(T({id:`P8yDjG`})),R.current?.focus();return}let i=OP({kind:`file`,path:e,name:r},t);z.current=!0,L(!0),F(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:i})});if(B.current){L(!1),z.current=!1;return}let r=await J(n,`Server error (HTTP ${n.status})`);if(!r.ok){F(r.title),L(!1),z.current=!1,V.current=t,R.current?.focus();return}let a=s(Pr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=H.current,l=NP(o,a);W(a);let u=!0;try{let e=PP(a,f(),p);await Promise.all(e.map(e=>c(e))),x(a),$s([`files`,`backlinks`,`graph`])}catch(n){let r=n;u=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),qs.error(T({id:`MUBR8r`}))}B.current=!0,j(null),N(``),F(null),L(!1),z.current=!1,V.current=null,u&&l&&l!==o&&gF(l)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),F(T({id:`HIb0vl`})),L(!1),z.current=!1,V.current=t,R.current?.focus()}},ue=typeof window<`u`&&window.okDesktop!=null,de;e[23]===g?de=e[24]:(de=new Set(g),e[23]=g,e[24]=de);let fe=de,pe;e[25]===O?pe=e[26]:(pe=cF(O),e[25]=O,e[26]=pe);let me;e[27]===pe?me=e[28]:(me=[pe],e[27]=pe,e[28]=me);let he=me,ge;e[29]!==l||e[30]!==d||e[31]!==fe?(ge=function(e){let t=[],n=[];for(let r of e)fe.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[29]=l,e[30]=d,e[31]=fe,e[32]=ge):ge=e[32];let _e=ge,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:As,keyboardCodes:eF},e[34]=ye):ye=e[34];let be=Ls(ws(Os,ve),ws(js,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(sF(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(Te=function(e){we();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(Ps([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=ue?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=Ti(`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]`,ue&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=_F,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=Ti(`flex items-end gap-1`,ue&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let je=Es,Me=lF,Ne;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ne={container:typeof document<`u`?document.body:void 0},e[43]=Ne):Ne=e[43];let Pe=Ms,Fe;e[44]===w?Fe=e[45]:(Fe=[...w],e[44]=w,e[45]=Fe);let Ie=Ts,Le=w.map(e=>{if(fe.has(e)){let t=e===r;return(0,Z.jsx)(bF,{tabId:e,canPin:!1,openTabs:w,closeTab:l,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(yF,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Ti(dF,t?fF:pF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:mF,onClick:()=>o(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(X,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:tF(t),tabIndex:nF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Js,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=en(e),n=e===G,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=Zt(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(bF,{tabId:e,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(yF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ti(dF,n?fF:pF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:mF,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:Ti(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Ti(`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)(xF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`||t.kind===`skill-file`){let{baseName:r,label:o,prefix:s}=Zt(t.kind===`asset`?t.assetPath:t.path,``),c=`${s}${o}`;return(0,Z.jsx)(bF,{tabId:e,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(yF,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ti(dF,n?fF:pF),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:mF,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:Ti(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Ti(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(xF,{accessibleLabel:c,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let s=t.docName,c=E.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Zt(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,_=A?.tabId===e,v=`editor-tab-rename-error-${hF(s)}`;return(0,Z.jsx)(bF,{disabled:_,tabId:e,openTabs:w,closeTab:u,closeTabs:_e,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(yF,{tabId:e,activateFromKeyboard:()=>a(e),disabled:_,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Ti(dF,n?fF:pF,_&&P&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:_?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(aT,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(uT,{ref:R,value:M,disabled:I,"aria-label":T({id:`Dw1T_W`,values:{label:p}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":P?!0:void 0,"aria-describedby":P?v:void 0,"aria-busy":I||void 0,title:P??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{N(vF(e.target.value,c)),F(null),V.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),le()):e.key===`Escape`&&(e.preventDefault(),ce())},onBlur:le}),(0,Z.jsx)(sT,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(lT,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),P?(0,Z.jsx)(`span`,{id:v,role:`alert`,className:`sr-only`,children:P}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":h,title:h,className:mF,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),se(e,s)},tabIndex:-1,children:[(0,Z.jsx)(SF,{docName:s}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),(0,Z.jsx)(xF,{accessibleLabel:h,closeTab:u,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),Re;e[46]!==Pe||e[47]!==Fe||e[48]!==Ie||e[49]!==Le?(Re=(0,Z.jsx)(Pe,{items:Fe,strategy:Ie,children:Le}),e[46]=Pe,e[47]=Fe,e[48]=Ie,e[49]=Le,e[50]=Re):Re=e[50];let ze;e[51]!==je||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Me||e[58]!==Ne||e[59]!==Re||e[60]!==he?(ze=(0,Z.jsx)(je,{sensors:be,autoScroll:!1,collisionDetection:Me,modifiers:he,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Ne,children:Re}),e[51]=je,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Me,e[58]=Ne,e[59]=Re,e[60]=he,e[61]=ze):ze=e[61];let Be;e[62]===T?Be=e[63]:(Be=T({id:`3YvS-c`}),e[62]=T,e[63]=Be);let Ve;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Z.jsx)(xt,{"aria-hidden":`true`}),e[64]=Ve):Ve=e[64];let He;e[65]!==_||e[66]!==Be?(He=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Be,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ve})}),e[65]=_,e[66]=Be,e[67]=He):He=e[67];let Ue;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`3YvS-c`})}),e[68]=Ue):Ue=e[68];let We;e[69]===He?We=e[70]:(We=(0,Z.jsxs)(hc,{children:[He,Ue]}),e[69]=He,e[70]=We);let Ge;e[71]!==Ae||e[72]!==ze||e[73]!==We?(Ge=(0,Z.jsxs)(`div`,{className:Ae,children:[ze,We]}),e[71]=Ae,e[72]=ze,e[73]=We,e[74]=Ge):Ge=e[74];let Ke;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==Ge?(Ke=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":De,className:Oe,onWheel:ke,children:Ge}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=Ge,e[79]=Ke):Ke=e[79],Ke}var wF=(e,t,n)=>{if(e&&`reportValidity`in e){let r=ea(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},TF=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?wF(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>wF(t,n,e))}},EF=(e,t)=>{t.shouldUseNativeValidation&&TF(e,t);let n={};for(let r in e){let i=ea(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(DF(t.names||Object.keys(e),r)){let e=Object.assign({},ea(n,r));Vi(e,`root`,a),Vi(n,r,e)}else Vi(n,r,a)}return n},DF=(e,t)=>{let n=OF(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>OF(e).match(`^${n}\\.\\d+`))};function OF(e){return e.replace(/[\[\]]/g,``)}function kF(){return kF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kF.apply(null,arguments)}function AF(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function jF(e,t){for(var n={};e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(`unionErrors`in r){var s=r.unionErrors[0].errors[0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Fa(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function MF(e,t){for(var n={},r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o])if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors[0][0];n[o]={message:s.message,type:s.code}}else n[o]={message:a,type:i};if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(kF({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=Fa(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function NF(e,t,n){if(n===void 0&&(n={}),function(e){return`_def`in e&&typeof e._def==`object`&&`typeName`in e._def}(e))return function(r,i,a){try{return Promise.resolve(AF(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&TF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:EF(jF(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(AF(function(){return Promise.resolve((n.mode===`sync`?Un:vr)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&TF({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof er}(e))return{values:{},errors:EF(MF(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var PF=`https://openknowledge.ai/api/subscribe`;async function FF(e){try{let t=await fetch(PF,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e}),signal:AbortSignal.timeout(15e3)});return t.ok?{ok:!0}:t.status===400?{ok:!1,reason:`invalid`}:t.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${t.status}`),{ok:!1,reason:`error`})}catch(e){return console.warn(`[subscribe] action=submit result=network-error message=${e instanceof Error?e.message:String(e)}`),{ok:!1,reason:`error`}}}function IF(e){let t=(0,$.c)(47),{title:n,description:r,onSuccess:i,onDismiss:a,autoFocus:o,className:s}=e,{_:c}=cn(),[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),f,p;t[0]===l?(f=t[1],p=t[2]):(f=()=>{l&&d.current?.focus()},p=[l],t[0]=l,t[1]=f,t[2]=p),(0,Q.useEffect)(f,p);let m,h;if(t[3]!==c){let e=fr({email:nr({message:c({id:`Wq6Wcm`})})});h=Bi,m=NF(e),t[3]=c,t[4]=m,t[5]=h}else m=t[4],h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={email:``},t[6]=g):g=t[6];let _;t[7]===m?_=t[8]:(_={resolver:m,defaultValues:g},t[7]=m,t[8]=_);let v=h(_),{isSubmitting:y}=v.formState,b=v.formState.errors.email?.message??v.formState.errors.root?.message,x;t[9]!==c||t[10]!==v||t[11]!==i?(x=async function(e){v.clearErrors(`root`);let t=await FF(e.email);if(t.ok){u(!0),i?.();return}if(t.reason===`invalid`){v.setError(`email`,{message:c({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){v.setError(`root`,{message:c({id:`4mLBx9`})});return}v.setError(`root`,{message:c({id:`fWsBTs`})})},t[9]=c,t[10]=v,t[11]=i,t[12]=x):x=t[12];let S=x,C;t[13]===s?C=t[14]:(C=Ti(`flex flex-col gap-3`,s),t[13]=s,t[14]=C);let w=l?-1:void 0,T;t[15]!==l||t[16]!==n?(T=l?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)($a,{className:`size-4 text-primary`}),(0,Z.jsx)(X,{id:`PIMM5l`})]}):n??(0,Z.jsx)(X,{id:`GzPQ2f`}),t[15]=l,t[16]=n,t[17]=T):T=t[17];let E;t[18]!==T||t[19]!==w?(E=(0,Z.jsx)(`p`,{ref:d,tabIndex:w,className:`text-base font-medium leading-tight text-foreground focus:outline-none`,children:T}),t[18]=T,t[19]=w,t[20]=E):E=t[20];let D;t[21]!==r||t[22]!==l?(D=l?(0,Z.jsx)(X,{id:`pBROkv`}):r??(0,Z.jsx)(X,{id:`WmPbvm`}),t[21]=r,t[22]=l,t[23]=D):D=t[23];let O;t[24]===D?O=t[25]:(O=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,role:`status`,children:D}),t[24]=D,t[25]=O);let k;t[26]!==E||t[27]!==O?(k=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E,O]}),t[26]=E,t[27]=O,t[28]=k):k=t[28];let A;t[29]!==c||t[30]!==a?(A=a?(0,Z.jsx)(Di,{type:`button`,variant:`ghost`,size:`icon`,onClick:a,"aria-label":c({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(Js,{className:`size-4`})}):null,t[29]=c,t[30]=a,t[31]=A):A=t[31];let j;t[32]!==k||t[33]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[k,A]}),t[32]=k,t[33]=A,t[34]=j):j=t[34];let M;t[35]!==c||t[36]!==o||t[37]!==b||t[38]!==v||t[39]!==y||t[40]!==S||t[41]!==l?(M=l?null:(0,Z.jsxs)(`form`,{onSubmit:v.handleSubmit(S),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)($i,{control:v.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(aT,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(sT,{className:`pl-2.5`,children:(0,Z.jsx)(ud,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(uT,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:o,placeholder:c({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":c({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Di,{type:`submit`,disabled:y,className:`mr-1 ml-auto text-1sm`,"data-testid":`subscribe-submit`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`lCC_D5`})})]}):(0,Z.jsx)(X,{id:`EDl9kS`})})]})}}),b?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:b}):null]}),t[35]=c,t[36]=o,t[37]=b,t[38]=v,t[39]=y,t[40]=S,t[41]=l,t[42]=M):M=t[42];let N;return t[43]!==j||t[44]!==M||t[45]!==C?(N=(0,Z.jsxs)(`div`,{className:C,children:[j,M]}),t[43]=j,t[44]=M,t[45]=C,t[46]=N):N=t[46],N}function LF(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 RF(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 zF=`https://github.com/inkeep/open-knowledge`,BF=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:at},{label:{id:`PCNIuJ`},href:`${zF}/issues/new`,icon:Fu},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:mo}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:LF},{label:`X (Twitter)`,href:`https://x.com/OpenKnowledgeAI`,icon:RF},{label:`GitHub`,href:zF,icon:tm}]}],VF=`${zF}/releases`,HF=`group flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`;function UF(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var WF=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=cn(),i,a,o,s;t[0]!==r||t[1]!==n?(i=UF(n),a=`img`,o=`ml-auto flex items-center gap-1 text-xs tabular-nums text-muted-foreground`,s=r({id:`SVLPt5`,values:{formatted:i}}),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s):(i=t[2],a=t[3],o=t[4],s=t[5]);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Pd,{className:`size-3 fill-current`,"aria-hidden":`true`}),t[6]=c):c=t[6];let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s?(l=(0,Z.jsxs)(`span`,{role:a,className:o,"aria-label":s,children:[c,i]}),t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=l):l=t[11],l},GF=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=cn(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>ic(e,o),l=e=>ic(e,o),t[0]=o,t[1]=c,t[2]=l);let u;t[3]===s?u=t[4]:(u=(0,Z.jsx)(s,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t[3]=s,t[4]=u);let d;t[5]!==i||t[6]!==a?(d=typeof a==`string`?a:i(a),t[5]=i,t[6]=a,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==r?(f=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,onClick:c,onAuxClick:l,className:HF,children:[u,d,r]})}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=r,t[14]=f):f=t[14],f},KF=e=>{let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:n}),t[0]=n,t[1]=r),r},qF=()=>{let e=(0,$.c)(28),{_:t}=cn(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(null),l,u;e[0]!==n||e[1]!==s?(l=()=>{if(!n||s!==null)return;let e=new AbortController;return Ar({signal:e.signal}).then(e=>{e!==null&&c(e)}),()=>e.abort()},u=[n,s],e[0]=n,e[1]=s,e[2]=l,e[3]=u):(l=e[2],u=e[3]),(0,Q.useEffect)(l,u);let d;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{r(e),e||a(!1)},e[4]=d):d=e[4];let f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(_,{className:`size-4`}),e[5]=f):f=e[5];let p;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[f,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`s-MGs7`})})]})})}),e[6]=p):p=e[6];let m;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsxs)(hc,{children:[p,(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`s-MGs7`})})]}),e[7]=m):m=e[7];let h;e[8]!==t||e[9]!==s?(h=BF.map((e,n)=>(0,Z.jsxs)(`div`,{className:Ti(n>0&&`mt-3`),children:[(0,Z.jsx)(KF,{children:t(e.heading)}),(0,Z.jsx)(`nav`,{"aria-label":t(e.heading),children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:e.links.map(e=>(0,Z.jsx)(GF,{link:e,trailing:e.href===zF&&s!==null?(0,Z.jsx)(WF,{count:s}):void 0},e.href))})})]},e.key)),e[8]=t,e[9]=s,e[10]=h):h=e[10];let g;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(KF,{children:(0,Z.jsx)(X,{id:`arUUsK`})}),e[11]=g):g=e[11];let v;e[12]===t?v=e[13]:(v=t({id:`arUUsK`}),e[12]=t,e[13]=v);let y;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(GF,{link:{label:{id:`3ePd3I`},href:VF,icon:fd}}),e[14]=y):y=e[14];let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(o,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,className:Ti(HF,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(ud,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(X,{id:`EDl9kS`})]})}),e[15]=b):b=e[15];let x;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(q,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(IF,{autoFocus:!0,onDismiss:()=>a(!1)})}),e[16]=x):x=e[16];let S;e[17]===i?S=e[18]:(S=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[y,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(he,{open:i,onOpenChange:a,children:[b,x]})})]}),e[17]=i,e[18]=S);let C;e[19]!==S||e[20]!==v?(C=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[g,(0,Z.jsx)(`nav`,{"aria-label":v,children:S})]}),e[19]=S,e[20]=v,e[21]=C):C=e[21];let w;e[22]!==C||e[23]!==h?(w=(0,Z.jsxs)(q,{align:`end`,className:`w-56 p-3`,children:[h,C]}),e[22]=C,e[23]=h,e[24]=w):w=e[24];let T;return e[25]!==n||e[26]!==w?(T=(0,Z.jsxs)(he,{open:n,onOpenChange:d,children:[m,w]}),e[25]=n,e[26]=w,e[27]=T):T=e[27],T},JF=50,YF=()=>{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,Ww.preload()},JF))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=ra)},l=(0,Z.jsx)(Dd,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(fc,{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:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(hc,{children:[u,(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},XF=`https://openknowledge.ai/docs/features/share`;function ZF(e){let t=(0,$.c)(42),{input:n,onClickWhenNoRemote:r}=e,{_:i}=cn(),{status:a}=ia(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d;t[0]===c?.autoCopyFailed?d=t[1]:(d=()=>{!c?.autoCopyFailed||!u.current||(u.current.focus(),u.current.select())},t[0]=c?.autoCopyFailed,t[1]=d);let f;t[2]===c?f=t[3]:(f=[c],t[2]=c,t[3]=f),(0,Q.useEffect)(d,f);let p=a?.hasRemote===!0,m=n===null,h;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(h=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await Yi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:is,toastSuccess:aI,toastError:iI,logEvent:rI});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0})}catch{qs.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=h):h=t[9];let g=h,v=c!==null,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{e||l(null)},t[10]=y):y=t[10];let b;t[11]!==i||t[12]!==n?.kind?(b=n?.kind===`folder`?i({id:`WR0y2O`}):i({id:`F4IYWe`}),t[11]=i,t[12]=n?.kind,t[13]=b):b=t[13];let x=o||m,S,C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Od,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(X,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let w;t[16]!==g||t[17]!==b||t[18]!==x?(w=(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsxs)(Di,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:g,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=g,t[17]=b,t[18]=x,t[19]=w):w=t[19];let T;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`Z8lGw6`})}),t[20]=T):T=t[20];let E;t[21]===c?.autoCopyFailed?E=t[22]:(E=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`ndeI89`})}):null,t[21]=c?.autoCopyFailed,t[22]=E);let D=c?.url??``,O;t[23]===i?O=t[24]:(O=i({id:`5-FeN2`}),t[23]=i,t[24]=O);let k;t[25]!==D||t[26]!==O?(k=(0,Z.jsx)(fl,{ref:u,readOnly:!0,value:D,onFocus:nI,onClick:tI,onContextMenu:eI,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":O}),t[25]=D,t[26]=O,t[27]=k):k=t[27];let A=c?.url??``,j=c?.autoCopyFailed===!1,M;t[28]!==A||t[29]!==j?(M=(0,Z.jsx)(`div`,{className:`absolute inset-y-0 right-1 flex items-center`,children:(0,Z.jsx)(`div`,{className:`rounded-md bg-background/50 backdrop-blur-sm`,children:(0,Z.jsx)(H,{copyContent:A,clipboardWrite:is,initialCopied:j})})}),t[28]=A,t[29]=j,t[30]=M):M=t[30];let N;t[31]!==k||t[32]!==M?(N=(0,Z.jsxs)(`div`,{className:`relative`,children:[k,M]}),t[31]=k,t[32]=M,t[33]=N):N=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(`a`,{href:XF,target:`_blank`,rel:`noopener noreferrer`,onClick:$F,onAuxClick:QF,className:`mt-2 flex items-center gap-1.5 self-start text-xs text-muted-foreground transition-colors hover:text-primary`,children:[(0,Z.jsx)(_,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(X,{id:`aByJ8j`})]}),t[34]=P):P=t[34];let F;t[35]!==E||t[36]!==N?(F=(0,Z.jsxs)(q,{align:`end`,className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-popover`,children:[T,E,N,P]}),t[35]=E,t[36]=N,t[37]=F):F=t[37];let I;return t[38]!==w||t[39]!==F||t[40]!==v?(I=(0,Z.jsxs)(he,{open:v,onOpenChange:y,children:[w,F]}),t[38]=w,t[39]=F,t[40]=v,t[41]=I):I=t[41],I}function QF(e){return ic(e,XF)}function $F(e){return ic(e,XF)}function eI(e){return e.currentTarget.select()}function tI(e){return e.currentTarget.select()}function nI(e){return e.currentTarget.select()}function rI(e){return console.log(e)}function iI(e){e!==`Link ready but could not copy to clipboard.`&&qs.error(e)}function aI(e){return qs.success(e)}function oI(e){let t=(0,$.c)(35),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=cn(),{activeDocName:o,activeTarget:s}=_t(),c=o?ti(o):null,{state:l,isDraggingRail:u}=Wj(),d=Y_(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=bl(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=bl(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=Ji(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=ya(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=Ji(``),t[5]=e):e=t[5],_=e;break bb0}_=null}let v=_,y=typeof window<`u`&&window.okDesktop!=null,b=l===`collapsed`,x=y?``:void 0,S=y&&b&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,C=y&&!u&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,w;t[6]!==S||t[7]!==C?(w=Ti(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,y&&`[-webkit-app-region:drag]`,S,C),t[6]=S,t[7]=C,t[8]=w):w=t[8];let T=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Yj,{className:Ti(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(pc,{children:l===`expanded`?(0,Z.jsx)(X,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(X,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(hc,{children:[(0,Z.jsx)(fc,{asChild:!0,children:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:Ti(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(nt,{"aria-hidden":`true`})})}),(0,Z.jsx)(pc,{children:(0,Z.jsx)(X,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(sa,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(CF,{})]}),E;t[9]===T?E=t[10]:(E=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:T}),t[9]=T,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=Ti(`flex shrink-0 items-center justify-end gap-2 px-3`,y&&`[&>*]:[-webkit-app-region:no-drag]`),t[11]=D):D=t[11];let O;t[12]!==h||t[13]!==g||t[14]!==v||t[15]!==d?(O=!d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ZF,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(Ia,{open:h,onOpenChange:g})]}),t[12]=h,t[13]=g,t[14]=v,t[15]=d,t[16]=O):O=t[16];let k;t[17]!==r||t[18]!==n?(k=(0,Z.jsx)(ma,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(qN,{}),j=(0,Z.jsx)(sa,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(Tp,{}),t[20]=A,t[21]=j,t[22]=M):(A=t[20],j=t[21],M=t[22]);let N;t[23]===d?N=t[24]:(N=!d&&(0,Z.jsx)(YF,{}),t[23]=d,t[24]=N);let P;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(qF,{}),t[25]=P):P=t[25];let F;t[26]!==O||t[27]!==k||t[28]!==N?(F=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P]}),t[26]=O,t[27]=k,t[28]=N,t[29]=F):F=t[29];let I;return t[30]!==F||t[31]!==x||t[32]!==w||t[33]!==E?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,F]}),t[30]=F,t[31]=x,t[32]=w,t[33]=E,t[34]=I):I=t[34],I}var sI=`open-knowledge:terminal-launch`;function cI(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(sI,{detail:{prompt:e,cli:t}}))}function lI(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.prompt==`string`&&e(n.prompt,n.cli)};return t.addEventListener(sI,n),()=>t.removeEventListener(sI,n)}function uI(e){let t=(0,$.c)(56),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=kv(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(Ky[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),[S,C]=(0,Q.useState)(null),w=(0,Q.useRef)(0),T=Gi(),{projectConfig:E,projectLocalConfig:D,projectLocalSynced:O,projectSynced:k}=ys(),{activeDocName:A}=_t(),j=T?.hasRemote,M=T?.pushPermission?.checkStatus,N;t[2]!==m||t[3]!==E||t[4]!==D||t[5]!==O||t[6]!==k||t[7]!==j||t[8]!==M?(N=Nv({autoSyncOnboardingDismissed:m,hasRemote:j,projectLocalSynced:O,projectSynced:k,projectLocalConfig:D,projectConfig:E,pushPermissionCheckStatus:M}),t[2]=m,t[3]=E,t[4]=D,t[5]=O,t[6]=k,t[7]=j,t[8]=M,t[9]=N):N=t[9];let P=N,F,I;t[10]===A?(F=t[11],I=t[12]):(F=()=>{let e=function(e){let t=e.detail;t&&A&&Kl(A,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(xv,e),()=>window.removeEventListener(xv,e)},I=[A],t[10]=A,t[11]=F,t[12]=I),(0,Q.useEffect)(F,I);let L,R;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?v(pI):e===`new-terminal`&&v(!0)})},R=[],t[13]=L,t[14]=R):(L=t[13],R=t[14]),(0,Q.useEffect)(L,R);let z,B;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{if(window.okDesktop!=null)return;let e=function(e){xl(e,`toggle-terminal-panel`)&&(e.preventDefault(),v(fI))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},z=[],t[15]=z,t[16]=B):(z=t[15],B=t[16]),(0,Q.useEffect)(B,z);let V,H;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>lI((e,t)=>{v(!0),w.current+=1,C({prompt:e,cli:t,nonce:w.current})}),H=[],t[17]=V,t[18]=H):(V=t[17],H=t[18]),(0,Q.useEffect)(V,H);let U,W;t[19]===_?(U=t[20],W=t[21]):(U=()=>{_||C(null)},W=[_],t[19]=_,t[20]=U,t[21]=W),(0,Q.useEffect)(U,W);let G,K;t[22]!==y||t[23]!==_?(G=()=>{window.okDesktop!=null&&y&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:_})},K=[_,y],t[22]=y,t[23]=_,t[24]=G,t[25]=K):(G=t[24],K=t[25]),(0,Q.useEffect)(G,K);let q,J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(q=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){b(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(x.current=!0,v(!0))}).catch(dI).finally(()=>{t||b(!0)}),()=>{t=!0}},J=[],t[26]=q,t[27]=J):(q=t[26],J=t[27]),(0,Q.useEffect)(q,J);let Y,ee;t[28]===_?(Y=t[29],ee=t[30]):(Y=()=>{if(window.okDesktop!=null){if(x.current){x.current=!1;return}_&&Ea()}},ee=[_],t[28]=_,t[29]=Y,t[30]=ee),(0,Q.useEffect)(Y,ee),Av(T?.pausedReason);let te;t[31]===a?te=t[32]:(te=function(e){s(e),a(e)},t[31]=a,t[32]=te);let ne=te,re,ie;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(re=()=>{d(`auth`),l(!0)},ie=()=>{d(`identity`),l(!0)},t[33]=re,t[34]=ie):(re=t[33],ie=t[34]);let ae;t[35]===r?ae=t[36]:(ae=(0,Z.jsx)(oI,{onSignIn:re,onSetIdentity:ie,onOpenSearch:r}),t[35]=r,t[36]=ae);let oe;t[37]!==f||t[38]!==o||t[39]!==ne||t[40]!==S||t[41]!==_?(oe=(0,Z.jsx)(bN,{editorMode:o,onModeChange:ne,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:_,onTerminalVisibleChange:v,terminalLaunch:S}),t[37]=f,t[38]=o,t[39]=ne,t[40]=S,t[41]=_,t[42]=oe):oe=t[42];let se=u===`identity`,ce;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{l(!1)},t[43]=ce):ce=t[43];let le;t[44]!==c||t[45]!==se?(le=(0,Z.jsx)(ua,{open:c,onOpenChange:l,identityPrompt:se,onSuccess:ce}),t[44]=c,t[45]=se,t[46]=le):le=t[46];let ue;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>h(!0),t[47]=ue):ue=t[47];let de;t[48]===P?de=t[49]:(de=(0,Z.jsx)(jv,{open:P,onResolved:ue}),t[48]=P,t[49]=de);let fe;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(vv,{}),t[50]=fe):fe=t[50];let pe;return t[51]!==ae||t[52]!==oe||t[53]!==le||t[54]!==de?(pe=(0,Z.jsxs)(Z.Fragment,{children:[ae,oe,le,de,fe]}),t[51]=ae,t[52]=oe,t[53]=le,t[54]=de,t[55]=pe):pe=t[55],pe}function dI(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function fI(e){return!e}function pI(e){return!e}function mI(e){let t=vo(po(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function hI(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=qi();if(n)return null;if(r===`server`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`section`,{"data-testid":`conflicts-section`,"aria-label":`Conflicted files`,className:`border-b border-amber-200/60 bg-amber-50/40 px-2 py-2 dark:border-amber-900/40 dark:bg-amber-950/20`,children:(0,Z.jsxs)(`p`,{"data-testid":`conflicts-section-error`,className:`px-2 py-1.5 text-[12px] text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(yo,{"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)(yo,{"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(gI),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 gI(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:()=>mI(e.file),children:[(0,Z.jsx)(yo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var _I=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
32
32
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
33
33
|
<path d="M12.4697 5.46973C12.7626 5.17684 13.2374 5.17684 13.5303 5.46973C13.8232 5.76262 13.8232 6.23738 13.5303 6.53028L8.53028 11.5303C8.23738 11.8232 7.76262 11.8232 7.46973 11.5303L2.46973 6.53028C2.17684 6.23738 2.17684 5.76262 2.46973 5.46973C2.76262 5.17684 3.23738 5.17684 3.53028 5.46973L8 9.93946L12.4697 5.46973Z" fill="currentcolor"/>
|
|
34
34
|
</symbol>
|
|
@@ -1940,14 +1940,14 @@ Error generating stack: `+e.message+`
|
|
|
1940
1940
|
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;
|
|
1941
1941
|
pointer-events: none;
|
|
1942
1942
|
}
|
|
1943
|
-
`;function dq(e){mq(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=mt(r);Ze(r)&&fq(i),!t.hasAttribute(oq)&&(hq(t),t.setAttribute(oq,``))}function fq(e){sq=e,cq!==null&&clearTimeout(cq),cq=setTimeout(pq,lq)}function pq(){sq=null,cq!==null&&(clearTimeout(cq),cq=null)}function mq(e){let t=e.querySelectorAll(`[${aq}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(aq);if(!t){e.removeAttribute(aq);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(aq);continue}let r=mt(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(aq)}if(sq===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(`/`)||mt(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==sq&&e.setAttribute(aq,sq))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&pq()}function hq(e){let t=mt(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function gq(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function _q(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function vq(e,t,n={}){if(!e)return _q(t);let r=Co(e);if(t&&r!==t)return _q(t);switch(e.kind){case`doc`:return _q(t??e.docName);case`large-file`:return _q(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?_q(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function yq(e,t){if(!e)return{kind:`none`};let n=t.find(t=>QN(t)===e);if(n&&So(n))return{kind:`asset`,path:n.path,hash:fo(n.path),mediaKind:n.mediaKind};let r=nP(e);return e.endsWith(`/`)?t.some(e=>Ro(e)?e.path===r||e.path.startsWith(`${r}/`):(So(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Fo(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var bq=`You can restore this file from the Trash.`;function xq(e){let t=bq,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function Sq(e,t){return e===`web`?null:xq(t)}function Cq(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function wq(e,t,n){let r=yq(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Fo(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var Tq=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function Eq(e){return typeof e==`string`&&Tq.includes(e)?e:`system-error`}function Dq(e){switch(e){case`not-found`:return rc._({id:`v41fCm`});case`permission-denied`:return rc._({id:`sJK6pq`});case`system-error`:return rc._({id:`Jqqevv`});case`path-escape`:return rc._({id:`WL6puM`})}}function Oq(e){let t=Dq(e.reason),n=e.detail;return n?rc._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):rc._({id:`dTaauv`,values:{reason:t}})}function kq(e){return e.kind===`folder`?`${e.name}/`:e.name}function Aq(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?kq(c):``;u=s?rc._({id:`5qNxOe`,values:{count:l}}):c?`${rc._({id:`E_BHoD`,values:{targetName:e}})}\n${Oq(c)}`:rc._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(to,{children:(0,Z.jsx)(X,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(ao,{children:[f,(0,Z.jsx)(eo,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(ro,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(jq)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(X,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(X,{id:`mf37rL`})]}):(0,Z.jsx)(X,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(X,{id:`s3caR3`})]}):(0,Z.jsx)(X,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(Di,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(io,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(no,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function jq(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:kq(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:Oq(e)})]},e.path)}function Mq(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Aa(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(X,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(X,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=l_(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(X,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function Nq(e){return e?.isDirectory()?e:null}function Pq(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function Fq(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=Nq(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}Pq(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var Iq=`open-knowledge:file-tree-menu-action-delete`,Lq=`open-knowledge:file-tree-menu-action-rename`,Rq=`open-knowledge:file-tree-menu-action-duplicate`;function zq(e){window.dispatchEvent(new CustomEvent(Iq,{detail:{target:e}}))}function Bq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Iq,t),()=>window.removeEventListener(Iq,t)}function Vq(e){window.dispatchEvent(new CustomEvent(Lq,{detail:{target:e}}))}function Hq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Lq,t),()=>window.removeEventListener(Lq,t)}function Uq(e){window.dispatchEvent(new CustomEvent(Rq,{detail:{target:e}}))}function Wq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Rq,t),()=>window.removeEventListener(Rq,t)}function Gq(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var Kq={Accept:`application/x-ndjson, application/json`};function qq(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var Jq=class extends Error{};function Yq(e){return typeof e==`object`&&!!e&&`type`in e}async function Xq(e){let t=e.body;if(!t)throw new Jq(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(Yq(n)){if(n.type===`error`)throw new Jq(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=Yn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
|
|
1944
|
-
`);for(;
|
|
1945
|
-
`)}}
|
|
1946
|
-
`)||
|
|
1947
|
-
${
|
|
1948
|
-
${
|
|
1949
|
-
${
|
|
1950
|
-
</svg>`,
|
|
1943
|
+
`;function dq(e){mq(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=mt(r);Ze(r)&&fq(i),!t.hasAttribute(oq)&&(hq(t),t.setAttribute(oq,``))}function fq(e){sq=e,cq!==null&&clearTimeout(cq),cq=setTimeout(pq,lq)}function pq(){sq=null,cq!==null&&(clearTimeout(cq),cq=null)}function mq(e){let t=e.querySelectorAll(`[${aq}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(aq);if(!t){e.removeAttribute(aq);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(aq);continue}let r=mt(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(aq)}if(sq===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(`/`)||mt(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==sq&&e.setAttribute(aq,sq))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&pq()}function hq(e){let t=mt(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function gq(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function _q(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function vq(e,t,n={}){if(!e)return _q(t);let r=Co(e);if(t&&r!==t)return _q(t);switch(e.kind){case`doc`:return _q(t??e.docName);case`large-file`:return _q(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?_q(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:case`skill-file`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function yq(e,t){if(!e)return{kind:`none`};let n=t.find(t=>QN(t)===e);if(n&&So(n))return{kind:`asset`,path:n.path,hash:fo(n.path),mediaKind:n.mediaKind};let r=nP(e);return e.endsWith(`/`)?t.some(e=>Ro(e)?e.path===r||e.path.startsWith(`${r}/`):(So(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Fo(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var bq=`You can restore this file from the Trash.`;function xq(e){let t=bq,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function Sq(e,t){return e===`web`?null:xq(t)}function Cq(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function wq(e,t,n){let r=yq(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>Fo(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var Tq=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function Eq(e){return typeof e==`string`&&Tq.includes(e)?e:`system-error`}function Dq(e){switch(e){case`not-found`:return rc._({id:`v41fCm`});case`permission-denied`:return rc._({id:`sJK6pq`});case`system-error`:return rc._({id:`Jqqevv`});case`path-escape`:return rc._({id:`WL6puM`})}}function Oq(e){let t=Dq(e.reason),n=e.detail;return n?rc._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):rc._({id:`dTaauv`,values:{reason:t}})}function kq(e){return e.kind===`folder`?`${e.name}/`:e.name}function Aq(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,s=n.length>1,c=n[0],l=n.length,u;if(t[0]!==l||t[1]!==s||t[2]!==c){let e=c?kq(c):``;u=s?rc._({id:`5qNxOe`,values:{count:l}}):c?`${rc._({id:`E_BHoD`,values:{targetName:e}})}\n${Oq(c)}`:rc._({id:`kolRU1`}),t[0]=l,t[1]=s,t[2]=c,t[3]=u}else u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(to,{children:(0,Z.jsx)(X,{id:`aOp3hw`})}),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=(0,Z.jsxs)(ao,{children:[f,(0,Z.jsx)(eo,{className:`whitespace-pre-wrap`,children:d})]}),t[5]=d,t[6]=p);let m;t[7]!==n||t[8]!==s?(m=s?(0,Z.jsx)(ro,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(jq)})}):null,t[7]=n,t[8]=s,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(X,{id:`dEgA5A`}),t[10]=h):h=t[10];let g;t[11]!==r||t[12]!==o?(g=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:h}),t[11]=r,t[12]=o,t[13]=g):g=t[13];let _;t[14]===r?_=t[15]:(_=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(X,{id:`mf37rL`})]}):(0,Z.jsx)(X,{id:`6gRgw8`}),t[14]=r,t[15]=_);let v;t[16]!==r||t[17]!==a||t[18]!==_?(v=(0,Z.jsx)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:_}),t[16]=r,t[17]=a,t[18]=_,t[19]=v):v=t[19];let y;t[20]===r?y=t[21]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(X,{id:`s3caR3`})]}):(0,Z.jsx)(X,{id:`UBv8UK`}),t[20]=r,t[21]=y);let b;t[22]!==r||t[23]!==i||t[24]!==y?(b=(0,Z.jsx)(Di,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:y}),t[22]=r,t[23]=i,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==b||t[27]!==g||t[28]!==v?(x=(0,Z.jsxs)(io,{children:[g,v,b]}),t[26]=b,t[27]=g,t[28]=v,t[29]=x):x=t[29];let S;return t[30]!==x||t[31]!==p||t[32]!==m?(S=(0,Z.jsxs)(no,{className:`sm:max-w-md`,children:[p,m,x]}),t[30]=x,t[31]=p,t[32]=m,t[33]=S):S=t[33],S}function jq(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:kq(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:Oq(e)})]},e.path)}function Mq(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Aa(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(X,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(X,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,s;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=l_(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(X,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),s=n;break bb0}let c;t[16]!==i||t[17]!==r?(c=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=c):c=t[18],o=n.map(c)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=s}else o=t[9],s=t[10];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[19]===o?c=t[20]:(c=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=c),c}function Nq(e){return e?.isDirectory()?e:null}function Pq(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function Fq(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=Nq(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}Pq(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var Iq=`open-knowledge:file-tree-menu-action-delete`,Lq=`open-knowledge:file-tree-menu-action-rename`,Rq=`open-knowledge:file-tree-menu-action-duplicate`;function zq(e){window.dispatchEvent(new CustomEvent(Iq,{detail:{target:e}}))}function Bq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Iq,t),()=>window.removeEventListener(Iq,t)}function Vq(e){window.dispatchEvent(new CustomEvent(Lq,{detail:{target:e}}))}function Hq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Lq,t),()=>window.removeEventListener(Lq,t)}function Uq(e){window.dispatchEvent(new CustomEvent(Rq,{detail:{target:e}}))}function Wq(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(Rq,t),()=>window.removeEventListener(Rq,t)}function Gq(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var Kq={Accept:`application/x-ndjson, application/json`};function qq(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var Jq=class extends Error{};function Yq(e){return typeof e==`object`&&!!e&&`type`in e}async function Xq(e,t={}){let n=e.body;if(!n)throw new Jq(`Show All Files stream had no response body.`);let{onBatch:r}=t,i=n.getReader(),a=new TextDecoder,o=[],s=[],c=!1,l=``,u=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(Yq(n)){if(n.type===`error`)throw new Jq(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return c=n.truncated===!0,!0}let r=Yn.safeParse(n);return r.success?(o.push(r.data),s.push(r.data)):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1},d=()=>{if(!r||s.length===0)return;let e=s;s=[],r(e)};try{let e=!1;for(;!e;){let t=await i.read();if(t.done)break;l+=a.decode(t.value,{stream:!0});let n=l.indexOf(`
|
|
1944
|
+
`);for(;n!==-1;){let t=u(l.slice(0,n));if(l=l.slice(n+1),t){e=!0;break}n=l.indexOf(`
|
|
1945
|
+
`)}d()}l+=a.decode(),l.includes(`
|
|
1946
|
+
`)||u(l),d()}finally{i.releaseLock()}return{entries:o,truncated:c}}function Zq(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>QN(e))),a=[];for(let e of t){let t=QN(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 Qq(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>QN(e))),r=[...e];for(let e of t){let t=QN(e);n.has(t)||(n.add(t),r.push(e))}return r}function $q(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>QN(e)===t))return[...e];let a=[],o=[];for(let n of e)eJ(t,QN(n))?a.push(n):o.push(n);let s=Zq(n,a,r,i),c=new Set(s.map(e=>QN(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=QN(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function eJ(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}var tJ=j(`HOVER_INTENT_MS`,80),nJ=3,rJ=20,iJ=new Map,aJ=new Set,oJ=[],sJ=new Map;function cJ(e){for(sJ.delete(e),sJ.set(e,!0);sJ.size>rJ;){let e=sJ.keys().next().value;if(e===void 0)break;sJ.delete(e)}}function lJ(e){aJ.delete(e),dJ()}function uJ(e,t){let n=Date.now();Ot(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),be(e,t,n)}function dJ(){for(;aJ.size<nJ&&oJ.length>0;){let e=oJ.shift();if(!e)break;if(!sJ.has(e.docName)){aJ.add(e.docName),cJ(e.docName);try{let t=e.prewarm(e.docName);t&&uJ(e.docName,t)}catch(t){Ot(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{lJ(e.docName)}}}}function fJ(e,t){if(He(e)||sJ.has(e))return;let n=iJ.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(iJ.delete(e),aJ.size>=nJ){oJ.push({docName:e,prewarm:t});return}cJ(e),aJ.add(e);try{let n=t(e);n&&uJ(e,n)}catch(t){Ot(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{lJ(e)}},tJ);iJ.set(e,{timer:r,prewarm:t})}function pJ(e){let t=iJ.get(e);t&&(clearTimeout(t.timer),iJ.delete(e))}var mJ=/\.(md|mdx)$/i;function hJ(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function gJ(e){let t=e.match(mJ);return t?t[0]:null}function _J(e){window.requestAnimationFrame(()=>{let t=ce(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function vJ(e){let t=e.current;t.row?.removeAttribute(AJ),t.root?.removeAttribute(jJ),e.current={row:null,root:null}}function yJ(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(vJ(e),t.row?.setAttribute(AJ,`true`),t.root?.setAttribute(jJ,`true`),e.current={row:t.row,root:t.root})}async function bJ(e,t){try{await navigator.clipboard.writeText(e),qs.success(t===`full`?rc._({id:`6_ZOw4`}):rc._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),qs.error(t===`full`?rc._({id:`vfRlCI`}):rc._({id:`5QGTaA`}))}}var xJ=new Set([`agents`,`agent`,`claude`,`skill`]),SJ=`ok-file-tree-link-decoration`,CJ=`ok-file-tree-agent-decoration`,wJ=`ok-file-tree-markdown`,TJ=`<symbol id="${wJ}" viewBox="${Ie}" fill="currentColor"><path d="${Ut}"/></symbol>`;function EJ(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function DJ(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${EJ(t)}</symbol>`}var OJ=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
1947
|
+
${DJ(SJ,We)}
|
|
1948
|
+
${DJ(CJ,ju)}
|
|
1949
|
+
${TJ}
|
|
1950
|
+
</svg>`,kJ=`
|
|
1951
1951
|
[data-file-tree-virtualized-root][data-file-tree-root-drag-target="true"] {
|
|
1952
1952
|
position: relative;
|
|
1953
1953
|
}
|
|
@@ -1970,15 +1970,15 @@ Error generating stack: `+e.message+`
|
|
|
1970
1970
|
border: 2px solid Highlight;
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
|
-
`,
|
|
1974
|
-
[data-type="item"][${
|
|
1973
|
+
`,AJ=`data-ok-external-file-drop-target`,jJ=`data-ok-external-file-drop-root-target`,MJ=`__external-file-drop__`,NJ=2e3,PJ=`
|
|
1974
|
+
[data-type="item"][${AJ}="true"] {
|
|
1975
1975
|
background: color-mix(in oklab, var(--color-primary) 10%, transparent);
|
|
1976
1976
|
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
|
|
1977
1977
|
}
|
|
1978
|
-
[data-file-tree-virtualized-root][${
|
|
1978
|
+
[data-file-tree-virtualized-root][${jJ}="true"] {
|
|
1979
1979
|
position: relative;
|
|
1980
1980
|
}
|
|
1981
|
-
[data-file-tree-virtualized-root][${
|
|
1981
|
+
[data-file-tree-virtualized-root][${jJ}="true"]::after {
|
|
1982
1982
|
content: "";
|
|
1983
1983
|
position: absolute;
|
|
1984
1984
|
inset: 0;
|
|
@@ -1989,16 +1989,16 @@ Error generating stack: `+e.message+`
|
|
|
1989
1989
|
pointer-events: none;
|
|
1990
1990
|
}
|
|
1991
1991
|
@media (forced-colors: active) {
|
|
1992
|
-
[data-type="item"][${
|
|
1992
|
+
[data-type="item"][${AJ}="true"] {
|
|
1993
1993
|
outline: 2px solid Highlight;
|
|
1994
1994
|
outline-offset: -2px;
|
|
1995
1995
|
}
|
|
1996
|
-
[data-file-tree-virtualized-root][${
|
|
1996
|
+
[data-file-tree-virtualized-root][${jJ}="true"]::after {
|
|
1997
1997
|
border: 2px solid Highlight;
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
|
-
`,
|
|
2001
|
-
:host([${
|
|
2000
|
+
`,FJ=`data-ok-creation-cleared`,IJ=`${KK}\n${uq}\n${kJ}\n${PJ}\n${`
|
|
2001
|
+
:host([${FJ}]) [data-item-focused="true"] {
|
|
2002
2002
|
--trees-focus-ring-color: transparent;
|
|
2003
2003
|
}
|
|
2004
|
-
`}\n${BK}\n${VK}`;function IJ(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&bJ.has(t)}function LJ(e){return e===`darwin`?rc._({id:`LtSYdi`}):e===`win32`?rc._({id:`qi1F96`}):rc._({id:`e1Rn_k`})}function RJ(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=cn(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=LJ(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=Ho(r.contentDir,fP(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(hs,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Jc,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function zJ(e,t){return dP({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function BJ(e,t){return e!==t&&e.startsWith(t)}function VJ(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>BJ(e,t))).map(e=>zJ(e,t))}function HJ(e,t){return e===t||e.startsWith(`${t}/`)}function UJ(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 WJ(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Fo(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):So(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=eP(e);HJ(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function GJ(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:HJ(t.createdPath,e.path)}function KJ(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onCreateFromTemplate:f,onDuplicate:p,onDelete:h,onExpandSubtree:g,onCollapseSubtree:_,folderTreePaths:v,isAsset:y,documents:b}=e,{_:x}=cn(),S=dP(n,b),C=n.kind===`directory`,w=S.kind===`asset`?null:S,T=w!==null&&c!==null,E;t[0]!==x||t[1]!==C?(E=x(C?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=x,t[1]=C,t[2]=E):E=t[2];let D=E,O=u?.appearance?.sidebar?.showHiddenFiles??!1,k=l!==null,A;t[3]!==C||t[4]!==n.path?(A=C?eP(n.path):null,t[3]=C,t[4]=n.path,t[5]=A):A=t[5];let j=Aa(A),M=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,N=s.getSelectedPaths(),P=N.includes(S.treePath)?VJ(N,b):[],F=P.length>1?P:[S],I=F.length,L=rc._({id:`djjdjr`,values:{deleteCount:I}}),R;t[6]!==y||t[7]!==C||t[8]!==n||t[9]!==a?(R=y?null:C?Ko({folderRelativePath:fP(n),workspace:a}):cs({docName:ZN(n.path),workspace:a}),t[6]=y,t[7]=C,t[8]=n,t[9]=a,t[10]=R):R=t[10];let z=R,B;t[11]===r?B=t[12]:(B=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=B);let V=B,H;t[13]===r?H=t[14]:(H=()=>r.close(),t[13]=r,t[14]=H);let U=H,{status:W}=ia(),G=W?.hasRemote===!0,K;t[15]!==y||t[16]!==C||t[17]!==n.path||t[18]!==S?(K=y||S.kind===`asset`?null:C?Ji(eP(n.path)):ya(ZN(n.path)),t[15]=y,t[16]=C,t[17]=n.path,t[18]=S,t[19]=K):K=t[19];let q=K,J=G&&q!==null,Y;t[20]!==x||t[21]!==G||t[22]!==q?(Y=()=>{q&&Yi({...q,hasRemote:G,onClickWhenNoRemote:()=>{qs.error(x({id:`WyQxwa`}))}},{clipboardWrite:is,toastSuccess:YJ,toastError:JJ,logEvent:qJ})},t[20]=x,t[21]=G,t[22]=q,t[23]=Y):Y=t[23];let ee=Y,te;t[24]!==J||t[25]!==U||t[26]!==ee?(te=J?(0,Z.jsxs)(Jc,{"data-testid":`file-tree-menu-share`,onSelect:()=>{U(),ee()},children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Z8lGw6`})]}):null,t[24]=J,t[25]=U,t[26]=ee,t[27]=te):te=t[27];let ne=te,re;t[28]!==x||t[29]!==l?(re=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Wr(t.error)),qs.error(x({id:`P47EWZ`}),{description:Wr(t.error)}))},t[28]=x,t[29]=l,t[30]=re):re=t[30];let ie=re,ae=0,oe=0;if(C){let e=tP(n.path);for(let t of v)(t===e||t.startsWith(e))&&(ae++,Nq(s.getItem(t))?.isExpanded()&&oe++)}let se=C&&oe<ae,ce=C&&oe>0,le;t[31]===U?le=t[32]:(le=e=>{e||U()},t[31]=U,t[32]=le);let ue;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[33]=ue):ue=t[33];let de;t[34]!==x||t[35]!==i||t[36]!==T||t[37]!==k||t[38]!==U||t[39]!==V||t[40]!==L||t[41]!==F||t[42]!==M||t[43]!==ie||t[44]!==o||t[45]!==z||t[46]!==D||t[47]!==y||t[48]!==C||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==w||t[53]!==_||t[54]!==f||t[55]!==h||t[56]!==p||t[57]!==g||t[58]!==d||t[59]!==ne||t[60]!==O||t[61]!==ce||t[62]!==se||t[63]!==S||t[64]!==a?(de=(0,Z.jsx)(Xc,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),d(`file`,eP(n.path))},children:[(0,Z.jsx)(Md,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`HdkSiO`})]}),M?(0,Z.jsxs)(Gc,{children:[(0,Z.jsxs)(ol,{disabled:i,children:[(0,Z.jsx)(ha,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Uuj_R4`})]}),(0,Z.jsx)(Nc,{children:(0,Z.jsx)(Mq,{parentDir:eP(n.path),onSelectTemplate:e=>{V(),f(eP(n.path),e)},ItemComponent:Jc})})]}):null,(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),d(`folder`,eP(n.path))},children:[(0,Z.jsx)(Xu,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`96G6Re`})]}),(0,Z.jsx)(sl,{}),(0,Z.jsx)(RJ,{item:n,workspace:a,onClose:U}),(0,Z.jsx)(qo,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(Gc,{children:[(0,Z.jsxs)(ol,{children:[(0,Z.jsx)(xs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`oCZkaG`})]}),(0,Z.jsxs)(Nc,{children:[(0,Z.jsx)(Jc,{disabled:!a,onSelect:()=>{a&&(U(),yJ(Ho(a.contentDir,fP(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(X,{id:`oQA-cA`})}),(0,Z.jsx)(Jc,{onSelect:()=>{U(),yJ(fP(n),`relative`)},children:(0,Z.jsx)(X,{id:`s061i4`})})]})]}),(0,Z.jsx)(sl,{}),(0,Z.jsx)(el,{checked:O,onCheckedChange:ie,disabled:!k,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(X,{id:`XcGbim`})}),se||ce?(0,Z.jsx)(sl,{}):null,se?(0,Z.jsxs)(Jc,{onSelect:()=>{U(),g(n.path)},children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`OlAl5i`})]}):null,ce?(0,Z.jsxs)(Jc,{onSelect:()=>{U(),_(n.path)},children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`qvWGzP`})]}):null,(0,Z.jsx)(sl,{}),(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{S.kind!==`asset`&&(U(),p(S))},children:[(0,Z.jsx)(vs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`euc6Ns`})]}),(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Cs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`2wxgft`})]}),(0,Z.jsxs)(Jc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;U();let e=iq(w),t=fa(c.current()),n=ca(t,e);if(n===t)return;c.patch(ga(n));let r=w.path.split(`/`).pop()||w.path;qs.success(x({id:`4xtLTl`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Jc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),h(F)},children:[(0,Z.jsx)(_s,{"aria-hidden":`true`}),L]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(RJ,{item:n,workspace:a,onClose:U}),!y&&(0,Z.jsx)(qo,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(Gc,{children:[(0,Z.jsxs)(ol,{children:[(0,Z.jsx)(xs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`oCZkaG`})]}),(0,Z.jsxs)(Nc,{children:[(0,Z.jsx)(Jc,{disabled:!a,onSelect:()=>{a&&(U(),yJ(Ho(a.contentDir,fP(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(X,{id:`oQA-cA`})}),(0,Z.jsx)(Jc,{onSelect:()=>{U(),yJ(fP(n),`relative`)},children:(0,Z.jsx)(X,{id:`s061i4`})})]})]}),(0,Z.jsx)(sl,{}),y?null:(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{U(),p(S)},children:[(0,Z.jsx)(vs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`euc6Ns`})]}),(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Cs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`2wxgft`})]}),w?(0,Z.jsxs)(Jc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;U();let e=iq(w),t=fa(c.current()),n=ca(t,e);if(n===t)return;c.patch(ga(n));let r=w.path.split(`/`).pop()||w.path;qs.success(x({id:`OD0FCX`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Jc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),h(F)},children:[(0,Z.jsx)(_s,{"aria-hidden":`true`}),L]})]})}),t[34]=x,t[35]=i,t[36]=T,t[37]=k,t[38]=U,t[39]=V,t[40]=L,t[41]=F,t[42]=M,t[43]=ie,t[44]=o,t[45]=z,t[46]=D,t[47]=y,t[48]=C,t[49]=n,t[50]=s,t[51]=c,t[52]=w,t[53]=_,t[54]=f,t[55]=h,t[56]=p,t[57]=g,t[58]=d,t[59]=ne,t[60]=O,t[61]=ce,t[62]=se,t[63]=S,t[64]=a,t[65]=de):de=t[65];let fe;return t[66]!==le||t[67]!==de?(fe=(0,Z.jsxs)(nl,{open:!0,modal:!1,onOpenChange:le,children:[ue,de]}),t[66]=le,t[67]=de,t[68]=fe):fe=t[68],fe}function qJ(e){return console.log(e)}function JJ(e){return qs.error(e)}function YJ(e){return qs.success(e)}async function XJ(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:Kq});if(qq(i)){let e=await Xq(i);return{kind:`entries`,entries:Lo(e.entries),truncated:e.truncated}}let a=await J(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Kn.safeParse(a.body);return o.success?{kind:`entries`,entries:Lo(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof Jq?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function ZJ(e){let t=(0,$.c)(356),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=cn(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=_t(),{notifySidebarFileSelected:v}=Wj(),{resolvedTheme:y}=xr(),{addPage:b,pageMeta:x}=Oo(),S;t[0]===x?S=t[1]:(S=function(e,t){return Po(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),go(vo(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=Ao(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),go(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(!0),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=zh(),R=(0,Q.useRef)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),{conflicts:Y}=qi(),[ee,te]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(ae),ce;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ce=new Set,t[10]=ce):ce=t[10];let le=(0,Q.useRef)(ce),ue=(0,Q.useRef)(k),de=(0,Q.useRef)(x),fe;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(fe=function(e,t){let n=t===void 0?k:t,r=yq(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,nP(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),go(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>Fo(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=fe):fe=t[16];let pe=fe,me;t[17]!==v||t[18]!==h?(me=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??ue.current).find(t=>So(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),go(fo(e)),v()},t[17]=v,t[18]=h,t[19]=me):me=t[19];let he=me,ge=(0,Q.useRef)(o),_e;t[20]===k?_e=t[21]:(_e=new Set(k.filter(So).map(wY)),t[20]=k,t[21]=_e);let ve=_e,ye=(0,Q.useRef)(ve),be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[22]=be):be=t[22];let xe=(0,Q.useRef)(be),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(CY),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(null),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ke={row:null,root:null},t[23]=ke):ke=t[23];let je=(0,Q.useRef)(ke),Me=(0,Q.useRef)(SY),Ne=(0,Q.useRef)(null),Pe;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=new Map,t[24]=Pe):Pe=t[24];let Fe=(0,Q.useRef)(Pe),Le;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Le=new Set,t[25]=Le):Le=t[25];let Re=(0,Q.useRef)(Le),ze;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ze=new Map,t[26]=ze):ze=t[26];let Be=(0,Q.useRef)(ze),Ve=(0,Q.useRef)(0),He;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(He=new Set,t[27]=He):He=t[27];let Ue=(0,Q.useRef)(He),We=(0,Q.useRef)(xY),Ge=(0,Q.useRef)(bY),Ke=(0,Q.useRef)(!1),Je=(0,Q.useRef)(null),Ye=(0,Q.useRef)(null),Xe=(0,Q.useRef)(yY),Qe=(0,Q.useRef)(vY),$e=(0,Q.useRef)(_Y),et=(0,Q.useRef)(gY),tt=(0,Q.useRef)(c),[nt,rt]=(0,Q.useState)(!1),it;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(){R.current!==null&&(clearTimeout(R.current),R.current=null)},t[28]=it):it=t[28];let at=it,ot;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(){at(),I(!1)},t[29]=ot):ot=t[29];let st=ot,ct;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){st(),P(e)},t[30]=ct):ct=t[30];let lt=ct,ut;t[31]===i?ut=t[32]:(ut=function(){if(at(),Fh()){P(null),I(!0),R.current=setTimeout(()=>{R.current=null,Je.current?.()},MJ);return}I(!1),P(i({id:`34qyH5`}))},t[31]=i,t[32]=ut);let dt=ut,ft=(0,Q.useRef)(!0),pt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>{if(ft.current){ft.current=!1;return}Je.current?.()},t[33]=pt):pt=t[33];let ht;t[34]===L?ht=t[35]:(ht=[L],t[34]=L,t[35]=ht),(0,Q.useEffect)(pt,ht);let gt,vt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(gt=()=>at,vt=[],t[36]=gt,t[37]=vt):(gt=t[36],vt=t[37]),(0,Q.useEffect)(gt,vt);let yt,bt;t[38]!==k.length||t[39]!==j?(yt=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=e,n=function(){Oe.current!==null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{De.current=!1,Oe.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=EY(e),n=t?.dataset.itemPath;if(!n)return;let r=wq(t.dataset.itemType===`folder`?tP(n):n,ue.current,de.current);r&&(Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!0,e.dataTransfer?.setData(xO,CO(r)))},i=function(e){if(!(e instanceof DragEvent)||!xP(e))return;let t=OY(e);if(!t){_J(je);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),vJ(je,t)},a=function(e){if(!(e instanceof DragEvent)||!xP(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||_J(je)},o=function(e){if(!(e instanceof DragEvent)||!xP(e))return;let t=OY(e),n=SP(e);if(!t||n.length===0){_J(je);return}e.preventDefault(),e.stopPropagation(),_J(je),Me.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),_J(je),Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!1}},bt=[k.length,j],t[38]=k.length,t[39]=j,t[40]=yt,t[41]=bt):(yt=t[40],bt=t[41]),(0,Q.useEffect)(yt,bt);let{selectedFilePath:xt,selectedFolderPath:St,navigationPath:Ct}=vq(c,m?null:o),wt=xt?XN(xt,k.find(e=>Fo(e)&&e.docName===xt)?.docExt):St?tP(St):c?.kind===`asset`?c.assetPath:null,Tt=ae?null:wt,Et=ts().states,{dispatch:Dt}=ls(),Ot;t[42]!==Dt||t[43]!==Et?(Ot={installStates:Et,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Dt},t[42]=Dt,t[43]=Et,t[44]=Ot):Ot=t[44];let kt=Ot,{okignoreBinding:At,projectLocalBinding:jt,merged:Mt}=ys(),Nt=Mt?.appearance?.sidebar?.showHiddenFiles??!1,Pt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=()=>Ne.current===null,t[45]=Pt):Pt=t[45];let Ft=Pt,It;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(It=[],t[46]=It):It=t[46];let Lt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Lt={set:`complete`,spriteSheet:DJ,byFileExtension:{md:{name:CJ,viewBox:Ie},mdx:{name:CJ,viewBox:Ie}}},t[47]=Lt):Lt=t[47];let Rt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Rt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Rt):Rt=t[48];let zt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(zt={canDrag:Ft,canDrop:Ft,onDropComplete:e=>et.current(e),onDropError:hY},t[49]=zt):zt=t[49];let Bt,Vt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Bt={canRename:Ft,onRename:e=>Qe.current(e),onError:e=>$e.current(e)},Vt=e=>Xe.current(e),t[50]=Bt,t[51]=Vt):(Bt=t[50],Vt=t[51]);let Ht;t[52]===i?Ht=t[53]:(Ht={paths:It,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...RK,icons:Lt,unsafeCSS:FJ,composition:Rt,dragAndDrop:zt,renaming:Bt,onSelectionChange:Vt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=ue.current.find(e=>Fo(e)&&XN(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:xJ,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return IJ(t.path)?{icon:SJ,title:i({id:`i9toLO`})}:null}let n=ue.current.find(e=>Ro(e)&&tP(e.path)===tP(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:xJ,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=i,t[53]=Ht);let{model:Ut}=LK(Ht),Wt;t[54]===Ut?Wt=t[55]:(Wt=function(e){let t=Ut.getItem(e)??Ut.getItem(tP(e));return t?.isDirectory()?tP(eP(t.getPath())):e},t[54]=Ut,t[55]=Wt);let Gt=Wt,Kt,qt;t[56]===k?(Kt=t[57],qt=t[58]):(qt=rP(k),Kt=iP(qt),t[56]=k,t[57]=Kt,t[58]=qt);let Jt=Kt,Yt=(0,Q.useRef)(qt),Xt;t[59]===k?Xt=t[60]:(Xt=oP(k),t[59]=k,t[60]=Xt);let Zt=Xt,Qt=(0,Q.useRef)(Zt),$t=St?sP(tP(St)).slice(0,-1):sP(Tt??Ct),en=$t.join(`\0`),tn;t[61]===Ut?tn=t[62]:(tn=()=>{let e=new Set;for(let t of Qt.current)Nq(Ut.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=Ut,t[62]=tn);let nn=tn,rn;t[63]===nn?rn=t[64]:(rn=e=>{let t=new Set(oP(e??ue.current)),n=nn();for(let e of xe.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=nn,t[64]=rn);let an=rn,on;t[65]!==an||t[66]!==Ut?(on=e=>{let t=rP(e??ue.current);Ut.resetPaths(t,{initialExpandedPaths:an(e)})},t[65]=an,t[66]=Ut,t[67]=on):on=t[67];let sn=on,ln;t[68]!==i||t[69]!==dt?(ln=async function(e){let t=Ve.current,n=new AbortController;Be.current.set(e,n);let r=await XJ(eP(e),n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Be.current.get(e)===n&&Be.current.delete(e),n.signal.aborted||t!==Ve.current)return;if(r.kind===`network-error`){dt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),lt(r.title);return}let a=Ke.current,o=Eo(r.entries,a);Re.current.add(e),A(t=>Qq(t,e,o,Fe.current)),P(null),st(),r.truncated&&B(r.entries.length)},t[68]=i,t[69]=dt,t[70]=ln):ln=t[70];let un=ln,dn;t[71]!==nn||t[72]!==un?(dn=()=>{let e=nn(),t=Ue.current;Ue.current=e;for(let n of e){if(t.has(n)||Re.current.has(n)||Be.current.has(n))continue;let e=eP(n);ue.current.find(t=>Ro(t)&&t.path===e)?.hasChildren!==!1&&un(n)}},t[71]=nn,t[72]=un,t[73]=dn):dn=t[73];let fn=dn,pn;t[74]!==nn||t[75]!==un?(pn=()=>{for(let e of nn())Re.current.has(e)||Be.current.has(e)||un(e)},t[74]=nn,t[75]=un,t[76]=pn):pn=t[76];let mn=pn,hn;t[77]!==Ut||t[78]!==sn?(hn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>Fo(e)&&e.docName===r);if(n==null||Ut.getItem(i)==null)continue;let s=XN(i,t.find(e=>Fo(e)&&e.docName===i)?.docExt??n.docExt);Ut.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=mt(e);if(t===``)continue;let n=e.slice(0,-t.length);Ut.getItem(n)!=null&&(Ut.getItem(e)??Ut.move(n,e),o=e,a+=1)}a!==0&&(sn(t),o!=null&&Ut.focusPath(o))},t[77]=Ut,t[78]=sn,t[79]=hn):hn=t[79];let gn=hn,_n;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_n=e=>{we.current=aP(e)},t[80]=_n):_n=t[80];let vn=_n,yn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(yn=e=>ye.current.has(e),t[81]=yn):yn=t[81];let bn=yn,xn;t[82]!==i||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==sn?(xn=async function(e){if(e.kind===`asset`||Ne.current!==null)return;let t=()=>{H(null),Ne.current=null};Ne.current=e.path,H(e.path),P(null);try{let n=await J(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){qs.error(n.title),sn(),t();return}let r=s(cr,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});qs.error(e),P(e),$s([`files`,`backlinks`,`graph`]),sn(),t();return}for(let e of r.duplicatedDocNames)b(e);A(t=>{let n=MP(t,e,r);return sn(n),vn(n),n}),$s([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?D(r.path):T(r.path)),qs.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),qs.error(i({id:`EBVbtP`}),{description:r}),sn(),t()}},t[82]=i,t[83]=b,t[84]=D,t[85]=T,t[86]=sn,t[87]=xn):xn=t[87];let Sn=xn,Cn=(0,Q.useRef)(Sn),wn;t[88]===Sn?wn=t[89]:(wn=()=>{Cn.current=Sn},t[88]=Sn,t[89]=wn),(0,Q.useEffect)(wn);let Tn=function(e){let t=mJ(e);if(!t||hJ(t))return!1;let n=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||bn(n))return!1;let r=hJ(n);if(!r)return!1;let i=tP(t);if(!Qt.current.includes(i))return!1;let a=`${t}${r}`;return Yt.current.includes(a)?!1:(ar({sourcePath:n,destinationPath:a,isFolder:!1}),Ut.move(n,a),!0)},En;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(En=e=>{let t=e??Se.current;!t||Se.current!==t||(t.disposeCommitListener(),Se.current=null)},t[90]=En):En=t[90];let Dn=En,On;t[91]!==i||t[92]!==Dn||t[93]!==u||t[94]!==l||t[95]!==sn?(On=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Dn(e),r&&H(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 J(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?qs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(H(null),sn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;qs.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(H(null),sn());return}r&&(e.kind===`file`?u(e.createdPath):l([Ae(e.createdPath)],{force:!0})),r&&A(t=>{let n=AP(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return vn(n),n}),$s([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&H(null)},t[91]=i,t[92]=Dn,t[93]=u,t[94]=l,t[95]=sn,t[96]=On):On=t[96];let kn=On,An,jn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(An=()=>()=>{let e=Se.current;e&&Ce.current(e,{restoreLocation:!1,updateUi:!1}).catch(mY)},jn=[],t[97]=An,t[98]=jn):(An=t[97],jn=t[98]),(0,Q.useEffect)(An,jn);let Mn;t[99]!==i||t[100]!==dt?(Mn=()=>{let e=!0,t=null,n=Gq(async function(){t?.abort();let n=new AbortController;t=n,Ve.current+=1;for(let e of Be.current.values())e.abort();Be.current.clear(),Re.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:Kq});if(qq(t)){let{entries:n,truncated:r}=await Xq(t);if(!e)return;let i=Ke.current,a=Eo(Lo(n),i);A(e=>Qq(e,``,a,Fe.current)),P(null),st(),B(r?n.length:null),Ge.current()}else{let n=await J(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)lt(n.title),B(null);else{let e=Kn.safeParse(n.body);if(!e.success)lt(i({id:`HlmZBk`})),B(null);else{let t=Ke.current,n=Eo(Lo(e.data.documents),t);A(e=>Qq(e,``,n,Fe.current)),P(null),st(),B(e.data.truncated===!0?e.data.documents.length:null),Ge.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof Jq?lt(r.message):dt()),console.warn(`[FileTree] fetch failed:`,r)}e&&M(!1)},()=>t?.abort());Je.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=ec(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Je.current=null,n.dispose();for(let e of Be.current.values())e.abort();Be.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[99]=i,t[100]=dt,t[101]=Mn):Mn=t[101];let Nn;t[102]===i?Nn=t[103]:(Nn=[i],t[102]=i,t[103]=Nn),(0,Q.useEffect)(Mn,Nn);let Pn=(0,Q.useRef)(!0),Fn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=()=>{if(Pn.current){Pn.current=!1;return}Je.current?.()},t[104]=Fn):Fn=t[104];let In;t[105]===Nt?In=t[106]:(In=[Nt],t[105]=Nt,t[106]=In),(0,Q.useEffect)(Fn,In);let Ln,Rn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=s(Kr,n,`workspace`,null);r&&ie({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(pY),()=>{e=!1}},Rn=[],t[107]=Ln,t[108]=Rn):(Ln=t[107],Rn=t[108]),(0,Q.useEffect)(Ln,Rn);let zn;t[109]!==an||t[110]!==Ut||t[111]!==Jt?(zn=()=>{if(we.current===Jt){we.current=null;return}Ut.resetPaths(Yt.current,{initialExpandedPaths:an()})},t[109]=an,t[110]=Ut,t[111]=Jt,t[112]=zn):zn=t[112];let Bn;t[113]!==Ut||t[114]!==Jt?(Bn=[Ut,Jt],t[113]=Ut,t[114]=Jt,t[115]=Bn):Bn=t[115],(0,Q.useEffect)(zn,Bn),Fq(Ut,Tt,en,Ee,Jt);let Vn,Hn;t[116]!==Ut||t[117]!==r?(Vn=()=>{if(!r)return;let e=0,t=0,n=()=>Ye.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Ut.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},Hn=[r,Ut],t[116]=Ut,t[117]=r,t[118]=Vn,t[119]=Hn):(Vn=t[118],Hn=t[119]),(0,Q.useEffect)(Vn,Hn);let Un;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Un=()=>{oe(!1)},t[120]=Un):Un=t[120];let Wn;t[121]===wt?Wn=t[122]:(Wn=[wt],t[121]=wt,t[122]=Wn),(0,Q.useEffect)(Un,Wn);let Gn,qn;t[123]===ae?(Gn=t[124],qn=t[125]):(Gn=()=>{se.current=ae;for(let e of le.current)e()},qn=[ae],t[123]=ae,t[124]=Gn,t[125]=qn),(0,Q.useEffect)(Gn,qn);let Yn;t[126]!==Tt||t[127]!==j||t[128]!==Ut?(Yn=()=>{j||!Tt||gq(Ut)},t[126]=Tt,t[127]=j,t[128]=Ut,t[129]=Yn):Yn=t[129];let Xn;t[130]!==en||t[131]!==Tt||t[132]!==j||t[133]!==Ut||t[134]!==Jt?(Xn=[Tt,en,Jt,j,Ut],t[130]=en,t[131]=Tt,t[132]=j,t[133]=Ut,t[134]=Jt,t[135]=Xn):Xn=t[135],(0,Q.useEffect)(Yn,Xn);let Zn,Qn;t[136]===Ut?(Zn=t[137],Qn=t[138]):(Zn=()=>Ut.subscribe(()=>{if(!Ut.isSearchOpen())for(let e of xe.current){let t=Nq(Ut.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Qn=[Ut],t[136]=Ut,t[137]=Zn,t[138]=Qn),(0,Q.useEffect)(Zn,Qn);let $n,er;t[139]===Ut?($n=t[140],er=t[141]):($n=()=>Ut.subscribe(()=>We.current()),er=[Ut],t[139]=Ut,t[140]=$n,t[141]=er),(0,Q.useEffect)($n,er);let tr,nr;t[142]===Ut?(tr=t[143],nr=t[144]):(tr=()=>Ut.onMutation(`remove`,e=>{let t=Se.current;!t||e.path!==t.renamePath||Ce.current(t)}),nr=[Ut],t[142]=Ut,t[143]=tr,t[144]=nr),(0,Q.useEffect)(tr,nr);let rr;t[145]!==b||t[146]!==d||t[147]!==f||t[148]!==he||t[149]!==D||t[150]!==T||t[151]!==p||t[152]!==gn||t[153]!==_?(rr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??ge.current,l=new Map,u=new Map;for(let e of ue.current){if(Fo(e)){let t=o.find(t=>t.fromPath===XN(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(So(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Ze(t)&&u.set(e.path,ZN(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(tt.current?.kind===`folder`?tt.current.folderPath:null),g=h?ne(h,a):null,v=r?.assetPath??(tt.current?.kind===`asset`?tt.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??NP(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??ne(v,a):null);W(e);let C=[...PP(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;A(t=>{let n=kP(t,e,a,o,s);return w=n,gn(t,n,e,o),vn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),gJ(x)):S&&(m||S!==v)&&he(S,w??ue.current),$s([`files`,`backlinks`,`graph`])},t[145]=b,t[146]=d,t[147]=f,t[148]=he,t[149]=D,t[150]=T,t[151]=p,t[152]=gn,t[153]=_,t[154]=rr):rr=t[154];let ir=rr;async function ar(e){let t=!e.isFolder&&bn(e.sourcePath),n=t?e.sourcePath:pP(e.sourcePath,e.isFolder);H(n),P(null);try{let r=qe(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Ze(r.destinationPath),o=t||a?r.destinationPath:pP(r.destinationPath,e.isFolder),c=e.isFolder?{kind:`folder`,fromPath:eP(n),toPath:eP(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:ZN(n),toPath:o},l={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null},u=await J(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`gijbne`}));if(!u.ok){qs.error(u.title),sn();let e=Se.current;e&&e.renamePath===n?await kn(e):Dn(),H(null);return}let d=s(Pr,u.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await ir(d.renamed,e.isFolder?[{fromPath:eP(n),toPath:eP(o)}]:[],d.renamedAssets,l,!e.isFolder&&!t&&!a?d.renamed.flatMap(e=>{let t=mt(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:d.renamed.length,renamedAssetCount:d.renamedAssets.length}),qs.error(i({id:`dDpCOp`}))}Dn(),H(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});qs.error(t),P(t),sn();let r=Se.current;r&&r.renamePath===n?await kn(r):Dn(),H(null)}}let or;t[155]!==i||t[156]!==ir||t[157]!==sn?(or=async function(e){let t=e.draggedPaths.map(t=>{let n=gP(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(fY);if(t.length!==0){H(t[0]?.sourcePath??null),P(null);try{let e=[],n=[],r=[],a={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&bn(a.sourcePath),c=t?{kind:`folder`,fromPath:eP(a.sourcePath),toPath:eP(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:ZN(a.sourcePath),toPath:ZN(a.destinationTreePath)},l=await J(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){qs.error(l.title),sn(),H(null);return}let u=s(Pr,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:eP(a.sourcePath),toPath:eP(a.destinationTreePath)})}try{await ir(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),qs.error(i({id:`8OxKZy`}))}H(null)}catch(e){console.warn(`[FileTree] move failed:`,e),qs.error(i({id:`HIb0vl`})),sn(),H(null)}}},t[155]=i,t[156]=ir,t[157]=sn,t[158]=or):or=t[158];let sr=or,ur;t[159]!==i||t[160]!==b||t[161]!==sn?(ur=async function(e,t,n){if(e.length===0||Ne.current!==null)return;let r=()=>{Ne.current=null,H(null)};Ne.current=n,H(n),P(null);let a=[],o=0,c=0;for(let n of e){let e=new FormData;e.append(`file`,n),yP(e,t,n.name||`upload`);try{let r=await J(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){c+=1,qs.error(r.title,{description:n.name});continue}let l=s(lr,r.body,`upload:drop`,null);if(l===null){c+=1,qs.error(i({id:`4Gz2wC`}),{description:n.name});continue}let u=bP(t,l);if(l.deduped===!0){c+=1,qs.error(i({id:`4sKwf6`}),{description:u});continue}o+=1;let d=CP(u,n);d&&a.push(d)}catch(e){let t=e;c+=1,console.warn(`[FileTree] external file upload failed:`,t),qs.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Fo(e)&&b(e.docName);A(e=>{let t=new Set(e.map(QN)),n=!1,r=[...e];for(let e of a){let i=QN(e);Fe.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(sn(r),vn(r),r):e})}o>0&&($s([`files`,`backlinks`,`graph`]),Je.current?.(),qs.success(rc._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),c>0&&P(o>0?rc._({id:`yH7T4q`,values:{failedCount:c}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),qs.error(n),P(n),r()}},t[159]=i,t[160]=b,t[161]=sn,t[162]=ur):ur=t[162];let dr=ur,fr;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(fr=function(e){te({parentDir:e})},t[163]=fr):fr=t[163];let pr=fr,mr;t[164]!==i||t[165]!==b||t[166]!==kn||t[167]!==Dn||t[168]!==Ut||t[169]!==D||t[170]!==T||t[171]!==sn||t[172]!==qt?(mr=async function(e,t,n){if(Ne.current)return;let r=Se.current;r&&Dn(r);try{let r=mP(e,t,[...qt,...Qt.current]);H(r.renamePath),Ne.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=hP(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await J(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){qs.error(a.title),H(null),Ne.current=null;return}let c=ZN(e),l=s(hr,a.body,`create-page`,{docName:c}).docName;o=l;let u={kind:`document`,docName:l,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(l),A(e=>{if(e.some(e=>Fo(e)&&e.docName===l))return e;let t=[...e,u];return vn(t),Fe.current.set(QN(u),Date.now()),t}),$s([`files`,`backlinks`,`graph`]),T(l)}else{let e=eP(r.addPath),t=await J(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){qs.error(t.title),H(null),Ne.current=null;return}o=s(vi,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};A(e=>{if(e.some(e=>Ro(e)&&e.path===o))return e;let t=[...e,n];return vn(t),Fe.current.set(QN(n),Date.now()),t}),$s([`files`]),D(o)}let c=!1,l=e=>{if(e.key!==`Enter`)return;let t=Se.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Dn(t))};document.addEventListener(`keydown`,l,!0),Se.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{c||(c=!0,document.removeEventListener(`keydown`,l,!0))}},H(null),Ne.current=null,Ut.add(r.addPath),Ut.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),qs.error(i({id:`S6l5dv`}));let t=Se.current;t?await kn(t):Dn(),H(null),Ne.current=null,sn()}},t[164]=i,t[165]=b,t[166]=kn,t[167]=Dn,t[168]=Ut,t[169]=D,t[170]=T,t[171]=sn,t[172]=qt,t[173]=mr):mr=t[173];let gr=mr,_r;t[174]===Ut?_r=t[175]:(_r=function(e){let t=tP(e);(0,Q.startTransition)(()=>{for(let e of Qt.current)if(e===t||e.startsWith(t)){let t=Nq(Ut.getItem(e));t&&t.expand()}})},t[174]=Ut,t[175]=_r);let vr=_r,yr;t[176]===Ut?yr=t[177]:(yr=function(e){let t=tP(e),n=new Set(xe.current);(0,Q.startTransition)(()=>{for(let e of[...Qt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=Nq(Ut.getItem(e));t&&t.collapse()}})},t[176]=Ut,t[177]=yr);let br=yr,Sr;t[178]!==pe||t[179]!==$t||t[180]!==o||t[181]!==c||t[182]!==ve||t[183]!==V||t[184]!==kn||t[185]!==fn||t[186]!==k||t[187]!==Zt||t[188]!==sr||t[189]!==ar||t[190]!==Gt||t[191]!==x||t[192]!==Tn||t[193]!==mn||t[194]!==Nt||t[195]!==qt||t[196]!==dr?(Sr=()=>{ue.current=k,de.current=x,ge.current=o,tt.current=c,ye.current=ve,Ne.current=V,Ke.current=Nt,Yt.current=qt,Qt.current=Zt,xe.current=$t,We.current=fn,Ge.current=mn,Ce.current=kn,Me.current=(e,t,n)=>{dr(e,t,n)},Xe.current=e=>{if(Ee.current||De.current||e.length!==1)return;let t=e[0];t&&(oe(!1),pe(Gt(t),k))},$e.current=e=>{Tn(e)||qs.error(e)},Qe.current=ar,et.current=sr},t[178]=pe,t[179]=$t,t[180]=o,t[181]=c,t[182]=ve,t[183]=V,t[184]=kn,t[185]=fn,t[186]=k,t[187]=Zt,t[188]=sr,t[189]=ar,t[190]=Gt,t[191]=x,t[192]=Tn,t[193]=mn,t[194]=Nt,t[195]=qt,t[196]=dr,t[197]=Sr):Sr=t[197],(0,Q.useLayoutEffect)(Sr);let Cr,wr;t[198]===Ut?(Cr=t[199],wr=t[200]):(Cr=()=>{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||UJ(e.target))return;let a=Ye.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=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!t)return;let n=Ut.getItem(t)??Ut.getItem(tP(t)),r=n?.isDirectory()?tP(eP(n.getPath())):t;if(ye.current.has(r))return;Cn.current(zJ(r,ue.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Qt.current,...Yt.current]);Ee.current=!0;for(let e of u)e&&Ut.getItem(e)?.select();queueMicrotask(()=>{Ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},wr=[Ut],t[198]=Ut,t[199]=Cr,t[200]=wr),(0,Q.useEffect)(Cr,wr);let Tr,Er;t[201]!==k.length||t[202]!==j?(Tr=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=dY,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()},Er=[j,k.length],t[201]=k.length,t[202]=j,t[203]=Tr,t[204]=Er):(Tr=t[203],Er=t[204]),(0,Q.useEffect)(Tr,Er);let Dr,Or;t[205]!==k.length||t[206]!==j?(Dr=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=()=>qK(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()},Or=[j,k.length],t[205]=k.length,t[206]=j,t[207]=Dr,t[208]=Or):(Dr=t[207],Or=t[208]),(0,Q.useEffect)(Dr,Or);let kr,Ar;t[209]!==k.length||t[210]!==j?(kr=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=()=>dq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Ar=[j,k.length],t[209]=k.length,t[210]=j,t[211]=kr,t[212]=Ar):(kr=t[211],Ar=t[212]),(0,Q.useEffect)(kr,Ar);let jr;t[213]===Symbol.for(`react.memo_cache_sentinel`)?(jr={folderCount:0,expandedCount:0},t[213]=jr):jr=t[213];let Mr=(0,Q.useRef)(jr),Nr=(0,Q.useRef)(gr),Fr=(0,Q.useRef)(pr),Ir;t[214]===gr?Ir=t[215]:(Ir=()=>{Nr.current=gr,Fr.current=pr},t[214]=gr,t[215]=Ir),(0,Q.useEffect)(Ir);let Lr,Rr;t[216]===Ut?(Lr=t[217],Rr=t[218]):(Lr=()=>({startCreating(e,t){Nr.current(e,t)},startCreatingFromTemplate(e){Fr.current(e)},createFromTemplate(e,t){Nr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Qt.current){let t=Nq(Ut.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(xe.current);(0,Q.startTransition)(()=>{for(let t of[...Qt.current].reverse()){if(e.has(t))continue;let n=Nq(Ut.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Qt.current,t=0;for(let n of e)Nq(Ut.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Mr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Mr.current=i,i},isCreationTargetCleared(){return se.current},clearCreationTarget(){oe(!0)},subscribe(e){le.current.add(e);let t=Ut.subscribe(e);return()=>{le.current.delete(e),t()}}}),Rr=[Ut],t[216]=Ut,t[217]=Lr,t[218]=Rr),(0,Q.useImperativeHandle)(n,Lr,Rr);let zr;t[219]!==Dn||t[220]!==d||t[221]!==l||t[222]!==Ut?(zr=async function(e,t,n){let r=WJ(e,ue.current,Qt.current),i=Se.current;i&&e.some(e=>GJ(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Dn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(uY).map(lY)]);l([...[...a].map(cY),...[...o].map(sY),...[...s].map(oY)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?tP(t.path):t.kind===`asset`?t.path:XN(t.path,t.docExt);Ut.getItem(e)&&Ut.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}A(e=>{let t=AP(e,[...a],void 0,[...s]);for(let e of o)t=AP(t,[],e);return vn(t),t}),$s([`files`,`backlinks`,`graph`])},t[219]=Dn,t[220]=d,t[221]=l,t[222]=Ut,t[223]=zr):zr=t[223];let Br=zr,Vr;t[224]!==i||t[225]!==Br?(Vr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;H(a.path);let o=await J(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Br(r,t,n),qs.error(o.title),!1;let c=s(hi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Br(r,t,n),!0},t[224]=i,t[225]=Br,t[226]=Vr):Vr=t[226];let Hr=Vr,Ur;t[227]===Symbol.for(`react.memo_cache_sentinel`)?(Ur=async function(e,t,n){let r=[],i=[];for(let a of e){H(a.path);let e=FP(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:Eq(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[227]=Ur):Ur=t[227];let Wr=Ur,Gr;t[228]===i?Gr=t[229]:(Gr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await J(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let c=s(Jn,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;qs.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[228]=i,t[229]=Gr);let qr=Gr,Jr;t[230]!==i||t[231]!==Y||t[232]!==Br||t[233]!==Hr||t[234]!==qr||t[235]!==sn||t[236]!==re?(Jr=async function(e){let t=e.map(e=>jP(e,ue.current)),n=t[0];if(!n)return;let r=Y.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(aY),t=r.length>e.length?`, +${r.length-e.length} more`:``;qs.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}H(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&re){let{trashed:e,failed:n}=await Wr(t,a,re);if(e.length>0){let t=await qr(e);t?await Br(e,t.deletedDocNames,t.deletedFolderPaths):await Br(e,e.filter(iY).map(rY),e.filter(nY).map(tY))}n.length>0&&q({failed:n,originalTargets:[...t]}),H(null)}else{let e=await Hr(t);H(null),e||sn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),qs.error(i({id:`0eHrMb`}),{description:n}),H(null),sn()}},t[230]=i,t[231]=Y,t[232]=Br,t[233]=Hr,t[234]=qr,t[235]=sn,t[236]=re,t[237]=Jr):Jr=t[237];let Yr=Jr,Xr;t[238]!==i||t[239]!==Hr||t[240]!==sn||t[241]!==K?(Xr=async function(){if(!K)return;let e=new Set(K.failed.map(eY)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(q(null),t.length!==0){H(t[0]?.path??null);try{let e=await Hr(t);H(null),e||sn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),qs.error(i({id:`0eHrMb`}),{description:n}),H(null),sn()}}},t[238]=i,t[239]=Hr,t[240]=sn,t[241]=K,t[242]=Xr):Xr=t[242];let Zr=Xr,Qr;t[243]!==Yr||t[244]!==K?(Qr=async function(){if(!K)return;let e=new Set(K.failed.map($J)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));q(null),await Yr(t)},t[243]=Yr,t[244]=K,t[245]=Qr):Qr=t[245];let $r=Qr,ei=(0,Q.useRef)(Yr),ti;t[246]===Yr?ti=t[247]:(ti=()=>{ei.current=Yr},t[246]=Yr,t[247]=ti),(0,Q.useEffect)(ti);let ni,ri;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(ni=()=>Bq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ue.current.find(e=>Fo(e)&&e.docName===t);ei.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){ei.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){ei.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),ri=[],t[248]=ni,t[249]=ri):(ni=t[248],ri=t[249]),(0,Q.useEffect)(ni,ri);let ii,ai;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ii=()=>Wq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ue.current.find(e=>Fo(e)&&e.docName===t);Cn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Cn.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}))}),ai=[],t[250]=ii,t[251]=ai):(ii=t[250],ai=t[251]),(0,Q.useEffect)(ii,ai);let oi,si;t[252]===Ut?(oi=t[253],si=t[254]):(oi=()=>Hq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=XN(t,ue.current.find(e=>Fo(e)&&e.docName===t)?.docExt);Ut.startRenaming(n);return}if(e.kind===`folder`){Ut.startRenaming(e.folderPath);return}if(e.kind===`asset`){Ut.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),si=[Ut],t[252]=Ut,t[253]=oi,t[254]=si),(0,Q.useEffect)(oi,si);let ci;t[255]===Symbol.for(`react.memo_cache_sentinel`)?(ci=function(){let e=Te.current;e&&fJ(e),Te.current=null},t[255]=ci):ci=t[255];let li=ci,ui;t[256]===g?ui=t[257]:(ui=function(e){let t=TY(e.nativeEvent);if(!t||t.endsWith(`/`)){li();return}let n=ZN(t),r=ue.current.find(e=>QN(e)===t);if(r&&So(r)){li();return}if(r&&Fo(r)&&xi(r.size)){li();return}Te.current!==n&&(li(),Te.current=n,dJ(n,e=>g(e)))},t[256]=g,t[257]=ui);let di=ui,fi;t[258]!==pe||t[259]!==Ut||t[260]!==D?(fi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=EY(e.nativeEvent);if(!t){kY(e.nativeEvent)&&oe(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?tP(n):n;if(Ut.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=eP(r);if(window.location.hash===Ao(e))return;queueMicrotask(()=>D(e));return}let i=ZN(r);window.location.hash!==vo(i)&&queueMicrotask(()=>pe(r))},t[258]=pe,t[259]=Ut,t[260]=D,t[261]=fi):fi=t[261];let pi=fi,mi;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(mi=function(e){xP(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,rt(!0))},t[262]=mi):mi=t[262];let gi=mi,_i;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(_i=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||rt(!1)},t[263]=_i):_i=t[263];let yi=_i,bi;t[264]===dr?bi=t[265]:(bi=function(e){if(!xP(e.nativeEvent))return;let t=SP(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),rt(!1),dr(t,``,jJ))},t[264]=dr,t[265]=bi);let Si=bi;if(j){let e;return t[266]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(jY,{}),t[266]=e):e=t[266],e}let Ci;t[267]!==i||t[268]!==F||t[269]!==L?(Ci=F?i(L?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[267]=i,t[268]=F,t[269]=L,t[270]=Ci):Ci=t[270];let wi=Ci;if(k.length===0){if(wi!==null){let e;return t[271]===wi?e=t[272]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:wi})}),t[271]=wi,t[272]=e),e}if(N){let e;return t[273]===N?e=t[274]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:N})}),t[273]=N,t[274]=e),e}let e;t[275]===i?e=t[276]:(e=i({id:`5ZB7XC`}),t[275]=i,t[276]=e);let n=nt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[277]===n?r=t[278]:(r=Ti(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=r);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(X,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===gr?o=t[281]:(o=()=>gr(`file`,``),t[280]=gr,t[281]=o);let s;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(X,{id:`6ibbCg`}),t[282]=s):s=t[282];let c;t[283]===o?c=t[284]:(c=(0,Z.jsx)(Di,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[283]=o,t[284]=c);let l;return t[285]!==Si||t[286]!==e||t[287]!==r||t[288]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:gi,onDragLeave:yi,onDrop:Si,children:[a,c]}),t[285]=Si,t[286]=e,t[287]=r,t[288]=c,t[289]=l):l=t[289],l}let Ei=V!==null,Oi=U?.targets[0]??null,ki=null;if(z!==null){let e;if(t[290]!==a.locale||t[291]!==z){let n=new Intl.NumberFormat(a.locale).format(z);e=rc._({id:`LuoJWu`,values:{truncatedShownCount:z,formattedCount:n}}),t[290]=a.locale,t[291]=z,t[292]=e}else e=t[292];ki=e}let Ai;t[293]!==N||t[294]!==wi||t[295]!==ki?(Ai=(N||wi!==null||ki!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[wi===null?N&&(0,Z.jsx)(NY,{kind:`error`,children:N}):(0,Z.jsx)(NY,{kind:`reconnecting`,children:wi}),ki!==null&&(0,Z.jsx)(NY,{kind:`info`,children:ki})]}),t[293]=N,t[294]=wi,t[295]=ki,t[296]=Ai):Ai=t[296];let ji;t[297]===y?ji=t[298]:(ji=HK(y),t[297]=y,t[298]=ji);let Mi=ae?``:void 0,Ni;t[299]===Mi?Ni=t[300]:(Ni={[PJ]:Mi},t[299]=Mi,t[300]=Ni);let Pi;t[301]!==Ei||t[302]!==ve||t[303]!==br||t[304]!==k||t[305]!==vr||t[306]!==Zt||t[307]!==Sn||t[308]!==kt||t[309]!==Mt||t[310]!==Ut||t[311]!==At||t[312]!==jt||t[313]!==gr||t[314]!==re?(Pi=(e,t)=>(0,Z.jsx)(KJ,{item:e,context:t,anyActionBusy:Ei,workspace:re,handoff:kt,model:Ut,okignoreBinding:At,projectLocalBinding:jt,mergedConfig:Mt,onStartCreating:gr,onCreateFromTemplate:(e,t)=>gr(`file`,e,{template:t}),onDuplicate:Sn,onDelete:e=>G({targets:e}),onExpandSubtree:vr,onCollapseSubtree:br,folderTreePaths:Zt,isAsset:ve.has(e.path),documents:k}),t[301]=Ei,t[302]=ve,t[303]=br,t[304]=k,t[305]=vr,t[306]=Zt,t[307]=Sn,t[308]=kt,t[309]=Mt,t[310]=Ut,t[311]=At,t[312]=jt,t[313]=gr,t[314]=re,t[315]=Pi):Pi=t[315];let Fi;t[316]!==pi||t[317]!==di||t[318]!==Ut||t[319]!==Ai||t[320]!==ji||t[321]!==Ni||t[322]!==Pi?(Fi=(0,Z.jsx)(`div`,{ref:Ye,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(IK,{header:Ai,model:Ut,style:ji,...Ni,onClickCapture:pi,onMouseMove:di,onMouseLeave:li,renderContextMenu:Pi})}),t[316]=pi,t[317]=di,t[318]=Ut,t[319]=Ai,t[320]=ji,t[321]=Ni,t[322]=Pi,t[323]=Fi):Fi=t[323];let Ii=!!U,Li;t[324]===V?Li=t[325]:(Li=e=>{!e&&!V&&G(null)},t[324]=V,t[325]=Li);let Ri;t[326]!==i||t[327]!==V||t[328]!==U||t[329]!==Yr||t[330]!==Oi?(Ri=U&&Oi&&(0,Z.jsx)(rs,{...(()=>{let e=Sq(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,U.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(QJ)}):null};let t=U.targets.length,n=Oi.name;return{itemName:t===1?Oi.kind===`folder`?`${Oi.name}/`:Oi.kind===`file`?`${Oi.name}${Oi.docExt??`.md`}`:Oi.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Oi.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:V!==null,onDelete:()=>Yr(U.targets)}),t[326]=i,t[327]=V,t[328]=U,t[329]=Yr,t[330]=Oi,t[331]=Ri):Ri=t[331];let zi;t[332]!==Ii||t[333]!==Li||t[334]!==Ri?(zi=(0,Z.jsx)(oo,{open:Ii,onOpenChange:Li,children:Ri}),t[332]=Ii,t[333]=Li,t[334]=Ri,t[335]=zi):zi=t[335];let Bi=!!K,Vi;t[336]===V?Vi=t[337]:(Vi=e=>{!e&&!V&&q(null)},t[336]=V,t[337]=Vi);let Hi;t[338]!==V||t[339]!==Zr||t[340]!==$r||t[341]!==K?(Hi=K&&(0,Z.jsx)(Aq,{failedTargets:K.failed,isSubmitting:V!==null,onDeletePermanently:Zr,onRetry:$r,onCancel:()=>q(null)}),t[338]=V,t[339]=Zr,t[340]=$r,t[341]=K,t[342]=Hi):Hi=t[342];let Ui;t[343]!==Bi||t[344]!==Vi||t[345]!==Hi?(Ui=(0,Z.jsx)(oo,{open:Bi,onOpenChange:Vi,children:Hi}),t[343]=Bi,t[344]=Vi,t[345]=Hi,t[346]=Ui):Ui=t[346];let Wi=ee!==null,Gi;t[347]===Symbol.for(`react.memo_cache_sentinel`)?(Gi=e=>{e||te(null)},t[347]=Gi):Gi=t[347];let Ki=ee?.parentDir??``,Ji;t[348]!==Wi||t[349]!==Ki?(Ji=(0,Z.jsx)(g_,{open:Wi,onOpenChange:Gi,kind:`file`,initialDir:Ki,defaultToTemplate:!0}),t[348]=Wi,t[349]=Ki,t[350]=Ji):Ji=t[350];let Yi;return t[351]!==Fi||t[352]!==zi||t[353]!==Ui||t[354]!==Ji?(Yi=(0,Z.jsxs)(Z.Fragment,{children:[Fi,zi,Ui,Ji]}),t[351]=Fi,t[352]=zi,t[353]=Ui,t[354]=Ji,t[355]=Yi):Yi=t[355],Yi}function QJ(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:Cq(e)},`${e.kind}:${e.path}`)}function $J(e){return`${e.kind}:${e.path}`}function eY(e){return`${e.kind}:${e.path}`}function tY(e){return e.path}function nY(e){return e.kind===`folder`}function rY(e){return e.path}function iY(e){return e.kind===`file`}function aY(e){return e.file}function oY(e){return Ce(e)}function sY(e){return Ae(e)}function cY(e){return Yt(e)}function lY(e){return e.path}function uY(e){return e.kind===`asset`}function dY(e){return e.endsWith(`/`)?e.slice(0,-1):e}function fY(e){return!!e}function pY(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function mY(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function hY(e){qs.error(e)}function gY(){}function _Y(e){return qs.error(e)}function vY(){}function yY(){}function bY(){}function xY(){}function SY(){}async function CY(){}function wY(e){return QN(e)}function TY(e){return EY(e)?.dataset.itemPath??null}function EY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function DY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function OY(e){let t=EY(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=_P(e,n);return{parentDir:r,row:t,root:null,busyPath:n?tP(r):e}}return kY(e)?{parentDir:``,row:null,root:DY(e),busyPath:jJ}:null}function kY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var AY=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function jY(){let e=(0,$.c)(5),{_:t}=cn(),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=AY.map(MY),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(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]=i),i}function MY(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(la,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(la,{className:`h-3 ${e}`})]},t)}function NY(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?yo:n===`reconnecting`?zo:zs,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Ti(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=Ti(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function PY(e){return e?rc._({id:`wTcjov`}):null}function FY(e){let t=(0,$.c)(23),{_:n}=cn(),r=$o(),i=ss();if(r)return null;let{input:a,installStates:o,dispatch:s}=e,c=a===null,l,u,d,f,p,m;if(t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==c||t[4]!==o||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=PY(c),r;t[12]===o?r=t[13]:(r=e=>o[e.id]?.installed===!0,t[12]=o,t[13]=r);let h=Uo.filter(r),g=h.length>0,_=i!==null;if(!g&&!_){m=null;break bb0}u=WP,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(qP,{children:[(0,Z.jsx)(Us,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`O7_W_a`})]}),t[14]=p):p=t[14],l=JP,d=g?(0,Z.jsxs)(UP,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(XP,{children:(0,Z.jsx)(X,{id:`BBqGS9`})}),h.map(t=>{let r=!c,{displayName:i}=t,o=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(KP,{disabled:!r,onSelect:()=>{a&&s(t.id,a)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":o,children:[(0,Z.jsx)(Yo,{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)})]}):null,f=_?(0,Z.jsxs)(Z.Fragment,{children:[g?(0,Z.jsx)(ZP,{}):null,(0,Z.jsxs)(UP,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(XP,{children:(0,Z.jsx)(X,{id:`ALhMYW`})}),os.map(t=>{let{displayName:r}=Gn[t];return(0,Z.jsxs)(KP,{onSelect:()=>{a!==null&&i.launchInTerminal(a,t)},disabled:c,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(Yo,{id:Jo(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]})]}):null}t[0]=n,t[1]=s,t[2]=a,t[3]=c,t[4]=o,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==l||t[16]!==d||t[17]!==f?(h=(0,Z.jsxs)(l,{children:[d,f]}),t[15]=l,t[16]=d,t[17]=f,t[18]=h):h=t[18];let g;return t[19]!==u||t[20]!==p||t[21]!==h?(g=(0,Z.jsxs)(u,{children:[p,h]}),t[19]=u,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}var IY=(e,t,n)=>Xd(e,t,n,`ProjectSwitcher`);function LY(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=cn(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),p=vM(),m=typeof window<`u`&&window.okDesktop!=null,h=(0,Q.useRef)(!1),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{c(e),e||u(``)},t[1]=g):g=t[1];let _=g,v;t[2]!==r||t[3]!==n.project||t[4]!==s?(v=()=>{if(!s)return;let e=!1;return IY(async()=>{let t=await n.project.listRecent();e||o(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=s,t[5]=v):v=t[5];let y;t[6]!==r||t[7]!==n||t[8]!==s?(y=[s,n,r],t[6]=r,t[7]=n,t[8]=s,t[9]=y):y=t[9],(0,Q.useEffect)(v,y);let b;t[10]!==r||t[11]!==n.project?(b=e=>{c(!1),IY(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=b):b=t[12];let x=b,S;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(S=()=>{c(!1),IY(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=S):S=t[16];let C=S,w;t[17]!==r||t[18]!==n.navigator?(w=()=>{c(!1),IY(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{c(!1),f(!0)},t[20]=E):E=t[20];let D=E,O=n.config.projectPath,k,A,j,M,N,P,F,I,L,R,z;if(t[21]!==r||t[22]!==p||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==O||t[26]!==s||t[27]!==x||t[28]!==a||t[29]!==l){let e;t[41]===O?e=t[42]:(e=e=>e.path!==O,t[41]=O,t[42]=e);let i=a.filter(e),o=l.trim().toLowerCase(),c=o?i.filter(e=>e.name.toLowerCase().includes(o)||e.path.toLowerCase().includes(o)):i;A=nl,F=s,I=_,L=!1;let d=p!==null&&`h-auto py-1.5`,f;t[43]===d?f=t[44]:(f=Ti(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,d),t[43]=d,t[44]=f);let g;t[45]===r?g=t[46]:(g=r({id:`zZ_I5K`}),t[45]=r,t[46]=g);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=m?()=>{h.current=!0}:void 0,t[47]=v):v=t[47];let y;t[48]===s?y=t[49]:(y=m?()=>{if(h.current){h.current=!1;return}_(!s)}:void 0,t[48]=s,t[49]=y);let b;t[50]===n.config.projectName?b=t[51]:(b=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=b);let S;t[52]===p?S=t[53]:(S=p===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Jt,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:p})]}),t[52]=p,t[53]=S);let C;t[54]!==b||t[55]!==S?(C=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[b,S]}),t[54]=b,t[55]=S,t[56]=C):C=t[56];let w;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Pu,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=w):w=t[57],t[58]!==n.config.projectPath||t[59]!==f||t[60]!==g||t[61]!==y||t[62]!==C?(R=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsxs)(cM,{className:f,"data-testid":`project-switcher-trigger`,"aria-label":g,title:n.config.projectPath,onPointerDown:v,onClick:y,children:[C,w]})}),t[58]=n.config.projectPath,t[59]=f,t[60]=g,t[61]=y,t[62]=C,t[63]=R):R=t[63],k=Xc,z=`start`,j=`top`,M=`min-w-[260px]`,N=`project-switcher-menu`,P=i.length===0?(0,Z.jsx)(al,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(aT,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(uT,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:l,onChange:e=>u(e.target.value),onKeyDown:RY,"data-testid":`project-switcher-search`}),(0,Z.jsx)(sT,{children:(0,Z.jsx)(nt,{"aria-hidden":`true`})})]}),(0,Z.jsx)(sl,{}),c.length===0?(0,Z.jsx)(al,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(X,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(Jc,{disabled:e.missing,onSelect:()=>x(e.path),className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=p,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=O,t[26]=s,t[27]=x,t[28]=a,t[29]=l,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z}else k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40];let B;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(sl,{}),t[64]=B):B=t[64];let V;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsxs)(Jc,{onSelect:D,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(X,{id:`gKi-a_`})]}),t[65]=V):V=t[65];let H,U;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Tt,{"aria-hidden":`true`,className:`text-muted-foreground`}),U=(0,Z.jsx)(X,{id:`xaDWAI`}),t[66]=H,t[67]=U):(H=t[66],U=t[67]);let W;t[68]===T?W=t[69]:(W=(0,Z.jsxs)(Jc,{onSelect:T,"data-testid":`project-switcher-switch-project`,children:[H,U]}),t[68]=T,t[69]=W);let G,K;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(hs,{"aria-hidden":`true`,className:`text-muted-foreground`}),K=(0,Z.jsx)(X,{id:`PVUn_c`}),t[70]=G,t[71]=K):(G=t[70],K=t[71]);let q;t[72]===C?q=t[73]:(q=(0,Z.jsxs)(Jc,{onSelect:C,"data-testid":`project-switcher-open-folder`,children:[G,K]}),t[72]=C,t[73]=q);let J;t[74]!==k||t[75]!==j||t[76]!==M||t[77]!==N||t[78]!==P||t[79]!==W||t[80]!==q||t[81]!==z?(J=(0,Z.jsxs)(k,{align:z,side:j,className:M,"data-testid":N,children:[P,B,V,W,q]}),t[74]=k,t[75]=j,t[76]=M,t[77]=N,t[78]=P,t[79]=W,t[80]=q,t[81]=z,t[82]=J):J=t[82];let Y;t[83]!==A||t[84]!==F||t[85]!==I||t[86]!==L||t[87]!==R||t[88]!==J?(Y=(0,Z.jsxs)(A,{open:F,onOpenChange:I,modal:L,children:[R,J]}),t[83]=A,t[84]=F,t[85]=I,t[86]=L,t[87]=R,t[88]=J,t[89]=Y):Y=t[89];let ee;t[90]!==n||t[91]!==d?(ee=(0,Z.jsx)(Kp,{open:d,onOpenChange:f,bridge:n}),t[90]=n,t[91]=d,t[92]=ee):ee=t[92];let te;return t[93]!==Y||t[94]!==ee?(te=(0,Z.jsxs)(Z.Fragment,{children:[Y,ee]}),t[93]=Y,t[94]=ee,t[95]=te):te=t[95],te}function RY(e){return e.stopPropagation()}function zY(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})),Qn(`sidebarSearchPill`)}function BY(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Ti(`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)(nt,{"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)(X,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Dt,{className:`text-foreground/70`,children:bl(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Di,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function VY(){let e=(0,$.c)(31),{_:t}=cn(),n=Qo(),{activeDocName:r}=_t(),[i,a]=(0,Q.useState)(!1),o=as(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=fs(c),e[3]=c,e[4]=l);let u=l,d=bs(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(nM,{asChild:!0,children:(0,Z.jsxs)(Vs,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(ed,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(X,{id:`PCSkw2`}),(0,Z.jsx)(co,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(xt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(rM,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(JY,{}),e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==u||e[18]!==p||e[19]!==d||e[20]!==c?(S=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`PdJZ5p`})}):Ss.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(Hs,{className:`group/scope`,open:c.some(t=>t.scope===e&&bi(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(Vs,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(co,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(Bs,{children:(0,Z.jsx)(aM,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(UY,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[15]=o,e[16]=r,e[17]=u,e[18]=p,e[19]=d,e[20]=c,e[21]=S):S=e[21];let C;e[22]===S?C=e[23]:(C=(0,Z.jsx)(Bs,{children:(0,Z.jsxs)(iM,{children:[x,S]})}),e[22]=S,e[23]=C);let w;e[24]===i?w=e[25]:(w=(0,Z.jsx)(ka,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:HY}),e[24]=i,e[25]=w);let T;return e[26]!==o.dialogs||e[27]!==C||e[28]!==w||e[29]!==b?(T=(0,Z.jsx)(Hs,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(tM,{children:[h,b,C,o.dialogs,w]})}),e[26]=o.dialogs,e[27]=C,e[28]=w,e[29]=b,e[30]=T):T=e[30],T}function HY(e){let{scope:t,name:n}=e;return Fs(bi(t,n))}function UY(e){let t=(0,$.c)(48),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=cn(),[s,c]=(0,Q.useState)(!1),l;t[0]!==n.name||t[1]!==n.scope?(l=bi(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=l):l=t[2];let u=r===l,d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(co,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),f=(0,Z.jsx)(ed,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=n.name,m;t[5]===n.name?m=t[6]:(m=gs(n.name),t[5]=n.name,t[6]=m);let h;t[7]!==n.name||t[8]!==m?(h=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:p,children:m}),t[7]=n.name,t[8]=m,t[9]=h):h=t[9];let g;t[10]!==o||t[11]!==n.bundledVersion||t[12]!==n.updateAvailable?(g=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(zo,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[10]=o,t[11]=n.bundledVersion,t[12]=n.updateAvailable,t[13]=g):g=t[13];let _;t[14]===n.installed?_=t[15]:(_=(0,Z.jsx)(Ca,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[14]=n.installed,t[15]=_);let v;t[16]!==g||t[17]!==_?(v=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[g,_]}),t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==u||t[20]!==h||t[21]!==v?(y=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(cM,{size:`sm`,isActive:u,className:`h-6 text-[11px]`,children:[d,f,h,v]})}),t[19]=u,t[20]=h,t[21]=v,t[22]=y):y=t[22];let b;t[23]!==o||t[24]!==n.name?(b=o({id:`RlLl3G`,values:{0:n.name}}),t[23]=o,t[24]=n.name,t[25]=b):b=t[25];let x;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(Hu,{}),t[26]=x):x=t[26];let S;t[27]===b?S=t[28]:(S=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(lM,{showOnHover:!0,"aria-label":b,children:x})}),t[27]=b,t[28]=S);let C;t[29]!==i||t[30]!==a||t[31]!==n?(C=(0,Z.jsx)(Xc,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(ns,{skill:n,actions:i,existingNames:a})}),t[29]=i,t[30]=a,t[31]=n,t[32]=C):C=t[32];let w;t[33]!==S||t[34]!==C?(w=(0,Z.jsxs)(nl,{children:[S,C]}),t[33]=S,t[34]=C,t[35]=w):w=t[35];let T;t[36]!==s||t[37]!==n?(T=s?(0,Z.jsx)(KY,{skill:n}):null,t[36]=s,t[37]=n,t[38]=T):T=t[38];let E;t[39]===T?E=t[40]:(E=(0,Z.jsx)(Bs,{children:T}),t[39]=T,t[40]=E);let D;t[41]!==y||t[42]!==w||t[43]!==E?(D=(0,Z.jsxs)(oM,{children:[y,w,E]}),t[41]=y,t[42]=w,t[43]=E,t[44]=D):D=t[44];let O;return t[45]!==s||t[46]!==D?(O=(0,Z.jsx)(Hs,{open:s,onOpenChange:c,className:`group/skill`,children:D}),t[45]=s,t[46]=D,t[47]=O):O=t[47],O}function WY(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return GY(t),t}function GY(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&GY(t.children)}function KY(e){let t=(0,$.c)(27),{skill:n}=e,{_:r}=cn(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=_t(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),go(vo(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==u||t[3]!==c||t[4]!==n.name||t[5]!==n.scope?(d=function(e){let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(b(n.name,e.replace(/\.mdx?$/i,``)));return}c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),go(lo({scope:n.scope,name:n.name,path:e}))},t[2]=u,t[3]=c,t[4]=n.name,t[5]=n.scope,t[6]=d):d=t[6];let f=d,p,m;t[7]!==n.name||t[8]!==n.scope?(p=()=>{let e=!0,t=()=>{rl(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=nc(t);return()=>{e=!1,r()}},m=[n.scope,n.name],t[7]=n.name,t[8]=n.scope,t[9]=p,t[10]=m):(p=t[9],m=t[10]),(0,Q.useEffect)(p,m);let h;if(t[11]!==r||t[12]!==i||t[13]!==o||t[14]!==f||t[15]!==u||t[16]!==n.name||t[17]!==n.scope){let e=i?WY(i):[],a;t[19]!==u||t[20]!==n.name||t[21]!==n.scope?(a=()=>n.scope===`project`?u(Lr(n.name)):Fs(bi(n.scope,n.name)),t[19]=u,t[20]=n.name,t[21]=n.scope,t[22]=a):a=t[22];let s,c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ke,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[23]=s,t[24]=c):(s=t[23],c=t[24]);let l;t[25]===a?l=t[26]:(l=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[25]=a,t[26]=l),h=(0,Z.jsxs)(uM,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(X,{id:`yQE2r9`})})}):o?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(X,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(qY,{node:e,depth:0,onOpenFile:f},e.path))]}),t[11]=r,t[12]=i,t[13]=o,t[14]=f,t[15]=u,t[16]=n.name,t[17]=n.scope,t[18]=h}else h=t[18];return h}function qY(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(co,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(qY,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(Bs,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(dM,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(Hs,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Gu,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function JY(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return Zc().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await il(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(X,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(Di,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(X,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(Di,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}function YY(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=cn(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(Js,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function XY(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 ZY(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(yg,vg,vg),n;e[0]===t?n=e[1]:(n=XY(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),_g(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(YY,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function QY(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Ho(n.contentDir,Go(t),n.pathSeparator):e?.kind===`folder`?Ho(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Ho(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function $Y(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Go(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function eX(e,t,n){return e===null?ds({workspace:n}):e.kind===`folder`?n?Ko({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?cs({docName:t,workspace:n}):null}var tX={folderCount:0,expandedCount:0},nX=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function rX(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(nX)!==null}function iX(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(P,{name:`file-sidebar`,children:(0,Z.jsx)(oX,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var aX=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)(fc,{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)(pc,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(hc,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function oX(e){let t=(0,$.c)(209),{onOpenSearch:n}=e,{_:r}=cn(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=_t(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Do(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=Wj(),y=$o(),b=_===`expanded`,x=h&&_===`collapsed`,[S,C]=(0,Q.useState)(tX),w,T;t[3]===i?(w=t[4],T=t[5]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[3]=i,t[4]=w,t[5]=T),(0,Q.useEffect)(w,T);let E,D;t[6]===i?(E=t[7],D=t[8]):(E=()=>{if(i!==null)return UC(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},D=[i],t[6]=i,t[7]=E,t[8]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=Aa(``),M=Aa(m===``?null:m),N=m===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=Vo(),{status:R}=ia(),z=R?.hasRemote===!0,B;t[9]!==r||t[10]!==L?.contentDir?(B=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[9]=r,t[10]=L?.contentDir,t[11]=B):B=t[11];let V=B,H=ts().states,{dispatch:U}=ls(),W;t[12]===L?W=t[13]:(W=ds({workspace:L}),t[12]=L,t[13]=W);let G=W,{projectLocalBinding:K,merged:q}=ys(),J=q?.appearance?.sidebar?.showHiddenFiles??!1,Y=O&&!k,ee=O&&!A,te=Y||ee,ne=dX,re;t[14]!==i||t[15]!==L?(re=()=>{L&&i?.startCreating(`file`,``)},t[14]=i,t[15]=L,t[16]=re):re=t[16];let ie=re,ae;t[17]!==i||t[18]!==L?(ae=e=>{L&&i?.createFromTemplate(``,e)},t[17]=i,t[18]=L,t[19]=ae):ae=t[19];let oe=ae,se;t[20]!==i||t[21]!==L?(se=()=>{L&&i?.startCreating(`folder`,``)},t[20]=i,t[21]=L,t[22]=se):se=t[22];let ce=se,le;t[23]===L?le=t[24]:(le=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[23]=L,t[24]=le);let ue=le,de;t[25]!==r||t[26]!==L?(de=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),qs.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),qs.error(r({id:`vfRlCI`}))}},t[25]=r,t[26]=L,t[27]=de):de=t[27];let fe=de,pe;t[28]!==r||t[29]!==z?(pe=()=>{Yi({...Ji(``),hasRemote:z,onClickWhenNoRemote:()=>{qs.error(r({id:`WyQxwa`}))}},{clipboardWrite:is,toastSuccess:uX,toastError:lX,logEvent:cX})},t[28]=r,t[29]=z,t[30]=pe):pe=t[30];let me=pe,he;t[31]!==r||t[32]!==K?(he=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Wr(t.error)),qs.error(r({id:`P47EWZ`}),{description:Wr(t.error)}))},t[31]=r,t[32]=K,t[33]=he):he=t[33];let ge=he,_e;t[34]===i?_e=t[35]:(_e=()=>{i?.expandAll()},t[34]=i,t[35]=_e);let ve=_e,ye;t[36]===i?ye=t[37]:(ye=()=>{i?.collapseAll()},t[36]=i,t[37]=ye);let be=ye,xe,Se;t[38]!==ee||t[39]!==Y||t[40]!==J||t[41]!==_?(xe=()=>{I&&I.editor.notifyViewMenuStateChanged({showHiddenFiles:J,canExpandAll:Y,canCollapseAll:ee,sidebarVisible:_===`expanded`})},Se=[I,J,Y,ee,_],t[38]=ee,t[39]=Y,t[40]=J,t[41]=_,t[42]=xe,t[43]=Se):(xe=t[42],Se=t[43]),(0,Q.useEffect)(xe,Se);let Ce,we;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==U||t[48]!==H||t[49]!==m||t[50]!==K||t[51]!==J||t[52]!==v||t[53]!==i||t[54]!==L?(Ce=()=>{if(I)return I.onMenuAction(e=>{switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;Vq(l);return;case`duplicate`:if(!l)return;Uq(l);return;case`move-to-trash`:if(!l)return;zq(l);return;case`reveal-in-finder`:{if(!I||!L)return;let e=QY(l,c,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Uo.filter(e=>H[e.id]?.installed===!0);if(e.length===0){qs.error(r({id:`LKOLNn`}));return}let t=eX(l,c,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=QY(l,c,L);navigator.clipboard.writeText(e).then(()=>qs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=$Y(l,c);if(e===``){qs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>qs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qs.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(K===null)return;let e=K.patch({appearance:{sidebar:{showHiddenFiles:!J}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Wr(e.error)),qs.error(r({id:`P47EWZ`}),{description:Wr(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},we=[I,i,L,l,c,m,K,J,H,U,v,r],t[44]=r,t[45]=c,t[46]=l,t[47]=U,t[48]=H,t[49]=m,t[50]=K,t[51]=J,t[52]=v,t[53]=i,t[54]=L,t[55]=Ce,t[56]=we):(Ce=t[55],we=t[56]),(0,Q.useEffect)(Ce,we);let Te=h&&b&&`motion-safe:delay-100`,Ee=x&&`opacity-0`,De;t[57]!==Te||t[58]!==Ee?(De=Ti(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Te,Ee,h&&`[-webkit-app-region:drag]`),t[57]=Te,t[58]=Ee,t[59]=De):De=t[59];let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[60]=Oe):Oe=t[60];let ke;t[61]===b?ke=t[62]:(ke=b&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(X,{id:`sER-bs`})}):null,t[61]=b,t[62]=ke);let Ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=Ti(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=Ae):Ae=t[63];let je;t[64]!==r||t[65]!==k||t[66]!==O||t[67]!==A||t[68]!==i?(je=O?(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(aX,{icon:od,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(Xc,{align:`end`,className:`min-w-52`,children:[k?null:(0,Z.jsxs)(Jc,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`OlAl5i`})]}),A?null:(0,Z.jsxs)(Jc,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`qvWGzP`})]})]})]}):null,t[64]=r,t[65]=k,t[66]=O,t[67]=A,t[68]=i,t[69]=je):je=t[69];let Me;t[70]===r?Me=t[71]:(Me=r({id:`HdkSiO`}),t[70]=r,t[71]=Me);let Ne;t[72]!==m||t[73]!==i?(Ne=()=>i?.startCreating(`file`,m),t[72]=m,t[73]=i,t[74]=Ne):Ne=t[74];let Pe;t[75]!==Me||t[76]!==Ne?(Pe=(0,Z.jsx)(aX,{icon:Md,label:Me,onClick:Ne}),t[75]=Me,t[76]=Ne,t[77]=Pe):Pe=t[77];let Fe;t[78]!==r||t[79]!==F||t[80]!==m||t[81]!==i?(Fe=F?(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(aX,{icon:ha,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(Xc,{align:`end`,className:`min-w-52`,children:(0,Z.jsx)(Mq,{parentDir:m,onSelectTemplate:e=>i?.createFromTemplate(m,e),ItemComponent:Jc})})]}):null,t[78]=r,t[79]=F,t[80]=m,t[81]=i,t[82]=Fe):Fe=t[82];let Ie;t[83]===r?Ie=t[84]:(Ie=r({id:`96G6Re`}),t[83]=r,t[84]=Ie);let Le;t[85]!==m||t[86]!==i?(Le=()=>i?.startCreating(`folder`,m),t[85]=m,t[86]=i,t[87]=Le):Le=t[87];let Re;t[88]!==Ie||t[89]!==Le?(Re=(0,Z.jsx)(aX,{icon:Xu,label:Ie,onClick:Le}),t[88]=Ie,t[89]=Le,t[90]=Re):Re=t[90];let ze;t[91]!==je||t[92]!==Pe||t[93]!==Fe||t[94]!==Re?(ze=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Ae,children:[je,Pe,Fe,Re]}),t[91]=je,t[92]=Pe,t[93]=Fe,t[94]=Re,t[95]=ze):ze=t[95];let Be;t[96]!==De||t[97]!==ke||t[98]!==ze?(Be=(0,Z.jsxs)(Qj,{"data-electron-drag":h?``:void 0,className:De,children:[Oe,ke,ze]}),t[96]=De,t[97]=ke,t[98]=ze,t[99]=Be):Be=t[99];let Ve=h&&b&&`motion-safe:delay-100`,He=x&&`opacity-0`,Ue;t[100]!==Ve||t[101]!==He?(Ue=Ti(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ve,He),t[100]=Ve,t[101]=He,t[102]=Ue):Ue=t[102];let We;t[103]===_?We=t[104]:(We=[_],t[103]=_,t[104]=We);let Ge;t[105]===n?Ge=t[106]:(Ge=(0,Z.jsx)(BY,{onClick:n}),t[105]=n,t[106]=Ge);let Ke;t[107]!==We||t[108]!==Ge?(Ke=(0,Z.jsx)(g,{fallbackRender:sX,onError:zY,resetKeys:We,children:Ge}),t[107]=We,t[108]=Ge,t[109]=Ke):Ke=t[109];let qe;t[110]!==Ue||t[111]!==Ke?(qe=(0,Z.jsx)(`div`,{className:Ue,children:Ke}),t[110]=Ue,t[111]=Ke,t[112]=qe):qe=t[112];let Je;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(hI,{}),t[113]=Je):Je=t[113];let Ye;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(hs,{className:`size-3.5 shrink-0`}),t[114]=Ye):Ye=t[114];let Xe;t[115]===V?Xe=t[116]:(Xe=(0,Z.jsx)(`span`,{className:`truncate`,children:V}),t[115]=V,t[116]=Xe);let Ze;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(co,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[117]=Ze):Ze=t[117];let Qe;t[118]===Xe?Qe=t[119]:(Qe=(0,Z.jsx)(nM,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(Vs,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[Ye,Xe,Ze]})}),t[118]=Xe,t[119]=Qe);let $e=o==null?`50vh`:`${o}px`,et;t[120]===$e?et=t[121]:(et={height:$e},t[120]=$e,t[121]=et);let tt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(ZJ,{ref:a,onContentHeightChange:s}),t[122]=tt):tt=t[122];let nt;t[123]===et?nt=t[124]:(nt=(0,Z.jsx)(Bs,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:et,children:tt}),t[123]=et,t[124]=nt);let rt;t[125]!==Qe||t[126]!==nt?(rt=(0,Z.jsx)(Hs,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(tM,{className:`min-h-0`,children:[Qe,nt]})}),t[125]=Qe,t[126]=nt,t[127]=rt):rt=t[127];let it;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(VY,{}),t[128]=it):it=t[128];let at;t[129]===i?at=t[130]:(at=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[129]=i,t[130]=at);let ot;t[131]!==rt||t[132]!==at?(ot=(0,Z.jsxs)(eM,{children:[Je,rt,it,at]}),t[131]=rt,t[132]=at,t[133]=ot):ot=t[133];let st;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsxs)($j,{className:`px-0`,children:[(0,Z.jsx)(ZY,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(aM,{children:(0,Z.jsx)(oM,{children:(0,Z.jsx)(LY,{bridge:window.okDesktop})})}):null]}),t[134]=st):st=t[134];let ct=!(y&&_===`collapsed`),lt;t[135]===ct?lt=t[136]:(lt=(0,Z.jsx)(Xj,{enableToggle:!1,enableDrag:ct}),t[135]=ct,t[136]=lt);let ut;t[137]!==Be||t[138]!==qe||t[139]!==ot||t[140]!==lt?(ut=(0,Z.jsx)(HP,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:ne,children:[Be,qe,ot,st,lt]})}),t[137]=Be,t[138]=qe,t[139]=ot,t[140]=lt,t[141]=ut):ut=t[141];let dt=!L,ft,pt;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(Md,{"aria-hidden":`true`}),pt=(0,Z.jsx)(X,{id:`HdkSiO`}),t[142]=ft,t[143]=pt):(ft=t[142],pt=t[143]);let mt;t[144]!==ie||t[145]!==dt?(mt=(0,Z.jsxs)(KP,{disabled:dt,onSelect:ie,"data-testid":`empty-space-menu-new-file`,children:[ft,pt]}),t[144]=ie,t[145]=dt,t[146]=mt):mt=t[146];let ht;t[147]!==oe||t[148]!==P||t[149]!==L?(ht=P?(0,Z.jsxs)(WP,{children:[(0,Z.jsxs)(qP,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ha,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Uuj_R4`})]}),(0,Z.jsx)(JP,{children:(0,Z.jsx)(Mq,{parentDir:``,onSelectTemplate:oe,ItemComponent:KP})})]}):null,t[147]=oe,t[148]=P,t[149]=L,t[150]=ht):ht=t[150];let gt=!L,vt,yt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(Xu,{"aria-hidden":`true`}),yt=(0,Z.jsx)(X,{id:`96G6Re`}),t[151]=vt,t[152]=yt):(vt=t[151],yt=t[152]);let bt;t[153]!==ce||t[154]!==gt?(bt=(0,Z.jsxs)(KP,{disabled:gt,onSelect:ce,"data-testid":`empty-space-menu-new-folder`,children:[vt,yt]}),t[153]=ce,t[154]=gt,t[155]=bt):bt=t[155];let xt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,Z.jsx)(ZP,{}),t[156]=xt):xt=t[156];let St;t[157]!==r||t[158]!==ue||t[159]!==L?(St=I?(0,Z.jsxs)(KP,{disabled:!L,onSelect:ue,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(L?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(hs,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(X,{id:`LtSYdi`})}),L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`wTcjov`})})]}):null,t[157]=r,t[158]=ue,t[159]=L,t[160]=St):St=t[160];let Ct;t[161]!==U||t[162]!==G||t[163]!==H?(Ct=(0,Z.jsx)(FY,{input:G,installStates:H,dispatch:U}),t[161]=U,t[162]=G,t[163]=H,t[164]=Ct):Ct=t[164];let wt;t[165]!==me||t[166]!==z?(wt=z?(0,Z.jsxs)(KP,{onSelect:me,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Z8lGw6`})]}):null,t[165]=me,t[166]=z,t[167]=wt):wt=t[167];let Tt=!L,Et;t[168]!==r||t[169]!==L?(Et=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[168]=r,t[169]=L,t[170]=Et):Et=t[170];let Dt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Z.jsx)(xs,{"aria-hidden":`true`}),t[171]=Dt):Dt=t[171];let Ot;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(X,{id:`Up2_7p`})}),t[172]=Ot):Ot=t[172];let kt;t[173]===L?kt=t[174]:(kt=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`wTcjov`})}),t[173]=L,t[174]=kt);let At;t[175]!==fe||t[176]!==Tt||t[177]!==Et||t[178]!==kt?(At=(0,Z.jsxs)(KP,{disabled:Tt,onSelect:fe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Et,children:[Dt,Ot,kt]}),t[175]=fe,t[176]=Tt,t[177]=Et,t[178]=kt,t[179]=At):At=t[179];let jt;t[180]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,Z.jsx)(ZP,{}),t[180]=jt):jt=t[180];let Mt=K===null,Nt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,Z.jsx)(X,{id:`XcGbim`}),t[181]=Nt):Nt=t[181];let Pt;t[182]!==ge||t[183]!==J||t[184]!==Mt?(Pt=(0,Z.jsx)(YP,{checked:J,onCheckedChange:ge,disabled:Mt,"data-testid":`empty-space-menu-show-hidden-files`,children:Nt}),t[182]=ge,t[183]=J,t[184]=Mt,t[185]=Pt):Pt=t[185];let Ft;t[186]===te?Ft=t[187]:(Ft=te?(0,Z.jsx)(ZP,{}):null,t[186]=te,t[187]=Ft);let It;t[188]!==ve||t[189]!==Y?(It=Y?(0,Z.jsxs)(KP,{onSelect:ve,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`OlAl5i`})]}):null,t[188]=ve,t[189]=Y,t[190]=It):It=t[190];let Lt;t[191]!==be||t[192]!==ee?(Lt=ee?(0,Z.jsxs)(KP,{onSelect:be,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`qvWGzP`})]}):null,t[191]=be,t[192]=ee,t[193]=Lt):Lt=t[193];let Rt;t[194]!==mt||t[195]!==ht||t[196]!==bt||t[197]!==St||t[198]!==Ct||t[199]!==wt||t[200]!==At||t[201]!==Pt||t[202]!==Ft||t[203]!==It||t[204]!==Lt?(Rt=(0,Z.jsxs)(GP,{className:`min-w-52`,children:[mt,ht,bt,xt,St,Ct,wt,At,jt,Pt,Ft,It,Lt]}),t[194]=mt,t[195]=ht,t[196]=bt,t[197]=St,t[198]=Ct,t[199]=wt,t[200]=At,t[201]=Pt,t[202]=Ft,t[203]=It,t[204]=Lt,t[205]=Rt):Rt=t[205];let zt;return t[206]!==ut||t[207]!==Rt?(zt=(0,Z.jsx)(Jj,{variant:`inset`,children:(0,Z.jsxs)(VP,{children:[ut,Rt]})}),t[206]=ut,t[207]=Rt,t[208]=zt):zt=t[208],zt}function sX(){return null}function cX(e){return console.log(e)}function lX(e){return qs.error(e)}function uX(e){return qs.success(e)}function dX(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||rX(e.target)&&(e.preventDefault(),e.stopPropagation())}function fX(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function pX(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function mX(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var hX={phase:`loading`};function gX(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function _X(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function vX(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=mX(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function yX(e){return e!==null&&e.kind===`project-branch-switch`}function bX(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,i=r===void 0?gm:r,{_:a}=cn(),o=(0,Q.useSyncExternalStore)(i.subscribe,i.getSnapshot,EX),[s,c]=(0,Q.useState)(hX),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(!1),d;t[0]===o?d=t[1]:(d=yX(o)?o:null,t[0]=o,t[1]=d);let f=d,p;t[2]!==a||t[3]!==f?.share.target.kind?(p=f?.share.target.kind===`folder`?a({id:`ugoTXs`}):a({id:`XH30C4`}),t[2]=a,t[3]=f?.share.target.kind,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{c(hX),l.current=!1,u.current=!1},t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _;t[8]!==f||t[9]!==n?(_=()=>{f&&(l.current||(l.current=!0,n.project.fetchBranchInfo({projectPath:f.projectPath,branch:f.share.branch,kind:f.share.target.kind,path:ps(f.share.target)}).then(e=>{c(t=>gX(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),c(TX)})))},t[8]=f,t[9]=n,t[10]=_):_=t[10];let v;t[11]===f?v=t[12]:(v=[f],t[11]=f,t[12]=v),(0,Q.useEffect)(_,v);let y;t[13]!==a||t[14]!==f||t[15]!==s.phase||t[16]!==n||t[17]!==i||t[18]!==m?(y=()=>{if(s.phase!==`awaiting-cc1-recycle`||!f)return;let e=f.share.branch;if(!e){i.dismiss();return}if(u.current)return;u.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:f.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(tf({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:f.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:f.share.target.kind,path:ps(f.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),qs.error(a({id:`gQV-9w`,values:{targetNoun:m}}))}),i.dismiss();return}console.log(tf({branch_dialog_action:`branch-switch-timeout`,branch:e})),qs.error(a({id:`LBwUR6`,values:{targetNoun:m}})),i.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),qs.error(a({id:`Jw6EC4`,values:{targetNoun:m}})),i.dismiss())}),()=>{t=!0}},t[13]=a,t[14]=f,t[15]=s.phase,t[16]=n,t[17]=i,t[18]=m,t[19]=y):y=t[19];let b;if(t[20]!==f||t[21]!==s.phase?(b=[s.phase,f],t[20]=f,t[21]=s.phase,t[22]=b):b=t[22],(0,Q.useEffect)(y,b),!f)return null;let{share:x,projectPath:S,currentBranch:C}=f,w=x.branch,T;t[23]!==a||t[24]!==s.info||t[25]!==s.phase||t[26]!==n.project||t[27]!==S||t[28]!==x.target||t[29]!==w||t[30]!==i?(T=function(){s.phase===`ready`&&fX(s.info).switchEnabled&&(console.log(tf({branch_dialog_action:`switch`,branch_action:`switch`,branch:w})),c(e=>_X(e,ps(x.target))),n.project.runCheckout({projectPath:S,branch:w}).then(e=>{let t=null,n=!1;c(r=>{let{state:i,sideEffect:a}=vX(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?qs.error(a({id:`NJyQi_`,values:{shareBranch:w}})):t===`fetch-failed`?qs.error(a({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&qs.error(a({id:`c863eW`,values:{shareBranch:w}})),n&&i.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),c(wX),qs.error(a({id:`c863eW`,values:{shareBranch:w}}))}))},t[23]=a,t[24]=s.info,t[25]=s.phase,t[26]=n.project,t[27]=S,t[28]=x.target,t[29]=w,t[30]=i,t[31]=T):T=t[31];let E=T,D;t[32]!==a||t[33]!==n.project||t[34]!==S||t[35]!==x.target||t[36]!==w||t[37]!==i||t[38]!==m?(D=function(){console.log(tf({branch_dialog_action:`open-current`,branch:w})),n.project.open({path:S,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:ps(x.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),qs.error(a({id:`b5aNbi`,values:{targetNoun:m}}))}),i.dismiss()},t[32]=a,t[33]=n.project,t[34]=S,t[35]=x.target,t[36]=w,t[37]=i,t[38]=m,t[39]=D):D=t[39];let O=D,k;t[40]!==a||t[41]!==s.otherWorktreePath||t[42]!==s.phase||t[43]!==n.project||t[44]!==x.target||t[45]!==w||t[46]!==i?(k=function(){if(s.phase!==`branch-in-other-worktree`)return;let e=s.otherWorktreePath;console.log(tf({branch_dialog_action:`pivot-to-other-worktree`,branch:w})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:ps(x.target)},pendingBranch:w}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),qs.error(a({id:`LdABLa`,values:{target:e}}))}),i.dismiss()},t[40]=a,t[41]=s.otherWorktreePath,t[42]=s.phase,t[43]=n.project,t[44]=x.target,t[45]=w,t[46]=i,t[47]=k):k=t[47];let A=k,j;t[48]===i?j=t[49]:(j=function(){console.log(tf({branch_dialog_action:`cancel`})),i.dismiss()},t[48]=i,t[49]=j);let M=j,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J,Y;if(t[50]!==a||t[51]!==s.info||t[52]!==s.otherWorktreePath||t[53]!==s.phase||t[54]!==M||t[55]!==C||t[56]!==x.branch||t[57]!==x.owner||t[58]!==x.repo||t[59]!==x.target||t[60]!==w||t[61]!==m){Y=s.phase===`ready`||s.phase===`switching`?fX(s.info):null;let e;t[79]!==s.info||t[80]!==s.phase||t[81]!==C?(e=s.phase===`ready`||s.phase===`switching`?pX(s.info):C??`HEAD`,t[79]=s.info,t[80]=s.phase,t[81]=C,t[82]=e):e=t[82];let n=e;R=s.phase===`switching`||s.phase===`awaiting-cc1-recycle`;let r;t[83]===a?r=t[84]:(r=a({id:`OuY8t9`}),t[83]=a,t[84]=r),I=r;let i;t[85]!==a||t[86]!==w?(i=a({id:`_BthEY`,values:{shareBranch:w}}),t[85]=a,t[86]=w,t[87]=i):i=t[87],L=i;let o=s.phase===`loading`,c=s.phase===`error`;F=oo,q=!0,t[88]===M?J=t[89]:(J=e=>{e||M()},t[88]=M,t[89]=J),P=no,H=`sm:max-w-xl`,U=`share-branch-switch-dialog`,W=CX,G=SX;let l;t[90]===m?l=t[91]:(l=(0,Z.jsx)(to,{children:(0,Z.jsx)(X,{id:`RY6Bq1`,values:{targetNoun:m}})}),t[90]=m,t[91]=l);let u=x.owner,d=x.repo,f;t[92]===x.target?f=t[93]:(f=ps(x.target),t[92]=x.target,t[93]=f);let p;t[94]!==x.owner||t[95]!==x.repo||t[96]!==f?(p=(0,Z.jsx)(eo,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`f8jU-L`,values:{0:u,1:d,2:f}})}),t[94]=x.owner,t[95]=x.repo,t[96]=f,t[97]=p):p=t[97],t[98]!==l||t[99]!==p?(K=(0,Z.jsxs)(ao,{children:[l,p]}),t[98]=l,t[99]=p,t[100]=K):K=t[100],N=ro;let h=x.owner,g=x.repo,_;t[101]===x.target?_=t[102]:(_=ps(x.target),t[101]=x.target,t[102]=_),t[103]!==x.branch||t[104]!==x.owner||t[105]!==x.repo||t[106]!==x.target.kind||t[107]!==_?(z=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(cm,{owner:h,repo:g,path:_,kind:x.target.kind,branch:x.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=x.branch,t[104]=x.owner,t[105]=x.repo,t[106]=x.target.kind,t[107]=_,t[108]=z):z=t[108],B=s.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(X,{id:`yjExfe`,values:{shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:s.otherWorktreePath})]}):o?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ms,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`w4hMYl`})}):Y?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`XnoA1k`,values:{targetNoun:m,shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):Y?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`sZ2IOu`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`_902BE`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),V=Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(X,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:Y.conflictingFiles.map(xX)})]}):null,t[50]=a,t[51]=s.info,t[52]=s.otherWorktreePath,t[53]=s.phase,t[54]=M,t[55]=C,t[56]=x.branch,t[57]=x.owner,t[58]=x.repo,t[59]=x.target,t[60]=w,t[61]=m,t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=R,t[68]=z,t[69]=B,t[70]=V,t[71]=H,t[72]=U,t[73]=W,t[74]=G,t[75]=K,t[76]=q,t[77]=J,t[78]=Y}else N=t[62],P=t[63],F=t[64],I=t[65],L=t[66],R=t[67],z=t[68],B=t[69],V=t[70],H=t[71],U=t[72],W=t[73],G=t[74],K=t[75],q=t[76],J=t[77],Y=t[78];let ee;t[109]===R?ee=t[110]:(ee=R?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ms,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`CU3AiE`})]}):null,t[109]=R,t[110]=ee);let te;t[111]!==N||t[112]!==z||t[113]!==B||t[114]!==V||t[115]!==ee?(te=(0,Z.jsxs)(N,{children:[z,B,V,ee]}),t[111]=N,t[112]=z,t[113]=B,t[114]=V,t[115]=ee,t[116]=te):te=t[116];let ne;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(X,{id:`dEgA5A`}),t[117]=ne):ne=t[117];let re;t[118]===M?re=t[119]:(re=(0,Z.jsx)(Di,{variant:`ghost`,className:`font-mono uppercase`,onClick:M,"data-testid":`share-branch-switch-cancel`,children:ne}),t[118]=M,t[119]=re);let ie;t[120]!==s.phase||t[121]!==O||t[122]!==A||t[123]!==E||t[124]!==I||t[125]!==L||t[126]!==R||t[127]!==Y?(ie=s.phase===`branch-in-other-worktree`?(0,Z.jsx)(Di,{onClick:A,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(X,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[Y?.openCurrentEnabled?(0,Z.jsxs)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:O,disabled:R,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(dd,{className:`size-3.5`,"aria-hidden":!0}),I]}):null,(0,Z.jsx)(Di,{onClick:E,disabled:!Y?.switchEnabled||R,"aria-disabled":!Y?.switchEnabled||R,"aria-describedby":Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:R?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),L]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{className:`size-3.5`,"aria-hidden":!0}),L]})})]}),t[120]=s.phase,t[121]=O,t[122]=A,t[123]=E,t[124]=I,t[125]=L,t[126]=R,t[127]=Y,t[128]=ie):ie=t[128];let ae;t[129]!==re||t[130]!==ie?(ae=(0,Z.jsxs)(io,{className:`sm:justify-between`,children:[re,ie]}),t[129]=re,t[130]=ie,t[131]=ae):ae=t[131];let oe;t[132]!==P||t[133]!==H||t[134]!==U||t[135]!==W||t[136]!==G||t[137]!==K||t[138]!==te||t[139]!==ae?(oe=(0,Z.jsxs)(P,{className:H,"data-testid":U,onInteractOutside:W,onPointerDownOutside:G,children:[K,te,ae]}),t[132]=P,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=te,t[139]=ae,t[140]=oe):oe=t[140];let se;return t[141]!==F||t[142]!==q||t[143]!==J||t[144]!==oe?(se=(0,Z.jsx)(F,{open:q,onOpenChange:J,children:oe}),t[141]=F,t[142]=q,t[143]=J,t[144]=oe,t[145]=se):se=t[145],se}function xX(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function SX(e){e.preventDefault()}function CX(e){e.preventDefault()}function wX(e){return vX(e,null).state}function TX(e){return gX(e,null)}function EX(){return null}function DX(){let e=(0,$.c)(17),t=Fn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=_t(),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 U,i=new Ye({url:n,name:ri,document:e,onStateless:e=>{let{payload:t}=e;M(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:NX,onConfigValidationRejected:MX,onConfigIgnoreNestedError:jX,onUnknown:AX})},onClose:kX,onDisconnect:OX}),a=ec(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=ge(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{$s([`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 OX(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function kX(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function AX(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function jX(e){Da(e)}function MX(e){ja(e)}function NX(e){$s([e.ch])}function PX(e){let t=ae(e);if(t)return{scope:`project`,name:t};let n=ti(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function FX(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=PX(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:bi(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function IX(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=_t(),r;e[0]===t?r=e[1]:(r=t.some(RX),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=Qo(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(LX).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=FX(t,e);for(let e of i)e.kind===`retarget`?(Fs(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function LX(e){return`${e.scope}\u0000${e.name}`}function RX(e){return PX(e)!==null}var zX=1e3,BX=3e4;function VX(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??zX,r=e.maxBackoffMs??BX,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function HX(e){if(e)return e.replace(/\/collab\/?$/,``)}function UX(){return kt(window)!==null}function WX(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??VX;if((i.current?.isElectronHost??UX)())return;let t=e({resolveWsUrl:async()=>HX(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var GX=`#install-claude-desktop`;function KX(e){return e===`#settings`||e===GX}function qX(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function JX(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=_t(),{openTargetTransition:i}=At();IX();let{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=Oo(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=qX(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(KX(window.location.hash))return;let e=uo(window.location.hash);if(e){let t=or(e.split(`.`).pop()??``);Ot(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=_o(window.location.hash);if(n){Ot(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),i({kind:`skill-file`,target:`${n.scope}/${n.name}/${n.path}`,scope:n.scope,name:n.name,path:n.path});return}if(ko(window.location.hash)){Ot(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let r=Io(window.location.hash);if(!r){Ot(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Ot(`ok/nav/hash-change`,{docName:r,kind:`deferred-loading`});return}let a=To(r,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(a.kind===`missing`&&/\/+$/.test(r.trim())){Ot(`ok/nav/hash-change`,{docName:r,kind:`deferred-missing-folder`});return}let f=jo(No(a),c);Ot(`ok/nav/hash-change`,{docName:r,kind:f.kind}),i(f)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function YX(){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)(XX,t),null}function XX(){let e=$X;if(!e(window.location.hash))return;let t=new AbortController;return ve(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(QX))}).catch(ZX),()=>t.abort()}function ZX(){}function QX(){}function $X(e){return!KX(e)&&!uo(e)&&!Io(e)&&(e===``||e===`#`||e===`#/`)}function eZ(){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)(tZ,t),null}function tZ(){let e=function(e){let t=e.target;aa({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=ra))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function nZ(){let e=(0,$.c)(4),{activeTarget:t}=_t(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function rZ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=_t(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Do(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;m_({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)(g_,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function iZ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=_t();WX(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(N,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function aZ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(P,{name:`app`,children:(0,Z.jsx)(Rt,{children:(0,Z.jsx)(iZ,{children:(0,Z.jsx)(K_,{children:(0,Z.jsx)(oZ,{})})})})}),e[0]=t):t=e[0],t}function oZ(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Y_(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:sZ}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(hv,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(DX,{}),u=(0,Z.jsx)(JX,{}),d=(0,Z.jsx)(YX,{}),f=(0,Z.jsx)(nZ,{}),p=(0,Z.jsx)(rZ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(eZ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(gv,{bridge:t}):null,h=(0,Z.jsx)(im,{}),g=t?(0,Z.jsx)(bX,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(sv,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=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]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(iX,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Zj,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(uI,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(es,{value:s,children:(0,Z.jsxs)(Gj,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(Mo,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function sZ(e,t){cI(us(e,t),t)}lu(),Rm({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Zm(),Ch()&&kh(),bg(),Rh(),typeof window<`u`&&$m({bridge:window.okDesktop}),typeof window<`u`&&uh({bridge:window.okDesktop}),typeof window<`u`&&vl({bridge:window.okDesktop}),typeof window<`u`&&pl({bridge:window.okDesktop}),typeof window<`u`&&nh({bridge:window.okDesktop}),typeof window<`u`&&_m({bridge:window.okDesktop}),Hh();var cZ=new vu({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),lZ=document.getElementById(`root`);if(!lZ)throw Error(`Root element not found`);var uZ=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Au.createRoot)(lZ).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(ln,{i18n:rc,children:(0,Z.jsx)(Dn,{client:cZ,children:(0,Z.jsxs)(_r,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(mc,{children:uZ&&window.okDesktop?(0,Z.jsx)(jm,{bridge:window.okDesktop}):(0,Z.jsx)(aZ,{})}),(0,Z.jsx)(Im,{richColors:!0,closeButton:!0})]})})})}));
|
|
2004
|
+
`}\n${BK}\n${VK}`;function LJ(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&xJ.has(t)}function RJ(e){return e===`darwin`?rc._({id:`LtSYdi`}):e===`win32`?rc._({id:`qi1F96`}):rc._({id:`e1Rn_k`})}function zJ(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:i}=e,{_:a}=cn(),o=typeof window<`u`?window.okDesktop:void 0;if(!o)return null;let s=o.platform,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=RJ(s),t[0]=c):c=t[0];let l=c,u,d;t[1]!==a||t[2]!==r?(u=r?null:a({id:`wTcjov`}),d=a(s===`darwin`?u?{id:`FvpFSZ`,values:{hint:u}}:{id:`LtSYdi`}:s===`win32`?u?{id:`o4dcAf`,values:{hint:u}}:{id:`qi1F96`}:u?{id:`zUhPuR`,values:{hint:u}}:{id:`e1Rn_k`}),t[1]=a,t[2]=r,t[3]=u,t[4]=d):(u=t[3],d=t[4]);let f=d,p=!r,m;t[5]!==n||t[6]!==i||t[7]!==r?(m=()=>{if(!r)return;i();let e=Ho(r.contentDir,fP(n),r.pathSeparator);o.shell.showItemInFolder(e)},t[5]=n,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h,g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(hs,{"aria-hidden":`true`}),g=(0,Z.jsx)(`span`,{className:`flex-1`,children:l}),t[9]=h,t[10]=g):(h=t[9],g=t[10]);let _;t[11]===u?_=t[12]:(_=u?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:u}):null,t[11]=u,t[12]=_);let v;return t[13]!==f||t[14]!==p||t[15]!==m||t[16]!==_?(v=(0,Z.jsxs)(Jc,{disabled:p,onSelect:m,"aria-label":f,children:[h,g,_]}),t[13]=f,t[14]=p,t[15]=m,t[16]=_,t[17]=v):v=t[17],v}function BJ(e,t){return dP({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function VJ(e,t){return e!==t&&e.startsWith(t)}function HJ(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>VJ(e,t))).map(e=>BJ(e,t))}function UJ(e,t){return e===t||e.startsWith(`${t}/`)}function WJ(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 GJ(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)Fo(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):So(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=eP(e);UJ(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function KJ(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:UJ(t.createdPath,e.path)}function qJ(e){let t=(0,$.c)(69),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,projectLocalBinding:l,mergedConfig:u,onStartCreating:d,onCreateFromTemplate:f,onDuplicate:p,onDelete:h,onExpandSubtree:g,onCollapseSubtree:_,folderTreePaths:v,isAsset:y,documents:b}=e,{_:x}=cn(),S=dP(n,b),C=n.kind===`directory`,w=S.kind===`asset`?null:S,T=w!==null&&c!==null,E;t[0]!==x||t[1]!==C?(E=x(C?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=x,t[1]=C,t[2]=E):E=t[2];let D=E,O=u?.appearance?.sidebar?.showHiddenFiles??!1,k=l!==null,A;t[3]!==C||t[4]!==n.path?(A=C?eP(n.path):null,t[3]=C,t[4]=n.path,t[5]=A):A=t[5];let j=Aa(A),M=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,N=s.getSelectedPaths(),P=N.includes(S.treePath)?HJ(N,b):[],F=P.length>1?P:[S],I=F.length,L=rc._({id:`djjdjr`,values:{deleteCount:I}}),R;t[6]!==y||t[7]!==C||t[8]!==n||t[9]!==a?(R=y?null:C?Ko({folderRelativePath:fP(n),workspace:a}):cs({docName:ZN(n.path),workspace:a}),t[6]=y,t[7]=C,t[8]=n,t[9]=a,t[10]=R):R=t[10];let z=R,B;t[11]===r?B=t[12]:(B=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=B);let V=B,H;t[13]===r?H=t[14]:(H=()=>r.close(),t[13]=r,t[14]=H);let U=H,{status:W}=ia(),G=W?.hasRemote===!0,K;t[15]!==y||t[16]!==C||t[17]!==n.path||t[18]!==S?(K=y||S.kind===`asset`?null:C?Ji(eP(n.path)):ya(ZN(n.path)),t[15]=y,t[16]=C,t[17]=n.path,t[18]=S,t[19]=K):K=t[19];let q=K,J=G&&q!==null,Y;t[20]!==x||t[21]!==G||t[22]!==q?(Y=()=>{q&&Yi({...q,hasRemote:G,onClickWhenNoRemote:()=>{qs.error(x({id:`WyQxwa`}))}},{clipboardWrite:is,toastSuccess:XJ,toastError:YJ,logEvent:JJ})},t[20]=x,t[21]=G,t[22]=q,t[23]=Y):Y=t[23];let ee=Y,te;t[24]!==J||t[25]!==U||t[26]!==ee?(te=J?(0,Z.jsxs)(Jc,{"data-testid":`file-tree-menu-share`,onSelect:()=>{U(),ee()},children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Z8lGw6`})]}):null,t[24]=J,t[25]=U,t[26]=ee,t[27]=te):te=t[27];let ne=te,re;t[28]!==x||t[29]!==l?(re=e=>{if(l===null)return;let t=l.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Wr(t.error)),qs.error(x({id:`P47EWZ`}),{description:Wr(t.error)}))},t[28]=x,t[29]=l,t[30]=re):re=t[30];let ie=re,ae=0,oe=0;if(C){let e=tP(n.path);for(let t of v)(t===e||t.startsWith(e))&&(ae++,Nq(s.getItem(t))?.isExpanded()&&oe++)}let se=C&&oe<ae,ce=C&&oe>0,le;t[31]===U?le=t[32]:(le=e=>{e||U()},t[31]=U,t[32]=le);let ue;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[33]=ue):ue=t[33];let de;t[34]!==x||t[35]!==i||t[36]!==T||t[37]!==k||t[38]!==U||t[39]!==V||t[40]!==L||t[41]!==F||t[42]!==M||t[43]!==ie||t[44]!==o||t[45]!==z||t[46]!==D||t[47]!==y||t[48]!==C||t[49]!==n||t[50]!==s||t[51]!==c||t[52]!==w||t[53]!==_||t[54]!==f||t[55]!==h||t[56]!==p||t[57]!==g||t[58]!==d||t[59]!==ne||t[60]!==O||t[61]!==ce||t[62]!==se||t[63]!==S||t[64]!==a?(de=(0,Z.jsx)(Xc,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:C?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),d(`file`,eP(n.path))},children:[(0,Z.jsx)(Md,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`HdkSiO`})]}),M?(0,Z.jsxs)(Gc,{children:[(0,Z.jsxs)(ol,{disabled:i,children:[(0,Z.jsx)(ha,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Uuj_R4`})]}),(0,Z.jsx)(Nc,{children:(0,Z.jsx)(Mq,{parentDir:eP(n.path),onSelectTemplate:e=>{V(),f(eP(n.path),e)},ItemComponent:Jc})})]}):null,(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),d(`folder`,eP(n.path))},children:[(0,Z.jsx)(Xu,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`96G6Re`})]}),(0,Z.jsx)(sl,{}),(0,Z.jsx)(zJ,{item:n,workspace:a,onClose:U}),(0,Z.jsx)(qo,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(Gc,{children:[(0,Z.jsxs)(ol,{children:[(0,Z.jsx)(xs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`oCZkaG`})]}),(0,Z.jsxs)(Nc,{children:[(0,Z.jsx)(Jc,{disabled:!a,onSelect:()=>{a&&(U(),bJ(Ho(a.contentDir,fP(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(X,{id:`oQA-cA`})}),(0,Z.jsx)(Jc,{onSelect:()=>{U(),bJ(fP(n),`relative`)},children:(0,Z.jsx)(X,{id:`s061i4`})})]})]}),(0,Z.jsx)(sl,{}),(0,Z.jsx)(el,{checked:O,onCheckedChange:ie,disabled:!k,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(X,{id:`XcGbim`})}),se||ce?(0,Z.jsx)(sl,{}):null,se?(0,Z.jsxs)(Jc,{onSelect:()=>{U(),g(n.path)},children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`OlAl5i`})]}):null,ce?(0,Z.jsxs)(Jc,{onSelect:()=>{U(),_(n.path)},children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`qvWGzP`})]}):null,(0,Z.jsx)(sl,{}),(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{S.kind!==`asset`&&(U(),p(S))},children:[(0,Z.jsx)(vs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`euc6Ns`})]}),(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Cs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`2wxgft`})]}),(0,Z.jsxs)(Jc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c||!w)return;U();let e=iq(w),t=fa(c.current()),n=ca(t,e);if(n===t)return;c.patch(ga(n));let r=w.path.split(`/`).pop()||w.path;qs.success(x({id:`4xtLTl`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),D]}),(0,Z.jsxs)(Jc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),h(F)},children:[(0,Z.jsx)(_s,{"aria-hidden":`true`}),L]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(zJ,{item:n,workspace:a,onClose:U}),!y&&(0,Z.jsx)(qo,{input:z,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),ne,(0,Z.jsxs)(Gc,{children:[(0,Z.jsxs)(ol,{children:[(0,Z.jsx)(xs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`oCZkaG`})]}),(0,Z.jsxs)(Nc,{children:[(0,Z.jsx)(Jc,{disabled:!a,onSelect:()=>{a&&(U(),bJ(Ho(a.contentDir,fP(n),a.pathSeparator),`full`))},children:(0,Z.jsx)(X,{id:`oQA-cA`})}),(0,Z.jsx)(Jc,{onSelect:()=>{U(),bJ(fP(n),`relative`)},children:(0,Z.jsx)(X,{id:`s061i4`})})]})]}),(0,Z.jsx)(sl,{}),y?null:(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{U(),p(S)},children:[(0,Z.jsx)(vs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`euc6Ns`})]}),(0,Z.jsxs)(Jc,{disabled:i,onSelect:()=>{V(),s.startRenaming(n.path)},children:[(0,Z.jsx)(Cs,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`2wxgft`})]}),w?(0,Z.jsxs)(Jc,{"data-testid":`file-tree-menu-hide`,disabled:!T,onSelect:()=>{if(!c)return;U();let e=iq(w),t=fa(c.current()),n=ca(t,e);if(n===t)return;c.patch(ga(n));let r=w.path.split(`/`).pop()||w.path;qs.success(x({id:`OD0FCX`,values:{basename:r}}),{description:x({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(m,{"aria-hidden":`true`}),D]}):null,(0,Z.jsxs)(Jc,{variant:`destructive`,disabled:i,onSelect:()=>{U(),h(F)},children:[(0,Z.jsx)(_s,{"aria-hidden":`true`}),L]})]})}),t[34]=x,t[35]=i,t[36]=T,t[37]=k,t[38]=U,t[39]=V,t[40]=L,t[41]=F,t[42]=M,t[43]=ie,t[44]=o,t[45]=z,t[46]=D,t[47]=y,t[48]=C,t[49]=n,t[50]=s,t[51]=c,t[52]=w,t[53]=_,t[54]=f,t[55]=h,t[56]=p,t[57]=g,t[58]=d,t[59]=ne,t[60]=O,t[61]=ce,t[62]=se,t[63]=S,t[64]=a,t[65]=de):de=t[65];let fe;return t[66]!==le||t[67]!==de?(fe=(0,Z.jsxs)(nl,{open:!0,modal:!1,onOpenChange:le,children:[ue,de]}),t[66]=le,t[67]=de,t[68]=fe):fe=t[68],fe}function JJ(e){return console.log(e)}function YJ(e){return qs.error(e)}function XJ(e){return qs.success(e)}async function ZJ(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:Kq});if(qq(i)){let e=await Xq(i);return{kind:`entries`,entries:Lo(e.entries),truncated:e.truncated}}let a=await J(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Kn.safeParse(a.body);return o.success?{kind:`entries`,entries:Lo(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof Jq?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function QJ(e){let t=(0,$.c)(356),{ref:n,onContentHeightChange:r}=e,{_:i,i18n:a}=cn(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=_t(),{notifySidebarFileSelected:v}=Wj(),{resolvedTheme:y}=xr(),{addPage:b,pageMeta:x}=Oo(),S;t[0]===x?S=t[1]:(S=function(e,t){return Po(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),go(vo(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=Ao(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),go(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(!0),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),L=zh(),R=(0,Q.useRef)(null),[z,B]=(0,Q.useState)(null),[V,H]=(0,Q.useState)(null),[U,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),{conflicts:Y}=qi(),[ee,te]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(null),[ae,oe]=(0,Q.useState)(!1),se=(0,Q.useRef)(ae),ce;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ce=new Set,t[10]=ce):ce=t[10];let le=(0,Q.useRef)(ce),ue=(0,Q.useRef)(k),de=(0,Q.useRef)(x),fe;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(fe=function(e,t){let n=t===void 0?k:t,r=yq(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,nP(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),go(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>Fo(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=fe):fe=t[16];let pe=fe,me;t[17]!==v||t[18]!==h?(me=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??ue.current).find(t=>So(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),go(fo(e)),v()},t[17]=v,t[18]=h,t[19]=me):me=t[19];let he=me,ge=(0,Q.useRef)(o),_e;t[20]===k?_e=t[21]:(_e=new Set(k.filter(So).map(TY)),t[20]=k,t[21]=_e);let ve=_e,ye=(0,Q.useRef)(ve),be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[22]=be):be=t[22];let xe=(0,Q.useRef)(be),Se=(0,Q.useRef)(null),Ce=(0,Q.useRef)(wY),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(null),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(!1),Oe=(0,Q.useRef)(null),ke;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(ke={row:null,root:null},t[23]=ke):ke=t[23];let je=(0,Q.useRef)(ke),Me=(0,Q.useRef)(CY),Ne=(0,Q.useRef)(null),Pe;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=new Map,t[24]=Pe):Pe=t[24];let Fe=(0,Q.useRef)(Pe),Le;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Le=new Set,t[25]=Le):Le=t[25];let Re=(0,Q.useRef)(Le),ze;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ze=new Map,t[26]=ze):ze=t[26];let Be=(0,Q.useRef)(ze),Ve=(0,Q.useRef)(0),He;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(He=new Set,t[27]=He):He=t[27];let Ue=(0,Q.useRef)(He),We=(0,Q.useRef)(SY),Ge=(0,Q.useRef)(xY),Ke=(0,Q.useRef)(!1),Je=(0,Q.useRef)(null),Ye=(0,Q.useRef)(null),Xe=(0,Q.useRef)(bY),Qe=(0,Q.useRef)(yY),$e=(0,Q.useRef)(vY),et=(0,Q.useRef)(_Y),tt=(0,Q.useRef)(c),[nt,rt]=(0,Q.useState)(!1),it;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(){R.current!==null&&(clearTimeout(R.current),R.current=null)},t[28]=it):it=t[28];let at=it,ot;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ot=function(){at(),I(!1)},t[29]=ot):ot=t[29];let st=ot,ct;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){st(),P(e)},t[30]=ct):ct=t[30];let lt=ct,ut;t[31]===i?ut=t[32]:(ut=function(){if(at(),Fh()){P(null),I(!0),R.current=setTimeout(()=>{R.current=null,Je.current?.()},NJ);return}I(!1),P(i({id:`34qyH5`}))},t[31]=i,t[32]=ut);let dt=ut,ft=(0,Q.useRef)(!0),pt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>{if(ft.current){ft.current=!1;return}Je.current?.()},t[33]=pt):pt=t[33];let ht;t[34]===L?ht=t[35]:(ht=[L],t[34]=L,t[35]=ht),(0,Q.useEffect)(pt,ht);let gt,vt;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(gt=()=>at,vt=[],t[36]=gt,t[37]=vt):(gt=t[36],vt=t[37]),(0,Q.useEffect)(gt,vt);let yt,bt;t[38]!==k.length||t[39]!==j?(yt=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=e,n=function(){Oe.current!==null&&clearTimeout(Oe.current),Oe.current=setTimeout(()=>{De.current=!1,Oe.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=DY(e),n=t?.dataset.itemPath;if(!n)return;let r=wq(t.dataset.itemType===`folder`?tP(n):n,ue.current,de.current);r&&(Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!0,e.dataTransfer?.setData(xO,CO(r)))},i=function(e){if(!(e instanceof DragEvent)||!xP(e))return;let t=kY(e);if(!t){vJ(je);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),yJ(je,t)},a=function(e){if(!(e instanceof DragEvent)||!xP(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||vJ(je)},o=function(e){if(!(e instanceof DragEvent)||!xP(e))return;let t=kY(e),n=SP(e);if(!t||n.length===0){vJ(je);return}e.preventDefault(),e.stopPropagation(),vJ(je),Me.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),vJ(je),Oe.current!==null&&(clearTimeout(Oe.current),Oe.current=null),De.current=!1}},bt=[k.length,j],t[38]=k.length,t[39]=j,t[40]=yt,t[41]=bt):(yt=t[40],bt=t[41]),(0,Q.useEffect)(yt,bt);let{selectedFilePath:xt,selectedFolderPath:St,navigationPath:Ct}=vq(c,m?null:o),wt=xt?XN(xt,k.find(e=>Fo(e)&&e.docName===xt)?.docExt):St?tP(St):c?.kind===`asset`?c.assetPath:null,Tt=ae?null:wt,Et=ts().states,{dispatch:Dt}=ls(),Ot;t[42]!==Dt||t[43]!==Et?(Ot={installStates:Et,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:Dt},t[42]=Dt,t[43]=Et,t[44]=Ot):Ot=t[44];let kt=Ot,{okignoreBinding:At,projectLocalBinding:jt,merged:Mt}=ys(),Nt=Mt?.appearance?.sidebar?.showHiddenFiles??!1,Pt;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=()=>Ne.current===null,t[45]=Pt):Pt=t[45];let Ft=Pt,It;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(It=[],t[46]=It):It=t[46];let Lt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Lt={set:`complete`,spriteSheet:OJ,byFileExtension:{md:{name:wJ,viewBox:Ie},mdx:{name:wJ,viewBox:Ie}}},t[47]=Lt):Lt=t[47];let Rt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Rt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Rt):Rt=t[48];let zt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(zt={canDrag:Ft,canDrop:Ft,onDropComplete:e=>et.current(e),onDropError:gY},t[49]=zt):zt=t[49];let Bt,Vt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Bt={canRename:Ft,onRename:e=>Qe.current(e),onError:e=>$e.current(e)},Vt=e=>Xe.current(e),t[50]=Bt,t[51]=Vt):(Bt=t[50],Vt=t[51]);let Ht;t[52]===i?Ht=t[53]:(Ht={paths:It,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...RK,icons:Lt,unsafeCSS:IJ,composition:Rt,dragAndDrop:zt,renaming:Bt,onSelectionChange:Vt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=ue.current.find(e=>Fo(e)&&XN(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:SJ,title:i(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return LJ(t.path)?{icon:CJ,title:i({id:`i9toLO`})}:null}let n=ue.current.find(e=>Ro(e)&&tP(e.path)===tP(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:SJ,title:i(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=i,t[53]=Ht);let{model:Ut}=LK(Ht),Wt;t[54]===Ut?Wt=t[55]:(Wt=function(e){let t=Ut.getItem(e)??Ut.getItem(tP(e));return t?.isDirectory()?tP(eP(t.getPath())):e},t[54]=Ut,t[55]=Wt);let Gt=Wt,Kt,qt;t[56]===k?(Kt=t[57],qt=t[58]):(qt=rP(k),Kt=iP(qt),t[56]=k,t[57]=Kt,t[58]=qt);let Jt=Kt,Yt=(0,Q.useRef)(qt),Xt;t[59]===k?Xt=t[60]:(Xt=oP(k),t[59]=k,t[60]=Xt);let Zt=Xt,Qt=(0,Q.useRef)(Zt),$t=St?sP(tP(St)).slice(0,-1):sP(Tt??Ct),en=$t.join(`\0`),tn;t[61]===Ut?tn=t[62]:(tn=()=>{let e=new Set;for(let t of Qt.current)Nq(Ut.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=Ut,t[62]=tn);let nn=tn,rn;t[63]===nn?rn=t[64]:(rn=e=>{let t=new Set(oP(e??ue.current)),n=nn();for(let e of xe.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=nn,t[64]=rn);let an=rn,on;t[65]!==an||t[66]!==Ut?(on=e=>{let t=rP(e??ue.current);Ut.resetPaths(t,{initialExpandedPaths:an(e)})},t[65]=an,t[66]=Ut,t[67]=on):on=t[67];let sn=on,ln;t[68]!==i||t[69]!==dt?(ln=async function(e){let t=Ve.current,n=new AbortController;Be.current.set(e,n);let r=await ZJ(eP(e),n.signal,i({id:`8RtNI0`}),i({id:`HlmZBk`}));if(Be.current.get(e)===n&&Be.current.delete(e),n.signal.aborted||t!==Ve.current)return;if(r.kind===`network-error`){dt(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,r.cause);return}if(r.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,r.title),lt(r.title);return}let a=Ke.current,o=Eo(r.entries,a);Re.current.add(e),A(t=>$q(t,e,o,Fe.current)),P(null),st(),r.truncated&&B(r.entries.length)},t[68]=i,t[69]=dt,t[70]=ln):ln=t[70];let un=ln,dn;t[71]!==nn||t[72]!==un?(dn=()=>{let e=nn(),t=Ue.current;Ue.current=e;for(let n of e){if(t.has(n)||Re.current.has(n)||Be.current.has(n))continue;let e=eP(n);ue.current.find(t=>Ro(t)&&t.path===e)?.hasChildren!==!1&&un(n)}},t[71]=nn,t[72]=un,t[73]=dn):dn=t[73];let fn=dn,pn;t[74]!==nn||t[75]!==un?(pn=()=>{for(let e of nn())Re.current.has(e)||Be.current.has(e)||un(e)},t[74]=nn,t[75]=un,t[76]=pn):pn=t[76];let mn=pn,hn;t[77]!==Ut||t[78]!==sn?(hn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>Fo(e)&&e.docName===r);if(n==null||Ut.getItem(i)==null)continue;let s=XN(i,t.find(e=>Fo(e)&&e.docName===i)?.docExt??n.docExt);Ut.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=mt(e);if(t===``)continue;let n=e.slice(0,-t.length);Ut.getItem(n)!=null&&(Ut.getItem(e)??Ut.move(n,e),o=e,a+=1)}a!==0&&(sn(t),o!=null&&Ut.focusPath(o))},t[77]=Ut,t[78]=sn,t[79]=hn):hn=t[79];let gn=hn,_n;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(_n=e=>{we.current=aP(e)},t[80]=_n):_n=t[80];let vn=_n,yn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(yn=e=>ye.current.has(e),t[81]=yn):yn=t[81];let bn=yn,xn;t[82]!==i||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==sn?(xn=async function(e){if(e.kind===`asset`||Ne.current!==null)return;let t=()=>{H(null),Ne.current=null};Ne.current=e.path,H(e.path),P(null);try{let n=await J(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),i({id:`dw_dUJ`}));if(!n.ok){qs.error(n.title),sn(),t();return}let r=s(cr,n.body,`duplicate-path`,null);if(r===null){let e=i({id:`67f-3g`});qs.error(e),P(e),$s([`files`,`backlinks`,`graph`]),sn(),t();return}for(let e of r.duplicatedDocNames)b(e);A(t=>{let n=MP(t,e,r);return sn(n),vn(n),n}),$s([`files`,`backlinks`,`graph`]),r.path!==e.path&&(r.kind===`folder`?D(r.path):T(r.path)),qs.success(r.kind===`folder`?i({id:`iilQXA`}):i({id:`A6h5b-`}),{description:r.path}),t()}catch(e){let n=e,r=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),qs.error(i({id:`EBVbtP`}),{description:r}),sn(),t()}},t[82]=i,t[83]=b,t[84]=D,t[85]=T,t[86]=sn,t[87]=xn):xn=t[87];let Sn=xn,Cn=(0,Q.useRef)(Sn),wn;t[88]===Sn?wn=t[89]:(wn=()=>{Cn.current=Sn},t[88]=Sn,t[89]=wn),(0,Q.useEffect)(wn);let Tn=function(e){let t=hJ(e);if(!t||gJ(t))return!1;let n=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||bn(n))return!1;let r=gJ(n);if(!r)return!1;let i=tP(t);if(!Qt.current.includes(i))return!1;let a=`${t}${r}`;return Yt.current.includes(a)?!1:(ar({sourcePath:n,destinationPath:a,isFolder:!1}),Ut.move(n,a),!0)},En;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(En=e=>{let t=e??Se.current;!t||Se.current!==t||(t.disposeCommitListener(),Se.current=null)},t[90]=En):En=t[90];let Dn=En,On;t[91]!==i||t[92]!==Dn||t[93]!==u||t[94]!==l||t[95]!==sn?(On=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,a=n.restoreLocation??r;Dn(e),r&&H(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 J(t,i({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=i({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});r?qs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),r&&(H(null),sn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),r){let t=e.kind,n=e.createdPath;qs.error(i({id:`_TDESN`,values:{kind:t,createdPath:n}}))}r&&(H(null),sn());return}r&&(e.kind===`file`?u(e.createdPath):l([Ae(e.createdPath)],{force:!0})),r&&A(t=>{let n=AP(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return vn(n),n}),$s([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),r&&H(null)},t[91]=i,t[92]=Dn,t[93]=u,t[94]=l,t[95]=sn,t[96]=On):On=t[96];let kn=On,An,jn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(An=()=>()=>{let e=Se.current;e&&Ce.current(e,{restoreLocation:!1,updateUi:!1}).catch(hY)},jn=[],t[97]=An,t[98]=jn):(An=t[97],jn=t[98]),(0,Q.useEffect)(An,jn);let Mn;t[99]!==i||t[100]!==dt?(Mn=()=>{let e=!0,t=null,n=Gq(async function(){t?.abort();let n=new AbortController;t=n,Ve.current+=1;for(let e of Be.current.values())e.abort();Be.current.clear(),Re.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:Kq});if(qq(t)){let r=Ke.current,i=!1,{entries:a,truncated:o}=await Xq(t,{onBatch:t=>{if(!e||n.signal.aborted)return;let a=Eo(Lo(t),r);a.length!==0&&(A(e=>Qq(e,a)),i||(i=!0,P(null),st(),M(!1)))}});if(!e)return;let s=Eo(Lo(a),r);A(e=>$q(e,``,s,Fe.current)),P(null),st(),B(o?a.length:null),Ge.current()}else{let n=await J(t,i({id:`8RtNI0`}));if(!e)return;if(!n.ok)lt(n.title),B(null);else{let e=Kn.safeParse(n.body);if(!e.success)lt(i({id:`HlmZBk`})),B(null);else{let t=Ke.current,n=Eo(Lo(e.data.documents),t);A(e=>$q(e,``,n,Fe.current)),P(null),st(),B(e.data.truncated===!0?e.data.documents.length:null),Ge.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof Jq?lt(r.message):dt()),console.warn(`[FileTree] fetch failed:`,r)}e&&M(!1)},()=>t?.abort());Je.current=()=>n.request(),n.request();let r=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,r),window.addEventListener(`visibilitychange`,r);let a=ec(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,Je.current=null,n.dispose();for(let e of Be.current.values())e.abort();Be.current.clear(),window.removeEventListener(`focus`,r),window.removeEventListener(`visibilitychange`,r),a()}},t[99]=i,t[100]=dt,t[101]=Mn):Mn=t[101];let Nn;t[102]===i?Nn=t[103]:(Nn=[i],t[102]=i,t[103]=Nn),(0,Q.useEffect)(Mn,Nn);let Pn=(0,Q.useRef)(!0),Fn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(Fn=()=>{if(Pn.current){Pn.current=!1;return}Je.current?.()},t[104]=Fn):Fn=t[104];let In;t[105]===Nt?In=t[106]:(In=[Nt],t[105]=Nt,t[106]=In),(0,Q.useEffect)(Fn,In);let Ln,Rn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ln=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=s(Kr,n,`workspace`,null);r&&ie({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(mY),()=>{e=!1}},Rn=[],t[107]=Ln,t[108]=Rn):(Ln=t[107],Rn=t[108]),(0,Q.useEffect)(Ln,Rn);let zn;t[109]!==an||t[110]!==Ut||t[111]!==Jt?(zn=()=>{if(we.current===Jt){we.current=null;return}Ut.resetPaths(Yt.current,{initialExpandedPaths:an()})},t[109]=an,t[110]=Ut,t[111]=Jt,t[112]=zn):zn=t[112];let Bn;t[113]!==Ut||t[114]!==Jt?(Bn=[Ut,Jt],t[113]=Ut,t[114]=Jt,t[115]=Bn):Bn=t[115],(0,Q.useEffect)(zn,Bn),Fq(Ut,Tt,en,Ee,Jt);let Vn,Hn;t[116]!==Ut||t[117]!==r?(Vn=()=>{if(!r)return;let e=0,t=0,n=()=>Ye.current?.querySelector(`file-tree-container`)?.shadowRoot?.querySelector(`[data-file-tree-virtualized-list]`)??null,i=()=>{let e=n();if(!e)return;let t=Number.parseFloat(e.style.height);Number.isFinite(t)&&r(t)},a=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(i)},o=new MutationObserver(i),s=()=>{let e=n();e?(o.observe(e,{attributes:!0,attributeFilter:[`style`]}),i()):t=requestAnimationFrame(s)};s();let c=Ut.subscribe(a);return window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(e),cancelAnimationFrame(t),o.disconnect(),c(),window.removeEventListener(`resize`,a)}},Hn=[r,Ut],t[116]=Ut,t[117]=r,t[118]=Vn,t[119]=Hn):(Vn=t[118],Hn=t[119]),(0,Q.useEffect)(Vn,Hn);let Un;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Un=()=>{oe(!1)},t[120]=Un):Un=t[120];let Wn;t[121]===wt?Wn=t[122]:(Wn=[wt],t[121]=wt,t[122]=Wn),(0,Q.useEffect)(Un,Wn);let Gn,qn;t[123]===ae?(Gn=t[124],qn=t[125]):(Gn=()=>{se.current=ae;for(let e of le.current)e()},qn=[ae],t[123]=ae,t[124]=Gn,t[125]=qn),(0,Q.useEffect)(Gn,qn);let Yn;t[126]!==Tt||t[127]!==j||t[128]!==Ut?(Yn=()=>{j||!Tt||gq(Ut)},t[126]=Tt,t[127]=j,t[128]=Ut,t[129]=Yn):Yn=t[129];let Xn;t[130]!==en||t[131]!==Tt||t[132]!==j||t[133]!==Ut||t[134]!==Jt?(Xn=[Tt,en,Jt,j,Ut],t[130]=en,t[131]=Tt,t[132]=j,t[133]=Ut,t[134]=Jt,t[135]=Xn):Xn=t[135],(0,Q.useEffect)(Yn,Xn);let Zn,Qn;t[136]===Ut?(Zn=t[137],Qn=t[138]):(Zn=()=>Ut.subscribe(()=>{if(!Ut.isSearchOpen())for(let e of xe.current){let t=Nq(Ut.getItem(e));t&&!t.isExpanded()&&t.expand()}}),Qn=[Ut],t[136]=Ut,t[137]=Zn,t[138]=Qn),(0,Q.useEffect)(Zn,Qn);let $n,er;t[139]===Ut?($n=t[140],er=t[141]):($n=()=>Ut.subscribe(()=>We.current()),er=[Ut],t[139]=Ut,t[140]=$n,t[141]=er),(0,Q.useEffect)($n,er);let tr,nr;t[142]===Ut?(tr=t[143],nr=t[144]):(tr=()=>Ut.onMutation(`remove`,e=>{let t=Se.current;!t||e.path!==t.renamePath||Ce.current(t)}),nr=[Ut],t[142]=Ut,t[143]=tr,t[144]=nr),(0,Q.useEffect)(tr,nr);let rr;t[145]!==b||t[146]!==d||t[147]!==f||t[148]!==he||t[149]!==D||t[150]!==T||t[151]!==p||t[152]!==gn||t[153]!==_?(rr=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??ge.current,l=new Map,u=new Map;for(let e of ue.current){if(Fo(e)){let t=o.find(t=>t.fromPath===XN(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(So(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&Ze(t)&&u.set(e.path,ZN(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(tt.current?.kind===`folder`?tt.current.folderPath:null),g=h?ne(h,a):null,v=r?.assetPath??(tt.current?.kind===`asset`?tt.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??NP(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??ne(v,a):null);W(e);let C=[...PP(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;A(t=>{let n=kP(t,e,a,o,s);return w=n,gn(t,n,e,o),vn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),_J(x)):S&&(m||S!==v)&&he(S,w??ue.current),$s([`files`,`backlinks`,`graph`])},t[145]=b,t[146]=d,t[147]=f,t[148]=he,t[149]=D,t[150]=T,t[151]=p,t[152]=gn,t[153]=_,t[154]=rr):rr=t[154];let ir=rr;async function ar(e){let t=!e.isFolder&&bn(e.sourcePath),n=t?e.sourcePath:pP(e.sourcePath,e.isFolder);H(n),P(null);try{let r=qe(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!Ze(r.destinationPath),o=t||a?r.destinationPath:pP(r.destinationPath,e.isFolder),c=e.isFolder?{kind:`folder`,fromPath:eP(n),toPath:eP(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:ZN(n),toPath:o},l={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null},u=await J(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`gijbne`}));if(!u.ok){qs.error(u.title),sn();let e=Se.current;e&&e.renamePath===n?await kn(e):Dn(),H(null);return}let d=s(Pr,u.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await ir(d.renamed,e.isFolder?[{fromPath:eP(n),toPath:eP(o)}]:[],d.renamedAssets,l,!e.isFolder&&!t&&!a?d.renamed.flatMap(e=>{let t=mt(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:d.renamed.length,renamedAssetCount:d.renamedAssets.length}),qs.error(i({id:`dDpCOp`}))}Dn(),H(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=i({id:`HIb0vl`});qs.error(t),P(t),sn();let r=Se.current;r&&r.renamePath===n?await kn(r):Dn(),H(null)}}let or;t[155]!==i||t[156]!==ir||t[157]!==sn?(or=async function(e){let t=e.draggedPaths.map(t=>{let n=gP(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(pY);if(t.length!==0){H(t[0]?.sourcePath??null),P(null);try{let e=[],n=[],r=[],a={docName:ge.current,folderPath:tt.current?.kind===`folder`?tt.current.folderPath:null,assetPath:tt.current?.kind===`asset`?tt.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&bn(a.sourcePath),c=t?{kind:`folder`,fromPath:eP(a.sourcePath),toPath:eP(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:ZN(a.sourcePath),toPath:ZN(a.destinationTreePath)},l=await J(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(c)}),i({id:`dOHMA0`}));if(!l.ok){qs.error(l.title),sn(),H(null);return}let u=s(Pr,l.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(u.renamed),n=n.concat(u.renamedAssets),t&&r.push({fromPath:eP(a.sourcePath),toPath:eP(a.destinationTreePath)})}try{await ir(e,r,n,a)}catch(r){console.warn(`[FileTree] post-move reconciliation failed`,{err:r,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),qs.error(i({id:`8OxKZy`}))}H(null)}catch(e){console.warn(`[FileTree] move failed:`,e),qs.error(i({id:`HIb0vl`})),sn(),H(null)}}},t[155]=i,t[156]=ir,t[157]=sn,t[158]=or):or=t[158];let sr=or,ur;t[159]!==i||t[160]!==b||t[161]!==sn?(ur=async function(e,t,n){if(e.length===0||Ne.current!==null)return;let r=()=>{Ne.current=null,H(null)};Ne.current=n,H(n),P(null);let a=[],o=0,c=0;for(let n of e){let e=new FormData;e.append(`file`,n),yP(e,t,n.name||`upload`);try{let r=await J(await fetch(`/api/upload`,{method:`POST`,body:e}),i({id:`4Gz2wC`}));if(!r.ok){c+=1,qs.error(r.title,{description:n.name});continue}let l=s(lr,r.body,`upload:drop`,null);if(l===null){c+=1,qs.error(i({id:`4Gz2wC`}),{description:n.name});continue}let u=bP(t,l);if(l.deduped===!0){c+=1,qs.error(i({id:`4sKwf6`}),{description:u});continue}o+=1;let d=CP(u,n);d&&a.push(d)}catch(e){let t=e;c+=1,console.warn(`[FileTree] external file upload failed:`,t),qs.error(t instanceof TypeError?i({id:`HIb0vl`}):i({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)Fo(e)&&b(e.docName);A(e=>{let t=new Set(e.map(QN)),n=!1,r=[...e];for(let e of a){let i=QN(e);Fe.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(sn(r),vn(r),r):e})}o>0&&($s([`files`,`backlinks`,`graph`]),Je.current?.(),qs.success(rc._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||i({id:`RSqaSd`})})),c>0&&P(o>0?rc._({id:`yH7T4q`,values:{failedCount:c}}):i({id:`4Gz2wC`})),r()}catch(e){let t=e,n=i({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),qs.error(n),P(n),r()}},t[159]=i,t[160]=b,t[161]=sn,t[162]=ur):ur=t[162];let dr=ur,fr;t[163]===Symbol.for(`react.memo_cache_sentinel`)?(fr=function(e){te({parentDir:e})},t[163]=fr):fr=t[163];let pr=fr,mr;t[164]!==i||t[165]!==b||t[166]!==kn||t[167]!==Dn||t[168]!==Ut||t[169]!==D||t[170]!==T||t[171]!==sn||t[172]!==qt?(mr=async function(e,t,n){if(Ne.current)return;let r=Se.current;r&&Dn(r);try{let r=mP(e,t,[...qt,...Qt.current]);H(r.renamePath),Ne.current=r.renamePath;let a=window.location.hash,o;if(e===`file`){let e=hP(`file`,r.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await J(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),i({id:`fJgQHX`}));if(!a.ok){qs.error(a.title),H(null),Ne.current=null;return}let c=ZN(e),l=s(hr,a.body,`create-page`,{docName:c}).docName;o=l;let u={kind:`document`,docName:l,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(l),A(e=>{if(e.some(e=>Fo(e)&&e.docName===l))return e;let t=[...e,u];return vn(t),Fe.current.set(QN(u),Date.now()),t}),$s([`files`,`backlinks`,`graph`]),T(l)}else{let e=eP(r.addPath),t=await J(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),i({id:`K1ckLX`}));if(!t.ok){qs.error(t.title),H(null),Ne.current=null;return}o=s(vi,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};A(e=>{if(e.some(e=>Ro(e)&&e.path===o))return e;let t=[...e,n];return vn(t),Fe.current.set(QN(n),Date.now()),t}),$s([`files`]),D(o)}let c=!1,l=e=>{if(e.key!==`Enter`)return;let t=Se.current;!t||t.renamePath!==r.renamePath||queueMicrotask(()=>Dn(t))};document.addEventListener(`keydown`,l,!0),Se.current={kind:e,renamePath:r.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{c||(c=!0,document.removeEventListener(`keydown`,l,!0))}},H(null),Ne.current=null,Ut.add(r.addPath),Ut.startRenaming(r.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),qs.error(i({id:`S6l5dv`}));let t=Se.current;t?await kn(t):Dn(),H(null),Ne.current=null,sn()}},t[164]=i,t[165]=b,t[166]=kn,t[167]=Dn,t[168]=Ut,t[169]=D,t[170]=T,t[171]=sn,t[172]=qt,t[173]=mr):mr=t[173];let gr=mr,_r;t[174]===Ut?_r=t[175]:(_r=function(e){let t=tP(e);(0,Q.startTransition)(()=>{for(let e of Qt.current)if(e===t||e.startsWith(t)){let t=Nq(Ut.getItem(e));t&&t.expand()}})},t[174]=Ut,t[175]=_r);let vr=_r,yr;t[176]===Ut?yr=t[177]:(yr=function(e){let t=tP(e),n=new Set(xe.current);(0,Q.startTransition)(()=>{for(let e of[...Qt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=Nq(Ut.getItem(e));t&&t.collapse()}})},t[176]=Ut,t[177]=yr);let br=yr,Sr;t[178]!==pe||t[179]!==$t||t[180]!==o||t[181]!==c||t[182]!==ve||t[183]!==V||t[184]!==kn||t[185]!==fn||t[186]!==k||t[187]!==Zt||t[188]!==sr||t[189]!==ar||t[190]!==Gt||t[191]!==x||t[192]!==Tn||t[193]!==mn||t[194]!==Nt||t[195]!==qt||t[196]!==dr?(Sr=()=>{ue.current=k,de.current=x,ge.current=o,tt.current=c,ye.current=ve,Ne.current=V,Ke.current=Nt,Yt.current=qt,Qt.current=Zt,xe.current=$t,We.current=fn,Ge.current=mn,Ce.current=kn,Me.current=(e,t,n)=>{dr(e,t,n)},Xe.current=e=>{if(Ee.current||De.current||e.length!==1)return;let t=e[0];t&&(oe(!1),pe(Gt(t),k))},$e.current=e=>{Tn(e)||qs.error(e)},Qe.current=ar,et.current=sr},t[178]=pe,t[179]=$t,t[180]=o,t[181]=c,t[182]=ve,t[183]=V,t[184]=kn,t[185]=fn,t[186]=k,t[187]=Zt,t[188]=sr,t[189]=ar,t[190]=Gt,t[191]=x,t[192]=Tn,t[193]=mn,t[194]=Nt,t[195]=qt,t[196]=dr,t[197]=Sr):Sr=t[197],(0,Q.useLayoutEffect)(Sr);let Cr,wr;t[198]===Ut?(Cr=t[199],wr=t[200]):(Cr=()=>{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||WJ(e.target))return;let a=Ye.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=Ut.getFocusedPath()??Ut.getSelectedPaths()[0]??null;if(!t)return;let n=Ut.getItem(t)??Ut.getItem(tP(t)),r=n?.isDirectory()?tP(eP(n.getPath())):t;if(ye.current.has(r))return;Cn.current(BJ(r,ue.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Qt.current,...Yt.current]);Ee.current=!0;for(let e of u)e&&Ut.getItem(e)?.select();queueMicrotask(()=>{Ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},wr=[Ut],t[198]=Ut,t[199]=Cr,t[200]=wr),(0,Q.useEffect)(Cr,wr);let Tr,Er;t[201]!==k.length||t[202]!==j?(Tr=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=fY,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()},Er=[j,k.length],t[201]=k.length,t[202]=j,t[203]=Tr,t[204]=Er):(Tr=t[203],Er=t[204]),(0,Q.useEffect)(Tr,Er);let Dr,Or;t[205]!==k.length||t[206]!==j?(Dr=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=()=>qK(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()},Or=[j,k.length],t[205]=k.length,t[206]=j,t[207]=Dr,t[208]=Or):(Dr=t[207],Or=t[208]),(0,Q.useEffect)(Dr,Or);let kr,Ar;t[209]!==k.length||t[210]!==j?(kr=()=>{if(j||k.length===0)return;let e=Ye.current?.querySelector(AL)?.shadowRoot;if(!e)return;let t=()=>dq(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Ar=[j,k.length],t[209]=k.length,t[210]=j,t[211]=kr,t[212]=Ar):(kr=t[211],Ar=t[212]),(0,Q.useEffect)(kr,Ar);let jr;t[213]===Symbol.for(`react.memo_cache_sentinel`)?(jr={folderCount:0,expandedCount:0},t[213]=jr):jr=t[213];let Mr=(0,Q.useRef)(jr),Nr=(0,Q.useRef)(gr),Fr=(0,Q.useRef)(pr),Ir;t[214]===gr?Ir=t[215]:(Ir=()=>{Nr.current=gr,Fr.current=pr},t[214]=gr,t[215]=Ir),(0,Q.useEffect)(Ir);let Lr,Rr;t[216]===Ut?(Lr=t[217],Rr=t[218]):(Lr=()=>({startCreating(e,t){Nr.current(e,t)},startCreatingFromTemplate(e){Fr.current(e)},createFromTemplate(e,t){Nr.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Qt.current){let t=Nq(Ut.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(xe.current);(0,Q.startTransition)(()=>{for(let t of[...Qt.current].reverse()){if(e.has(t))continue;let n=Nq(Ut.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Qt.current,t=0;for(let n of e)Nq(Ut.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Mr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Mr.current=i,i},isCreationTargetCleared(){return se.current},clearCreationTarget(){oe(!0)},subscribe(e){le.current.add(e);let t=Ut.subscribe(e);return()=>{le.current.delete(e),t()}}}),Rr=[Ut],t[216]=Ut,t[217]=Lr,t[218]=Rr),(0,Q.useImperativeHandle)(n,Lr,Rr);let zr;t[219]!==Dn||t[220]!==d||t[221]!==l||t[222]!==Ut?(zr=async function(e,t,n){let r=GJ(e,ue.current,Qt.current),i=Se.current;i&&e.some(e=>KJ(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Dn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(dY).map(uY)]);l([...[...a].map(lY),...[...o].map(cY),...[...s].map(sY)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?tP(t.path):t.kind===`asset`?t.path:XN(t.path,t.docExt);Ut.getItem(e)&&Ut.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}A(e=>{let t=AP(e,[...a],void 0,[...s]);for(let e of o)t=AP(t,[],e);return vn(t),t}),$s([`files`,`backlinks`,`graph`])},t[219]=Dn,t[220]=d,t[221]=l,t[222]=Ut,t[223]=zr):zr=t[223];let Br=zr,Vr;t[224]!==i||t[225]!==Br?(Vr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;H(a.path);let o=await J(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`7JtSLi`}));if(!o.ok)return r.length>0&&await Br(r,t,n),qs.error(o.title),!1;let c=s(hi,o.body,`delete-path`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path),r.push(a)}return await Br(r,t,n),!0},t[224]=i,t[225]=Br,t[226]=Vr):Vr=t[226];let Hr=Vr,Ur;t[227]===Symbol.for(`react.memo_cache_sentinel`)?(Ur=async function(e,t,n){let r=[],i=[];for(let a of e){H(a.path);let e=FP(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:Eq(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[227]=Ur):Ur=t[227];let Wr=Ur,Gr;t[228]===i?Gr=t[229]:(Gr=async function(e){let t=[],n=[],r=[];for(let a of e){let e=a.kind;try{let o=await J(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),i({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),r.push({target:a,reason:o.title});continue}let c=s(Jn,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...c.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),r.push({target:a,reason:i({id:`r4R7AZ`})})}}if(r.length>0){let e=r.length;qs.error(i({id:`IrB5AK`,values:{failedCount:e}}),{description:i({id:`vEJDlt`})})}return r.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[228]=i,t[229]=Gr);let qr=Gr,Jr;t[230]!==i||t[231]!==Y||t[232]!==Br||t[233]!==Hr||t[234]!==qr||t[235]!==sn||t[236]!==re?(Jr=async function(e){let t=e.map(e=>jP(e,ue.current)),n=t[0];if(!n)return;let r=Y.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(r.length>0){let e=r.slice(0,3).map(oY),t=r.length>e.length?`, +${r.length-e.length} more`:``;qs.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}H(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&re){let{trashed:e,failed:n}=await Wr(t,a,re);if(e.length>0){let t=await qr(e);t?await Br(e,t.deletedDocNames,t.deletedFolderPaths):await Br(e,e.filter(aY).map(iY),e.filter(rY).map(nY))}n.length>0&&q({failed:n,originalTargets:[...t]}),H(null)}else{let e=await Hr(t);H(null),e||sn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),qs.error(i({id:`0eHrMb`}),{description:n}),H(null),sn()}},t[230]=i,t[231]=Y,t[232]=Br,t[233]=Hr,t[234]=qr,t[235]=sn,t[236]=re,t[237]=Jr):Jr=t[237];let Yr=Jr,Xr;t[238]!==i||t[239]!==Hr||t[240]!==sn||t[241]!==K?(Xr=async function(){if(!K)return;let e=new Set(K.failed.map(tY)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(q(null),t.length!==0){H(t[0]?.path??null);try{let e=await Hr(t);H(null),e||sn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),qs.error(i({id:`0eHrMb`}),{description:n}),H(null),sn()}}},t[238]=i,t[239]=Hr,t[240]=sn,t[241]=K,t[242]=Xr):Xr=t[242];let Zr=Xr,Qr;t[243]!==Yr||t[244]!==K?(Qr=async function(){if(!K)return;let e=new Set(K.failed.map(eY)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));q(null),await Yr(t)},t[243]=Yr,t[244]=K,t[245]=Qr):Qr=t[245];let $r=Qr,ei=(0,Q.useRef)(Yr),ti;t[246]===Yr?ti=t[247]:(ti=()=>{ei.current=Yr},t[246]=Yr,t[247]=ti),(0,Q.useEffect)(ti);let ni,ri;t[248]===Symbol.for(`react.memo_cache_sentinel`)?(ni=()=>Bq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ue.current.find(e=>Fo(e)&&e.docName===t);ei.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){ei.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){ei.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),ri=[],t[248]=ni,t[249]=ri):(ni=t[248],ri=t[249]),(0,Q.useEffect)(ni,ri);let ii,ai;t[250]===Symbol.for(`react.memo_cache_sentinel`)?(ii=()=>Wq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ue.current.find(e=>Fo(e)&&e.docName===t);Cn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){Cn.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}))}),ai=[],t[250]=ii,t[251]=ai):(ii=t[250],ai=t[251]),(0,Q.useEffect)(ii,ai);let oi,si;t[252]===Ut?(oi=t[253],si=t[254]):(oi=()=>Hq(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=XN(t,ue.current.find(e=>Fo(e)&&e.docName===t)?.docExt);Ut.startRenaming(n);return}if(e.kind===`folder`){Ut.startRenaming(e.folderPath);return}if(e.kind===`asset`){Ut.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),si=[Ut],t[252]=Ut,t[253]=oi,t[254]=si),(0,Q.useEffect)(oi,si);let ci;t[255]===Symbol.for(`react.memo_cache_sentinel`)?(ci=function(){let e=Te.current;e&&pJ(e),Te.current=null},t[255]=ci):ci=t[255];let li=ci,ui;t[256]===g?ui=t[257]:(ui=function(e){let t=EY(e.nativeEvent);if(!t||t.endsWith(`/`)){li();return}let n=ZN(t),r=ue.current.find(e=>QN(e)===t);if(r&&So(r)){li();return}if(r&&Fo(r)&&xi(r.size)){li();return}Te.current!==n&&(li(),Te.current=n,fJ(n,e=>g(e)))},t[256]=g,t[257]=ui);let di=ui,fi;t[258]!==pe||t[259]!==Ut||t[260]!==D?(fi=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=DY(e.nativeEvent);if(!t){AY(e.nativeEvent)&&oe(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?tP(n):n;if(Ut.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=eP(r);if(window.location.hash===Ao(e))return;queueMicrotask(()=>D(e));return}let i=ZN(r);window.location.hash!==vo(i)&&queueMicrotask(()=>pe(r))},t[258]=pe,t[259]=Ut,t[260]=D,t[261]=fi):fi=t[261];let pi=fi,mi;t[262]===Symbol.for(`react.memo_cache_sentinel`)?(mi=function(e){xP(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,rt(!0))},t[262]=mi):mi=t[262];let gi=mi,_i;t[263]===Symbol.for(`react.memo_cache_sentinel`)?(_i=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||rt(!1)},t[263]=_i):_i=t[263];let yi=_i,bi;t[264]===dr?bi=t[265]:(bi=function(e){if(!xP(e.nativeEvent))return;let t=SP(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),rt(!1),dr(t,``,MJ))},t[264]=dr,t[265]=bi);let Si=bi;if(j){let e;return t[266]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(MY,{}),t[266]=e):e=t[266],e}let Ci;t[267]!==i||t[268]!==F||t[269]!==L?(Ci=F?i(L?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[267]=i,t[268]=F,t[269]=L,t[270]=Ci):Ci=t[270];let wi=Ci;if(k.length===0){if(wi!==null){let e;return t[271]===wi?e=t[272]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:wi})}),t[271]=wi,t[272]=e),e}if(N){let e;return t[273]===N?e=t[274]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:N})}),t[273]=N,t[274]=e),e}let e;t[275]===i?e=t[276]:(e=i({id:`5ZB7XC`}),t[275]=i,t[276]=e);let n=nt&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,r;t[277]===n?r=t[278]:(r=Ti(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[277]=n,t[278]=r);let a;t[279]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(X,{id:`xiv-dW`})}),t[279]=a):a=t[279];let o;t[280]===gr?o=t[281]:(o=()=>gr(`file`,``),t[280]=gr,t[281]=o);let s;t[282]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(X,{id:`6ibbCg`}),t[282]=s):s=t[282];let c;t[283]===o?c=t[284]:(c=(0,Z.jsx)(Di,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:s}),t[283]=o,t[284]=c);let l;return t[285]!==Si||t[286]!==e||t[287]!==r||t[288]!==c?(l=(0,Z.jsxs)(`section`,{"aria-label":e,className:r,onDragOver:gi,onDragLeave:yi,onDrop:Si,children:[a,c]}),t[285]=Si,t[286]=e,t[287]=r,t[288]=c,t[289]=l):l=t[289],l}let Ei=V!==null,Oi=U?.targets[0]??null,ki=null;if(z!==null){let e;if(t[290]!==a.locale||t[291]!==z){let n=new Intl.NumberFormat(a.locale).format(z);e=rc._({id:`LuoJWu`,values:{truncatedShownCount:z,formattedCount:n}}),t[290]=a.locale,t[291]=z,t[292]=e}else e=t[292];ki=e}let Ai;t[293]!==N||t[294]!==wi||t[295]!==ki?(Ai=(N||wi!==null||ki!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[wi===null?N&&(0,Z.jsx)(PY,{kind:`error`,children:N}):(0,Z.jsx)(PY,{kind:`reconnecting`,children:wi}),ki!==null&&(0,Z.jsx)(PY,{kind:`info`,children:ki})]}),t[293]=N,t[294]=wi,t[295]=ki,t[296]=Ai):Ai=t[296];let ji;t[297]===y?ji=t[298]:(ji=HK(y),t[297]=y,t[298]=ji);let Mi=ae?``:void 0,Ni;t[299]===Mi?Ni=t[300]:(Ni={[FJ]:Mi},t[299]=Mi,t[300]=Ni);let Pi;t[301]!==Ei||t[302]!==ve||t[303]!==br||t[304]!==k||t[305]!==vr||t[306]!==Zt||t[307]!==Sn||t[308]!==kt||t[309]!==Mt||t[310]!==Ut||t[311]!==At||t[312]!==jt||t[313]!==gr||t[314]!==re?(Pi=(e,t)=>(0,Z.jsx)(qJ,{item:e,context:t,anyActionBusy:Ei,workspace:re,handoff:kt,model:Ut,okignoreBinding:At,projectLocalBinding:jt,mergedConfig:Mt,onStartCreating:gr,onCreateFromTemplate:(e,t)=>gr(`file`,e,{template:t}),onDuplicate:Sn,onDelete:e=>G({targets:e}),onExpandSubtree:vr,onCollapseSubtree:br,folderTreePaths:Zt,isAsset:ve.has(e.path),documents:k}),t[301]=Ei,t[302]=ve,t[303]=br,t[304]=k,t[305]=vr,t[306]=Zt,t[307]=Sn,t[308]=kt,t[309]=Mt,t[310]=Ut,t[311]=At,t[312]=jt,t[313]=gr,t[314]=re,t[315]=Pi):Pi=t[315];let Fi;t[316]!==pi||t[317]!==di||t[318]!==Ut||t[319]!==Ai||t[320]!==ji||t[321]!==Ni||t[322]!==Pi?(Fi=(0,Z.jsx)(`div`,{ref:Ye,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(IK,{header:Ai,model:Ut,style:ji,...Ni,onClickCapture:pi,onMouseMove:di,onMouseLeave:li,renderContextMenu:Pi})}),t[316]=pi,t[317]=di,t[318]=Ut,t[319]=Ai,t[320]=ji,t[321]=Ni,t[322]=Pi,t[323]=Fi):Fi=t[323];let Ii=!!U,Li;t[324]===V?Li=t[325]:(Li=e=>{!e&&!V&&G(null)},t[324]=V,t[325]=Li);let Ri;t[326]!==i||t[327]!==V||t[328]!==U||t[329]!==Yr||t[330]!==Oi?(Ri=U&&Oi&&(0,Z.jsx)(rs,{...(()=>{let e=Sq(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,U.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($J)}):null};let t=U.targets.length,n=Oi.name;return{itemName:t===1?Oi.kind===`folder`?`${Oi.name}/`:Oi.kind===`file`?`${Oi.name}${Oi.docExt??`.md`}`:Oi.name:void 0,customTitle:t>1?i({id:`abiHje`}):void 0,customDescription:t>1?i({id:`WMIKXK`,values:{targetCount:t}}):Oi.kind===`folder`?i({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:V!==null,onDelete:()=>Yr(U.targets)}),t[326]=i,t[327]=V,t[328]=U,t[329]=Yr,t[330]=Oi,t[331]=Ri):Ri=t[331];let zi;t[332]!==Ii||t[333]!==Li||t[334]!==Ri?(zi=(0,Z.jsx)(oo,{open:Ii,onOpenChange:Li,children:Ri}),t[332]=Ii,t[333]=Li,t[334]=Ri,t[335]=zi):zi=t[335];let Bi=!!K,Vi;t[336]===V?Vi=t[337]:(Vi=e=>{!e&&!V&&q(null)},t[336]=V,t[337]=Vi);let Hi;t[338]!==V||t[339]!==Zr||t[340]!==$r||t[341]!==K?(Hi=K&&(0,Z.jsx)(Aq,{failedTargets:K.failed,isSubmitting:V!==null,onDeletePermanently:Zr,onRetry:$r,onCancel:()=>q(null)}),t[338]=V,t[339]=Zr,t[340]=$r,t[341]=K,t[342]=Hi):Hi=t[342];let Ui;t[343]!==Bi||t[344]!==Vi||t[345]!==Hi?(Ui=(0,Z.jsx)(oo,{open:Bi,onOpenChange:Vi,children:Hi}),t[343]=Bi,t[344]=Vi,t[345]=Hi,t[346]=Ui):Ui=t[346];let Wi=ee!==null,Gi;t[347]===Symbol.for(`react.memo_cache_sentinel`)?(Gi=e=>{e||te(null)},t[347]=Gi):Gi=t[347];let Ki=ee?.parentDir??``,Ji;t[348]!==Wi||t[349]!==Ki?(Ji=(0,Z.jsx)(g_,{open:Wi,onOpenChange:Gi,kind:`file`,initialDir:Ki,defaultToTemplate:!0}),t[348]=Wi,t[349]=Ki,t[350]=Ji):Ji=t[350];let Yi;return t[351]!==Fi||t[352]!==zi||t[353]!==Ui||t[354]!==Ji?(Yi=(0,Z.jsxs)(Z.Fragment,{children:[Fi,zi,Ui,Ji]}),t[351]=Fi,t[352]=zi,t[353]=Ui,t[354]=Ji,t[355]=Yi):Yi=t[355],Yi}function $J(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:Cq(e)},`${e.kind}:${e.path}`)}function eY(e){return`${e.kind}:${e.path}`}function tY(e){return`${e.kind}:${e.path}`}function nY(e){return e.path}function rY(e){return e.kind===`folder`}function iY(e){return e.path}function aY(e){return e.kind===`file`}function oY(e){return e.file}function sY(e){return Ce(e)}function cY(e){return Ae(e)}function lY(e){return Yt(e)}function uY(e){return e.path}function dY(e){return e.kind===`asset`}function fY(e){return e.endsWith(`/`)?e.slice(0,-1):e}function pY(e){return!!e}function mY(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function hY(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function gY(e){qs.error(e)}function _Y(){}function vY(e){return qs.error(e)}function yY(){}function bY(){}function xY(){}function SY(){}function CY(){}async function wY(){}function TY(e){return QN(e)}function EY(e){return DY(e)?.dataset.itemPath??null}function DY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function OY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function kY(e){let t=DY(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=_P(e,n);return{parentDir:r,row:t,root:null,busyPath:n?tP(r):e}}return AY(e)?{parentDir:``,row:null,root:OY(e),busyPath:MJ}:null}function AY(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var jY=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function MY(){let e=(0,$.c)(5),{_:t}=cn(),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=jY.map(NY),e[2]=r):r=e[2];let i;return e[3]===n?i=e[4]:(i=(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]=i),i}function NY(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(la,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(la,{className:`h-3 ${e}`})]},t)}function PY(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?yo:n===`reconnecting`?zo:zs,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=Ti(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=Ti(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function FY(e){return e?rc._({id:`wTcjov`}):null}function IY(e){let t=(0,$.c)(23),{_:n}=cn(),r=$o(),i=ss();if(r)return null;let{input:a,installStates:o,dispatch:s}=e,c=a===null,l,u,d,f,p,m;if(t[0]!==n||t[1]!==s||t[2]!==a||t[3]!==c||t[4]!==o||t[5]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=FY(c),r;t[12]===o?r=t[13]:(r=e=>o[e.id]?.installed===!0,t[12]=o,t[13]=r);let h=Uo.filter(r),g=h.length>0,_=i!==null;if(!g&&!_){m=null;break bb0}u=WP,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(qP,{children:[(0,Z.jsx)(Us,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`O7_W_a`})]}),t[14]=p):p=t[14],l=JP,d=g?(0,Z.jsxs)(UP,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(XP,{children:(0,Z.jsx)(X,{id:`BBqGS9`})}),h.map(t=>{let r=!c,{displayName:i}=t,o=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(KP,{disabled:!r,onSelect:()=>{a&&s(t.id,a)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":o,children:[(0,Z.jsx)(Yo,{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)})]}):null,f=_?(0,Z.jsxs)(Z.Fragment,{children:[g?(0,Z.jsx)(ZP,{}):null,(0,Z.jsxs)(UP,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(XP,{children:(0,Z.jsx)(X,{id:`ALhMYW`})}),os.map(t=>{let{displayName:r}=Gn[t];return(0,Z.jsxs)(KP,{onSelect:()=>{a!==null&&i.launchInTerminal(a,t)},disabled:c,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Z.jsx)(Yo,{id:Jo(t),"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]})]}):null}t[0]=n,t[1]=s,t[2]=a,t[3]=c,t[4]=o,t[5]=i,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==l||t[16]!==d||t[17]!==f?(h=(0,Z.jsxs)(l,{children:[d,f]}),t[15]=l,t[16]=d,t[17]=f,t[18]=h):h=t[18];let g;return t[19]!==u||t[20]!==p||t[21]!==h?(g=(0,Z.jsxs)(u,{children:[p,h]}),t[19]=u,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}var LY=(e,t,n)=>Xd(e,t,n,`ProjectSwitcher`);function RY(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=cn(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),p=vM(),m=typeof window<`u`&&window.okDesktop!=null,h=(0,Q.useRef)(!1),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{c(e),e||u(``)},t[1]=g):g=t[1];let _=g,v;t[2]!==r||t[3]!==n.project||t[4]!==s?(v=()=>{if(!s)return;let e=!1;return LY(async()=>{let t=await n.project.listRecent();e||o(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=s,t[5]=v):v=t[5];let y;t[6]!==r||t[7]!==n||t[8]!==s?(y=[s,n,r],t[6]=r,t[7]=n,t[8]=s,t[9]=y):y=t[9],(0,Q.useEffect)(v,y);let b;t[10]!==r||t[11]!==n.project?(b=e=>{c(!1),LY(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=b):b=t[12];let x=b,S;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(S=()=>{c(!1),LY(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=S):S=t[16];let C=S,w;t[17]!==r||t[18]!==n.navigator?(w=()=>{c(!1),LY(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>{c(!1),f(!0)},t[20]=E):E=t[20];let D=E,O=n.config.projectPath,k,A,j,M,N,P,F,I,L,R,z;if(t[21]!==r||t[22]!==p||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==O||t[26]!==s||t[27]!==x||t[28]!==a||t[29]!==l){let e;t[41]===O?e=t[42]:(e=e=>e.path!==O,t[41]=O,t[42]=e);let i=a.filter(e),o=l.trim().toLowerCase(),c=o?i.filter(e=>e.name.toLowerCase().includes(o)||e.path.toLowerCase().includes(o)):i;A=nl,F=s,I=_,L=!1;let d=p!==null&&`h-auto py-1.5`,f;t[43]===d?f=t[44]:(f=Ti(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,d),t[43]=d,t[44]=f);let g;t[45]===r?g=t[46]:(g=r({id:`zZ_I5K`}),t[45]=r,t[46]=g);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=m?()=>{h.current=!0}:void 0,t[47]=v):v=t[47];let y;t[48]===s?y=t[49]:(y=m?()=>{if(h.current){h.current=!1;return}_(!s)}:void 0,t[48]=s,t[49]=y);let b;t[50]===n.config.projectName?b=t[51]:(b=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=b);let S;t[52]===p?S=t[53]:(S=p===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Jt,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:p})]}),t[52]=p,t[53]=S);let C;t[54]!==b||t[55]!==S?(C=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[b,S]}),t[54]=b,t[55]=S,t[56]=C):C=t[56];let w;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Pu,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=w):w=t[57],t[58]!==n.config.projectPath||t[59]!==f||t[60]!==g||t[61]!==y||t[62]!==C?(R=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsxs)(cM,{className:f,"data-testid":`project-switcher-trigger`,"aria-label":g,title:n.config.projectPath,onPointerDown:v,onClick:y,children:[C,w]})}),t[58]=n.config.projectPath,t[59]=f,t[60]=g,t[61]=y,t[62]=C,t[63]=R):R=t[63],k=Xc,z=`start`,j=`top`,M=`min-w-[260px]`,N=`project-switcher-menu`,P=i.length===0?(0,Z.jsx)(al,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(aT,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(uT,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:l,onChange:e=>u(e.target.value),onKeyDown:zY,"data-testid":`project-switcher-search`}),(0,Z.jsx)(sT,{children:(0,Z.jsx)(nt,{"aria-hidden":`true`})})]}),(0,Z.jsx)(sl,{}),c.length===0?(0,Z.jsx)(al,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(X,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(Jc,{disabled:e.missing,onSelect:()=>x(e.path),className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=p,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=O,t[26]=s,t[27]=x,t[28]=a,t[29]=l,t[30]=k,t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P,t[36]=F,t[37]=I,t[38]=L,t[39]=R,t[40]=z}else k=t[30],A=t[31],j=t[32],M=t[33],N=t[34],P=t[35],F=t[36],I=t[37],L=t[38],R=t[39],z=t[40];let B;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(sl,{}),t[64]=B):B=t[64];let V;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsxs)(Jc,{onSelect:D,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(xt,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(X,{id:`gKi-a_`})]}),t[65]=V):V=t[65];let H,U;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Tt,{"aria-hidden":`true`,className:`text-muted-foreground`}),U=(0,Z.jsx)(X,{id:`xaDWAI`}),t[66]=H,t[67]=U):(H=t[66],U=t[67]);let W;t[68]===T?W=t[69]:(W=(0,Z.jsxs)(Jc,{onSelect:T,"data-testid":`project-switcher-switch-project`,children:[H,U]}),t[68]=T,t[69]=W);let G,K;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(hs,{"aria-hidden":`true`,className:`text-muted-foreground`}),K=(0,Z.jsx)(X,{id:`PVUn_c`}),t[70]=G,t[71]=K):(G=t[70],K=t[71]);let q;t[72]===C?q=t[73]:(q=(0,Z.jsxs)(Jc,{onSelect:C,"data-testid":`project-switcher-open-folder`,children:[G,K]}),t[72]=C,t[73]=q);let J;t[74]!==k||t[75]!==j||t[76]!==M||t[77]!==N||t[78]!==P||t[79]!==W||t[80]!==q||t[81]!==z?(J=(0,Z.jsxs)(k,{align:z,side:j,className:M,"data-testid":N,children:[P,B,V,W,q]}),t[74]=k,t[75]=j,t[76]=M,t[77]=N,t[78]=P,t[79]=W,t[80]=q,t[81]=z,t[82]=J):J=t[82];let Y;t[83]!==A||t[84]!==F||t[85]!==I||t[86]!==L||t[87]!==R||t[88]!==J?(Y=(0,Z.jsxs)(A,{open:F,onOpenChange:I,modal:L,children:[R,J]}),t[83]=A,t[84]=F,t[85]=I,t[86]=L,t[87]=R,t[88]=J,t[89]=Y):Y=t[89];let ee;t[90]!==n||t[91]!==d?(ee=(0,Z.jsx)(Kp,{open:d,onOpenChange:f,bridge:n}),t[90]=n,t[91]=d,t[92]=ee):ee=t[92];let te;return t[93]!==Y||t[94]!==ee?(te=(0,Z.jsxs)(Z.Fragment,{children:[Y,ee]}),t[93]=Y,t[94]=ee,t[95]=te):te=t[95],te}function zY(e){return e.stopPropagation()}function BY(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})),Qn(`sidebarSearchPill`)}function VY(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Ti(`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)(nt,{"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)(X,{id:`A1taO8`})}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Dt,{className:`text-foreground/70`,children:bl(`command-palette`)}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(Di,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function HY(){let e=(0,$.c)(31),{_:t}=cn(),n=Qo(),{activeDocName:r}=_t(),[i,a]=(0,Q.useState)(!1),o=as(),s;e[0]!==n.data||e[1]!==n.status?(s=n.status===`ready`?n.data:[],e[0]=n.data,e[1]=n.status,e[2]=s):s=e[2];let c=s,l;e[3]===c?l=e[4]:(l=fs(c),e[3]=c,e[4]=l);let u=l,d=bs(),f;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(f={},e[5]=f):f=e[5];let[p,m]=(0,Q.useState)(f),h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(nM,{asChild:!0,children:(0,Z.jsxs)(Vs,{className:`flex w-full items-center gap-1.5`,children:[(0,Z.jsx)(ed,{className:`size-3.5 shrink-0`}),(0,Z.jsx)(X,{id:`PCSkw2`}),(0,Z.jsx)(co,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skills:rotate-90`})]})}),e[6]=h):h=e[6];let g;e[7]===t?g=e[8]:(g=t({id:`MdpSC1`}),e[7]=t,e[8]=g);let _,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>a(!0),v=(0,Z.jsx)(xt,{}),e[9]=_,e[10]=v):(_=e[9],v=e[10]);let y;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`MdpSC1`})}),e[11]=y):y=e[11];let b;e[12]===g?b=e[13]:(b=(0,Z.jsxs)(rM,{title:g,onClick:_,children:[v,y]}),e[12]=g,e[13]=b);let x;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(YY,{}),e[14]=x):x=e[14];let S;e[15]!==o||e[16]!==r||e[17]!==u||e[18]!==p||e[19]!==d||e[20]!==c?(S=c.length===0?(0,Z.jsx)(`p`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:(0,Z.jsx)(X,{id:`PdJZ5p`})}):Ss.filter(e=>c.some(t=>t.scope===e)).map(e=>(0,Z.jsxs)(Hs,{className:`group/scope`,open:c.some(t=>t.scope===e&&bi(t.scope,t.name)===r)||(p[e]??!1),onOpenChange:t=>m(n=>({...n,[e]:t})),children:[(0,Z.jsxs)(Vs,{className:`flex w-full items-center gap-1 px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground/70 hover:text-muted-foreground`,children:[(0,Z.jsx)(co,{className:`size-3 shrink-0 transition-transform group-data-[state=open]/scope:rotate-90`}),(0,Z.jsx)(`span`,{className:`truncate`,children:d[e]})]}),(0,Z.jsx)(Bs,{children:(0,Z.jsx)(aM,{className:`pl-2`,children:c.filter(t=>t.scope===e).map(e=>(0,Z.jsx)(WY,{skill:e,activeDocName:r,actions:o,existingNames:u[e.scope]},`${e.scope}::${e.name}`))})})]},e)),e[15]=o,e[16]=r,e[17]=u,e[18]=p,e[19]=d,e[20]=c,e[21]=S):S=e[21];let C;e[22]===S?C=e[23]:(C=(0,Z.jsx)(Bs,{children:(0,Z.jsxs)(iM,{children:[x,S]})}),e[22]=S,e[23]=C);let w;e[24]===i?w=e[25]:(w=(0,Z.jsx)(ka,{defaultScope:`project`,open:i,onOpenChange:a,onCreated:UY}),e[24]=i,e[25]=w);let T;return e[26]!==o.dialogs||e[27]!==C||e[28]!==w||e[29]!==b?(T=(0,Z.jsx)(Hs,{className:`group/skills shrink-0`,children:(0,Z.jsxs)(tM,{children:[h,b,C,o.dialogs,w]})}),e[26]=o.dialogs,e[27]=C,e[28]=w,e[29]=b,e[30]=T):T=e[30],T}function UY(e){let{scope:t,name:n}=e;return Fs(bi(t,n))}function WY(e){let t=(0,$.c)(50),{skill:n,activeDocName:r,actions:i,existingNames:a}=e,{_:o}=cn(),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),d;t[0]!==n.name||t[1]!==n.scope?(d=bi(n.scope,n.name),t[0]=n.name,t[1]=n.scope,t[2]=d):d=t[2];let f=r===d,p,m,h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e.preventDefault(),u(!0)},m=(0,Z.jsx)(co,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/skill:rotate-90`}),h=(0,Z.jsx)(ed,{className:`size-3 shrink-0 text-muted-foreground`}),t[3]=p,t[4]=m,t[5]=h):(p=t[3],m=t[4],h=t[5]);let g=n.name,_;t[6]===n.name?_=t[7]:(_=gs(n.name),t[6]=n.name,t[7]=_);let v;t[8]!==n.name||t[9]!==_?(v=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:g,children:_}),t[8]=n.name,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==n.bundledVersion||t[13]!==n.updateAvailable?(y=n.updateAvailable?(0,Z.jsx)(`span`,{title:o({id:`1YJ4Yg`,values:{0:n.bundledVersion?` (${n.bundledVersion})`:``}}),className:`flex items-center`,children:(0,Z.jsx)(zo,{className:`size-3 text-primary`,"aria-label":o({id:`CifUuG`})})}):null,t[11]=o,t[12]=n.bundledVersion,t[13]=n.updateAvailable,t[14]=y):y=t[14];let b;t[15]===n.installed?b=t[16]:(b=(0,Z.jsx)(Ca,{installed:n.installed,subtle:!0,className:`shrink-0`}),t[15]=n.installed,t[16]=b);let x;t[17]!==y||t[18]!==b?(x=(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1`,children:[y,b]}),t[17]=y,t[18]=b,t[19]=x):x=t[19];let S;t[20]!==f||t[21]!==x||t[22]!==v?(S=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(cM,{size:`sm`,isActive:f,className:`h-6 text-[11px]`,onContextMenu:p,children:[m,h,v,x]})}),t[20]=f,t[21]=x,t[22]=v,t[23]=S):S=t[23];let C;t[24]!==o||t[25]!==n.name?(C=o({id:`RlLl3G`,values:{0:n.name}}),t[24]=o,t[25]=n.name,t[26]=C):C=t[26];let w;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Hu,{}),t[27]=w):w=t[27];let T;t[28]===C?T=t[29]:(T=(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(lM,{showOnHover:!0,"aria-label":C,children:w})}),t[28]=C,t[29]=T);let E;t[30]!==i||t[31]!==a||t[32]!==n?(E=(0,Z.jsx)(Xc,{side:`right`,align:`start`,className:`min-w-52`,children:(0,Z.jsx)(ns,{skill:n,actions:i,existingNames:a})}),t[30]=i,t[31]=a,t[32]=n,t[33]=E):E=t[33];let D;t[34]!==l||t[35]!==T||t[36]!==E?(D=(0,Z.jsxs)(nl,{open:l,onOpenChange:u,children:[T,E]}),t[34]=l,t[35]=T,t[36]=E,t[37]=D):D=t[37];let O;t[38]!==s||t[39]!==n?(O=s?(0,Z.jsx)(qY,{skill:n}):null,t[38]=s,t[39]=n,t[40]=O):O=t[40];let k;t[41]===O?k=t[42]:(k=(0,Z.jsx)(Bs,{children:O}),t[41]=O,t[42]=k);let A;t[43]!==S||t[44]!==D||t[45]!==k?(A=(0,Z.jsxs)(oM,{children:[S,D,k]}),t[43]=S,t[44]=D,t[45]=k,t[46]=A):A=t[46];let j;return t[47]!==s||t[48]!==A?(j=(0,Z.jsx)(Hs,{open:s,onOpenChange:c,className:`group/skill`,children:A}),t[47]=s,t[48]=A,t[49]=j):j=t[49],j}function GY(e){let t=[];for(let n of e){let e=n.path.split(`/`),r=t;e.forEach((t,i)=>{let a=i===e.length-1,o=r.find(e=>e.name===t);o||(o=a?{name:t,path:n.path,text:n.text}:{name:t,path:e.slice(0,i+1).join(`/`),children:[]},r.push(o)),!a&&o.children&&(r=o.children)})}return KY(t),t}function KY(e){e.sort((e,t)=>{let n=+!e.children,r=+!t.children;return n===r?e.name.localeCompare(t.name):n-r});for(let t of e)t.children&&KY(t.children)}function qY(e){let t=(0,$.c)(27),{skill:n}=e,{_:r}=cn(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),{openTarget:c}=_t(),l;t[0]===c?l=t[1]:(l=function(e){c({kind:`doc`,target:e,docName:e},{tabBehavior:`append`}),go(vo(e))},t[0]=c,t[1]=l);let u=l,d;t[2]!==u||t[3]!==c||t[4]!==n.name||t[5]!==n.scope?(d=function(e){let t=e.lastIndexOf(`.`),r=t>=0?e.slice(t+1).toLowerCase():``;if(n.scope===`project`&&(r===`md`||r===`mdx`)){u(b(n.name,e.replace(/\.mdx?$/i,``)));return}c({kind:`skill-file`,target:`${n.scope}/${n.name}/${e}`,scope:n.scope,name:n.name,path:e},{tabBehavior:`replace-active`}),go(lo({scope:n.scope,name:n.name,path:e}))},t[2]=u,t[3]=c,t[4]=n.name,t[5]=n.scope,t[6]=d):d=t[6];let f=d,p,m;t[7]!==n.name||t[8]!==n.scope?(p=()=>{let e=!0,t=()=>{rl(n.scope,n.name).then(t=>{e&&(t.ok?(a(t.files),s(!1)):(a([]),s(!0)))})};t();let r=nc(t);return()=>{e=!1,r()}},m=[n.scope,n.name],t[7]=n.name,t[8]=n.scope,t[9]=p,t[10]=m):(p=t[9],m=t[10]),(0,Q.useEffect)(p,m);let h;if(t[11]!==r||t[12]!==i||t[13]!==o||t[14]!==f||t[15]!==u||t[16]!==n.name||t[17]!==n.scope){let e=i?GY(i):[],a;t[19]!==u||t[20]!==n.name||t[21]!==n.scope?(a=()=>n.scope===`project`?u(Lr(n.name)):Fs(bi(n.scope,n.name)),t[19]=u,t[20]=n.name,t[21]=n.scope,t[22]=a):a=t[22];let s,c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ke,{className:`size-3 shrink-0 text-muted-foreground`}),c=(0,Z.jsx)(`span`,{className:`truncate`,children:`SKILL.md`}),t[23]=s,t[24]=c):(s=t[23],c=t[24]);let l;t[25]===a?l=t[26]:(l=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,onClick:a,className:`text-[11px]`,children:[s,c]})}),t[25]=a,t[26]=l),h=(0,Z.jsxs)(uM,{className:`mr-0 pr-0`,children:[l,i===null?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,children:(0,Z.jsx)(X,{id:`yQE2r9`})})}):o?(0,Z.jsx)(dM,{children:(0,Z.jsx)(`span`,{className:`px-2 py-0.5 text-[11px] text-muted-foreground/70`,title:r({id:`3Ijjy1`}),children:(0,Z.jsx)(X,{id:`ZARuZJ`})})}):e.map(e=>(0,Z.jsx)(JY,{node:e,depth:0,onOpenFile:f},e.path))]}),t[11]=r,t[12]=i,t[13]=o,t[14]=f,t[15]=u,t[16]=n.name,t[17]=n.scope,t[18]=h}else h=t[18];return h}function JY(e){let t=(0,$.c)(34),{node:n,depth:r,onOpenFile:i}=e,[a,o]=(0,Q.useState)(!1),s=`${r*.6}rem`,c;t[0]===s?c=t[1]:(c={paddingLeft:s},t[0]=s,t[1]=c);let l=c;if(n.children){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(co,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/dir:rotate-90`}),t[2]=e):e=t[2];let s;t[3]===n.name?s=t[4]:(s=(0,Z.jsxs)(`span`,{className:`truncate`,children:[n.name,`/`]}),t[3]=n.name,t[4]=s);let c;t[5]!==l||t[6]!==s?(c=(0,Z.jsx)(Vs,{asChild:!0,children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,children:[e,s]})}),t[5]=l,t[6]=s,t[7]=c):c=t[7];let u;if(t[8]!==r||t[9]!==n.children||t[10]!==i){let e;t[12]!==r||t[13]!==i?(e=e=>(0,Z.jsx)(JY,{node:e,depth:r+1,onOpenFile:i},e.path),t[12]=r,t[13]=i,t[14]=e):e=t[14],u=n.children.map(e),t[8]=r,t[9]=n.children,t[10]=i,t[11]=u}else u=t[11];let d;t[15]===u?d=t[16]:(d=(0,Z.jsx)(Bs,{children:u}),t[15]=u,t[16]=d);let f;t[17]!==c||t[18]!==d?(f=(0,Z.jsxs)(dM,{children:[c,d]}),t[17]=c,t[18]=d,t[19]=f):f=t[19];let p;return t[20]!==a||t[21]!==f?(p=(0,Z.jsx)(Hs,{open:a,onOpenChange:o,className:`group/dir`,children:f}),t[20]=a,t[21]=f,t[22]=p):p=t[22],p}let u=`skill-file-${n.path}`,d;t[23]!==n.path||t[24]!==i?(d=()=>i(n.path),t[23]=n.path,t[24]=i,t[25]=d):d=t[25];let f;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Gu,{className:`size-3 shrink-0 text-muted-foreground`}),t[26]=f):f=t[26];let p;t[27]===n.name?p=t[28]:(p=(0,Z.jsx)(`span`,{className:`truncate`,children:n.name}),t[27]=n.name,t[28]=p);let m;return t[29]!==l||t[30]!==u||t[31]!==d||t[32]!==p?(m=(0,Z.jsx)(dM,{children:(0,Z.jsxs)(fM,{size:`sm`,className:`text-[11px]`,style:l,"data-testid":u,onClick:d,children:[f,p]})}),t[29]=l,t[30]=u,t[31]=d,t[32]=p,t[33]=m):m=t[33],m}function YY(){let e=(0,$.c)(19),[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=!1;return Zc().then(t=>{e||n(t)}),()=>{e=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o),!t||t.managed!==null||t.importable===0)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=async e=>{if(i(!0),!await il(e)){i(!1);return}n({managed:e,importable:0})},e[2]=s):s=e[2];let c=s,l;e[3]===t.importable?l=e[4]:(l=(0,Z.jsx)(`p`,{className:`mb-2 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`mu1O0q`,values:{0:t.importable}})}),e[3]=t.importable,e[4]=l);let u,d;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>c(!0),d=(0,Z.jsx)(X,{id:`l3s5ri`}),e[5]=u,e[6]=d):(u=e[5],d=e[6]);let f;e[7]===r?f=e[8]:(f=(0,Z.jsx)(Di,{size:`sm`,className:`h-6 px-2 text-xs`,disabled:r,onClick:u,children:d}),e[7]=r,e[8]=f);let p,m;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>c(!1),m=(0,Z.jsx)(X,{id:`PBxg_E`}),e[9]=p,e[10]=m):(p=e[9],m=e[10]);let h;e[11]===r?h=e[12]:(h=(0,Z.jsx)(Di,{size:`sm`,variant:`ghost`,className:`h-6 px-2 text-xs`,disabled:r,onClick:p,children:m}),e[11]=r,e[12]=h);let g;e[13]!==f||e[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex gap-1.5`,children:[f,h]}),e[13]=f,e[14]=h,e[15]=g):g=e[15];let _;return e[16]!==g||e[17]!==l?(_=(0,Z.jsxs)(`div`,{className:`mx-2 mb-1 rounded-md border border-border/60 bg-muted/40 p-2 text-xs`,children:[l,g]}),e[16]=g,e[17]=l,e[18]=_):_=e[18],_}function XY(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:i}=cn(),a=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,o;t[0]!==i||t[1]!==n.dismissible||t[2]!==r?(o=n.dismissible===!1?null:(0,Z.jsx)(Di,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":i({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(Js,{"aria-hidden":`true`,className:`size-3`})}),t[0]=i,t[1]=n.dismissible,t[2]=r,t[3]=o):o=t[3];let s=o,c=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${a}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let o;t[6]!==s||t[7]!==i?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,s]}),t[6]=s,t[7]=i,t[8]=o):o=t[8];let l;t[9]!==c||t[10]!==n.action?(l=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=c,t[10]=n.action,t[11]=l):l=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==c||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:u,children:n.secondaryAction.label}),t[14]=c,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==l||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==o||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,f]}),t[21]=e,t[22]=r,t[23]=o,t[24]=f,t[25]=p):p=t[25],p}let l=`update-notice-${n.id}`,u=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${a}`,d;t[26]===n.body?d=t[27]:(d=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=d);let f;t[28]!==c||t[29]!==n.action?(f=n.action?(0,Z.jsx)(`button`,{type:`button`,className:c,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=c,t[29]=n.action,t[30]=f):f=t[30];let p;return t[31]!==s||t[32]!==l||t[33]!==u||t[34]!==d||t[35]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":l,className:u,children:[d,f,s]}),t[31]=s,t[32]=l,t[33]=u,t[34]=d,t[35]=f,t[36]=p):p=t[36],p}function ZY(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 QY(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(yg,vg,vg),n;e[0]===t?n=e[1]:(n=ZY(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),_g(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(XY,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function $Y(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Ho(n.contentDir,Go(t),n.pathSeparator):e?.kind===`folder`?Ho(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Ho(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function eX(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?Go(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function tX(e,t,n){return e===null?ds({workspace:n}):e.kind===`folder`?n?Ko({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?cs({docName:t,workspace:n}):null}var nX={folderCount:0,expandedCount:0},rX=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function iX(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(rX)!==null}function aX(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(P,{name:`file-sidebar`,children:(0,Z.jsx)(sX,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var oX=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)(fc,{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)(pc,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(hc,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function sX(e){let t=(0,$.c)(209),{onOpenSearch:n}=e,{_:r}=cn(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=_t(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:Do(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:_,toggleSidebar:v}=Wj(),y=$o(),b=_===`expanded`,x=h&&_===`collapsed`,[S,C]=(0,Q.useState)(nX),w,T;t[3]===i?(w=t[4],T=t[5]):(w=()=>{if(i===null)return;let e=()=>{C(i.getFolderState()),p(i.isCreationTargetCleared())};return e(),i.subscribe(e)},T=[i],t[3]=i,t[4]=w,t[5]=T),(0,Q.useEffect)(w,T);let E,D;t[6]===i?(E=t[7],D=t[8]):(E=()=>{if(i!==null)return UC(e=>{let t=e.initialDir??``;if(e.template){i.createFromTemplate(e.template.folder,e.template.name);return}i.startCreating(`file`,t)})},D=[i],t[6]=i,t[7]=E,t[8]=D),(0,Q.useEffect)(E,D);let O=S.folderCount>0,k=O&&S.expandedCount===S.folderCount,A=S.expandedCount===0,j=Aa(``),M=Aa(m===``?null:m),N=m===``?j:M,P=j.state.status===`ready`?(j.state.data.folder.templates_available?.length??0)>0:!0,F=N.state.status===`ready`?(N.state.data.folder.templates_available?.length??0)>0:!0,I=typeof window<`u`?window.okDesktop:void 0,L=Vo(),{status:R}=ia(),z=R?.hasRemote===!0,B;t[9]!==r||t[10]!==L?.contentDir?(B=I?.config?.projectName||L?.contentDir.split(`/`).filter(Boolean).pop()||r({id:`sER-bs`}),t[9]=r,t[10]=L?.contentDir,t[11]=B):B=t[11];let V=B,H=ts().states,{dispatch:U}=ls(),W;t[12]===L?W=t[13]:(W=ds({workspace:L}),t[12]=L,t[13]=W);let G=W,{projectLocalBinding:K,merged:q}=ys(),J=q?.appearance?.sidebar?.showHiddenFiles??!1,Y=O&&!k,ee=O&&!A,te=Y||ee,ne=fX,re;t[14]!==i||t[15]!==L?(re=()=>{L&&i?.startCreating(`file`,``)},t[14]=i,t[15]=L,t[16]=re):re=t[16];let ie=re,ae;t[17]!==i||t[18]!==L?(ae=e=>{L&&i?.createFromTemplate(``,e)},t[17]=i,t[18]=L,t[19]=ae):ae=t[19];let oe=ae,se;t[20]!==i||t[21]!==L?(se=()=>{L&&i?.startCreating(`folder`,``)},t[20]=i,t[21]=L,t[22]=se):se=t[22];let ce=se,le;t[23]===L?le=t[24]:(le=()=>{!L||!I||I.shell.showItemInFolder(L.contentDir)},t[23]=L,t[24]=le);let ue=le,de;t[25]!==r||t[26]!==L?(de=async()=>{if(L)try{await navigator.clipboard.writeText(L.contentDir),qs.success(r({id:`6_ZOw4`}),{description:L.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),qs.error(r({id:`vfRlCI`}))}},t[25]=r,t[26]=L,t[27]=de):de=t[27];let fe=de,pe;t[28]!==r||t[29]!==z?(pe=()=>{Yi({...Ji(``),hasRemote:z,onClickWhenNoRemote:()=>{qs.error(r({id:`WyQxwa`}))}},{clipboardWrite:is,toastSuccess:dX,toastError:uX,logEvent:lX})},t[28]=r,t[29]=z,t[30]=pe):pe=t[30];let me=pe,he;t[31]!==r||t[32]!==K?(he=e=>{if(K===null)return;let t=K.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Wr(t.error)),qs.error(r({id:`P47EWZ`}),{description:Wr(t.error)}))},t[31]=r,t[32]=K,t[33]=he):he=t[33];let ge=he,_e;t[34]===i?_e=t[35]:(_e=()=>{i?.expandAll()},t[34]=i,t[35]=_e);let ve=_e,ye;t[36]===i?ye=t[37]:(ye=()=>{i?.collapseAll()},t[36]=i,t[37]=ye);let be=ye,xe,Se;t[38]!==ee||t[39]!==Y||t[40]!==J||t[41]!==_?(xe=()=>{I&&I.editor.notifyViewMenuStateChanged({showHiddenFiles:J,canExpandAll:Y,canCollapseAll:ee,sidebarVisible:_===`expanded`})},Se=[I,J,Y,ee,_],t[38]=ee,t[39]=Y,t[40]=J,t[41]=_,t[42]=xe,t[43]=Se):(xe=t[42],Se=t[43]),(0,Q.useEffect)(xe,Se);let Ce,we;t[44]!==r||t[45]!==c||t[46]!==l||t[47]!==U||t[48]!==H||t[49]!==m||t[50]!==K||t[51]!==J||t[52]!==v||t[53]!==i||t[54]!==L?(Ce=()=>{if(I)return I.onMenuAction(e=>{switch(e){case`new-doc`:if(!L||!i)return;i.startCreating(`file`,m);return;case`new-folder`:if(!L||!i)return;i.startCreating(`folder`,m);return;case`new-from-template`:if(!L||!i)return;i.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;Vq(l);return;case`duplicate`:if(!l)return;Uq(l);return;case`move-to-trash`:if(!l)return;zq(l);return;case`reveal-in-finder`:{if(!I||!L)return;let e=$Y(l,c,L);I.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=Uo.filter(e=>H[e.id]?.installed===!0);if(e.length===0){qs.error(r({id:`LKOLNn`}));return}let t=tX(l,c,L);if(!t)return;let[n]=e;if(!n)return;U(n.id,t);return}case`copy-full-path`:{if(!L)return;let e=$Y(l,c,L);navigator.clipboard.writeText(e).then(()=>qs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=eX(l,c);if(e===``){qs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>qs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),qs.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(K===null)return;let e=K.patch({appearance:{sidebar:{showHiddenFiles:!J}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Wr(e.error)),qs.error(r({id:`P47EWZ`}),{description:Wr(e.error)}));return}case`expand-all-tree`:i?.expandAll();return;case`collapse-all-tree`:i?.collapseAll();return;case`toggle-sidebar`:v();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},we=[I,i,L,l,c,m,K,J,H,U,v,r],t[44]=r,t[45]=c,t[46]=l,t[47]=U,t[48]=H,t[49]=m,t[50]=K,t[51]=J,t[52]=v,t[53]=i,t[54]=L,t[55]=Ce,t[56]=we):(Ce=t[55],we=t[56]),(0,Q.useEffect)(Ce,we);let Te=h&&b&&`motion-safe:delay-100`,Ee=x&&`opacity-0`,De;t[57]!==Te||t[58]!==Ee?(De=Ti(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Te,Ee,h&&`[-webkit-app-region:drag]`),t[57]=Te,t[58]=Ee,t[59]=De):De=t[59];let Oe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[60]=Oe):Oe=t[60];let ke;t[61]===b?ke=t[62]:(ke=b&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(X,{id:`sER-bs`})}):null,t[61]=b,t[62]=ke);let Ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=Ti(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[63]=Ae):Ae=t[63];let je;t[64]!==r||t[65]!==k||t[66]!==O||t[67]!==A||t[68]!==i?(je=O?(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(oX,{icon:od,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(Xc,{align:`end`,className:`min-w-52`,children:[k?null:(0,Z.jsxs)(Jc,{onSelect:()=>i?.expandAll(),children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`OlAl5i`})]}),A?null:(0,Z.jsxs)(Jc,{onSelect:()=>i?.collapseAll(),children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`qvWGzP`})]})]})]}):null,t[64]=r,t[65]=k,t[66]=O,t[67]=A,t[68]=i,t[69]=je):je=t[69];let Me;t[70]===r?Me=t[71]:(Me=r({id:`HdkSiO`}),t[70]=r,t[71]=Me);let Ne;t[72]!==m||t[73]!==i?(Ne=()=>i?.startCreating(`file`,m),t[72]=m,t[73]=i,t[74]=Ne):Ne=t[74];let Pe;t[75]!==Me||t[76]!==Ne?(Pe=(0,Z.jsx)(oX,{icon:Md,label:Me,onClick:Ne}),t[75]=Me,t[76]=Ne,t[77]=Pe):Pe=t[77];let Fe;t[78]!==r||t[79]!==F||t[80]!==m||t[81]!==i?(Fe=F?(0,Z.jsxs)(nl,{children:[(0,Z.jsx)(Kc,{asChild:!0,children:(0,Z.jsx)(oX,{icon:ha,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(Xc,{align:`end`,className:`min-w-52`,children:(0,Z.jsx)(Mq,{parentDir:m,onSelectTemplate:e=>i?.createFromTemplate(m,e),ItemComponent:Jc})})]}):null,t[78]=r,t[79]=F,t[80]=m,t[81]=i,t[82]=Fe):Fe=t[82];let Ie;t[83]===r?Ie=t[84]:(Ie=r({id:`96G6Re`}),t[83]=r,t[84]=Ie);let Le;t[85]!==m||t[86]!==i?(Le=()=>i?.startCreating(`folder`,m),t[85]=m,t[86]=i,t[87]=Le):Le=t[87];let Re;t[88]!==Ie||t[89]!==Le?(Re=(0,Z.jsx)(oX,{icon:Xu,label:Ie,onClick:Le}),t[88]=Ie,t[89]=Le,t[90]=Re):Re=t[90];let ze;t[91]!==je||t[92]!==Pe||t[93]!==Fe||t[94]!==Re?(ze=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Ae,children:[je,Pe,Fe,Re]}),t[91]=je,t[92]=Pe,t[93]=Fe,t[94]=Re,t[95]=ze):ze=t[95];let Be;t[96]!==De||t[97]!==ke||t[98]!==ze?(Be=(0,Z.jsxs)(Qj,{"data-electron-drag":h?``:void 0,className:De,children:[Oe,ke,ze]}),t[96]=De,t[97]=ke,t[98]=ze,t[99]=Be):Be=t[99];let Ve=h&&b&&`motion-safe:delay-100`,He=x&&`opacity-0`,Ue;t[100]!==Ve||t[101]!==He?(Ue=Ti(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ve,He),t[100]=Ve,t[101]=He,t[102]=Ue):Ue=t[102];let We;t[103]===_?We=t[104]:(We=[_],t[103]=_,t[104]=We);let Ge;t[105]===n?Ge=t[106]:(Ge=(0,Z.jsx)(VY,{onClick:n}),t[105]=n,t[106]=Ge);let Ke;t[107]!==We||t[108]!==Ge?(Ke=(0,Z.jsx)(g,{fallbackRender:cX,onError:BY,resetKeys:We,children:Ge}),t[107]=We,t[108]=Ge,t[109]=Ke):Ke=t[109];let qe;t[110]!==Ue||t[111]!==Ke?(qe=(0,Z.jsx)(`div`,{className:Ue,children:Ke}),t[110]=Ue,t[111]=Ke,t[112]=qe):qe=t[112];let Je;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(hI,{}),t[113]=Je):Je=t[113];let Ye;t[114]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(hs,{className:`size-3.5 shrink-0`}),t[114]=Ye):Ye=t[114];let Xe;t[115]===V?Xe=t[116]:(Xe=(0,Z.jsx)(`span`,{className:`truncate`,children:V}),t[115]=V,t[116]=Xe);let Ze;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Z.jsx)(co,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]/files:rotate-90`}),t[117]=Ze):Ze=t[117];let Qe;t[118]===Xe?Qe=t[119]:(Qe=(0,Z.jsx)(nM,{asChild:!0,className:`shrink-0`,children:(0,Z.jsxs)(Vs,{"data-sidebar-root-context":!0,className:`flex w-full items-center gap-1.5`,children:[Ye,Xe,Ze]})}),t[118]=Xe,t[119]=Qe);let $e=o==null?`50vh`:`${o}px`,et;t[120]===$e?et=t[121]:(et={height:$e},t[120]=$e,t[121]=et);let tt;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsx)(QJ,{ref:a,onContentHeightChange:s}),t[122]=tt):tt=t[122];let nt;t[123]===et?nt=t[124]:(nt=(0,Z.jsx)(Bs,{className:`flex max-h-[70vh] flex-col overflow-hidden`,style:et,children:tt}),t[123]=et,t[124]=nt);let rt;t[125]!==Qe||t[126]!==nt?(rt=(0,Z.jsx)(Hs,{defaultOpen:!0,className:`group/files flex shrink-0 flex-col`,children:(0,Z.jsxs)(tM,{className:`min-h-0`,children:[Qe,nt]})}),t[125]=Qe,t[126]=nt,t[127]=rt):rt=t[127];let it;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(HY,{}),t[128]=it):it=t[128];let at;t[129]===i?at=t[130]:(at=(0,Z.jsx)(`div`,{"aria-hidden":!0,"data-sidebar-empty-deselect":!0,className:`min-h-8 flex-1 cursor-default`,onClick:()=>i?.clearCreationTarget()}),t[129]=i,t[130]=at);let ot;t[131]!==rt||t[132]!==at?(ot=(0,Z.jsxs)(eM,{children:[Je,rt,it,at]}),t[131]=rt,t[132]=at,t[133]=ot):ot=t[133];let st;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsxs)($j,{className:`px-0`,children:[(0,Z.jsx)(QY,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(aM,{children:(0,Z.jsx)(oM,{children:(0,Z.jsx)(RY,{bridge:window.okDesktop})})}):null]}),t[134]=st):st=t[134];let ct=!(y&&_===`collapsed`),lt;t[135]===ct?lt=t[136]:(lt=(0,Z.jsx)(Xj,{enableToggle:!1,enableDrag:ct}),t[135]=ct,t[136]=lt);let ut;t[137]!==Be||t[138]!==qe||t[139]!==ot||t[140]!==lt?(ut=(0,Z.jsx)(HP,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:ne,children:[Be,qe,ot,st,lt]})}),t[137]=Be,t[138]=qe,t[139]=ot,t[140]=lt,t[141]=ut):ut=t[141];let dt=!L,ft,pt;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(Md,{"aria-hidden":`true`}),pt=(0,Z.jsx)(X,{id:`HdkSiO`}),t[142]=ft,t[143]=pt):(ft=t[142],pt=t[143]);let mt;t[144]!==ie||t[145]!==dt?(mt=(0,Z.jsxs)(KP,{disabled:dt,onSelect:ie,"data-testid":`empty-space-menu-new-file`,children:[ft,pt]}),t[144]=ie,t[145]=dt,t[146]=mt):mt=t[146];let ht;t[147]!==oe||t[148]!==P||t[149]!==L?(ht=P?(0,Z.jsxs)(WP,{children:[(0,Z.jsxs)(qP,{disabled:!L,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(ha,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Uuj_R4`})]}),(0,Z.jsx)(JP,{children:(0,Z.jsx)(Mq,{parentDir:``,onSelectTemplate:oe,ItemComponent:KP})})]}):null,t[147]=oe,t[148]=P,t[149]=L,t[150]=ht):ht=t[150];let gt=!L,vt,yt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(vt=(0,Z.jsx)(Xu,{"aria-hidden":`true`}),yt=(0,Z.jsx)(X,{id:`96G6Re`}),t[151]=vt,t[152]=yt):(vt=t[151],yt=t[152]);let bt;t[153]!==ce||t[154]!==gt?(bt=(0,Z.jsxs)(KP,{disabled:gt,onSelect:ce,"data-testid":`empty-space-menu-new-folder`,children:[vt,yt]}),t[153]=ce,t[154]=gt,t[155]=bt):bt=t[155];let xt;t[156]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,Z.jsx)(ZP,{}),t[156]=xt):xt=t[156];let St;t[157]!==r||t[158]!==ue||t[159]!==L?(St=I?(0,Z.jsxs)(KP,{disabled:!L,onSelect:ue,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(L?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(hs,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(X,{id:`LtSYdi`})}),L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`wTcjov`})})]}):null,t[157]=r,t[158]=ue,t[159]=L,t[160]=St):St=t[160];let Ct;t[161]!==U||t[162]!==G||t[163]!==H?(Ct=(0,Z.jsx)(IY,{input:G,installStates:H,dispatch:U}),t[161]=U,t[162]=G,t[163]=H,t[164]=Ct):Ct=t[164];let wt;t[165]!==me||t[166]!==z?(wt=z?(0,Z.jsxs)(KP,{onSelect:me,"data-testid":`empty-space-menu-share`,children:[(0,Z.jsx)(Od,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`Z8lGw6`})]}):null,t[165]=me,t[166]=z,t[167]=wt):wt=t[167];let Tt=!L,Et;t[168]!==r||t[169]!==L?(Et=r(L?{id:`Up2_7p`}:{id:`U8CD-l`}),t[168]=r,t[169]=L,t[170]=Et):Et=t[170];let Dt;t[171]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,Z.jsx)(xs,{"aria-hidden":`true`}),t[171]=Dt):Dt=t[171];let Ot;t[172]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(X,{id:`Up2_7p`})}),t[172]=Ot):Ot=t[172];let kt;t[173]===L?kt=t[174]:(kt=L?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(X,{id:`wTcjov`})}),t[173]=L,t[174]=kt);let At;t[175]!==fe||t[176]!==Tt||t[177]!==Et||t[178]!==kt?(At=(0,Z.jsxs)(KP,{disabled:Tt,onSelect:fe,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":Et,children:[Dt,Ot,kt]}),t[175]=fe,t[176]=Tt,t[177]=Et,t[178]=kt,t[179]=At):At=t[179];let jt;t[180]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,Z.jsx)(ZP,{}),t[180]=jt):jt=t[180];let Mt=K===null,Nt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,Z.jsx)(X,{id:`XcGbim`}),t[181]=Nt):Nt=t[181];let Pt;t[182]!==ge||t[183]!==J||t[184]!==Mt?(Pt=(0,Z.jsx)(YP,{checked:J,onCheckedChange:ge,disabled:Mt,"data-testid":`empty-space-menu-show-hidden-files`,children:Nt}),t[182]=ge,t[183]=J,t[184]=Mt,t[185]=Pt):Pt=t[185];let Ft;t[186]===te?Ft=t[187]:(Ft=te?(0,Z.jsx)(ZP,{}):null,t[186]=te,t[187]=Ft);let It;t[188]!==ve||t[189]!==Y?(It=Y?(0,Z.jsxs)(KP,{onSelect:ve,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(Gd,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`OlAl5i`})]}):null,t[188]=ve,t[189]=Y,t[190]=It):It=t[190];let Lt;t[191]!==be||t[192]!==ee?(Lt=ee?(0,Z.jsxs)(KP,{onSelect:be,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(Ju,{"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`qvWGzP`})]}):null,t[191]=be,t[192]=ee,t[193]=Lt):Lt=t[193];let Rt;t[194]!==mt||t[195]!==ht||t[196]!==bt||t[197]!==St||t[198]!==Ct||t[199]!==wt||t[200]!==At||t[201]!==Pt||t[202]!==Ft||t[203]!==It||t[204]!==Lt?(Rt=(0,Z.jsxs)(GP,{className:`min-w-52`,children:[mt,ht,bt,xt,St,Ct,wt,At,jt,Pt,Ft,It,Lt]}),t[194]=mt,t[195]=ht,t[196]=bt,t[197]=St,t[198]=Ct,t[199]=wt,t[200]=At,t[201]=Pt,t[202]=Ft,t[203]=It,t[204]=Lt,t[205]=Rt):Rt=t[205];let zt;return t[206]!==ut||t[207]!==Rt?(zt=(0,Z.jsx)(Jj,{variant:`inset`,children:(0,Z.jsxs)(VP,{children:[ut,Rt]})}),t[206]=ut,t[207]=Rt,t[208]=zt):zt=t[208],zt}function cX(){return null}function lX(e){return console.log(e)}function uX(e){return qs.error(e)}function dX(e){return qs.success(e)}function fX(e){e.target instanceof Element&&e.target.closest(`[data-sidebar-root-context]`)||iX(e.target)&&(e.preventDefault(),e.stopPropagation())}function pX(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function mX(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function hX(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var gX={phase:`loading`};function _X(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function vX(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function yX(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=hX(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function bX(e){return e!==null&&e.kind===`project-branch-switch`}function xX(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,i=r===void 0?gm:r,{_:a}=cn(),o=(0,Q.useSyncExternalStore)(i.subscribe,i.getSnapshot,DX),[s,c]=(0,Q.useState)(gX),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(!1),d;t[0]===o?d=t[1]:(d=bX(o)?o:null,t[0]=o,t[1]=d);let f=d,p;t[2]!==a||t[3]!==f?.share.target.kind?(p=f?.share.target.kind===`folder`?a({id:`ugoTXs`}):a({id:`XH30C4`}),t[2]=a,t[3]=f?.share.target.kind,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{c(gX),l.current=!1,u.current=!1},t[5]=h):h=t[5];let g;t[6]===o?g=t[7]:(g=[o],t[6]=o,t[7]=g),(0,Q.useEffect)(h,g);let _;t[8]!==f||t[9]!==n?(_=()=>{f&&(l.current||(l.current=!0,n.project.fetchBranchInfo({projectPath:f.projectPath,branch:f.share.branch,kind:f.share.target.kind,path:ps(f.share.target)}).then(e=>{c(t=>_X(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),c(EX)})))},t[8]=f,t[9]=n,t[10]=_):_=t[10];let v;t[11]===f?v=t[12]:(v=[f],t[11]=f,t[12]=v),(0,Q.useEffect)(_,v);let y;t[13]!==a||t[14]!==f||t[15]!==s.phase||t[16]!==n||t[17]!==i||t[18]!==m?(y=()=>{if(s.phase!==`awaiting-cc1-recycle`||!f)return;let e=f.share.branch;if(!e){i.dismiss();return}if(u.current)return;u.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:f.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(tf({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:f.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:f.share.target.kind,path:ps(f.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),qs.error(a({id:`gQV-9w`,values:{targetNoun:m}}))}),i.dismiss();return}console.log(tf({branch_dialog_action:`branch-switch-timeout`,branch:e})),qs.error(a({id:`LBwUR6`,values:{targetNoun:m}})),i.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),qs.error(a({id:`Jw6EC4`,values:{targetNoun:m}})),i.dismiss())}),()=>{t=!0}},t[13]=a,t[14]=f,t[15]=s.phase,t[16]=n,t[17]=i,t[18]=m,t[19]=y):y=t[19];let b;if(t[20]!==f||t[21]!==s.phase?(b=[s.phase,f],t[20]=f,t[21]=s.phase,t[22]=b):b=t[22],(0,Q.useEffect)(y,b),!f)return null;let{share:x,projectPath:S,currentBranch:C}=f,w=x.branch,T;t[23]!==a||t[24]!==s.info||t[25]!==s.phase||t[26]!==n.project||t[27]!==S||t[28]!==x.target||t[29]!==w||t[30]!==i?(T=function(){s.phase===`ready`&&pX(s.info).switchEnabled&&(console.log(tf({branch_dialog_action:`switch`,branch_action:`switch`,branch:w})),c(e=>vX(e,ps(x.target))),n.project.runCheckout({projectPath:S,branch:w}).then(e=>{let t=null,n=!1;c(r=>{let{state:i,sideEffect:a}=yX(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?qs.error(a({id:`NJyQi_`,values:{shareBranch:w}})):t===`fetch-failed`?qs.error(a({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&qs.error(a({id:`c863eW`,values:{shareBranch:w}})),n&&i.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),c(TX),qs.error(a({id:`c863eW`,values:{shareBranch:w}}))}))},t[23]=a,t[24]=s.info,t[25]=s.phase,t[26]=n.project,t[27]=S,t[28]=x.target,t[29]=w,t[30]=i,t[31]=T):T=t[31];let E=T,D;t[32]!==a||t[33]!==n.project||t[34]!==S||t[35]!==x.target||t[36]!==w||t[37]!==i||t[38]!==m?(D=function(){console.log(tf({branch_dialog_action:`open-current`,branch:w})),n.project.open({path:S,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:ps(x.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),qs.error(a({id:`b5aNbi`,values:{targetNoun:m}}))}),i.dismiss()},t[32]=a,t[33]=n.project,t[34]=S,t[35]=x.target,t[36]=w,t[37]=i,t[38]=m,t[39]=D):D=t[39];let O=D,k;t[40]!==a||t[41]!==s.otherWorktreePath||t[42]!==s.phase||t[43]!==n.project||t[44]!==x.target||t[45]!==w||t[46]!==i?(k=function(){if(s.phase!==`branch-in-other-worktree`)return;let e=s.otherWorktreePath;console.log(tf({branch_dialog_action:`pivot-to-other-worktree`,branch:w})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:x.target.kind,path:ps(x.target)},pendingBranch:w}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),qs.error(a({id:`LdABLa`,values:{target:e}}))}),i.dismiss()},t[40]=a,t[41]=s.otherWorktreePath,t[42]=s.phase,t[43]=n.project,t[44]=x.target,t[45]=w,t[46]=i,t[47]=k):k=t[47];let A=k,j;t[48]===i?j=t[49]:(j=function(){console.log(tf({branch_dialog_action:`cancel`})),i.dismiss()},t[48]=i,t[49]=j);let M=j,N,P,F,I,L,R,z,B,V,H,U,W,G,K,q,J,Y;if(t[50]!==a||t[51]!==s.info||t[52]!==s.otherWorktreePath||t[53]!==s.phase||t[54]!==M||t[55]!==C||t[56]!==x.branch||t[57]!==x.owner||t[58]!==x.repo||t[59]!==x.target||t[60]!==w||t[61]!==m){Y=s.phase===`ready`||s.phase===`switching`?pX(s.info):null;let e;t[79]!==s.info||t[80]!==s.phase||t[81]!==C?(e=s.phase===`ready`||s.phase===`switching`?mX(s.info):C??`HEAD`,t[79]=s.info,t[80]=s.phase,t[81]=C,t[82]=e):e=t[82];let n=e;R=s.phase===`switching`||s.phase===`awaiting-cc1-recycle`;let r;t[83]===a?r=t[84]:(r=a({id:`OuY8t9`}),t[83]=a,t[84]=r),I=r;let i;t[85]!==a||t[86]!==w?(i=a({id:`_BthEY`,values:{shareBranch:w}}),t[85]=a,t[86]=w,t[87]=i):i=t[87],L=i;let o=s.phase===`loading`,c=s.phase===`error`;F=oo,q=!0,t[88]===M?J=t[89]:(J=e=>{e||M()},t[88]=M,t[89]=J),P=no,H=`sm:max-w-xl`,U=`share-branch-switch-dialog`,W=wX,G=CX;let l;t[90]===m?l=t[91]:(l=(0,Z.jsx)(to,{children:(0,Z.jsx)(X,{id:`RY6Bq1`,values:{targetNoun:m}})}),t[90]=m,t[91]=l);let u=x.owner,d=x.repo,f;t[92]===x.target?f=t[93]:(f=ps(x.target),t[92]=x.target,t[93]=f);let p;t[94]!==x.owner||t[95]!==x.repo||t[96]!==f?(p=(0,Z.jsx)(eo,{className:`sr-only`,children:(0,Z.jsx)(X,{id:`f8jU-L`,values:{0:u,1:d,2:f}})}),t[94]=x.owner,t[95]=x.repo,t[96]=f,t[97]=p):p=t[97],t[98]!==l||t[99]!==p?(K=(0,Z.jsxs)(ao,{children:[l,p]}),t[98]=l,t[99]=p,t[100]=K):K=t[100],N=ro;let h=x.owner,g=x.repo,_;t[101]===x.target?_=t[102]:(_=ps(x.target),t[101]=x.target,t[102]=_),t[103]!==x.branch||t[104]!==x.owner||t[105]!==x.repo||t[106]!==x.target.kind||t[107]!==_?(z=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(cm,{owner:h,repo:g,path:_,kind:x.target.kind,branch:x.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=x.branch,t[104]=x.owner,t[105]=x.repo,t[106]=x.target.kind,t[107]=_,t[108]=z):z=t[108],B=s.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(X,{id:`yjExfe`,values:{shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:s.otherWorktreePath})]}):o?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ms,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(X,{id:`w4hMYl`})}):Y?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`XnoA1k`,values:{targetNoun:m,shareBranch:w},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):Y?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`sZ2IOu`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(X,{id:`_902BE`,values:{targetNoun:m,shareBranch:w,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),V=Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(X,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:Y.conflictingFiles.map(SX)})]}):null,t[50]=a,t[51]=s.info,t[52]=s.otherWorktreePath,t[53]=s.phase,t[54]=M,t[55]=C,t[56]=x.branch,t[57]=x.owner,t[58]=x.repo,t[59]=x.target,t[60]=w,t[61]=m,t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L,t[67]=R,t[68]=z,t[69]=B,t[70]=V,t[71]=H,t[72]=U,t[73]=W,t[74]=G,t[75]=K,t[76]=q,t[77]=J,t[78]=Y}else N=t[62],P=t[63],F=t[64],I=t[65],L=t[66],R=t[67],z=t[68],B=t[69],V=t[70],H=t[71],U=t[72],W=t[73],G=t[74],K=t[75],q=t[76],J=t[77],Y=t[78];let ee;t[109]===R?ee=t[110]:(ee=R?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(ms,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(X,{id:`CU3AiE`})]}):null,t[109]=R,t[110]=ee);let te;t[111]!==N||t[112]!==z||t[113]!==B||t[114]!==V||t[115]!==ee?(te=(0,Z.jsxs)(N,{children:[z,B,V,ee]}),t[111]=N,t[112]=z,t[113]=B,t[114]=V,t[115]=ee,t[116]=te):te=t[116];let ne;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(X,{id:`dEgA5A`}),t[117]=ne):ne=t[117];let re;t[118]===M?re=t[119]:(re=(0,Z.jsx)(Di,{variant:`ghost`,className:`font-mono uppercase`,onClick:M,"data-testid":`share-branch-switch-cancel`,children:ne}),t[118]=M,t[119]=re);let ie;t[120]!==s.phase||t[121]!==O||t[122]!==A||t[123]!==E||t[124]!==I||t[125]!==L||t[126]!==R||t[127]!==Y?(ie=s.phase===`branch-in-other-worktree`?(0,Z.jsx)(Di,{onClick:A,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(X,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[Y?.openCurrentEnabled?(0,Z.jsxs)(Di,{variant:`outline`,className:`font-mono uppercase`,onClick:O,disabled:R,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(dd,{className:`size-3.5`,"aria-hidden":!0}),I]}):null,(0,Z.jsx)(Di,{onClick:E,disabled:!Y?.switchEnabled||R,"aria-disabled":!Y?.switchEnabled||R,"aria-describedby":Y&&!Y.switchEnabled&&Y.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:R?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ms,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),L]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{className:`size-3.5`,"aria-hidden":!0}),L]})})]}),t[120]=s.phase,t[121]=O,t[122]=A,t[123]=E,t[124]=I,t[125]=L,t[126]=R,t[127]=Y,t[128]=ie):ie=t[128];let ae;t[129]!==re||t[130]!==ie?(ae=(0,Z.jsxs)(io,{className:`sm:justify-between`,children:[re,ie]}),t[129]=re,t[130]=ie,t[131]=ae):ae=t[131];let oe;t[132]!==P||t[133]!==H||t[134]!==U||t[135]!==W||t[136]!==G||t[137]!==K||t[138]!==te||t[139]!==ae?(oe=(0,Z.jsxs)(P,{className:H,"data-testid":U,onInteractOutside:W,onPointerDownOutside:G,children:[K,te,ae]}),t[132]=P,t[133]=H,t[134]=U,t[135]=W,t[136]=G,t[137]=K,t[138]=te,t[139]=ae,t[140]=oe):oe=t[140];let se;return t[141]!==F||t[142]!==q||t[143]!==J||t[144]!==oe?(se=(0,Z.jsx)(F,{open:q,onOpenChange:J,children:oe}),t[141]=F,t[142]=q,t[143]=J,t[144]=oe,t[145]=se):se=t[145],se}function SX(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function CX(e){e.preventDefault()}function wX(e){e.preventDefault()}function TX(e){return yX(e,null).state}function EX(e){return _X(e,null)}function DX(){return null}function OX(){let e=(0,$.c)(17),t=Fn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=_t(),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 U,i=new Ye({url:n,name:ri,document:e,onStateless:e=>{let{payload:t}=e;M(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:PX,onConfigValidationRejected:NX,onConfigIgnoreNestedError:MX,onUnknown:jX})},onClose:AX,onDisconnect:kX}),a=ec(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=ge(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{$s([`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 kX(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function AX(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function jX(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function MX(e){Da(e)}function NX(e){ja(e)}function PX(e){$s([e.ch])}function FX(e){let t=ae(e);if(t)return{scope:`project`,name:t};let n=ti(e);return n?.kind===`skill`?{scope:n.scope,name:n.name}:null}function IX(e,t){let n=new Set(t.map(e=>`${e.scope}\u0000${e.name}`)),r=[];for(let t of e){let e=FX(t);if(!e||n.has(`${e.scope}\u0000${e.name}`))continue;let i=e.scope===`project`?`global`:`project`;n.has(`${i}\u0000${e.name}`)?r.push({kind:`retarget`,fromDocName:t,toDocName:bi(i,e.name)}):r.push({kind:`close`,docName:t})}return r}function LX(){let e=(0,$.c)(13),{openTabs:t,closeDocument:n}=_t(),r;e[0]===t?r=e[1]:(r=t.some(zX),e[0]=t,e[1]=r);let i=r,a;e[2]===i?a=e[3]:(a={enabled:i},e[2]=i,e[3]=a);let o=Qo(a),s=(0,Q.useRef)(null),c;e[4]!==n||e[5]!==t||e[6]!==o.data||e[7]!==o.status?(c=()=>{if(o.status!==`ready`)return;let e=o.data,r=`${t.join(``)}\u0002${e.map(RX).sort().join(``)}`;if(s.current===r)return;s.current=r;let i=IX(t,e);for(let e of i)e.kind===`retarget`?(Fs(e.toDocName),n(e.fromDocName)):n(e.docName)},e[4]=n,e[5]=t,e[6]=o.data,e[7]=o.status,e[8]=c):c=e[8];let l;e[9]!==n||e[10]!==t||e[11]!==o?(l=[o,t,n],e[9]=n,e[10]=t,e[11]=o,e[12]=l):l=e[12],(0,Q.useEffect)(c,l)}function RX(e){return`${e.scope}\u0000${e.name}`}function zX(e){return FX(e)!==null}var BX=1e3,VX=3e4;function HX(e){let t=e.scheduler??{setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)},n=e.initialBackoffMs??BX,r=e.maxBackoffMs??VX,i=e.rng??Math.random,a=e.createWebSocket??(e=>new WebSocket(e)),o=e.logger??null,s=e.log,c=null,l=null,u=!1,d=n;function f(e,t,n){try{o?o[e](t,n):s?.(t)}catch{}}function p(){if(u)return;l!==null&&t.clearTimeout(l);let e=d;d=Math.min(d*2,r);let n=i(),a=Math.max(1,Math.floor(e*(1-n/2)));f(`debug`,`scheduling reconnect`,{backoffMs:a,ceilMs:e}),l=t.setTimeout(()=>{l=null,m().catch(e=>f(`warn`,`reconnect failed`,{error:String(e)}))},a)}async function m(){if(u)return;let t;try{t=await e.resolveWsUrl()}catch(e){f(`warn`,`resolveWsUrl threw`,{error:String(e)}),p();return}if(!t){p();return}let r=[];e.pid!==void 0&&r.push(`pid=${encodeURIComponent(String(e.pid))}`),e.connectionId&&r.push(`connectionId=${encodeURIComponent(e.connectionId)}`),e.connectionId&&e.displayName!==void 0&&e.clientName!==void 0&&e.colorSeed!==void 0&&(r.push(`displayName=${encodeURIComponent(e.displayName)}`),r.push(`clientName=${encodeURIComponent(e.clientName)}`),r.push(`colorSeed=${encodeURIComponent(e.colorSeed)}`));let i=r.length>0?`?${r.join(`&`)}`:``,o=`${t}/collab/keepalive${i}`;try{c=a(o)}catch(e){f(`warn`,`WebSocket constructor failed`,{url:o,error:String(e)}),c=null,p();return}c.addEventListener(`open`,()=>{f(`info`,`connected`,{url:t}),d=n}),c.addEventListener(`close`,()=>{u||(f(`info`,`disconnected`,{url:t}),c=null,p())}),c.addEventListener(`error`,()=>{f(`debug`,`websocket error observed`,{url:t,readyState:c?.readyState,reason:`error-event`})})}return queueMicrotask(()=>{m().catch(e=>f(`warn`,`initial connect failed`,{error:String(e)}))}),{close:()=>{if(!u&&(u=!0,l!==null&&(t.clearTimeout(l),l=null),c)){try{c.close()}catch{}c=null}},isConnected:()=>c!==null&&c.readyState===1}}function UX(e){if(e)return e.replace(/\/collab\/?$/,``)}function WX(){return kt(window)!==null}function GX(e,t){let n=(0,$.c)(5),r=(0,Q.useRef)(e),i=(0,Q.useRef)(t),a,o;n[0]===e?(a=n[1],o=n[2]):(a=()=>{r.current=e},o=[e],n[0]=e,n[1]=a,n[2]=o),(0,Q.useEffect)(a,o);let s,c;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=i.current?.startKeepalive??HX;if((i.current?.isElectronHost??WX)())return;let t=e({resolveWsUrl:async()=>UX(r.current)});return()=>t.close()},c=[],n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,Q.useEffect)(s,c)}var KX=`#install-claude-desktop`;function qX(e){return e===`#settings`||e===KX}function JX(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function YX(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=_t(),{openTargetTransition:i}=At();LX();let{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=Oo(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=JX(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(qX(window.location.hash))return;let e=uo(window.location.hash);if(e){let t=or(e.split(`.`).pop()??``);Ot(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=_o(window.location.hash);if(n){Ot(`ok/nav/hash-change`,{docName:null,kind:`skill-file`}),i({kind:`skill-file`,target:`${n.scope}/${n.name}/${n.path}`,scope:n.scope,name:n.name,path:n.path});return}if(ko(window.location.hash)){Ot(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let r=Io(window.location.hash);if(!r){Ot(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Ot(`ok/nav/hash-change`,{docName:r,kind:`deferred-loading`});return}let a=To(r,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(a.kind===`missing`&&/\/+$/.test(r.trim())){Ot(`ok/nav/hash-change`,{docName:r,kind:`deferred-missing-folder`});return}let f=jo(No(a),c);Ot(`ok/nav/hash-change`,{docName:r,kind:f.kind}),i(f)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function XX(){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)(ZX,t),null}function ZX(){let e=eZ;if(!e(window.location.hash))return;let t=new AbortController;return ve(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch($X))}).catch(QX),()=>t.abort()}function QX(){}function $X(){}function eZ(e){return!qX(e)&&!uo(e)&&!Io(e)&&(e===``||e===`#`||e===`#/`)}function tZ(){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)(nZ,t),null}function nZ(){let e=function(e){let t=e.target;aa({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=ra))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function rZ(){let e=(0,$.c)(4),{activeTarget:t}=_t(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function iZ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=_t(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Do(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;m_({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)(g_,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function aZ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=_t();GX(r);let i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(N,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function oZ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(P,{name:`app`,children:(0,Z.jsx)(Rt,{children:(0,Z.jsx)(aZ,{children:(0,Z.jsx)(K_,{children:(0,Z.jsx)(sZ,{})})})})}),e[0]=t):t=e[0],t}function sZ(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Y_(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:cZ}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(hv,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(OX,{}),u=(0,Z.jsx)(YX,{}),d=(0,Z.jsx)(XX,{}),f=(0,Z.jsx)(rZ,{}),p=(0,Z.jsx)(iZ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(tZ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(gv,{bridge:t}):null,h=(0,Z.jsx)(im,{}),g=t?(0,Z.jsx)(xX,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(sv,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=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]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(aX,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Zj,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(uI,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(es,{value:s,children:(0,Z.jsxs)(Gj,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(Mo,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function cZ(e,t){cI(us(e,t),t)}lu(),Rm({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),Zm(),Ch()&&kh(),bg(),Rh(),typeof window<`u`&&$m({bridge:window.okDesktop}),typeof window<`u`&&uh({bridge:window.okDesktop}),typeof window<`u`&&vl({bridge:window.okDesktop}),typeof window<`u`&&pl({bridge:window.okDesktop}),typeof window<`u`&&nh({bridge:window.okDesktop}),typeof window<`u`&&_m({bridge:window.okDesktop}),Hh();var lZ=new vu({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),uZ=document.getElementById(`root`);if(!uZ)throw Error(`Root element not found`);var dZ=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,Au.createRoot)(uZ).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(ln,{i18n:rc,children:(0,Z.jsx)(Dn,{client:lZ,children:(0,Z.jsxs)(_r,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(mc,{children:dZ&&window.okDesktop?(0,Z.jsx)(jm,{bridge:window.okDesktop}):(0,Z.jsx)(oZ,{})}),(0,Z.jsx)(Im,{richColors:!0,closeButton:!0})]})})})}));
|