@inkeep/open-knowledge 0.35.0-beta.1 → 0.35.0-beta.2
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-DpyZcZY8.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-B9aBCKfN.mjs +1 -0
- package/dist/{init-CVLKb3oz.mjs → init-Djn0N_zk.mjs} +3 -3
- package/dist/{launch-json-removal-AdTwk3eT.mjs → launch-json-removal-CP7Ar6Ob.mjs} +2 -2
- package/dist/{loader-CJD5H4rj.mjs → loader-BXG_Ue4t.mjs} +2 -2
- package/dist/loader-irKuAg3E.mjs +1 -0
- package/dist/preview-CrLp2V_V.mjs +1 -0
- package/dist/{preview-Dq8FTDPe.mjs → preview-Dhq40nJ_.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-DBgWJhkx.js → ActivityModeContent-BNz82usM.js} +1 -1
- package/dist/public/assets/{DocumentContext-CWJ7hfZT.js → DocumentContext-s7Qfd8iz.js} +19 -19
- package/dist/public/assets/{ManagedArtifactProperties-_V5aR-6k.js → ManagedArtifactProperties-CgjKuRi_.js} +1 -1
- package/dist/public/assets/{PropertyPanel-hMoN4Hda.js → PropertyPanel-Dnh_rOsE.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-SwVDm-ay.js → SettingsDialogBody-BrRjDYgY.js} +1 -1
- package/dist/public/assets/{SourceEditor-FX3akQbF.js → SourceEditor-dylchaTN.js} +1 -1
- package/dist/public/assets/{auth-state-cache-ByjLRYDx.js → auth-state-cache-DebyEMGy.js} +1 -1
- package/dist/public/assets/{index-D2oet0wG.js → index-BgzB1Mj8.js} +5 -5
- package/dist/public/assets/{selection-context-C_A_tH6W.js → selection-context-CkCMxiY8.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-CwIqbcfm.js → typing-burst-detector-DBCESRMW.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/{repair-launch-json-CxNjlqij.mjs → repair-launch-json-CdPB4PAo.mjs} +2 -2
- package/dist/{repair-mcp-configs-Dtnsor_m.mjs → repair-mcp-configs-OwymJ26_.mjs} +2 -2
- package/dist/{src-nG3ysTNI.mjs → src-3qc3R4lD.mjs} +2 -2
- package/dist/start-BnLtN72x.mjs +1 -0
- package/dist/{start-DLha1qnz.mjs → start-CHvIBqjW.mjs} +2 -2
- package/package.json +4 -4
- package/dist/constants-DZx62n7t.mjs +0 -2
- package/dist/init-CzoKldU1.mjs +0 -1
- package/dist/loader-CU424QQ7.mjs +0 -1
- package/dist/preview-CM4FOiPe.mjs +0 -1
- package/dist/start-vpVar-h6.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-jUMr-Cv1.js","./chunk-DseTPa7n.js","./preload-helper-2ej06EnG.js","./trace-api-BIWqyPc9.js","./propagation-api-M_AcuP6N.js","./ReportBugDialogBody-memFSmPS.js","./dist-GfBYAWEU.js","./markdownit-DyWy6cMj.js","./w3c-keyname-CRPBoZED.js","./dist-CSDjUb5q.js","./compiler-runtime-DrcePeIl.js","./checkbox-Ds7GA0j4.js","./dist-DGkUVO6K.js","./floating-ui.dom-B3TJy2Tg.js","./dist-DivkR5AO.js","./createLucideIcon-Wgamzz8_.js","./react-dom-CMNLH3L-.js","./dist-CVCmotds.js","./check-BJRSVBAg.js","./dialog-D9fMUB3u.js","./x-BUBUnCd-.js","./CopyButton-B8lE78wK.js","./tooltip-CuKuwVbZ.js","./copy-CfDOH9N1.js","./loader-circle-BrJhrTc7.js","./triangle-alert-VZ_Cki-r.js","./input-BX4UDDMJ.js","./textarea--26Ac0EI.js","./external-link-BfiFPJEx.js","./clipboard-adapter-BHfhAZ-n.js","./ActivityPanelDiffView-COM6jgM6.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-C5V7tN6C.js","./dist-o9cVHl8Q.js","./toggle-group-B30vKHKs.js","./dist-Bpw_gSUm.js","./dist-Ly1ZfY-Y.js","./panel-BGYdvxEm.js","./min-wGNVvSoq.js","./src-DyReJWGm.js","./colors-yCcn8znj.js","./ordinal-RCdkn_04.js","./init-DSak-Kkw.js","./isObject-qQeVObYJ.js","./now-7lIApcFa.js","./arrow-up-right-BnJZWj8r.js","./prop-types-BvMtVAeG.js","./navigation-targets-CW61_XIz.js","./doc-hash-BMXWNo_I.js","./documents-events-DJ1GG23v.js","./documents-fetch-YrVYNlaU.js","./parse-api-error-BcfaIWfX.js","./startup-marks-Dq0rZGD-.js","./dist-DGbq0bSp.js","./target-navigation-intent-oLHFF9_D.js","./ActivityModeContent-
|
|
2
|
-
import{i as e,t}from"./chunk-DseTPa7n.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-DrcePeIl.js";import{$ as o,$t as s,A as c,An as l,At as u,B as d,Bt as f,Cn as p,Ct as m,D as h,Dn as g,Dt as _,Et as v,F as y,Ft as b,G as x,Gt as S,H as C,Ht as w,I as T,It as E,J as D,Jt as O,K as k,Kt as A,L as j,Lt as M,Mn as N,Mt as P,N as F,Nn as I,Nt as L,O as R,Ot as z,P as B,Pt as V,Q as H,Qt as U,R as W,Rt as G,Sn as K,St as q,Tn as ee,Tt as te,U as ne,Ut as re,V as ie,Vt as ae,W as oe,Wt as se,X as ce,Xt as le,Y as ue,Yt as de,Z as fe,Zt as pe,_n as me,_t as he,a as ge,an as _e,at as ve,bn as ye,bt as be,c as xe,ct as Se,d as Ce,dn as we,en as Te,et as Ee,f as De,fn as Oe,g as ke,gn as Ae,gt as je,h as Me,hn as Ne,ht as Pe,i as Fe,in as Ie,it as Le,j as Re,jn as ze,jt as Be,k as Ve,kn as He,kt as Ue,l as We,ln as Ge,lt as Ke,m as qe,mn as Je,mt as Ye,n as Xe,nn as Ze,nt as Qe,o as $e,on as et,ot as tt,p as nt,pn as rt,pt as it,q as at,qt as ot,r as st,rn as ct,rt as lt,s as ut,sn as dt,st as ft,t as pt,tn as mt,tt as ht,u as gt,un as _t,ut as vt,v as yt,vn as bt,vt as xt,wn as St,wt as Ct,xn as wt,xt as Tt,y as Et,yn as Dt,yt as Ot,z as kt,zt as At}from"./DocumentContext-CWJ7hfZT.js";import{n as J,r as jt,t as Mt}from"./dist-CSDjUb5q.js";import{C as Nt,E as Pt,S as Ft,T as It,_ as Lt,a as Rt,b as zt,c as Bt,d as Vt,f as Ht,g as Ut,h as Wt,i as Gt,l as Kt,m as qt,n as Jt,o as Yt,p as Xt,r as Zt,s as Qt,t as $t,u as en,v as tn,w as nn,x as rn,y as an}from"./panel-BGYdvxEm.js";import{n as on,t as sn}from"./dist-DGbq0bSp.js";import{t as cn}from"./react-dom-CMNLH3L-.js";import{i as ln,l as un,n as Y,t as dn,u as X}from"./createLucideIcon-Wgamzz8_.js";import{a as fn,c as pn,d as mn,i as hn,o as gn,r as _n,u as vn}from"./dist-DivkR5AO.js";import{i as yn,n as bn,r as xn,t as Sn}from"./tooltip-CuKuwVbZ.js";import{t as Cn}from"./dist-Bpw_gSUm.js";import{n as wn,r as Tn,t as En}from"./collapsible-UIgt0pSO.js";import{a as Dn,c as On,i as kn,n as An,o as jn,s as Mn,t as Nn}from"./dialog-D9fMUB3u.js";import{$ as Pn,B as Fn,C as In,D as Ln,F as Rn,I as zn,K as Bn,L as Vn,O as Hn,Q as Un,T as Wn,X as Gn,Y as Kn,_ as qn,_t as Jn,at as Yn,b as Xn,ct as Zn,et as Qn,f as $n,gt as er,ht as tr,l as nr,m as rr,mt as ir,ot as ar,q as or,rt as sr,st as cr,u as lr,vt as ur,w as dr,yt as fr}from"./CodeMirrorPropInput-DKUgIQit.js";import{t as pr}from"./checkbox-Ds7GA0j4.js";import{a as mr,d as hr,i as gr,l as _r,n as vr,o as yr,r as br,s as xr,t as Sr,u as Cr}from"./floating-ui.dom-B3TJy2Tg.js";import{n as wr,r as Tr,t as Er}from"./dist-Ly1ZfY-Y.js";import{A as Dr,B as Or,C as kr,D as Ar,E as jr,F as Mr,H as Nr,I as Pr,L as Fr,M as Ir,N as Lr,O as Rr,P as zr,R as Br,S as Vr,T as Hr,U as Ur,V as Wr,_ as Gr,g as Kr,h as qr,i as Jr,j as Yr,k as Xr,m as Zr,o as Qr,p as $r,r as ei,u as ti,v as ni,w as ri,y as ii,z as ai}from"./skills-api-BhEjmNIn.js";import{t as oi}from"./label-CveCqKNR.js";import{n as si,t as ci}from"./radio-group-D9Wp487Q.js";import{$ as li,A as ui,B as di,D as fi,F as pi,G as mi,H as hi,I as gi,J as _i,K as vi,L as yi,O as bi,P as xi,Q as Si,R as Ci,T as wi,U as Ti,V as Ei,W as Di,X as Oi,Y as ki,Z as Ai,_ as ji,a as Mi,at as Ni,b as Pi,c as Fi,ct as Ii,dt as Li,et as Ri,ft as zi,it as Bi,k as Vi,l as Hi,lt as Ui,m as Wi,n as Gi,nt as Ki,ot as qi,q as Ji,r as Yi,st as Xi,t as Zi,tt as Qi,u as $i,ut as ea,v as ta,w as na,y as ra,z as ia}from"./auth-state-cache-ByjLRYDx.js";import{n as aa,r as oa,t as sa}from"./toggle-group-B30vKHKs.js";import{$r as ca,A as la,Ai as ua,Ar as da,B as fa,Bi as pa,Bn as ma,Br as ha,Bt as ga,C as _a,Ca as va,Cn as ya,D as ba,Di as xa,Ei as Sa,En as Ca,Er as wa,Et as Ta,F as Ea,Fi as Da,Fr as Oa,Ft as ka,Hn as Aa,Ii as ja,In as Ma,Ir as Na,It as Pa,Jr as Fa,Li as Ia,M as La,Mi as Ra,N as za,Ni as Ba,Nn as Va,Pn as Ha,Pr as Ua,Qr as Wa,Rn as Ga,Rr as Ka,Sa as qa,Sn as Ja,Ti as Ya,Tt as Xa,Ut as Za,Vr as Qa,Wr as $a,Xr as eo,Zn as to,Zr as no,_a as ro,ai as io,at as ao,b as oo,bi as so,bt as co,c as lo,cn as uo,ei as fo,er as po,fa as mo,hn as ho,ir as go,ji as _o,jn as vo,jr as yo,k as bo,kr as xo,li as So,mn as Co,mt as wo,n as To,nr as Eo,nt as Do,oa as Oo,oi as ko,pa as Ao,pr as jo,qt as Mo,r as No,sn as Po,sr as Fo,t as Io,tt as Lo,ua as Ro,vn as zo,w as Bo,wi as Vo,wn as Ho,wr as Uo,xa as Wo,xi as Go,xn as Ko,ya as qo,yr as Jo,z as Yo,zr as Xo,zt as Zo}from"./dist-GfBYAWEU.js";import{t as Qo}from"./git-branch-CAiKE5bw.js";import{a as $o,c as es,i as ts,n as ns,o as rs,r as is,s as as,t as os}from"./pending-receive-nav-store-9viWJ9VV.js";import{a as ss,c as cs,l as ls,o as us,s as ds}from"./EnableSyncConfirmDialog-BFsmDIV-.js";import{t as fs}from"./arrow-up-right-BnJZWj8r.js";import{a as ps,c as ms,d as hs,f as gs,i as _s,l as vs,m as ys,n as bs,o as xs,p as Ss,r as Cs,s as ws,t as Ts,u as Es}from"./PropertyPanel-hMoN4Hda.js";import{t as Ds}from"./check-BJRSVBAg.js";import{t as Os}from"./chevron-left-rxhGFFOu.js";import{t as ks}from"./chevron-down-kQ6IAInm.js";import{t as As}from"./chevron-right-B2thM4kG.js";import{n as js,t as Ms}from"./CopyButton-B8lE78wK.js";import{a as Ns,i as Ps,n as Fs,o as Is}from"./prop-types-BvMtVAeG.js";import{C as Ls,E as Rs,S as zs,T as Bs,_ as Vs,a as Hs,b as Us,c as Ws,d as Gs,f as Ks,g as qs,h as Js,i as Ys,l as Xs,m as Zs,n as Qs,o as $s,p as ec,r as tc,s as nc,u as rc,v as ic,w as ac,x as oc}from"./skill-actions-6AAhO9zY.js";import{a as sc,d as cc,i as lc,l as uc,n as dc,o as fc,r as pc,s as mc,t as hc,u as gc}from"./workspace-paths-DtvYoBMA.js";import{t as _c}from"./copy-CfDOH9N1.js";import{t as vc}from"./eye-Cq1_8-Tk.js";import{t as yc}from"./folder-open-ygPcz1xa.js";import{_ as bc,a as xc,b as Sc,c as Cc,d as wc,g as Tc,h as Ec,l as Dc,m as Oc,p as kc,s as Ac,t as jc,u as Mc,v as Nc,y as Pc}from"./open-managed-artifact-tab-BGW4m9f4.js";import{t as Fc}from"./info-CVuSDi5Y.js";import{t as Ic}from"./loader-circle-BrJhrTc7.js";import{t as Lc}from"./miss-dialog-store-b0Uwu1ZT.js";import{t as Rc}from"./refresh-cw-FMnveNBD.js";import{t as zc}from"./trash-2-Cgf308yS.js";import{t as Bc}from"./triangle-alert-VZ_Cki-r.js";import{a as Vc,i as Hc,n as Uc,o as Wc,r as Gc,s as Kc,t as qc}from"./agent-presence-CTUYlsSf.js";import{a as Jc,c as Yc,d as Xc,f as Zc,h as Qc,i as $c,l as el,m as tl,n as nl,o as rl,s as il,t as al,u as ol}from"./typing-burst-detector-CwIqbcfm.js";import{t as sl}from"./x-BUBUnCd-.js";import{n as cl,t as ll}from"./dist-Qabe7wDM.js";import{a as ul,i as dl,n as fl,r as pl}from"./project-paths-DJDWBB-8.js";import{t as ml}from"./input-BX4UDDMJ.js";import{t as hl}from"./parse-api-error-BcfaIWfX.js";import{t as gl}from"./dist-o9cVHl8Q.js";import{n as _l,r as vl,t as yl}from"./file-tree-rename-validation-DgUQ0I0S.js";import{C as bl,S as xl,_ as Sl,a as Cl,b as wl,g as Tl,h as El,i as Dl,m as Ol,n as kl,o as Al,r as jl,s as Ml,v as Nl,x as Pl,y as Fl}from"./navigation-targets-CW61_XIz.js";import{a as Il,c as Ll,n as Rl,o as zl,r as Bl,s as Vl}from"./documents-events-DJ1GG23v.js";import{t as Hl}from"./documents-fetch-YrVYNlaU.js";import{a as Ul,i as Wl,o as Gl}from"./startup-marks-Dq0rZGD-.js";import{a as Kl,c as ql,d as Jl,f as Yl,i as Xl,l as Zl,n as Ql,o as $l,r as eu,s as tu,t as nu,u as ru}from"./doc-hash-BMXWNo_I.js";import{_ as iu,a as au,h as ou,l as su,n as cu,o as lu,p as uu,v as du}from"./lint-config-client-BGM5HIsf.js";import{a as fu,i as pu,l as mu,n as hu,t as gu}from"./config-provider-CBrCc3Qp.js";import{$ as _u,Et as vu,Ft as yu,I as bu,It as xu,J as Su,Lt as Cu,Mt as wu,Nt as Tu,Ot as Eu,Q as Du,X as Ou,Z as ku,jt as Au,k as ju,kt as Mu,ot as Nu,w as Pu,wt as Fu,xt as Iu}from"./dist-DOee8t3p.js";import{n as Lu}from"./dist-DLiIchlL.js";import{n as Ru}from"./config-context-BbS_JaHs.js";import{t as zu}from"./external-link-BfiFPJEx.js";import{n as Bu,r as Vu,t as Hu}from"./worktree-store-DFmh2OE1.js";import{c as Uu,i as Wu,n as Gu,r as Ku,s as qu,t as Ju}from"./selection-context-C_A_tH6W.js";import{t as Yu}from"./target-navigation-intent-oLHFF9_D.js";import{a as Xu,i as Zu,n as Qu,t as $u}from"./cursor-Rw-XIAht.js";import{t as ed}from"./dist-Cub6hBx7.js";import{n as td}from"./clipboard-adapter-BHfhAZ-n.js";import"./textarea--26Ac0EI.js";import{A as nd,C as rd,D as id,E as ad,O as od,S as sd,T as cd,_ as ld,a as ud,b as dd,c as fd,d as pd,f as md,g as hd,h as gd,i as _d,k as vd,l as yd,m as bd,n as xd,o as Sd,p as Cd,r as wd,s as Td,t as Ed,u as Dd,v as Od,w as kd,x as Ad,y as jd}from"./file-tree-adapter-DDhSPjxf.js";import{n as Md,t as Nd}from"./mcp-consent-store-O7e02Mi1.js";import{a as Pd,t as Fd}from"./receive-store-B3-FInQ9.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 Id(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.34.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-jUMr-Cv1.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var Ld=class extends Ht{#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||Rd(),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=Xt({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),Wt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Rd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var zd=class extends Pt{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 Ld({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=Bd(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=Bd(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=Bd(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=Bd(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Wt.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=>an(t,e))}findAll(e={}){return this.getAll().filter(t=>an(e,t))}notify(e){Wt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Wt.batch(()=>Promise.all(e.map(e=>e.continue().catch(rn))))}};function Bd(e){return e.options.scope?.id}var Vd=class extends Pt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??tn(r,t),a=this.get(i);return a||(a=new Vt({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(){Wt.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=>zt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>zt(e,t)):t}notify(e){Wt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Wt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Wt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Hd=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Vd,this.#t=e.mutationCache||new zd,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=It.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=qt.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(Nt(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=Ut(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Wt.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;Wt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Wt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Wt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e,t={}){return Wt.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=Wt.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(rn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(rn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Nt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return qt.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(Lt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ft(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Lt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ft(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||=tn(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===nn&&(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()}},Ud=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}}}})),Wd=t(((e,t)=>{t.exports=Ud()})),Gd=t((e=>{var t=Wd(),n=r(),i=cn();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)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Gd(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 ee(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Gd(t,e.type);t!==n&&(V(U,e),V(H,n))}function te(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-jUMr-Cv1.js","./chunk-DseTPa7n.js","./preload-helper-2ej06EnG.js","./trace-api-BIWqyPc9.js","./propagation-api-M_AcuP6N.js","./ReportBugDialogBody-memFSmPS.js","./dist-GfBYAWEU.js","./markdownit-DyWy6cMj.js","./w3c-keyname-CRPBoZED.js","./dist-CSDjUb5q.js","./compiler-runtime-DrcePeIl.js","./checkbox-Ds7GA0j4.js","./dist-DGkUVO6K.js","./floating-ui.dom-B3TJy2Tg.js","./dist-DivkR5AO.js","./createLucideIcon-Wgamzz8_.js","./react-dom-CMNLH3L-.js","./dist-CVCmotds.js","./check-BJRSVBAg.js","./dialog-D9fMUB3u.js","./x-BUBUnCd-.js","./CopyButton-B8lE78wK.js","./tooltip-CuKuwVbZ.js","./copy-CfDOH9N1.js","./loader-circle-BrJhrTc7.js","./triangle-alert-VZ_Cki-r.js","./input-BX4UDDMJ.js","./textarea--26Ac0EI.js","./external-link-BfiFPJEx.js","./clipboard-adapter-BHfhAZ-n.js","./ActivityPanelDiffView-COM6jgM6.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-C5V7tN6C.js","./dist-o9cVHl8Q.js","./toggle-group-B30vKHKs.js","./dist-Bpw_gSUm.js","./dist-Ly1ZfY-Y.js","./panel-BGYdvxEm.js","./min-wGNVvSoq.js","./src-DyReJWGm.js","./colors-yCcn8znj.js","./ordinal-RCdkn_04.js","./init-DSak-Kkw.js","./isObject-qQeVObYJ.js","./now-7lIApcFa.js","./arrow-up-right-BnJZWj8r.js","./prop-types-BvMtVAeG.js","./navigation-targets-CW61_XIz.js","./doc-hash-BMXWNo_I.js","./documents-events-DJ1GG23v.js","./documents-fetch-YrVYNlaU.js","./parse-api-error-BcfaIWfX.js","./startup-marks-Dq0rZGD-.js","./dist-DGbq0bSp.js","./target-navigation-intent-oLHFF9_D.js","./ActivityModeContent-BNz82usM.js","./CodeMirrorPropInput-DKUgIQit.js","./dist-Uf9Tc8KS.js","./dist-DOee8t3p.js","./dist-DQ98O3oW.js","./dist-CSbnaLam.js","./dist-C6B3IZlW.js","./dist-D6P0HEvG.js","./dist-RKGXlTOn.js","./dist-DLiIchlL.js","./dist-Cid07B-b.js","./stex-lDOZN-ZW.js","./config-provider-CBrCc3Qp.js","./use-apply-config-color-theme-JH4tQfHA.js","./config-context-BbS_JaHs.js","./folder-open-ygPcz1xa.js","./trash-2-Cgf308yS.js","./DocumentContext-s7Qfd8iz.js","./collapsible-UIgt0pSO.js","./git-branch-CAiKE5bw.js","./chevron-down-kQ6IAInm.js","./chevron-right-B2thM4kG.js","./workspace-paths-DtvYoBMA.js","./eye-Cq1_8-Tk.js","./info-CVuSDi5Y.js","./dist-Qabe7wDM.js","./file-tree-rename-validation-DgUQ0I0S.js","./DocumentContext-B0sQn39F.css","./agent-presence-CTUYlsSf.js","./cursor-Rw-XIAht.js","./dist-Ddrqoe4c.js","./dist-TIByzzIF.js","./SettingsDialogBody-BrRjDYgY.js","./open-managed-artifact-tab-BGW4m9f4.js","./skills-api-BhEjmNIn.js","./label-CveCqKNR.js","./radio-group-D9Wp487Q.js","./auth-state-cache-DebyEMGy.js","./EnableSyncConfirmDialog-BFsmDIV-.js","./skill-actions-6AAhO9zY.js","./refresh-cw-FMnveNBD.js","./lint-config-client-BGM5HIsf.js","./ManagedArtifactProperties-CgjKuRi_.js","./PropertyPanel-Dnh_rOsE.js","./format-DJS8_tfZ.js","./selection-context-CkCMxiY8.js","./MermaidDocEditor-dbbj76iW.js","./dist-Cub6hBx7.js","./src-G334Yrxd.js","./SourceEditor-dylchaTN.js","./typing-burst-detector-DBCESRMW.js","./SkillEditorActions-DG7dmv6Z.js","./TerminalPanel-N3nlUpP9.js","./file-tree-adapter-DDhSPjxf.js","./TerminalPanel-BrP-ENHg.css","./McpConsentDialogBody-BwgO2quE.js","./mcp-consent-store-O7e02Mi1.js","./ShareBranchSwitchDialog-DI52ZkaG.js","./miss-dialog-store-b0Uwu1ZT.js","./share-metadata-rows-CVWX1vOJ.js","./desktop-bridge-types-_D7JSBL8.js","./receive-store-B3-FInQ9.js","./worktree-store-DFmh2OE1.js","./ShareReceiveMissDialog-PR-XSxN1.js","./pending-receive-nav-store-9viWJ9VV.js","./ConsentDialogBody-Dac-eNHp.js","./project-paths-DJDWBB-8.js","./ShareReceiveDialog-C8u6PgdG.js","./telemetry-startup-BtK87qj7.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./chunk-DseTPa7n.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-DrcePeIl.js";import{$ as o,$t as s,A as c,An as l,At as u,B as d,Bt as f,Cn as p,Ct as m,D as h,Dn as g,Dt as _,Et as v,F as y,Ft as b,G as x,Gt as S,H as C,Ht as w,I as T,It as E,J as D,Jt as O,K as k,Kt as A,L as j,Lt as M,Mn as N,Mt as P,N as F,Nn as I,Nt as L,O as R,Ot as z,P as B,Pt as V,Q as H,Qt as U,R as W,Rt as G,Sn as K,St as q,Tn as ee,Tt as te,U as ne,Ut as re,V as ie,Vt as ae,W as oe,Wt as se,X as ce,Xt as le,Y as ue,Yt as de,Z as fe,Zt as pe,_n as me,_t as he,a as ge,an as _e,at as ve,bn as ye,bt as be,c as xe,ct as Se,d as Ce,dn as we,en as Te,et as Ee,f as De,fn as Oe,g as ke,gn as Ae,gt as je,h as Me,hn as Ne,ht as Pe,i as Fe,in as Ie,it as Le,j as Re,jn as ze,jt as Be,k as Ve,kn as He,kt as Ue,l as We,ln as Ge,lt as Ke,m as qe,mn as Je,mt as Ye,n as Xe,nn as Ze,nt as Qe,o as $e,on as et,ot as tt,p as nt,pn as rt,pt as it,q as at,qt as ot,r as st,rn as ct,rt as lt,s as ut,sn as dt,st as ft,t as pt,tn as mt,tt as ht,u as gt,un as _t,ut as vt,v as yt,vn as bt,vt as xt,wn as St,wt as Ct,xn as wt,xt as Tt,y as Et,yn as Dt,yt as Ot,z as kt,zt as At}from"./DocumentContext-s7Qfd8iz.js";import{n as J,r as jt,t as Mt}from"./dist-CSDjUb5q.js";import{C as Nt,E as Pt,S as Ft,T as It,_ as Lt,a as Rt,b as zt,c as Bt,d as Vt,f as Ht,g as Ut,h as Wt,i as Gt,l as Kt,m as qt,n as Jt,o as Yt,p as Xt,r as Zt,s as Qt,t as $t,u as en,v as tn,w as nn,x as rn,y as an}from"./panel-BGYdvxEm.js";import{n as on,t as sn}from"./dist-DGbq0bSp.js";import{t as cn}from"./react-dom-CMNLH3L-.js";import{i as ln,l as un,n as Y,t as dn,u as X}from"./createLucideIcon-Wgamzz8_.js";import{a as fn,c as pn,d as mn,i as hn,o as gn,r as _n,u as vn}from"./dist-DivkR5AO.js";import{i as yn,n as bn,r as xn,t as Sn}from"./tooltip-CuKuwVbZ.js";import{t as Cn}from"./dist-Bpw_gSUm.js";import{n as wn,r as Tn,t as En}from"./collapsible-UIgt0pSO.js";import{a as Dn,c as On,i as kn,n as An,o as jn,s as Mn,t as Nn}from"./dialog-D9fMUB3u.js";import{$ as Pn,B as Fn,C as In,D as Ln,F as Rn,I as zn,K as Bn,L as Vn,O as Hn,Q as Un,T as Wn,X as Gn,Y as Kn,_ as qn,_t as Jn,at as Yn,b as Xn,ct as Zn,et as Qn,f as $n,gt as er,ht as tr,l as nr,m as rr,mt as ir,ot as ar,q as or,rt as sr,st as cr,u as lr,vt as ur,w as dr,yt as fr}from"./CodeMirrorPropInput-DKUgIQit.js";import{t as pr}from"./checkbox-Ds7GA0j4.js";import{a as mr,d as hr,i as gr,l as _r,n as vr,o as yr,r as br,s as xr,t as Sr,u as Cr}from"./floating-ui.dom-B3TJy2Tg.js";import{n as wr,r as Tr,t as Er}from"./dist-Ly1ZfY-Y.js";import{A as Dr,B as Or,C as kr,D as Ar,E as jr,F as Mr,H as Nr,I as Pr,L as Fr,M as Ir,N as Lr,O as Rr,P as zr,R as Br,S as Vr,T as Hr,U as Ur,V as Wr,_ as Gr,g as Kr,h as qr,i as Jr,j as Yr,k as Xr,m as Zr,o as Qr,p as $r,r as ei,u as ti,v as ni,w as ri,y as ii,z as ai}from"./skills-api-BhEjmNIn.js";import{t as oi}from"./label-CveCqKNR.js";import{n as si,t as ci}from"./radio-group-D9Wp487Q.js";import{$ as li,A as ui,B as di,D as fi,F as pi,G as mi,H as hi,I as gi,J as _i,K as vi,L as yi,O as bi,P as xi,Q as Si,R as Ci,T as wi,U as Ti,V as Ei,W as Di,X as Oi,Y as ki,Z as Ai,_ as ji,a as Mi,at as Ni,b as Pi,c as Fi,ct as Ii,dt as Li,et as Ri,ft as zi,it as Bi,k as Vi,l as Hi,lt as Ui,m as Wi,n as Gi,nt as Ki,ot as qi,q as Ji,r as Yi,st as Xi,t as Zi,tt as Qi,u as $i,ut as ea,v as ta,w as na,y as ra,z as ia}from"./auth-state-cache-DebyEMGy.js";import{n as aa,r as oa,t as sa}from"./toggle-group-B30vKHKs.js";import{$r as ca,A as la,Ai as ua,Ar as da,B as fa,Bi as pa,Bn as ma,Br as ha,Bt as ga,C as _a,Ca as va,Cn as ya,D as ba,Di as xa,Ei as Sa,En as Ca,Er as wa,Et as Ta,F as Ea,Fi as Da,Fr as Oa,Ft as ka,Hn as Aa,Ii as ja,In as Ma,Ir as Na,It as Pa,Jr as Fa,Li as Ia,M as La,Mi as Ra,N as za,Ni as Ba,Nn as Va,Pn as Ha,Pr as Ua,Qr as Wa,Rn as Ga,Rr as Ka,Sa as qa,Sn as Ja,Ti as Ya,Tt as Xa,Ut as Za,Vr as Qa,Wr as $a,Xr as eo,Zn as to,Zr as no,_a as ro,ai as io,at as ao,b as oo,bi as so,bt as co,c as lo,cn as uo,ei as fo,er as po,fa as mo,hn as ho,ir as go,ji as _o,jn as vo,jr as yo,k as bo,kr as xo,li as So,mn as Co,mt as wo,n as To,nr as Eo,nt as Do,oa as Oo,oi as ko,pa as Ao,pr as jo,qt as Mo,r as No,sn as Po,sr as Fo,t as Io,tt as Lo,ua as Ro,vn as zo,w as Bo,wi as Vo,wn as Ho,wr as Uo,xa as Wo,xi as Go,xn as Ko,ya as qo,yr as Jo,z as Yo,zr as Xo,zt as Zo}from"./dist-GfBYAWEU.js";import{t as Qo}from"./git-branch-CAiKE5bw.js";import{a as $o,c as es,i as ts,n as ns,o as rs,r as is,s as as,t as os}from"./pending-receive-nav-store-9viWJ9VV.js";import{a as ss,c as cs,l as ls,o as us,s as ds}from"./EnableSyncConfirmDialog-BFsmDIV-.js";import{t as fs}from"./arrow-up-right-BnJZWj8r.js";import{a as ps,c as ms,d as hs,f as gs,i as _s,l as vs,m as ys,n as bs,o as xs,p as Ss,r as Cs,s as ws,t as Ts,u as Es}from"./PropertyPanel-Dnh_rOsE.js";import{t as Ds}from"./check-BJRSVBAg.js";import{t as Os}from"./chevron-left-rxhGFFOu.js";import{t as ks}from"./chevron-down-kQ6IAInm.js";import{t as As}from"./chevron-right-B2thM4kG.js";import{n as js,t as Ms}from"./CopyButton-B8lE78wK.js";import{a as Ns,i as Ps,n as Fs,o as Is}from"./prop-types-BvMtVAeG.js";import{C as Ls,E as Rs,S as zs,T as Bs,_ as Vs,a as Hs,b as Us,c as Ws,d as Gs,f as Ks,g as qs,h as Js,i as Ys,l as Xs,m as Zs,n as Qs,o as $s,p as ec,r as tc,s as nc,u as rc,v as ic,w as ac,x as oc}from"./skill-actions-6AAhO9zY.js";import{a as sc,d as cc,i as lc,l as uc,n as dc,o as fc,r as pc,s as mc,t as hc,u as gc}from"./workspace-paths-DtvYoBMA.js";import{t as _c}from"./copy-CfDOH9N1.js";import{t as vc}from"./eye-Cq1_8-Tk.js";import{t as yc}from"./folder-open-ygPcz1xa.js";import{_ as bc,a as xc,b as Sc,c as Cc,d as wc,g as Tc,h as Ec,l as Dc,m as Oc,p as kc,s as Ac,t as jc,u as Mc,v as Nc,y as Pc}from"./open-managed-artifact-tab-BGW4m9f4.js";import{t as Fc}from"./info-CVuSDi5Y.js";import{t as Ic}from"./loader-circle-BrJhrTc7.js";import{t as Lc}from"./miss-dialog-store-b0Uwu1ZT.js";import{t as Rc}from"./refresh-cw-FMnveNBD.js";import{t as zc}from"./trash-2-Cgf308yS.js";import{t as Bc}from"./triangle-alert-VZ_Cki-r.js";import{a as Vc,i as Hc,n as Uc,o as Wc,r as Gc,s as Kc,t as qc}from"./agent-presence-CTUYlsSf.js";import{a as Jc,c as Yc,d as Xc,f as Zc,h as Qc,i as $c,l as el,m as tl,n as nl,o as rl,s as il,t as al,u as ol}from"./typing-burst-detector-DBCESRMW.js";import{t as sl}from"./x-BUBUnCd-.js";import{n as cl,t as ll}from"./dist-Qabe7wDM.js";import{a as ul,i as dl,n as fl,r as pl}from"./project-paths-DJDWBB-8.js";import{t as ml}from"./input-BX4UDDMJ.js";import{t as hl}from"./parse-api-error-BcfaIWfX.js";import{t as gl}from"./dist-o9cVHl8Q.js";import{n as _l,r as vl,t as yl}from"./file-tree-rename-validation-DgUQ0I0S.js";import{C as bl,S as xl,_ as Sl,a as Cl,b as wl,g as Tl,h as El,i as Dl,m as Ol,n as kl,o as Al,r as jl,s as Ml,v as Nl,x as Pl,y as Fl}from"./navigation-targets-CW61_XIz.js";import{a as Il,c as Ll,n as Rl,o as zl,r as Bl,s as Vl}from"./documents-events-DJ1GG23v.js";import{t as Hl}from"./documents-fetch-YrVYNlaU.js";import{a as Ul,i as Wl,o as Gl}from"./startup-marks-Dq0rZGD-.js";import{a as Kl,c as ql,d as Jl,f as Yl,i as Xl,l as Zl,n as Ql,o as $l,r as eu,s as tu,t as nu,u as ru}from"./doc-hash-BMXWNo_I.js";import{_ as iu,a as au,h as ou,l as su,n as cu,o as lu,p as uu,v as du}from"./lint-config-client-BGM5HIsf.js";import{a as fu,i as pu,l as mu,n as hu,t as gu}from"./config-provider-CBrCc3Qp.js";import{$ as _u,Et as vu,Ft as yu,I as bu,It as xu,J as Su,Lt as Cu,Mt as wu,Nt as Tu,Ot as Eu,Q as Du,X as Ou,Z as ku,jt as Au,k as ju,kt as Mu,ot as Nu,w as Pu,wt as Fu,xt as Iu}from"./dist-DOee8t3p.js";import{n as Lu}from"./dist-DLiIchlL.js";import{n as Ru}from"./config-context-BbS_JaHs.js";import{t as zu}from"./external-link-BfiFPJEx.js";import{n as Bu,r as Vu,t as Hu}from"./worktree-store-DFmh2OE1.js";import{c as Uu,i as Wu,n as Gu,r as Ku,s as qu,t as Ju}from"./selection-context-CkCMxiY8.js";import{t as Yu}from"./target-navigation-intent-oLHFF9_D.js";import{a as Xu,i as Zu,n as Qu,t as $u}from"./cursor-Rw-XIAht.js";import{t as ed}from"./dist-Cub6hBx7.js";import{n as td}from"./clipboard-adapter-BHfhAZ-n.js";import"./textarea--26Ac0EI.js";import{A as nd,C as rd,D as id,E as ad,O as od,S as sd,T as cd,_ as ld,a as ud,b as dd,c as fd,d as pd,f as md,g as hd,h as gd,i as _d,k as vd,l as yd,m as bd,n as xd,o as Sd,p as Cd,r as wd,s as Td,t as Ed,u as Dd,v as Od,w as kd,x as Ad,y as jd}from"./file-tree-adapter-DDhSPjxf.js";import{n as Md,t as Nd}from"./mcp-consent-store-O7e02Mi1.js";import{a as Pd,t as Fd}from"./receive-store-B3-FInQ9.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 Id(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.34.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-jUMr-Cv1.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}var Ld=class extends Ht{#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||Rd(),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=Xt({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),Wt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Rd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var zd=class extends Pt{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 Ld({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=Bd(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=Bd(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=Bd(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=Bd(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Wt.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=>an(t,e))}findAll(e={}){return this.getAll().filter(t=>an(e,t))}notify(e){Wt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Wt.batch(()=>Promise.all(e.map(e=>e.continue().catch(rn))))}};function Bd(e){return e.options.scope?.id}var Vd=class extends Pt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??tn(r,t),a=this.get(i);return a||(a=new Vt({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(){Wt.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=>zt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>zt(e,t)):t}notify(e){Wt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Wt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Wt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Hd=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Vd,this.#t=e.mutationCache||new zd,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=It.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=qt.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(Nt(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=Ut(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Wt.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;Wt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Wt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Wt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e,t={}){return Wt.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=Wt.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(rn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(rn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Nt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return qt.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(Lt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ft(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Lt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ft(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||=tn(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===nn&&(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()}},Ud=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}}}})),Wd=t(((e,t)=>{t.exports=Ud()})),Gd=t((e=>{var t=Wd(),n=r(),i=cn();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)?Ud(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ud(t),e=Gd(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 ee(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Gd(t,e.type);t!==n&&(V(U,e),V(H,n))}function te(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+ne+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -20,17 +20,17 @@ Error generating stack: `+e.message+`
|
|
|
20
20
|
`),n=e.split(`
|
|
21
21
|
`).map(e=>e+`
|
|
22
22
|
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function Fy(e,t){return`${e}\u0000${t}`}function Iy(e,t,n){let r=Xo(e).body,i=Xo(t).body;return r===i?``:Ny(n,r,i,``,``,{context:3})}function Ly(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=Xe(),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=Fy(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=Iy(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 Ry=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-COM6jgM6.js`),__vite__mapDeps([30,1,9,10,31]),import.meta.url)).ActivityPanelDiffView})),zy=1e4,By=6e4;async function Vy(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 Hy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return gl._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return gl._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return gl._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return gl._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?gl._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function Uy(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Wy(e){return e.slice(0,7)}function Gy(e){return e.type===`upstream`?gl._({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`?gl._({id:`B2DrPb`}):e.author}function Ky(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)(Xu,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)($u,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Vc,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(Zu,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Wc,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(Qu,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(uc,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function qy(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)(Qo,{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=Aa(i),t[1]=i,t[2]=a);let o=a,s=r?To[o]??Io[o]:Io[o],c;t[3]!==s||t[4]!==i?(c=s??uo(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)(Ky,{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)(wm,{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)(es,{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)(yh,{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)(uc,{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)(es,{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)(yh,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function Jy(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function Yy(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(Zy),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(Xy)},children:[r?(0,Z.jsx)(ks,{className:`size-3`}):(0,Z.jsx)(As,{className:`size-3`}),r?(0,Z.jsx)(J,{id:`vLyv1R`}):(0,Z.jsx)(J,{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 Xy(e){return!e}function Zy(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 Qy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=Ly(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)(Ic,{className:`size-3 animate-spin`}),(0,Z.jsx)(J,{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)(J,{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)(Ic,{className:`size-3 animate-spin`}),(0,Z.jsx)(J,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(Ry,{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 $y(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:i,cache:a,docName:o,expanded:s,onToggleExpanded:c,onRestoreSuccess:l}=e,{_:u}=jt(),d;t[0]===n.timestamp?d=t[1]:(d=Hy(n.timestamp),t[0]=n.timestamp,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=Gy(n),t[2]=n,t[3]=p);let m=p,h;t[4]===n.timestamp?h=t[5]:(h=Uy(n.timestamp),t[4]=n.timestamp,t[5]=h);let g=h,_;t[6]===n.sha?_=t[7]:(_=Wy(n.sha),t[6]=n.sha,t[7]=_);let v=_,y=n.contributors.flatMap(eb),b;t[8]===n?b=t[9]:(b=Jy(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}),cl.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=wo.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}),cl.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)(qy,{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 ee;t[40]===C?ee=t[41]:(ee=e=>{e.stopPropagation(),C(!0)},t[40]=C,t[41]=ee);let te;t[42]===w?te=t[43]:(te=w?(0,Z.jsx)(Ic,{className:`size-3 animate-spin`}):(0,Z.jsx)(Kc,{className:`size-3`}),t[42]=w,t[43]=te);let ne;t[44]!==w||t[45]!==q||t[46]!==ee||t[47]!==te?(ne=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{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:ee,children:te})}),t[44]=w,t[45]=q,t[46]=ee,t[47]=te,t[48]=ne):ne=t[48];let re;t[49]===u?re=t[50]:(re=u({id:`Yea-K5`}),t[49]=u,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=(0,Z.jsx)(bn,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==ne||t[54]!==ie?(ae=(0,Z.jsxs)(Sn,{children:[ne,ie]}),t[53]=ne,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==W||t[57]!==G||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[W,G,K,ae]}),t[56]=W,t[57]=G,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===x?se=t[61]:(se=x.length>0&&(0,Z.jsx)(Yy,{summaries:x}),t[60]=x,t[61]=se);let ce=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}),le;t[62]!==oe||t[63]!==se||t[64]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[62]=oe,t[63]=se,t[64]=ce,t[65]=le):le=t[65];let ue;t[66]!==s||t[67]!==j||t[68]!==R||t[69]!==V||t[70]!==H||t[71]!==U||t[72]!==le?(ue=(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,le]}),t[66]=s,t[67]=j,t[68]=R,t[69]=V,t[70]=H,t[71]=U,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==a||t[75]!==i||t[76]!==D||t[77]!==o||t[78]!==n.sha||t[79]!==s?(de=s&&(0,Z.jsx)(Qy,{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]=de):de=t[80];let fe;t[81]!==ue||t[82]!==de?(fe=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[81]=ue,t[82]=de,t[83]=fe):fe=t[83];let pe;t[84]!==N||t[85]!==C?(pe=e=>{e?C(!0):N()},t[84]=N,t[85]=C,t[86]=pe):pe=t[86];let me;t[87]===u?me=t[88]:(me=u({id:`Pyp1NA`}),t[87]=u,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(On,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==g||t[92]!==m||t[93]!==v||t[94]!==f?(ge={relative:f,absoluteTime:g,entrySha:v,authorName:m},t[91]=g,t[92]=m,t[93]=v,t[94]=f,t[95]=ge):ge=t[95];let _e;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(_e={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`}),1:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[96]=_e):_e=t[96];let ve;t[97]===ge?ve=t[98]:(ve=(0,Z.jsx)(Dn,{children:(0,Z.jsx)(J,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Mn,{children:[he,ve]}),t[99]=he,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(J,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===N?xe=t[104]:(xe=(0,Z.jsx)(Y,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:N,children:be}),t[103]=N,t[104]=xe);let Se;t[105]===F?Se=t[106]:(Se=()=>F(),t[105]=F,t[106]=Se);let Ce;t[107]===w?Ce=t[108]:(Ce=w?(0,Z.jsx)(Ic,{className:`mr-2 size-4 animate-spin`}):null,t[107]=w,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(J,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==w||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(Y,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:w,onClick:Se,children:[Ce,we]}),t[110]=w,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(jn,{children:[xe,Te]}),t[114]=xe,t[115]=Te,t[116]=Ee):Ee=t[116];let De;t[117]!==ye||t[118]!==Ee?(De=(0,Z.jsxs)(kn,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==S||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Nn,{open:S,onOpenChange:pe,children:De}),t[120]=S,t[121]=pe,t[122]=De,t[123]=Oe):Oe=t[123];let ke;return t[124]!==fe||t[125]!==Oe?(ke=(0,Z.jsxs)(Z.Fragment,{children:[fe,Oe]}),t[124]=fe,t[125]=Oe,t[126]=ke):ke=t[126],ke}function eb(e){return e.docs}function tb(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{_:a}=jt(),{resolvedTheme:o}=on(),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)(ab),[g,_]=(0,Q.useState)(ib),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=sy({baseMs:zy,maxBackoffMs:By,isPaused:rb,poll:e=>Vy(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)(Qt,{children:(0,Z.jsx)(J,{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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsxs)(sa,{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)(aa,{value:`unified`,"aria-label":a({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Zm,{className:`size-3.5`})}),(0,Z.jsx)(aa,{value:`split`,"aria-label":a({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(cm,{className:`size-3.5`})})]})}),(0,Z.jsx)(bn,{children:r===`unified`?(0,Z.jsx)(J,{id:`379t2h`}):(0,Z.jsx)(J,{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)(Yt,{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(nb)}),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)(J,{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)($y,{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 nb(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(su,{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)(su,{className:`h-3 w-28`}),(0,Z.jsx)(su,{className:`h-3 w-40`})]})]},e)}function rb(){return typeof document<`u`&&document.visibilityState===`hidden`}function ib(){return new Set}function ab(){return new Hc(32)}var ob=`open-knowledge:lint-source-fixed`,sb=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`lint-fix`})});function cb(e,t){let n=e.split(`
|
|
23
|
-
`),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function lb(e){return e.flatMap(e=>e.fixes??[])}function ub(e,t){if(t.length===0)return!1;let n=e.document.getText(`source`),r=n.toString(),i=t.map(e=>({from:cb(r,e.range.start),to:cb(r,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert));return e.document.transact(()=>{let e=1/0,t;for(let r of i){let i=t!==void 0&&r.from===t.from&&r.to===t.to&&r.insert===t.insert;t=r,!(i||r.to>e)&&(r.to>r.from&&n.delete(r.from,r.to-r.from),r.insert.length>0&&n.insert(r.from,r.insert),e=r.from)}},sb),typeof window<`u`&&window.dispatchEvent(new CustomEvent(ob)),!0}var db=300;function fb(e,t){let n=(0,$.c)(7),r;n[0]===t?r=n[1]:(r=t?.enabled?JSON.stringify(t):null,n[0]=t,n[1]=r);let i=r,a;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[2]=a):a=n[2];let[o,s]=(0,Q.useState)(a),c,l;return n[3]!==i||n[4]!==e?(c=()=>{if(!e||i===null){s(pb);return}let t=JSON.parse(i),n=e.document.getText(`source`),r=null,a=!1,o=e.configuration.name,c=()=>void jo(n.toString(),t,o).then(e=>{a||s(e)}).catch(e=>{a||console.warn(`[lint] lintDocument failed`,e)}),l=()=>{r&&clearTimeout(r),r=setTimeout(c,db)};return c(),n.observe(l),()=>{a=!0,r&&clearTimeout(r),n.unobserve(l)}},l=[e,i],n[3]=i,n[4]=e,n[5]=c,n[6]=l):(c=n[5],l=n[6]),(0,Q.useEffect)(c,l),o}function pb(e){return e.length===0?e:[]}var mb=[{id:`outline`,icon:Nm},{id:`links`,icon:me},{id:`graph`,icon:Im},{id:`timeline`,icon:sm},{id:`problems`,icon:Bc}];function hb(e){return e===`outline`?gl._({id:`dD7NPy`}):e===`links`?gl._({id:`Rj01Fz`}):e===`graph`?gl._({id:`x2fr_j`}):e===`problems`?gl._({id:`OXdGnd`}):gl._({id:`cklVjM`})}function gb(){return n(()=>import(`./GraphPanel-C5V7tN6C.js`),__vite__mapDeps([32,1,6,2,3,7,8,33,9,10,15,34,14,16,35,36,22,12,13,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,25,53,54,28]),import.meta.url)}var _b=(0,Q.lazy)(async()=>({default:(await gb()).GraphPanel})),vb=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-
|
|
23
|
+
`),r=0;for(let e=0;e<t.line&&e<n.length;e+=1)r+=n[e].length+1;let i=n[Math.min(t.line,n.length-1)]?.length??0;return r+Math.min(Math.max(t.character,0),i)}function lb(e){return e.flatMap(e=>e.fixes??[])}function ub(e,t){if(t.length===0)return!1;let n=e.document.getText(`source`),r=n.toString(),i=t.map(e=>({from:cb(r,e.range.start),to:cb(r,e.range.end),insert:e.newText})).sort((e,t)=>t.to-e.to||t.from-e.from||e.insert.localeCompare(t.insert));return e.document.transact(()=>{let e=1/0,t;for(let r of i){let i=t!==void 0&&r.from===t.from&&r.to===t.to&&r.insert===t.insert;t=r,!(i||r.to>e)&&(r.to>r.from&&n.delete(r.from,r.to-r.from),r.insert.length>0&&n.insert(r.from,r.insert),e=r.from)}},sb),typeof window<`u`&&window.dispatchEvent(new CustomEvent(ob)),!0}var db=300;function fb(e,t){let n=(0,$.c)(7),r;n[0]===t?r=n[1]:(r=t?.enabled?JSON.stringify(t):null,n[0]=t,n[1]=r);let i=r,a;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],n[2]=a):a=n[2];let[o,s]=(0,Q.useState)(a),c,l;return n[3]!==i||n[4]!==e?(c=()=>{if(!e||i===null){s(pb);return}let t=JSON.parse(i),n=e.document.getText(`source`),r=null,a=!1,o=e.configuration.name,c=()=>void jo(n.toString(),t,o).then(e=>{a||s(e)}).catch(e=>{a||console.warn(`[lint] lintDocument failed`,e)}),l=()=>{r&&clearTimeout(r),r=setTimeout(c,db)};return c(),n.observe(l),()=>{a=!0,r&&clearTimeout(r),n.unobserve(l)}},l=[e,i],n[3]=i,n[4]=e,n[5]=c,n[6]=l):(c=n[5],l=n[6]),(0,Q.useEffect)(c,l),o}function pb(e){return e.length===0?e:[]}var mb=[{id:`outline`,icon:Nm},{id:`links`,icon:me},{id:`graph`,icon:Im},{id:`timeline`,icon:sm},{id:`problems`,icon:Bc}];function hb(e){return e===`outline`?gl._({id:`dD7NPy`}):e===`links`?gl._({id:`Rj01Fz`}):e===`graph`?gl._({id:`x2fr_j`}):e===`problems`?gl._({id:`OXdGnd`}):gl._({id:`cklVjM`})}function gb(){return n(()=>import(`./GraphPanel-C5V7tN6C.js`),__vite__mapDeps([32,1,6,2,3,7,8,33,9,10,15,34,14,16,35,36,22,12,13,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,25,53,54,28]),import.meta.url)}var _b=(0,Q.lazy)(async()=>({default:(await gb()).GraphPanel})),vb=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BNz82usM.js`),__vite__mapDeps([55,1,2,56,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,72,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,49,51,52,77,78,79,24,80,81,26,82,83,84]),import.meta.url)).ActivityModeContent}));function yb(e){let t=(0,$.c)(33),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,{_:s}=jt(),[c,l]=(0,Q.useState)(`unified`),{activeProvider:u,activeDocName:d}=Xe(),{data:f}=lu(n),p=d===n?u:null,m=fb(p,f?.effective??null),h;t[0]===p?h=t[1]:(h=e=>{p!==null&&e.fixes&&e.fixes.length>0&&ub(p,e.fixes)},t[0]=p,t[1]=h);let g=h,_;t[2]!==m||t[3]!==p?(_=()=>{p!==null&&ub(p,lb(m))},t[2]=m,t[3]=p,t[4]=_):_=t[4];let v=_,y=Ks(),b;t[5]!==n||t[6]!==p?(b=e=>{if(p===null)return;let t=p.document.getText(`source`).toString().split(`
|
|
24
24
|
`)[e.range.start.line];W(qv(n,e,t))},t[5]=n,t[6]=p,t[7]=b):b=t[7];let x=b,S=S_(),C,w,T;if(t[8]!==s||t[9]!==i||t[10]!==m||t[11]!==o||t[12]!==a||t[13]!==S){let e=S?mb.filter(bb):mb;C=e.some(e=>e.id===i)?i:`outline`,w=o===`doc`&&e.length>1,T=w?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(sa,{type:`single`,variant:`outline`,value:C,onValueChange:e=>{e&&a(e)},"aria-label":s({id:`SrOuyg`}),children:e.map(e=>{let{id:t,icon:n}=e,r=hb(t),i=t===`problems`&&m.length>0;return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(aa,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":i?s({id:`2m_bmh`,values:{0:m.length,label:r}}):r,asChild:!0,children:(0,Z.jsxs)(yn,{className:`relative`,children:[(0,Z.jsx)(n,{}),i&&(0,Z.jsx)(js,{variant:`destructive`,"aria-hidden":`true`,className:`absolute -right-1.5 -top-1.5 h-4 min-w-4 rounded-full px-1 text-[10px] leading-none`,children:m.length>99?`99+`:m.length})]})}),(0,Z.jsx)(bn,{side:`bottom`,children:r})]},t)})})}):null,t[8]=s,t[9]=i,t[10]=m,t[11]=o,t[12]=a,t[13]=S,t[14]=C,t[15]=w,t[16]=T}else C=t[14],w=t[15],T=t[16];let E;t[17]!==m||t[18]!==c||t[19]!==n||t[20]!==C||t[21]!==x||t[22]!==g||t[23]!==v||t[24]!==r||t[25]!==p||t[26]!==o||t[27]!==w||t[28]!==y?(E=o===`doc`?(0,Z.jsxs)(`div`,{...w?{role:`tabpanel`,id:`panel-${C}`,"aria-labelledby":`tab-${C}`}:{},className:`min-h-0 flex-1`,children:[C===`outline`&&(0,Z.jsx)(Xc,{docName:n,isSourceMode:r}),C===`links`&&(0,Z.jsx)(oy,{docName:n}),C===`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)(J,{id:`-lCAuQ`})}),children:(0,Z.jsx)(_b,{activeDocName:n})}),C===`timeline`&&(0,Z.jsx)(tb,{docName:n,diffLayout:c,onDiffLayoutChange:l}),C===`problems`&&(0,Z.jsx)(el,{docName:n,diagnostics:m,onFix:p===null?void 0:g,onFixAll:p===null?void 0:v,onAskAi:p!==null&&y!==null?x:void 0})]}):(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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(vb,{})})}),t[17]=m,t[18]=c,t[19]=n,t[20]=C,t[21]=x,t[22]=g,t[23]=v,t[24]=r,t[25]=p,t[26]=o,t[27]=w,t[28]=y,t[29]=E):E=t[29];let D;return t[30]!==T||t[31]!==E?(D=(0,Z.jsxs)(Z.Fragment,{children:[T,E]}),t[30]=T,t[31]=E,t[32]=D):D=t[32],D}function bb(e){return e.id===`outline`||e.id===`problems`}function xb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Sb(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Cb(e){return e/100*window.innerHeight}function wb(e){return e/100*window.innerWidth}function Tb(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 Eb({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Tb(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Sb(t,i);break;case`em`:r=xb(t,i);break;case`vh`:r=Cb(i);break;case`vw`:r=wb(i);break}return r}function Db(e){return parseFloat(e.toFixed(3))}function Ob({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 kb(e){let{panels:t}=e,n=Ob({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=Db(Eb({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=Db(Eb({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=Db(Eb({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=Db(Eb({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 Ab(e,t=`Assertion error`){if(!e)throw Error(t)}function jb(e,t){return Array.from(t).sort(e===`horizontal`?Mb:Nb)}function Mb(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Nb(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 Fb(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 Ib({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}=Fb(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Ab(i,`No rect found`),i}var Lb;function Rb(){return Lb===void 0&&(Lb=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Lb}function zb(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=jb(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,Ib({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=Rb()?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:Ob({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 Bb=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)}}},Vb={cursorFlags:0,state:`inactive`},Hb=new Bb;function Ub(){return Vb}function Wb(e){return Hb.addListener(`change`,e)}function Gb(e){let t=Vb,n={...Vb};n.cursorFlags=e,Vb=n,Hb.emit(`change`,{prev:t,next:n})}function Kb(e){let t=Vb;Vb=e,Hb.emit(`change`,{prev:t,next:e})}var qb=e=>e,Jb=()=>{},Yb=1,Xb=2,Zb=4,Qb=8,$b=3,ex=12,tx;function nx(){return tx===void 0&&(tx=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(tx=!0)),tx}function rx({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&&nx()){let t=(e&Yb)!==0,n=(e&Xb)!==0,r=(e&Zb)!==0,i=(e&Qb)!==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 nx()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var ix=new WeakMap;function ax(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=ix.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Ub();switch(r.state){case`active`:case`hover`:{let e=rx({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}ix.set(e,{prevStyle:t,styleSheet:n})}var ox=new Map,sx=new Bb;function cx(e){ox=new Map(ox),ox.delete(e)}function lx(e,t){for(let[t]of ox)if(t.id===e)return t}function ux(e,t){for(let[t,n]of ox)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function dx(){return ox}function fx(e,t){return sx.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function px(e,t,n){let r=ox.get(e);ox=new Map(ox),ox.set(e,t),sx.emit(`groupChange`,{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:r,next:t})}function mx(e){let t=Ub(),n=!1;switch(t.state){case`active`:Kb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(ax(e),n=!0,t.hitRegions.forEach(e=>{let t=ux(e.group.id,!0);px(e.group,t,{isUserInteraction:!0})}))}return n}function hx(e){e.defaultPrevented||mx(e.currentTarget)}function gx(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Fb(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 _x(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function vx(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:wx(e),b:wx(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Ab(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Cx(Sx(n.a)),b:Cx(Sx(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 yx=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function bx(e){let t=getComputedStyle(Tx(e)??e).display;return t===`flex`||t===`inline-flex`}function xx(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||bx(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`||yx.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Sx(e){let t=e.length;for(;t--;){let n=e[t];if(Ab(n,`Missing node`),xx(n))return n}return null}function Cx(e){return e&&Number(getComputedStyle(e).zIndex)||0}function wx(e){let t=[];for(;e;)t.push(e),e=Tx(e);return t}function Tx(e){let{parentNode:t}=e;return _x(t)?t.host:t}function Ex(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 Dx({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Pb(n)||n.contains(e)||e.contains(n))return!0;if(vx(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Ex(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Ox(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=zb(r),a=gx(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Dx({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function kx(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 Ax(e,t,n=0){return Math.abs(Db(e)-Db(t))<=n}function jx(e,t){return Ax(e,t)?0:e>t?1:-1}function Mx({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(jx(r,c)<0)if(a){let e=(i+c)/2;r=jx(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=Db(r),r}function Nx({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ax(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Ab(u!=null,`Invalid first pivot index`),Ab(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Ab(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(Ab(n!=null,`Previous layout not found for panel index ${t}`),Ax(n,i)){let t=o-n;jx(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Ab(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(Ab(n!=null,`Previous layout not found for panel index ${t}`),Ax(n,o)){let t=n-i;jx(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Ab(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&jx(i,c)<0)if(e>0){let t=c-o,n=t/2;jx(i+e,c)<0&&(e=jx(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;jx(i-e,c)<0&&(e=jx(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];Ab(e!=null,`Previous layout not found for panel index ${r}`);let a=Mx({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];Ab(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Mx({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Ax(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(kx(c,l))return i;{let t=e<0?d:u,r=s[t];Ab(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Mx({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Ax(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Ab(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Mx({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Ax(i,s)||(t-=s-i,l[r]=s),Ax(t,0))break;e>0?r--:r++}}}if(!Ax(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 Px(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||jx(e[n],t[n])!==0)return!1;return!0}function Fx({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(!Ax(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Ab(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];Ab(i!=null,`No layout data found for index ${e}`);let o=r[e];Ab(o!=null,`No layout data found for index ${e}`);let s=Mx({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Ax(a,0))for(let e=0;e<t.length;e++){let n=r[e];Ab(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Mx({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Ax(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Ix({groupId:e,panelId:t}){let n=()=>{let t=dx();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=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&Ax(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:Db(100-e)}}return Nx({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=Fx({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});Px(c,u)||px(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(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&&Ax(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Ob({group:t});s(Db(Eb({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Lx(e){e.defaultPrevented||Ox(e,dx()).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=Ix({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Rx(e){let t=dx();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 zx({groupId:e}){let t=()=>{let t=dx();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=Fx({layout:e,panelConstraints:r});return n?o:(Px(o,c)||px(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Bx(e,t){let n=Rx(e),r=ux(n.id,!0),i=n.separators.find(t=>t.element===e);Ab(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Ab(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=zx({groupId:n.id}).getLayout(),c=Fx({layout:Nx({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Px(s,c)||px(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels},{isUserInteraction:!0})}function Vx(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Rx(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Bx(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Bx(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Bx(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Bx(t,-5);break;case`End`:e.preventDefault(),Bx(t,100);break;case`Enter`:{e.preventDefault();let n=Rx(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ux(n.id,!0),o=n.separators.find(e=>e.element===t);Ab(o,`Matching separator not found`);let s=a.get(o);Ab(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Ab(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Bx(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Rx(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Ab(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(),Bx(t,-100);break}}function Hx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=dx(),n=Ox(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Kb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}function Ux({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=Nx({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Px(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Yb:Xb;break;case`vertical`:s|=d<0?Zb:Qb;break}}else px(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&$b:c|=s&$b,t.movementY===0?c|=o&ex:c|=s&ex,Gb(c),ax(e)}function Wx(e){let t=dx(),n=Ub();switch(n.state){case`active`:Ux({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Gx(e){if(e.defaultPrevented)return;let t=Ub(),n=dx();switch(t.state){case`active`:if(e.buttons===0){Kb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ux(e.group.id,!0);px(e.group,t,{isUserInteraction:!0})});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}Ux({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ox(e,n);r.length===0?t.state!==`inactive`&&Kb({cursorFlags:0,state:`inactive`}):Kb({cursorFlags:0,hitRegions:r,state:`hover`}),ax(e.currentTarget);break}}}function Kx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ub().state){case`hover`:Kb({cursorFlags:0,state:`inactive`})}}function qx(e){e.defaultPrevented||e.pointerType===`mouse`&&e.button>0||mx(e.currentTarget)&&e.preventDefault()}function Jx(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=Db(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=Db((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Yx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Ob({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:Db(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Xx(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 Zx({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=Db(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]=Db((r[e]??0)/a*l);else{let e=Db(l/c.length);for(let t of c)u[t]=e}return u}function Qx(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 $x=new Map;function eS(e){let t=!0;Ab(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=Ob({group:e});if(t===0)return;let n=ux(e.id);if(!n)return;let r=kb(e),i=n.defaultLayoutDeferred?Jx(r):n.layout,a=Fx({layout:Zx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Px(n.layout,a)&&Xx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;px(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Yx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Ab(!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=Ob({group:e}),s=kb(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Qx(e.panels,l)||(l=void 0));let u=Fx({layout:e.mutableState.layouts[c]??l??Jx(s),panelConstraints:s}),d=e.element.ownerDocument;$x.set(d,($x.get(d)??0)+1);let f=new Map;return zb(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),px(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Ab(!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`,Vx)}),$x.get(d)===1&&(d.addEventListener(`contextmenu`,hx,!0),d.addEventListener(`dblclick`,Lx,!0),d.addEventListener(`pointerdown`,Hx,!0),d.addEventListener(`pointerleave`,Wx),d.addEventListener(`pointermove`,Gx),d.addEventListener(`pointerout`,Kx),d.addEventListener(`pointerup`,qx,!0)),function(){t=!1,$x.set(d,Math.max(0,($x.get(d)??0)-1)),cx(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Vx)}),$x.get(d)||(d.removeEventListener(`contextmenu`,hx,!0),d.removeEventListener(`dblclick`,Lx,!0),d.removeEventListener(`pointerdown`,Hx,!0),d.removeEventListener(`pointerleave`,Wx),d.removeEventListener(`pointermove`,Gx),d.removeEventListener(`pointerout`,Kx),d.removeEventListener(`pointerup`,qx,!0)),a.disconnect()}}function tS(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function nS(e){let t=(0,Q.useId)();return`${e??t}`}var rS=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function iS(e){let t=(0,Q.useRef)(e);return rS(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function aS(...e){return iS(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function oS(e){let t=(0,Q.useRef)({...e});return rS(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var sS=(0,Q.createContext)(null);function cS(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:qb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),rS(()=>{Object.assign(n.current,zx({groupId:e}))})}function lS({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=iS(e=>{Px(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=iS((e,t)=>{Px(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e,{isUserInteraction:t}))}),_=nS(s),v=(0,Q.useRef)(null),[y,b]=tS(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=aS(v,a);cS(_,o);let C=iS((e,t)=>{let r=Ub(),i=lx(e),a=ux(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=oS({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=jb(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=jb(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=lx(_),i=ux(_);r&&i&&px(r,{...i,derivedPanelConstraints:kb(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 rS(()=>{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=eS(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ux(r.id,!0);!o&&s.length>0&&(h(c),g(c,!1));let l=fx(_,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=Ax(t.collapsedSize,i[t.panelId]),a=Ax(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ub().state!==`active`;h(i),o&&g(i,e.isUserInteraction)});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)(sS.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})})}lS.displayName=`Group`;function uS(){return(0,Q.useRef)(null)}function dS(){let e=(0,Q.useContext)(sS);return Ab(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function fS(e,t){let{id:n}=dS(),r=(0,Q.useRef)({collapse:Jb,expand:Jb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Jb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),rS(()=>{Object.assign(r.current,Ix({groupId:n,panelId:e}))})}function pS({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=nS(c),_=oS({disabled:a}),v=(0,Q.useRef)(null),y=aS(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=dS(),T=d!==null,E=iS((e,t,n)=>{d?.(e,c,n)});rS(()=>{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]),fS(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>fx(x,e),D,D),k;return k=O?JSON.parse(O):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...mS,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})})}pS.displayName=`Panel`;var mS={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function hS(){return(0,Q.useRef)(null)}function gS({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=Fx({layout:Nx({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Fx({layout:Nx({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function _S({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=nS(a),l=oS({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),[m,h]=(0,Q.useState)(!1),g=(0,Q.useRef)(null),_=aS(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=dS(),C=b===`horizontal`?`vertical`:`horizontal`;rS(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=Wb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=fx(y,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(gS({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,Q.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let T;if(n)T=`disabled`;else switch(f){case`active`:T=`active`;break;default:T=m?`focus`:f}return(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":T,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}_S.displayName=`Separator`;var vS=new Map;function yS(e){let t=vS.get(e);if(t)return t;let n=bS(e);return vS.set(e,n),n}async function bS(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-B2Oc-2BR.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrU-cR_S.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrU-cR_S.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrU-cR_S.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Uf9Tc8KS.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([57,1,58,8,59]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-BVcHwfdB.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-Ceq0cEZq.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-C7p4lNrk.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrU-cR_S.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-C6B3IZlW.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([61,1,62,58,8,59]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-RKGXlTOn.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([63,1,58,8,59]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrU-cR_S.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-DM28D-6o.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-DLiIchlL.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([64,1,62,58,8,60,57,59,61]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrU-cR_S.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-D5vgbj2Y.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-Ddrqoe4c.js`);return{python:e}},__vite__mapDeps([85,62,58,1,8,59]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-BcyApZ2Y.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-DxabsNt7.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-TIByzzIF.js`);return{rust:e}},__vite__mapDeps([86,58,1,8,59]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-DWXp9JcL.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-BlyE8smW.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-C6B3IZlW.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([61,1,62,58,8,59]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-CSbnaLam.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([60,1,57,58,8,59,61,62]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-Cid07B-b.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([65,1,58,8,59]),import.meta.url)).yaml().language;default:return null}}async function xS(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-RKGXlTOn.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([63,1,58,8,59]),import.meta.url)).json().language;if(t){let e=await yS(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-DOee8t3p.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([58,1,8]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-Bg2104qZ.js`);return{toml:e}},[],import.meta.url)).toml):null}function SS(e){let t=(0,$.c)(10),{_:n}=jt(),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 CS(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)(J,{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 wS(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)(J,{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)(J,{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=Wn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),ES=dr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function DS(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}=on(),c=SS(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=Oo(e),r=s===`dark`?TS:ES,i=!1,c=null;return xS(e,t).then(e=>{if(i||!a.current)return;let t=[ed,...e?[e]:[],Ou.editable.of(!0),Eu.readOnly.of(!0),Ou.lineWrapping,r];c=new Ou({state:Eu.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)(CS,{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)(wS,{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 OS(e){let t=(0,$.c)(50),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}=jt(),[o,s]=(0,Q.useState)(`diagram`),c=SS(i),l;t[4]===n?l=t[5]:(l={"data-mermaid-file-viewer-extension":n},t[4]=n,t[5]=l);let u=l;if(c.status===`loading`){let e;return t[6]!==u||t[7]!==r?(e=(0,Z.jsx)(CS,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u}),t[6]=u,t[7]=r,t[8]=e):e=t[8],e}if(c.status===`error`){let e;return t[9]!==u||t[10]!==c.message||t[11]!==r||t[12]!==i.src?(e=(0,Z.jsx)(wS,{fileName:r,dataAttr:`data-mermaid-file-viewer`,extraAttrs:u,message:c.message,openHref:i.src}),t[9]=u,t[10]=c.message,t[11]=r,t[12]=i.src,t[13]=e):e=t[13],e}let d=c.content,f;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e&&s(e)},t[14]=f):f=t[14];let p;t[15]===a?p=t[16]:(p=a({id:`72xhRD`}),t[15]=a,t[16]=p);let m;t[17]===a?m=t[18]:(m=a({id:`DEWDbv`}),t[17]=a,t[18]=m);let h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(yn,{children:(0,Z.jsx)(dt,{className:`size-4`})}),t[19]=h):h=t[19];let _;t[20]===m?_=t[21]:(_=(0,Z.jsx)(aa,{value:`diagram`,"aria-label":m,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:h}),t[20]=m,t[21]=_);let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`i-ShMB`})}),t[22]=v):v=t[22];let y;t[23]===_?y=t[24]:(y=(0,Z.jsxs)(Sn,{children:[_,v]}),t[23]=_,t[24]=y);let b;t[25]===a?b=t[26]:(b=a({id:`Y6SK9K`}),t[25]=a,t[26]=b);let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(yn,{children:(0,Z.jsx)(g,{className:`size-4`})}),t[27]=x):x=t[27];let S;t[28]===b?S=t[29]:(S=(0,Z.jsx)(aa,{value:`source`,"aria-label":b,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:x}),t[28]=b,t[29]=S);let C;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`wdxz7K`})}),t[30]=C):C=t[30];let w;t[31]===S?w=t[32]:(w=(0,Z.jsxs)(Sn,{children:[S,C]}),t[31]=S,t[32]=w);let T;t[33]!==o||t[34]!==w||t[35]!==p||t[36]!==y?(T=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center justify-center border-b bg-background py-2`,children:(0,Z.jsxs)(sa,{type:`single`,value:o,onValueChange:f,"aria-label":p,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 bg-muted p-0.5 data-[size=sm]:rounded-[10px]`,children:[y,w]})}),t[33]=o,t[34]=w,t[35]=p,t[36]=y,t[37]=T):T=t[37];let E;t[38]!==n||t[39]!==r||t[40]!==o||t[41]!==i||t[42]!==d?(E=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:o===`diagram`?(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 flex-col p-3 [&_.mermaid-error-source]:hidden`,children:(0,Z.jsx)(Vn,{chart:d,className:`min-h-0 flex-1`})}):(0,Z.jsx)(DS,{...i,fileName:r,extension:n})}),t[38]=n,t[39]=r,t[40]=o,t[41]=i,t[42]=d,t[43]=E):E=t[43];let D;return t[44]!==u||t[45]!==r||t[46]!==o||t[47]!==T||t[48]!==E?(D=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-mermaid-file-viewer":``,"data-mermaid-file-viewer-state":`loaded`,"data-mermaid-file-viewer-mode":o,...u,children:[T,E]}),t[44]=u,t[45]=r,t[46]=o,t[47]=T,t[48]=E,t[49]=D):D=t[49],D}function kS(e){let t=(0,$.c)(29),{entry:n,className:r}=e,{_:i}=jt(),{projectLocalBinding:a,merged:o}=Ru(),s=o?.appearance?.sidebar,c=s?.showHiddenFiles??!1,l=s?.showOnlyMarkdownFiles??!1,u;t[0]!==n||t[1]!==c||t[2]!==l?(u=Ol(n,{showHiddenFiles:c,showOnlyMarkdownFiles:l}),t[0]=n,t[1]=c,t[2]=l,t[3]=u):u=t[3];let d=u;if(!d.hiddenFiles&&!d.onlyMarkdownFiles)return null;let f;t[4]!==i||t[5]!==a?(f=e=>{if(a===null)return;let t=a.patch({appearance:{sidebar:e}});t.ok||(console.warn(`[NotInSidebarIndicator] sidebar visibility flip rejected:`,Ro(t.error)),cl.error(i({id:`P47EWZ`}),{description:Ro(t.error)}))},t[4]=i,t[5]=a,t[6]=f):f=t[6];let p=f,m;t[7]===r?m=t[8]:(m=X(`flex items-center gap-1.5 text-muted-foreground/70 text-xs`,r),t[7]=r,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),t[9]=h):h=t[9];let g;t[10]===i?g=t[11]:(g=i({id:`j9tqwO`}),t[10]=i,t[11]=g);let _;t[12]===g?_=t[13]:(_=(0,Z.jsx)(`span`,{className:`whitespace-nowrap`,children:g}),t[12]=g,t[13]=_);let v;t[14]!==i||t[15]!==d.hiddenFiles||t[16]!==p||t[17]!==a?(v=d.hiddenFiles?(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-5 rounded-sm px-1.5 font-normal text-2xs text-muted-foreground hover:text-foreground`,disabled:a===null,onClick:()=>p({showHiddenFiles:!0}),"aria-label":i({id:`XcGbim`}),title:i({id:`XcGbim`}),"data-testid":`not-in-sidebar-flip-hidden-files`,children:i({id:`6KCH4m`})}):null,t[14]=i,t[15]=d.hiddenFiles,t[16]=p,t[17]=a,t[18]=v):v=t[18];let y;t[19]!==i||t[20]!==d.onlyMarkdownFiles||t[21]!==p||t[22]!==a?(y=d.onlyMarkdownFiles?(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,className:`h-5 rounded-sm px-1.5 font-normal text-2xs text-muted-foreground hover:text-foreground`,disabled:a===null,onClick:()=>p({showOnlyMarkdownFiles:!1}),"aria-label":i({id:`10g8I_`}),title:i({id:`10g8I_`}),"data-testid":`not-in-sidebar-flip-only-markdown`,children:i({id:`5-o4kO`})}):null,t[19]=i,t[20]=d.onlyMarkdownFiles,t[21]=p,t[22]=a,t[23]=y):y=t[23];let b;return t[24]!==y||t[25]!==m||t[26]!==_||t[27]!==v?(b=(0,Z.jsxs)(`div`,{"data-testid":`not-in-sidebar-indicator`,className:m,children:[h,_,v,y]}),t[24]=y,t[25]=m,t[26]=_,t[27]=v,t[28]=b):b=t[28],b}function AS(e){return Qa(`/api/asset?path=${encodeURIComponent(e)}`)}function jS(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function MS(e){let t=(0,$.c)(8),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(kS,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[0]=n,t[1]=i);let a;t[2]!==n||t[3]!==r?(a=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(NS,{assetPath:n,mediaKind:r})}),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==i||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function NS(e){let t=(0,$.c)(33),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=AS(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,u,d,f,p;if(t[4]!==n||t[5]!==l||t[6]!==i||t[7]!==r||t[8]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{if(f=l.includes(`.`)?l.split(`.`).pop()??``:``,d=f.length>0?f.toUpperCase():`FILE`,u=i?`text`:r,u===`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)(ne,{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],p=n;break bb0}if(u===`text`){let e;t[19]===n?e=t[20]:(e=jS(n),t[19]=n,t[20]=e),p=(0,Z.jsx)(DS,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}if(u===`mermaid`){let e;t[21]===n?e=t[22]:(e=jS(n),t[21]=n,t[22]=e),p=(0,Z.jsx)(OS,{src:e,fileName:l,extension:f.toLowerCase()},n);break bb0}}t[4]=n,t[5]=l,t[6]=i,t[7]=r,t[8]=s,t[9]=u,t[10]=d,t[11]=f,t[12]=p}else u=t[9],d=t[10],f=t[11],p=t[12];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[23]!==n||t[24]!==u||t[25]!==d||t[26]!==l||t[27]!==f||t[28]!==s?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:u===`image`?(0,Z.jsx)(oe,{src:s,alt:l,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):u===`video`?(0,Z.jsx)(`video`,{src:s,controls:!0,className:`max-h-full max-w-full`}):u===`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:d}),(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)(Y,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(J,{id:`qFWMl-`})}),(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{Xn({url:s,projectRelPath:n,ext:f.toLowerCase(),title:l,forceOsDelegation:!1})},children:(0,Z.jsx)(J,{id:`9npOH9`})})]})]})}),t[23]=n,t[24]=u,t[25]=d,t[26]=l,t[27]=f,t[28]=s,t[29]=m):m=t[29];let h;return t[30]!==l||t[31]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":l,children:m}),t[30]=l,t[31]=m,t[32]=h):h=t[32],h}function PS(){let e=(0,$.c)(5),{_:t}=jt(),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)(su,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(su,{className:`h-4 w-full`}),(0,Z.jsx)(su,{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 FS(e){let{_:t}=jt();return e===`existing-repo`?[{id:`draft-spec`,icon:hm,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Nm,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Im,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:dh,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:hm,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:Zp,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function IS(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:i}=jt(),a=FS(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){td(t).then(()=>{s(e),clearTimeout(c.current),c.current=setTimeout(()=>s(null),1600)}).catch(LS)};t[8]===r?d=t[9]:(d=X(`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)(Y,{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:X(`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)(Ds,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(_c,{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 LS(){}var RS=`ok-ask-ai-draft-v2`,zS={doc:null,dismissed:!1};function BS(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}var VS=null,HS=new Set;function US(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 WS(){let e=BS();if(!e)return zS;try{let t=e.getItem(RS);if(!t)return zS;let n=JSON.parse(t);return typeof n!=`object`||!n||Array.isArray(n)?zS:{doc:n,dismissed:!1}}catch(e){return console.warn(`failed to parse stored draft — clearing`,e),zS}}function GS(){return VS===null&&(VS=WS()),VS}function KS(e){let t=BS();if(t)try{e&&!US(e)?t.setItem(RS,JSON.stringify(e)):t.removeItem(RS)}catch{}}function qS(){for(let e of HS)e()}function JS(){return GS()}function YS(e){let t=e&&!US(e)?e:null;VS={...GS(),doc:t},KS(t),qS()}function XS(){YS(null)}var ZS=`button, a[href], [role="menuitem"], [role="button"], input, textarea, select, [contenteditable="true"]`;function QS(e,t){!(e.target instanceof HTMLElement)||e.target.closest(ZS)||(e.preventDefault(),t.current?.focus())}var $S=un(`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 eC(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=X($S({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 tC=eo;function nC(e){let t=$n(e).kind;return t===`folder`||t===`asset`?t:`page`}function rC(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}=jt(),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=nC(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)(Te,{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 iC=8,aC=new Ia(`composerMentionSuggestion`);function oC(e){return e.kind===`asset`?e.docName.replace(/^\//,``):e.kind===`folder`?e.docName:hc(e.docName)}var sC=So.create({name:`doc`,topNode:!0,content:`paragraph+`}),cC=So.create({name:`paragraph`,group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML(){return[`p`,0]}}),lC=So.create({name:`text`,group:`inline`}),uC=So.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`})}}}),dC=ko.create({name:`composerHistory`,addProseMirrorPlugins(){return[no(),ua({"Mod-z":ca,"Mod-y":Wa,"Shift-Mod-z":Wa})]}}),fC=So.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`,Sa(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`,gl._({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=ct(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=Ie(sl),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[hC(this.editor)]}});function pC(e){return[sC,cC,lC,uC,dC,fC,...e?.placeholder?[tC.configure({placeholder:e.placeholder})]:[]]}function mC(e=nr){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 lr(t,a).map(e=>({docName:e.docName,title:e.title,path:oC(e)})).filter(e=>e.path!==``)},reset(){t=[],n=!1,r=null,i=!1}}}function hC(e){let t=mC();return Pn({editor:e,pluginKey:aC,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>=iC}},l=()=>{!e||!n||e.updateProps(c(n))};return{onBeforeStart(t){n=t,r=0;let s=Kn(()=>n,`composer-mention`);i.popup=s.popup,a=s.doPosition,o=s.reveal,e=new Yn(rC,{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(){Gn(i),a=null,o=null,e?.destroy(),e=null,n=null,r=0,t.reset()}}}})}function gC(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 _C(e){let{instruction:t,mentions:n}=gC(e);return t===``&&n.length===0}function vC(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 yC(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,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=pC({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=X(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?aC.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?aC.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(_C(t)),f.current?.(t.getJSON()),p.current?.(gC(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=cr(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(_C(w)&&vC(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),XS()),d.current(_C(w)),p.current?.(gC(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(gC(w).mentions))},getContent:()=>w?gC(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(Qn,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function bC(e,t,n){return e.trim().length>0||t.length>0||n}var xC=new Set(Bs.map(e=>e.id));function SC(e){return typeof e==`string`&&xC.has(e)}function CC(e){try{let t=kv(e);return SC(t)?t:null}catch{return null}}function wC(e,t){Av(e,t)}function TC(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:Bs.find(e=>n[e.id]?.installed===!0)?.id??null}function EC(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=jt(),{states:a,refresh:o}=ec(),{dispatch:s}=Ls(),c=ac(),l=Ks(),[u,d]=(0,Q.useState)(kC),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(OC),[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=FS(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=Bs.filter(T),D;t[3]===a?D=t[4]:(D=Bs.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=TC({lastUsed:CC(),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),wC(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(!bC(e,t,!1)){x(!0);return}let r=Js({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),XS())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!bC(t,r,!1)){x(!0);return}wC(e);let i=Js({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),XS())},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=X(`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)(uc,{"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)(J,{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:Bs.map(DC)}),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=l?Xs(l.installedClis,p):[],V;t[16]===r?V=t[17]:(V=X(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=V);let H;t[18]===i?H=t[19]:(H=i({id:`7hctf2`}),t[18]=i,t[19]=H);let U;t[20]===i?U=t[21]:(U=i({id:`0jD-Gn`}),t[20]=i,t[21]=U);let W;t[22]!==v||t[23]!==b?(W=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=W):W=t[24];let G=u===null?(0,Z.jsx)(Y,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}):(0,Z.jsxs)(eC,{children:[(0,Z.jsx)(Y,{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)(rc,{id:Ws(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:ka[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(rc,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:oc(u)}})]})}),(0,Z.jsxs)($r,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(jr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(qr,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(Kr,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),B.map(e=>{let{displayName:t}=ka[e];return(0,Z.jsxs)(Gr,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(rc,{id:Ws(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(Vr,{}):null,(0,Z.jsxs)(Kr,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Gr,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(rc,{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)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),K;return t[25]!==G||t[26]!==W?(K=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[W,G]}),t[25]=G,t[26]=W,t[27]=K):K=t[27],(0,Z.jsxs)(`div`,{className:V,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>QS(e,g),className:`flex w-full cursor-text 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)(yC,{ref:g,ariaLabel:H,placeholder:U,onEmptyChange:C,onContentChange:YS,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),K]}),n!==`existing-repo`&&w.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),w.map(e=>{let t=e.icon;return(0,Z.jsxs)(Y,{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 DC(e){return(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void zs(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(rc,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(fs,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function OC(){return JS().doc??void 0}function kC(){return CC()}function AC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(vf,{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 flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function jC({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 MC=`open-knowledge:create-top-level-file`;function NC(e={}){window.dispatchEvent(new CustomEvent(MC,{detail:e}))}function PC(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(MC,t),()=>window.removeEventListener(MC,t)}function FC(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=jt(),a=pc(),{title:o,subtitle:s}=jC({isOnboarding:!1,isEmbedded:a}),c=Xi(),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=AC,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)(IS,{scenario:`existing-repo`}):(0,Z.jsx)(EC,{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)(RC,{templates:u,loading:d,error:f,onSelect:LC}):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)(Oe,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{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)(Y,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:IC,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Jn,{"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 IC(){return NC({initialDir:``})}function LC(e,t){return NC({template:{folder:e,name:t}})}function RC(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=jt(),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)(J,{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)(js,{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)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(zC,{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 zC(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=jt(),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)(Y,{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 BC(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null: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{ok:t,body:n}=await Hl();if(e)return;let r=t?la.safeParse(n):null;r?.success?(l(UC(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=zl(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(HC),500),Hl().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=la.safeParse(n);r.success&&l(UC(r.data.documents))}).catch(VC)},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!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=X(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(WC,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(GC,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(FC,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(s_,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function VC(){}function HC(e){return e+1}function UC(e){return Sl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function WC(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=jt(),a=pc(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=jC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=AC,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 GC(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=jt(),a=pc(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=jC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=AC,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)(IS,{scenario:`new-project`}):(0,Z.jsx)(EC,{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)(qC,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(t_,{onPackSelect:r,onCreateBlankFile:KC,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function KC(){return NC()}function qC(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=jt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Fc,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(yn,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(bn,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(Sn,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function JC(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function YC(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=jt(),[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)(ZC,{}),(0,Z.jsx)(su,{className:`h-7 w-full`}),(0,Z.jsx)(su,{className:`h-7 w-full`}),(0,Z.jsx)(su,{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)(J,{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=JC(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 xc(n,{[e]:t});if(!r.ok){let{error:e}=r;cl.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 xc(n,{[e]:null});if(!t.ok){let{error:e}=t;cl.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,gs(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):Es[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(go(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 xc(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 xc(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)(As,{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)(J,{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 ee;t[45]===h?ee=t[46]:(ee=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:XC,children:h}),t[45]=h,t[46]=ee);let te;t[47]!==q||t[48]!==ee?(te=(0,Z.jsxs)(Tn,{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,ee]}),t[47]=q,t[48]=ee,t[49]=te):te=t[49];let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=ne):ne=t[50];let re;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(re=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(ws,{keyName:e,value:t,declared:ys(t,po(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]=re):re=t[59];let ie;t[60]!==c||t[61]!==N?(ie=c?(0,Z.jsx)(xs,{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)(Y,{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)(Oe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(wn,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ne,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==H||t[67]!==te||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(En,{open:H,onOpenChange:U,children:[te,ae]})}),t[66]=H,t[67]=te,t[68]=ae,t[69]=oe):oe=t[69],oe}function XC(e){return e.stopPropagation()}function ZC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(bm,{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)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function QC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?gl._({id:`xOTzt5`}):t<3600?gl._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?gl._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?gl._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function $C(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function ew(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:Ui,label:gl._({id:`QR5SP1`}),detail:$C(i)};case`template-edit`:return{Icon:gc,label:gl._({id:`-LHLx7`}),detail:$C(i)};case`template-delete`:return{Icon:zc,label:gl._({id:`_gkGSK`}),detail:$C(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Yp,label:gl._({id:`KPW5WC`}),detail:`${$C(e??``)} → ${$C(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:bm,label:gl._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:bm,label:gl._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:bm,label:gl._({id:`ZQLDTl`}),detail:``};default:return{Icon:Dm,label:r.replace(/-/g,` `),detail:$C(i)}}}function tw(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?gl._({id:`B2DrPb`}):e.author||gl._({id:`Ef7StM`})}function nw(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=Ll(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)(J,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(js,{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)(su,{className:`h-8 w-full`}),(0,Z.jsx)(su,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(rw)})}),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 rw(e){let{Icon:t,label:n,detail:r}=ew(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)(yh,{className:`size-3`,"aria-hidden":!0}),tw(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:QC(e.timestamp)})]},e.sha)}function iw(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function aw(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=iw(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function ow(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function sw(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:aw(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:ow(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:aw(e,t.pageTitles),children:a}}function cw(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)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(su,{className:`h-12 w-full`}),(0,Z.jsx)(su,{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)(J,{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)(J,{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)(js,{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)(Y,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{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 v;t[11]===p?v=t[12]:(v=(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)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(Ei,{template:e,onCreate:()=>l(e.name),onEdit:()=>jc(Se(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(ms,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(hi,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(lw)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),jc(Se(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(Ti,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(Ng,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function lw(e){return e.name}function uw(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=X(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function dw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pw(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=X(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function mw(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=X(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function hw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gw(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return gl._({id:`xOTzt5`});if(r<60)return gl._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return gl._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?gl._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function _w(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 vw(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)(er,{className:`ml-1 size-3`}):(0,Z.jsx)(fr,{className:`ml-1 size-3`}):(0,Z.jsx)(Xp,{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)(Y,{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 yw(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=jt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Ps(),l=Ii(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)(su,{className:`size-5 rounded`}),(0,Z.jsx)(su,{className:`h-7 w-48`})]}),(0,Z.jsx)(su,{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)(su,{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)(su,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Sw)]})]}),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=sw(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=_w(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?_(xw):(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)(yc,{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)(Y,{onClick:()=>p(!0),children:[(0,Z.jsx)(Oe,{className:`size-4`}),(0,Z.jsx)(J,{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)(YC,{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)(cw,{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)(nw,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=uw;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)(vw,{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)(mw,{"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)(vw,{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)(mw,{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)(dw,{children:(0,Z.jsxs)(pw,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=fw,b=a.length?a.map(bw):(0,Z.jsx)(pw,{children:(0,Z.jsx)(hw,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{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)(Ng,{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 bw(e){return(0,Z.jsxs)(pw,{children:[(0,Z.jsx)(hw,{children:(0,Z.jsxs)(`a`,{href:tu(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)(Sm,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(St,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(hw,{className:`text-muted-foreground`,children:e.kind===`file`?gw(e.modified):`—`})]},e.path)}function xw(e){return e===`asc`?`desc`:`asc`}function Sw(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)(su,{className:`size-4 rounded`}),(0,Z.jsx)(su,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(su,{className:`h-4 w-16`})})]},e)}function Cw(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)(_m,{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)(J,{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=Va(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Va(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)(J,{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)(Y,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(ur,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{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 ww(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Tw),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>be(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(){he(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)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{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)(Y,{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 Tw(){return new Set}function Ew(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=$o(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=ql(ts(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){ns.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?ql(e):tu(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(is,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Dw(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=yo(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=da(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(Ow,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Cs,{title:s,testId:`readonly-property-panel`,className:`pt-4 pb-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ow(e){let t=(0,$.c)(12),{keyName:n,value:r}=e,i=hs[po(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground`,children:(0,Z.jsx)(i,{className:`size-3.5`})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`flex h-7 w-32 shrink-0 items-center truncate px-2 text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=o);let s;t[4]!==n||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(kw,{keyName:n,value:r})}),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`group flex items-start gap-1 py-0.5`,"data-testid":`readonly-property-row`,"data-key":n,children:[a,o,s]}),t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function kw(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Ss(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(vs,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(Aw).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function Aw(e){return typeof e==`string`}function jw(e){let t=(0,$.c)(29),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=Xo(r).body;s=cr,i=nt,a=!1,o=zn().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 d=s(l,u),[f]=(0,Q.useState)(Mw),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===r?g=t[16]:(g=(0,Z.jsx)(Dw,{text:r}),t[15]=r,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})}),t[17]=_):_=t[17];let v;t[18]===g?v=t[19]:(v=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:[g,_]}),t[18]=g,t[19]=v);let y;t[20]===d?y=t[21]:(y=(0,Z.jsx)(Qn,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[20]=d,t[21]=y);let b;t[22]!==f||t[23]!==y?(b=(0,tm.createPortal)(y,f),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==n||t[26]!==v||t[27]!==b?(x=(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:[v,b]}),t[25]=n,t[26]=v,t[27]=b,t[28]=x):x=t[28],x}function Mw(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var Nw=`data-skill-markdown`;function Pw(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=>Qr({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=SS(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(CS,{fileName:a,dataAttr:Nw}),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)(wS,{fileName:a,dataAttr:Nw,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)(jw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var Fw=new Set([`md`,`mdx`]);function Iw(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=Fw.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)(Pw,{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=>Qr({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)(DS,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function Lw(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Rw=Lw(()=>n(()=>import(`./SettingsDialogBody-SwVDm-ay.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([87,1,88,15,10,16,48,6,2,3,7,8,49,51,67,53,68,69,9,72,56,57,58,59,60,61,62,63,64,65,66,13,33,70,71,25,47,28,50,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,52,77,78,79,24,80,81,26,82,11,89,36,90,91,92,93,45,94,95,84,29,96,27,34]),import.meta.url));function zw(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=jt(),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)(J,{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)(Y,{variant:`default`,onClick:Bw,children:(0,Z.jsx)(J,{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 Bw(){return window.location.reload()}function Vw(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(I,{fallbackRender:Uw,onError:Hw,children:n}),t[0]=n,t[1]=r),r}function Hw(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function Uw(e){return(0,Z.jsx)(zw,{...e})}function Ww(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function Gw(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Kw(e){let t=(0,$.c)(140),{open:n,onOpenChange:r}=e,{_:i}=jt(),{collabUrl:a}=Xe(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l,projectConfig:u,merged:d}=Ru(),{desktopPresent:f}=di(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=a!==null,v=typeof window<`u`&&window.okDesktop!=null,y,b,x,S,C,w;if(t[3]!==i||t[4]!==_||t[5]!==d?.appearance?.colorThemeEnabled||t[6]!==u?.contentRules){let e;t[13]===u?.contentRules?e=t[14]:(e=e=>u?.contentRules?.[e.id]?.enabled===!0,t[13]=u?.contentRules,t[14]=e);let n=ia.filter(e).map(qw),r=d?.appearance?.colorThemeEnabled!==!1,a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=Ww(),t[15]=a):a=t[15];let o=a,s;t[16]===i?s=t[17]:(s=i({id:`7PzzBU`}),t[16]=i,t[17]=s);let c;t[18]===i?c=t[19]:(c=i({id:`Q6hhn8`}),t[18]=i,t[19]=c);let l;t[20]===c?l=t[21]:(l={id:`preferences`,label:c},t[20]=c,t[21]=l);let f;t[22]===i?f=t[23]:(f=i({id:`4KmEoC`}),t[22]=i,t[23]=f);let p;t[24]===f?p=t[25]:(p={id:`hotkeys`,label:f},t[24]=f,t[25]=p);let m;t[26]===i?m=t[27]:(m=i({id:`AeXO77`}),t[26]=i,t[27]=m);let h;t[28]===m?h=t[29]:(h={id:`account`,label:m},t[28]=m,t[29]=h);let g;t[30]===i?g=t[31]:(g=i({id:`ohUJJM`}),t[30]=i,t[31]=g);let T;t[32]===g?T=t[33]:(T={id:`user-plugins-manage`,label:g},t[32]=g,t[33]=T);let E;t[34]===i?E=t[35]:(E=v?[{id:`ai-tools`,label:i({id:`_5qBNl`})}]:[],t[34]=i,t[35]=E);let D;t[36]!==l||t[37]!==p||t[38]!==h||t[39]!==T||t[40]!==E?(D=[l,p,h,T,...E],t[36]=l,t[37]=p,t[38]=h,t[39]=T,t[40]=E,t[41]=D):D=t[41],t[42]!==s||t[43]!==D?(C={id:`user`,label:s,enabled:!0,items:D},t[42]=s,t[43]=D,t[44]=C):C=t[44];let O;t[45]===i?O=t[46]:(O=i({id:`ZWyHmq`}),t[45]=i,t[46]=O);let k;t[47]===i?k=t[48]:(k=i({id:`Nu4DdT`}),t[47]=i,t[48]=k);let A;t[49]===k?A=t[50]:(A={id:`sync`,label:k},t[49]=k,t[50]=A);let j;t[51]===i?j=t[52]:(j=i({id:`A1taO8`}),t[51]=i,t[52]=j);let M;t[53]===j?M=t[54]:(M={id:`search`,label:j},t[53]=j,t[54]=M);let N;t[55]===i?N=t[56]:(N=i({id:`ohUJJM`}),t[55]=i,t[56]=N);let P;t[57]===N?P=t[58]:(P={id:`plugins-manage`,label:N},t[57]=N,t[58]=P);let F,I,L;t[59]===i?(F=t[60],I=t[61],L=t[62]):(F=o?[]:[{id:`link-previews`,label:i({id:`gh27t1`})}],I=v?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],L=v?[{id:`project-ai-tools`,label:i({id:`crqzW5`})}]:[],t[59]=i,t[60]=F,t[61]=I,t[62]=L);let R;t[63]===i?R=t[64]:(R=i({id:`iTylMl`}),t[63]=i,t[64]=R);let z;t[65]===R?z=t[66]:(z={id:`project-templates`,label:R},t[65]=R,t[66]=z);let B;t[67]===i?B=t[68]:(B=i({id:`PCSkw2`}),t[67]=i,t[68]=B);let V;t[69]===B?V=t[70]:(V={id:`skills`,label:B},t[69]=B,t[70]=V);let H;t[71]===i?H=t[72]:(H=i({id:`3zyg_A`}),t[71]=i,t[72]=H);let U;t[73]===H?U=t[74]:(U={id:`okignore`,label:H},t[73]=H,t[74]=U);let W;t[75]===i?W=t[76]:(W=i({id:`cs4mps`}),t[75]=i,t[76]=W);let G;t[77]===W?G=t[78]:(G={id:`sharing`,label:W},t[77]=W,t[78]=G);let K;t[79]!==A||t[80]!==M||t[81]!==P||t[82]!==F||t[83]!==I||t[84]!==L||t[85]!==z||t[86]!==V||t[87]!==U||t[88]!==G?(K=[A,M,P,...F,...I,...L,z,V,U,G],t[79]=A,t[80]=M,t[81]=P,t[82]=F,t[83]=I,t[84]=L,t[85]=z,t[86]=V,t[87]=U,t[88]=G,t[89]=K):K=t[89],t[90]!==_||t[91]!==O||t[92]!==K?(w={id:`project`,label:O,enabled:_,items:K},t[90]=_,t[91]=O,t[92]=K,t[93]=w):w=t[93],y=`plugins`,t[94]===i?b=t[95]:(b=i({id:`ohUJJM`}),t[94]=i,t[95]=b),x=!0;let q;t[96]!==i||t[97]!==r?(q=r?[{id:`plugin:theme`,label:i({id:`fJ3EbT`})}]:[],t[96]=i,t[97]=r,t[98]=q):q=t[98],S=[..._?n:[],...q],t[3]=i,t[4]=_,t[5]=d?.appearance?.colorThemeEnabled,t[6]=u?.contentRules,t[7]=y,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w}else y=t[7],b=t[8],x=t[9],S=t[10],C=t[11],w=t[12];let T;t[99]!==y||t[100]!==b||t[101]!==x||t[102]!==S?(T={id:y,label:b,enabled:x,items:S},t[99]=y,t[100]=b,t[101]=x,t[102]=S,t[103]=T):T=t[103];let E;t[104]===i?E=t[105]:(E=i({id:`nbfdhU`}),t[104]=i,t[105]=E);let D;t[106]!==i||t[107]!==f?(D=[],t[106]=i,t[107]=f,t[108]=D):D=t[108];let O;t[109]!==E||t[110]!==D?(O={id:`integrations`,label:E,enabled:!0,items:D},t[109]=E,t[110]=D,t[111]=O):O=t[111];let k;t[112]!==O||t[113]!==C||t[114]!==w||t[115]!==T?(k=[C,w,T,O],t[112]=O,t[113]=C,t[114]=w,t[115]=T,t[116]=k):k=t[116];let A=k,j;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(On,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[117]=j):j=t[117];let M;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(Dn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[118]=M):M=t[118];let N;t[119]!==p||t[120]!==A?(N=(0,Z.jsx)(Jw,{groups:A,activeId:p,onSelect:m}),t[119]=p,t[120]=A,t[121]=N):N=t[121];let P;t[122]===i?P=t[123]:(P=i({id:`OXb_Df`}),t[122]=i,t[123]=P);let F;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Zw,{}),t[124]=F):F=t[124];let I=s?o:null,L;t[125]!==p||t[126]!==c||t[127]!==l||t[128]!==I?(L=(0,Z.jsx)(Vw,{children:(0,Z.jsx)(Q.Suspense,{fallback:F,children:(0,Z.jsx)(Rw,{activeId:p,userBinding:I,okignoreBinding:c,okignoreSynced:l})})}),t[125]=p,t[126]=c,t[127]=l,t[128]=I,t[129]=L):L=t[129];let R;t[130]!==P||t[131]!==L?(R=(0,Z.jsx)(`section`,{"aria-label":P,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:L}),t[130]=P,t[131]=L,t[132]=R):R=t[132];let z;t[133]!==N||t[134]!==R?(z=(0,Z.jsxs)(kn,{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:[j,M,N,R]}),t[133]=N,t[134]=R,t[135]=z):z=t[135];let B;return t[136]!==r||t[137]!==n||t[138]!==z?(B=(0,Z.jsx)(Nn,{open:n,onOpenChange:r,children:z}),t[136]=r,t[137]=n,t[138]=z,t[139]=B):B=t[139],B}function qw(e){return{id:`plugin:${e.id}`,label:e.label}}function Jw(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=jt(),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)(Xw,{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)(Yw,{}),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 Yw(){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=Gw(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:X(`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)(J,{id:`_PACVa`}),(0,Z.jsx)(fs,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function Xw(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=X(`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)(J,{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:X(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],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 Zw(){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)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(su,{className:`h-5 w-32`}),r=(0,Z.jsx)(su,{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)(su,{className:`h-9 w-full`}),(0,Z.jsx)(su,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function Qw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(lS,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $w(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)(pS,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function eT(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=X(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(_S,{"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 tT(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var nT=un(`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 rT(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=X(nT({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:iT,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function iT(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}un(`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 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=X(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oT(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ml,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sT(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:u,onQueryChange:d,onReplacementChange:f,onReplaceOpenChange:p,onCaseSensitiveChange:m,onWholeWordChange:h,onNext:g,onPrevious:_,onReplaceCurrent:v,onReplaceAll:y,onClose:b}=e,{_:x}=jt(),S=r.length>0,C=u>0,w;t[0]!==x||t[1]!==c||t[2]!==C||t[3]!==S||t[4]!==u?(w=S?C?`${c} / ${u}`:x({id:`Ev2r9A`}):``,t[0]=x,t[1]=c,t[2]=C,t[3]=S,t[4]=u,t[5]=w):w=t[5];let T=w,E;t[6]!==b||t[7]!==g||t[8]!==_?(E=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?_():g()):e.key===`Escape`&&(e.preventDefault(),b())},t[6]=b,t[7]=g,t[8]=_,t[9]=E):E=t[9];let D=E,O;t[10]!==b||t[11]!==v?(O=function(e){e.key===`Enter`?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),b())},t[10]=b,t[11]=v,t[12]=O):O=t[12];let k=O,A;t[13]===x?A=t[14]:(A=x({id:`MVxpbf`}),t[13]=x,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=j):j=t[15];let M;t[16]===d?M=t[17]:(M=e=>d(e.target.value),t[16]=d,t[17]=M);let N;t[18]===x?N=t[19]:(N=x({id:`KujtjC`}),t[18]=x,t[19]=N);let P;t[20]!==n||t[21]!==D||t[22]!==r||t[23]!==M||t[24]!==N?(P=(0,Z.jsx)(oT,{ref:n,id:`ok-find-input`,value:r,onChange:M,onKeyDown:D,placeholder:N,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=D,t[22]=r,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]===x?F=t[27]:(F=x({id:`-8PP0T`}),t[26]=x,t[27]=F);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(rm,{"aria-hidden":`true`}),t[28]=I):I=t[28];let L;t[29]!==o||t[30]!==m||t[31]!==F?(L=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(oa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":F,pressed:o,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:I})}),t[29]=o,t[30]=m,t[31]=F,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=R):R=t[33];let z;t[34]===L?z=t[35]:(z=(0,Z.jsxs)(Sn,{children:[L,R]}),t[34]=L,t[35]=z);let B;t[36]===x?B=t[37]:(B=x({id:`_7UQ7y`}),t[36]=x,t[37]=B);let V;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(bh,{"aria-hidden":`true`}),t[38]=V):V=t[38];let H;t[39]!==h||t[40]!==B||t[41]!==s?(H=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(oa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":B,pressed:s,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:V})}),t[39]=h,t[40]=B,t[41]=s,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=U):U=t[43];let W;t[44]===H?W=t[45]:(W=(0,Z.jsxs)(Sn,{children:[H,U]}),t[44]=H,t[45]=W);let G;t[46]!==z||t[47]!==W?(G=(0,Z.jsxs)(rT,{align:`inline-end`,className:`gap-0.5`,children:[z,W]}),t[46]=z,t[47]=W,t[48]=G):G=t[48];let K;t[49]!==G||t[50]!==P?(K=(0,Z.jsxs)(tT,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[P,G]}),t[49]=G,t[50]=P,t[51]=K):K=t[51];let q;t[52]===T?q=t[53]:(q=(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:T}),t[52]=T,t[53]=q);let ee;t[54]===x?ee=t[55]:(ee=x({id:`oqB2ez`}),t[54]=x,t[55]=ee);let te=!C,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(l,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==_||t[58]!==ee||t[59]!==te?(re=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:_,children:ne})}),t[57]=_,t[58]=ee,t[59]=te,t[60]=re):re=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let ae;t[62]===re?ae=t[63]:(ae=(0,Z.jsxs)(Sn,{children:[re,ie]}),t[62]=re,t[63]=ae);let oe;t[64]===x?oe=t[65]:(oe=x({id:`SiUUCS`}),t[64]=x,t[65]=oe);let se=!C,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(ks,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==g||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:g,children:ce})}),t[67]=g,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(Sn,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=a?`secondary`:`ghost`,pe;t[74]!==x||t[75]!==a?(pe=x(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=x,t[75]=a,t[76]=pe):pe=t[76];let me=a?`ok-replace-input`:void 0,he;t[77]!==p||t[78]!==a?(he=()=>p(!a),t[77]=p,t[78]=a,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Xm,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":me,onClick:he,children:ge})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===a?ve=t[88]:(ve=(0,Z.jsx)(bn,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Sn,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==x||t[93]!==k||t[94]!==C||t[95]!==y||t[96]!==v||t[97]!==f||t[98]!==a||t[99]!==i?(be=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(ml,{id:`ok-replace-input`,value:i,onChange:e=>f(e.target.value),onKeyDown:k,placeholder:x({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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":x({id:`bS_boY`}),disabled:!C,onClick:v,children:(0,Z.jsx)(Xm,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":x({id:`dr1vFs`}),disabled:!C,onClick:y,children:(0,Z.jsx)(Ym,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=x,t[93]=k,t[94]=C,t[95]=y,t[96]=v,t[97]=f,t[98]=a,t[99]=i,t[100]=be):be=t[100];let xe;t[101]===x?xe=t[102]:(xe=x({id:`wJo9oS`}),t[101]=x,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(sl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==b||t[105]!==xe?(Ce=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:b,children:Se})}),t[104]=b,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Sn,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==K||t[111]!==q||t[112]!==ae||t[113]!==de||t[114]!==A||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":A,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:[j,K,q,ae,de,ye,be,Te]}),t[110]=K,t[111]=q,t[112]=ae,t[113]=de,t[114]=A,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var cT={current:0,total:0},lT=120,uT=100;function dT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?z(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(u,n,fT)}function fT(){return null}function pT(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 _C(e){let{instruction:t,mentions:n}=gC(e);return t===``&&n.length===0}function vC(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 yC(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,d=(0,Q.useRef)(i),f=(0,Q.useRef)(a),p=(0,Q.useRef)(o),m=(0,Q.useRef)(s),h;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==s?(h=()=>{d.current=i,f.current=a,p.current=o,m.current=s},t[0]=a,t[1]=i,t[2]=o,t[3]=s,t[4]=h):h=t[4],(0,Q.useEffect)(h);let g;t[5]===l?g=t[6]:(g=pC({placeholder:l}),t[5]=l,t[6]=g);let _=u??void 0,v;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(v=X(`composer-prosemirror py-1 outline-none`),t[7]=v):v=t[7];let y;t[8]===r?y=t[9]:(y={role:`textbox`,"aria-label":r,"aria-multiline":`true`,class:v},t[8]=r,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>t.key===`Escape`?aC.getState(e.state)?.active?!1:(e.dom.blur(),!0):t.key===`Enter`&&!t.shiftKey&&!t.isComposing&&!e.composing?aC.getState(e.state)?.active?!1:(m.current(),!0):!1,t[10]=b):b=t[10];let x;t[11]===y?x=t[12]:(x={attributes:y,handleKeyDown:b},t[11]=y,t[12]=x);let S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let{editor:t}=e;d.current(_C(t)),f.current?.(t.getJSON()),p.current?.(gC(t).mentions)},t[13]=S):S=t[13];let C;t[14]!==g||t[15]!==_||t[16]!==x?(C={extensions:g,content:_,immediatelyRender:!0,editorProps:x,onUpdate:S},t[14]=g,t[15]=_,t[16]=x,t[17]=C):C=t[17];let w=cr(C),T;t[18]!==w||t[19]!==u?(T=()=>{w&&(_C(w)&&vC(u)&&(console.warn(`composer draft was incompatible with the current schema — clearing it`),XS()),d.current(_C(w)),p.current?.(gC(w).mentions))},t[18]=w,t[19]=u,t[20]=T):T=t[20];let E;t[21]===w?E=t[22]:(E=[w],t[21]=w,t[22]=E),(0,Q.useEffect)(T,E);let D,O;t[23]===w?(D=t[24],O=t[25]):(D=()=>({focus:()=>w?.commands.focus(),blur:()=>w?.commands.blur(),clear:()=>w?.commands.clearContent(!0),setText:e=>{w&&(w.commands.setContent(e),f.current?.(w.getJSON()),p.current?.(gC(w).mentions))},getContent:()=>w?gC(w):{instruction:``,mentions:[]}}),O=[w],t[23]=w,t[24]=D,t[25]=O),(0,Q.useImperativeHandle)(n,D,O);let k;return t[26]!==c||t[27]!==w?(k=(0,Z.jsx)(Qn,{editor:w,className:c}),t[26]=c,t[27]=w,t[28]=k):k=t[28],k}function bC(e,t,n){return e.trim().length>0||t.length>0||n}var xC=new Set(Bs.map(e=>e.id));function SC(e){return typeof e==`string`&&xC.has(e)}function CC(e){try{let t=kv(e);return SC(t)?t:null}catch{return null}}function wC(e,t){Av(e,t)}function TC(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:Bs.find(e=>n[e.id]?.installed===!0)?.id??null}function EC(e){let t=(0,$.c)(28),{scenario:n,className:r}=e,{_:i}=jt(),{states:a,refresh:o}=ec(),{dispatch:s}=Ls(),c=ac(),l=Ks(),[u,d]=(0,Q.useState)(kC),f=(0,Q.useRef)(!1),[p,m]=(0,Q.useState)(null),h=p!==null&&l!==null,g=(0,Q.useRef)(null),[_]=(0,Q.useState)(OC),[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=FS(n),T;t[1]===a?T=t[2]:(T=e=>a[e.id]?.installed===!0,t[1]=a,t[2]=T);let E=Bs.filter(T),D;t[3]===a?D=t[4]:(D=Bs.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=TC({lastUsed:CC(),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),wC(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(!bC(e,t,!1)){x(!0);return}let r=Js({workspace:c,description:e,scenario:n,mentions:t});r!==null&&(l.launchInTerminal(r,p),g.current?.clear(),XS())},F=function(e){let{instruction:t,mentions:r}=g.current?.getContent()??{instruction:``,mentions:[]};if(!bC(t,r,!1)){x(!0);return}wC(e);let i=Js({workspace:c,description:t,scenario:n,mentions:r});i!==null&&(s(e,i),g.current?.clear(),XS())},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=X(`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)(uc,{"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)(J,{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:Bs.map(DC)}),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=l?Xs(l.installedClis,p):[],V;t[16]===r?V=t[17]:(V=X(`flex w-full flex-col gap-3`,r),t[16]=r,t[17]=V);let H;t[18]===i?H=t[19]:(H=i({id:`7hctf2`}),t[18]=i,t[19]=H);let U;t[20]===i?U=t[21]:(U=i({id:`0jD-Gn`}),t[20]=i,t[21]=U);let W;t[22]!==v||t[23]!==b?(W=b&&v?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-input-required`,children:(0,Z.jsx)(J,{id:`1FLarN`})}):(0,Z.jsx)(`span`,{}),t[22]=v,t[23]=b,t[24]=W):W=t[24];let G=u===null?(0,Z.jsx)(Y,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(J,{id:`hYgDIe`})}):(0,Z.jsxs)(eC,{children:[(0,Z.jsx)(Y,{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)(rc,{id:Ws(p),"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`4rjwLG`,values:{0:ka[p].displayName}})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(rc,{id:u,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(J,{id:`9dw5bW`,values:{0:oc(u)}})]})}),(0,Z.jsxs)($r,{onOpenChange:e=>{e&&o()},children:[(0,Z.jsx)(jr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,"aria-label":i({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(qr,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(Kr,{"aria-label":i({id:`ALhMYW`}),children:[(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),B.map(e=>{let{displayName:t}=ka[e];return(0,Z.jsxs)(Gr,{onSelect:()=>N(e),"data-testid":`create-with-cli-${e}`,"aria-label":i({id:`QYfQdv`,values:{displayName:t}}),children:[(0,Z.jsx)(rc,{id:Ws(e),"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),p===e?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)})]}):null,R?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(Vr,{}):null,(0,Z.jsxs)(Kr,{"aria-label":i({id:`BBqGS9`}),children:[(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),E.map(e=>(0,Z.jsxs)(Gr,{onSelect:()=>M(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(rc,{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)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):null]})]})]}),K;return t[25]!==G||t[26]!==W?(K=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 px-3 pb-3`,children:[W,G]}),t[25]=G,t[26]=W,t[27]=K):K=t[27],(0,Z.jsxs)(`div`,{className:V,children:[(0,Z.jsxs)(`div`,{onMouseDown:e=>QS(e,g),className:`flex w-full cursor-text 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)(yC,{ref:g,ariaLabel:H,placeholder:U,onEmptyChange:C,onContentChange:YS,onSubmit:I,initialDoc:_,className:`max-h-96 overflow-y-auto px-4 py-3 text-sm leading-relaxed subtle-scrollbar [&_.ProseMirror]:min-h-16`}),K]}),n!==`existing-repo`&&w.length>0?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`I5685_`})}),w.map(e=>{let t=e.icon;return(0,Z.jsxs)(Y,{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 DC(e){return(0,Z.jsxs)(Y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void zs(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(rc,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(fs,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function OC(){return JS().doc??void 0}function kC(){return CC()}function AC(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(vf,{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 flex-col items-start gap-3 @md/emptystate:flex-row @md/emptystate:items-center @md/emptystate:gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function jC({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 MC=`open-knowledge:create-top-level-file`;function NC(e={}){window.dispatchEvent(new CustomEvent(MC,{detail:e}))}function PC(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(MC,t),()=>window.removeEventListener(MC,t)}function FC(e){let t=(0,$.c)(28),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=jt(),a=pc(),{title:o,subtitle:s}=jC({isOnboarding:!1,isEmbedded:a}),c=Xi(),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=AC,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)(IS,{scenario:`existing-repo`}):(0,Z.jsx)(EC,{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)(RC,{templates:u,loading:d,error:f,onSelect:LC}):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)(Oe,{"aria-hidden":`true`,className:`size-3`}),b=(0,Z.jsx)(J,{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)(Y,{onClick:r,variant:`link-muted`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider`,children:[y,b]}),t[16]=r,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Y,{variant:`link-muted`,className:`justify-end`,size:`sm`,onClick:IC,children:(0,Z.jsx)(J,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(Jn,{"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 IC(){return NC({initialDir:``})}function LC(e,t){return NC({template:{folder:e,name:t}})}function RC(e){let t=(0,$.c)(25),{templates:n,loading:r,error:i,onSelect:a}=e,{_:o}=jt(),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)(J,{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)(js,{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)(J,{id:`Hl89Qd`})}):i?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(J,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(zC,{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 zC(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:i}=e,{_:a}=jt(),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)(Y,{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 BC(e){let t=(0,$.c)(25),{terminalDock:n}=e,r=n===void 0?null: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{ok:t,body:n}=await Hl();if(e)return;let r=t?la.safeParse(n):null;r?.success?(l(UC(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=zl(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(HC),500),Hl().then(e=>{let{ok:t,body:n}=e;if(!t)return;let r=la.safeParse(n);r.success&&l(UC(r.data.documents))}).catch(VC)},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!==null){let e=r===`bottom`?`justify-end`:`justify-center`,n;t[4]===e?n=t[5]:(n=X(`@container/emptystate flex min-h-0 flex-1 flex-col items-center pb-8 pt-10`,e),t[4]=e,t[5]=n);let i;t[6]!==u||t[7]!==y||t[8]!==v?(i=v?(0,Z.jsx)(WC,{isOnboarding:y,celebrateSignal:u}):null,t[6]=u,t[7]=y,t[8]=v,t[9]=i):i=t[9];let a;t[10]===i?a=t[11]:(a=(0,Z.jsx)(`div`,{className:`flex w-full flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:i}),t[10]=i,t[11]=a);let o;return t[12]!==n||t[13]!==a?(o=(0,Z.jsx)(`div`,{className:n,children:a}),t[12]=n,t[13]=a,t[14]=o):o=t[14],o}let S;t[15]!==u||t[16]!==y||t[17]!==v?(S=v?y?(0,Z.jsx)(GC,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(FC,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[15]=u,t[16]=y,t[17]=v,t[18]=S):S=t[18];let C;t[19]!==o||t[20]!==i?(C=(0,Z.jsx)(s_,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[19]=o,t[20]=i,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Z.jsx)(`div`,{className:`@container/emptystate flex min-h-0 flex-1 flex-col items-center overflow-y-auto subtle-scrollbar`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-1 flex-col items-center px-4 @md/emptystate:px-10 @2xl/emptystate:px-16`,children:[S,C]})}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w}function VC(){}function HC(e){return e+1}function UC(e){return Sl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function WC(e){let t=(0,$.c)(15),{isOnboarding:n,celebrateSignal:r}=e,{_:i}=jt(),a=pc(),o,s,c,l;if(t[0]!==i||t[1]!==a||t[2]!==n){let{title:e,subtitle:r}=jC({isOnboarding:n,isEmbedded:a});l=`w-full max-w-5xl`,o=AC,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 GC(e){let t=(0,$.c)(29),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=jt(),a=pc(),o,s,c,l;if(t[0]!==i||t[1]!==a){let{title:e,subtitle:n}=jC({isOnboarding:!0,isEmbedded:a});l=`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,o=AC,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)(IS,{scenario:`new-project`}):(0,Z.jsx)(EC,{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)(qC,{label:f}),t[16]=f,t[17]=p);let m;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(m=[`okf`,`entity-vault`],t[18]=m):m=t[18];let h;t[19]===r?h=t[20]:(h=(0,Z.jsx)(t_,{onPackSelect:r,onCreateBlankFile:KC,collapsedPackIds:m}),t[19]=r,t[20]=h);let g;t[21]!==p||t[22]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[p,h]}),t[21]=p,t[22]=h,t[23]=g):g=t[23];let _;return t[24]!==g||t[25]!==l||t[26]!==u||t[27]!==d?(_=(0,Z.jsxs)(`div`,{className:l,children:[u,d,g]}),t[24]=g,t[25]=l,t[26]=u,t[27]=d,t[28]=_):_=t[28],_}function KC(){return NC()}function qC(e){let t=(0,$.c)(13),{label:n}=e,{_:r}=jt(),i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r({id:`jAMpHn`}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Fc,{className:`size-3.5`,"aria-hidden":!0}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsx)(yn,{className:`text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,"data-testid":`starter-pack-info`,children:o}),t[5]=a,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(bn,{className:`max-w-xs`,children:(0,Z.jsx)(`p`,{className:`leading-relaxed wrap-break-word`,children:(0,Z.jsx)(J,{id:`k4CuuV`})})}),t[7]=c):c=t[7];let l;t[8]===s?l=t[9]:(l=(0,Z.jsxs)(Sn,{children:[s,c]}),t[8]=s,t[9]=l);let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function JC(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function YC(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:i}=e,{_:a}=jt(),[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)(ZC,{}),(0,Z.jsx)(su,{className:`h-7 w-full`}),(0,Z.jsx)(su,{className:`h-7 w-full`}),(0,Z.jsx)(su,{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)(J,{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=JC(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 xc(n,{[e]:t});if(!r.ok){let{error:e}=r;cl.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 xc(n,{[e]:null});if(!t.ok){let{error:e}=t;cl.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,gs(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):Es[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(go(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 xc(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 xc(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)(As,{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)(J,{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 ee;t[45]===h?ee=t[46]:(ee=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:XC,children:h}),t[45]=h,t[46]=ee);let te;t[47]!==q||t[48]!==ee?(te=(0,Z.jsxs)(Tn,{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,ee]}),t[47]=q,t[48]=ee,t[49]=te):te=t[49];let ne;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hSBIG-`})}),t[50]=ne):ne=t[50];let re;t[51]!==c||t[52]!==y||t[53]!==z||t[54]!==_||t[55]!==p||t[56]!==x||t[57]!==u||t[58]!==C?(re=_.length===0&&!c?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4c_a6S`})}):_.map(e=>{let t=p[e];return(0,Z.jsx)(ws,{keyName:e,value:t,declared:ys(t,po(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]=re):re=t[59];let ie;t[60]!==c||t[61]!==N?(ie=c?(0,Z.jsx)(xs,{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)(Y,{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)(Oe,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`G8t9NN`})})]})}),t[60]=c,t[61]=N,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(wn,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[ne,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==H||t[67]!==te||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(En,{open:H,onOpenChange:U,children:[te,ae]})}),t[66]=H,t[67]=te,t[68]=ae,t[69]=oe):oe=t[69],oe}function XC(e){return e.stopPropagation()}function ZC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(bm,{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)(J,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function QC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?gl._({id:`xOTzt5`}):t<3600?gl._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?gl._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?gl._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function $C(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function ew(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:Ui,label:gl._({id:`QR5SP1`}),detail:$C(i)};case`template-edit`:return{Icon:gc,label:gl._({id:`-LHLx7`}),detail:$C(i)};case`template-delete`:return{Icon:zc,label:gl._({id:`_gkGSK`}),detail:$C(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:Yp,label:gl._({id:`KPW5WC`}),detail:`${$C(e??``)} → ${$C(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:bm,label:gl._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:bm,label:gl._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:bm,label:gl._({id:`ZQLDTl`}),detail:``};default:return{Icon:Dm,label:r.replace(/-/g,` `),detail:$C(i)}}}function tw(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?gl._({id:`B2DrPb`}):e.author||gl._({id:`Ef7StM`})}function nw(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=Ll(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)(J,{id:`XJOV1Y`})}),t[4]=f):f=t[4];let p;t[5]===i.length?p=t[6]:(p=i.length>0?(0,Z.jsx)(js,{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)(su,{className:`h-8 w-full`}),(0,Z.jsx)(su,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(rw)})}),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 rw(e){let{Icon:t,label:n,detail:r}=ew(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)(yh,{className:`size-3`,"aria-hidden":!0}),tw(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:QC(e.timestamp)})]},e.sha)}function iw(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function aw(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=iw(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function ow(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function sw(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:aw(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:ow(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:aw(e,t.pageTitles),children:a}}function cw(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)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(su,{className:`h-12 w-full`}),(0,Z.jsx)(su,{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)(J,{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)(J,{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)(js,{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)(Y,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>d(!0),children:[(0,Z.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{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 v;t[11]===p?v=t[12]:(v=(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)(J,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:p.map(e=>(0,Z.jsx)(Ei,{template:e,onCreate:()=>l(e.name),onEdit:()=>jc(Se(e.source_folder,e.name)),onDelete:()=>s(e),badge:e.scope===`inherited`?(0,Z.jsx)(ms,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=p,t[12]=v);let y;t[13]!==_||t[14]!==v?(y=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[_,v]}),t[13]=_,t[14]=v,t[15]=y):y=t[15];let b;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>{e||s(null)},t[16]=b):b=t[16];let x;t[17]!==o||t[18]!==i?(x=(0,Z.jsx)(hi,{template:o,onOpenChange:b,onDeleted:i}),t[17]=o,t[18]=i,t[19]=x):x=t[19];let S;t[20]===p?S=t[21]:(S=new Set(p.map(lw)),t[20]=p,t[21]=S);let C;t[22]!==n||t[23]!==i?(C=e=>{i(),jc(Se(n,e))},t[22]=n,t[23]=i,t[24]=C):C=t[24];let w;t[25]!==n||t[26]!==u||t[27]!==S||t[28]!==C?(w=(0,Z.jsx)(Ti,{folderPath:n,existingNames:S,open:u,onOpenChange:d,onCreated:C}),t[25]=n,t[26]=u,t[27]=S,t[28]=C,t[29]=w):w=t[29];let T=c!==null,E;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||l(null)},t[30]=E):E=t[30];let D=c??void 0,O;t[31]!==a||t[32]!==n||t[33]!==T||t[34]!==D?(O=(0,Z.jsx)(Ng,{open:T,onOpenChange:E,kind:`file`,initialDir:n,initialTemplate:D,folderConfig:a}),t[31]=a,t[32]=n,t[33]=T,t[34]=D,t[35]=O):O=t[35];let k;return t[36]!==w||t[37]!==O||t[38]!==y||t[39]!==x?(k=(0,Z.jsxs)(Z.Fragment,{children:[y,x,w,O]}),t[36]=w,t[37]=O,t[38]=y,t[39]=x,t[40]=k):k=t[40],k}function lw(e){return e.name}function uw(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=X(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function dw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pw(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=X(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function mw(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=X(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function hw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gw(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return gl._({id:`xOTzt5`});if(r<60)return gl._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return gl._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?gl._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function _w(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 vw(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)(er,{className:`ml-1 size-3`}):(0,Z.jsx)(fr,{className:`ml-1 size-3`}):(0,Z.jsx)(Xp,{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)(Y,{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 yw(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=jt(),{folderPaths:i,loading:a,pages:o,pageTitles:s,pageMeta:c}=Ps(),l=Ii(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)(su,{className:`size-5 rounded`}),(0,Z.jsx)(su,{className:`h-7 w-48`})]}),(0,Z.jsx)(su,{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)(su,{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)(su,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(Sw)]})]}),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=sw(n,{pages:o,pageTitles:s,pageMeta:c,folderPaths:i}),a=_w(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?_(xw):(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)(yc,{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)(Y,{onClick:()=>p(!0),children:[(0,Z.jsx)(Oe,{className:`size-4`}),(0,Z.jsx)(J,{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)(YC,{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)(cw,{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)(nw,{folderPath:n}),t[44]=n,t[45]=D),S=`rounded-lg border`,y=uw;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)(vw,{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)(mw,{"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)(vw,{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)(mw,{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)(dw,{children:(0,Z.jsxs)(pw,{children:[L,V]})}),t[66]=L,t[67]=V,t[68]=x):x=t[68],v=fw,b=a.length?a.map(bw):(0,Z.jsx)(pw,{children:(0,Z.jsx)(hw,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(J,{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)(Ng,{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 bw(e){return(0,Z.jsxs)(pw,{children:[(0,Z.jsx)(hw,{children:(0,Z.jsxs)(`a`,{href:tu(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)(Sm,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(St,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(hw,{className:`text-muted-foreground`,children:e.kind===`file`?gw(e.modified):`—`})]},e.path)}function xw(e){return e===`asc`?`desc`:`asc`}function Sw(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)(su,{className:`size-4 rounded`}),(0,Z.jsx)(su,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(su,{className:`h-4 w-16`})})]},e)}function Cw(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)(_m,{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)(J,{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=Va(r),t[7]=r,t[8]=h);let g;t[9]===i?g=t[10]:(g=Va(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)(J,{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)(Y,{ref:s,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(ur,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(J,{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 ww(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(Tw),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>be(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(){he(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)(J,{id:`A67Uwj`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{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)(Y,{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 Tw(){return new Set}function Ew(e){let t=(0,$.c)(20),{nav:n}=e,{state:r,refetch:i}=$o(n),a=(0,Q.useRef)(null),o=n.branch,s,c;t[0]===r.phase?(s=t[1],c=t[2]):(s=()=>{r.phase===`resolved`&&a.current?.querySelector(`button`)?.focus()},c=[r.phase],t[0]=r.phase,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c);let l;t[3]===n.path?l=t[4]:(l=function(){window.location.hash=ql(ts(n.path))},t[3]=n.path,t[4]=l);let u=l,d;t[5]!==o||t[6]!==n.kind?(d=function(e){ns.arm({kind:n.kind,path:e,branch:o}),window.location.hash=n.kind===`folder`?ql(e):tu(e)},t[5]=o,t[6]=n.kind,t[7]=d):d=t[7];let f=d,p=r.phase===`pending`?`polite`:void 0,m=r.phase===`resolved`?r.resolution.verdict:void 0,h=r.phase===`pending`?`flex h-full flex-col items-center justify-center gap-3 p-8 text-center text-sm text-muted-foreground`:`flex h-full flex-col items-center justify-center gap-6 p-8 text-center`,g;t[8]!==u||t[9]!==n||t[10]!==f||t[11]!==i||t[12]!==r?(g=(0,Z.jsx)(is,{nav:n,state:r,onBrowseFolder:u,onOpenRenamed:f,onEnableAutoSync:u,onSyncCompleted:i}),t[8]=u,t[9]=n,t[10]=f,t[11]=i,t[12]=r,t[13]=g):g=t[13];let _;return t[14]!==r.phase||t[15]!==p||t[16]!==m||t[17]!==h||t[18]!==g?(_=(0,Z.jsx)(`div`,{ref:a,role:`status`,"aria-live":p,"data-testid":`share-receive-miss-panel`,"data-phase":r.phase,"data-verdict":m,className:h,children:g}),t[14]=r.phase,t[15]=p,t[16]=m,t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function Dw(e){let t=(0,$.c)(9),{text:n}=e,r;t[0]===n?r=t[1]:(r=yo(n),t[0]=n,t[1]=r);let{map:i}=r,a,o;if(t[2]!==i||t[3]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=da(n),r=e.length>0?e:Object.keys(i);if(r.length===0){o=null;break bb0}let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(J,{id:`l_UFPv`}),t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(e,t)=>{let n=i[e];return n===void 0?null:(0,Z.jsx)(Ow,{keyName:e,value:n},`${e}-${t}`)},t[7]=i,t[8]=c),a=(0,Z.jsx)(Cs,{title:s,testId:`readonly-property-panel`,className:`pt-4 pb-4`,children:r.map(c)})}t[2]=i,t[3]=n,t[4]=a,t[5]=o}else a=t[4],o=t[5];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function Ow(e){let t=(0,$.c)(12),{keyName:n,value:r}=e,i=hs[po(r)],a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground`,children:(0,Z.jsx)(i,{className:`size-3.5`})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`flex h-7 w-32 shrink-0 items-center truncate px-2 text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=o);let s;t[4]!==n||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(kw,{keyName:n,value:r})}),t[4]=n,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==n||t[8]!==a||t[9]!==o||t[10]!==s?(c=(0,Z.jsxs)(`div`,{className:`group flex items-start gap-1 py-0.5`,"data-testid":`readonly-property-row`,"data-key":n,children:[a,o,s]}),t[7]=n,t[8]=a,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function kw(e){let t=(0,$.c)(8),{keyName:n,value:r}=e;if(Ss(r)){let e;return t[0]!==n||t[1]!==r?(e=(0,Z.jsx)(vs,{keyName:n,value:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2],e}let i;t[3]===r?i=t[4]:(i=Array.isArray(r)?r.filter(Aw).join(`, `):String(r),t[3]=r,t[4]=i);let a=i,o;return t[5]!==a||t[6]!==n?(o=(0,Z.jsx)(`div`,{className:`flex min-h-7 items-center px-2 py-1 text-sm break-words`,"data-testid":`readonly-property-value`,"data-key":n,children:a}),t[5]=a,t[6]=n,t[7]=o):o=t[7],o}function Aw(e){return typeof e==`string`}function jw(e){let t=(0,$.c)(29),{fileName:n,text:r}=e,i,a,o,s;if(t[0]!==r){let e=Xo(r).body;s=cr,i=nt,a=!1,o=zn().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 d=s(l,u),[f]=(0,Q.useState)(Mw),p=(0,Q.useRef)(null),m,h;t[12]===f?(m=t[13],h=t[14]):(m=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},h=[f],t[12]=f,t[13]=m,t[14]=h),(0,Q.useLayoutEffect)(m,h);let g;t[15]===r?g=t[16]:(g=(0,Z.jsx)(Dw,{text:r}),t[15]=r,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`div`,{className:`tiptap-editor`,children:(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}})}),t[17]=_):_=t[17];let v;t[18]===g?v=t[19]:(v=(0,Z.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1 overflow-auto`,children:[g,_]}),t[18]=g,t[19]=v);let y;t[20]===d?y=t[21]:(y=(0,Z.jsx)(Qn,{editor:d,className:`tiptap-editor-portal-content h-full`}),t[20]=d,t[21]=y);let b;t[22]!==f||t[23]!==y?(b=(0,tm.createPortal)(y,f),t[22]=f,t[23]=y,t[24]=b):b=t[24];let x;return t[25]!==n||t[26]!==v||t[27]!==b?(x=(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:[v,b]}),t[25]=n,t[26]=v,t[27]=b,t[28]=x):x=t[28],x}function Mw(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var Nw=`data-skill-markdown`;function Pw(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=>Qr({scope:n,name:r,path:i},e)},t[0]=r,t[1]=i,t[2]=n,t[3]=o):o=t[3];let s=SS(o);if(s.status===`loading`){let e;return t[4]===a?e=t[5]:(e=(0,Z.jsx)(CS,{fileName:a,dataAttr:Nw}),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)(wS,{fileName:a,dataAttr:Nw,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)(jw,{fileName:a,text:s.content}),t[9]=s.content,t[10]=a,t[11]=c):c=t[11],c}var Fw=new Set([`md`,`mdx`]);function Iw(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=Fw.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)(Pw,{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=>Qr({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)(DS,{fileName:o,extension:c,loadText:u}),t[15]=c,t[16]=o,t[17]=u,t[18]=d):d=t[18],d}function Lw(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var Rw=Lw(()=>n(()=>import(`./SettingsDialogBody-BrRjDYgY.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([87,1,88,15,10,16,48,6,2,3,7,8,49,51,67,53,68,69,9,72,56,57,58,59,60,61,62,63,64,65,66,13,33,70,71,25,47,28,50,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,52,77,78,79,24,80,81,26,82,11,89,36,90,91,92,93,45,94,95,84,29,96,27,34]),import.meta.url));function zw(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=jt(),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)(J,{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)(Y,{variant:`default`,onClick:Bw,children:(0,Z.jsx)(J,{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 Bw(){return window.location.reload()}function Vw(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(I,{fallbackRender:Uw,onError:Hw,children:n}),t[0]=n,t[1]=r),r}function Hw(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function Uw(e){return(0,Z.jsx)(zw,{...e})}function Ww(e=typeof window>`u`?void 0:window.location){return e?.protocol===`file:`}function Gw(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function Kw(e){let t=(0,$.c)(140),{open:n,onOpenChange:r}=e,{_:i}=jt(),{collabUrl:a}=Xe(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l,projectConfig:u,merged:d}=Ru(),{desktopPresent:f}=di(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=a!==null,v=typeof window<`u`&&window.okDesktop!=null,y,b,x,S,C,w;if(t[3]!==i||t[4]!==_||t[5]!==d?.appearance?.colorThemeEnabled||t[6]!==u?.contentRules){let e;t[13]===u?.contentRules?e=t[14]:(e=e=>u?.contentRules?.[e.id]?.enabled===!0,t[13]=u?.contentRules,t[14]=e);let n=ia.filter(e).map(qw),r=d?.appearance?.colorThemeEnabled!==!1,a;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(a=Ww(),t[15]=a):a=t[15];let o=a,s;t[16]===i?s=t[17]:(s=i({id:`7PzzBU`}),t[16]=i,t[17]=s);let c;t[18]===i?c=t[19]:(c=i({id:`Q6hhn8`}),t[18]=i,t[19]=c);let l;t[20]===c?l=t[21]:(l={id:`preferences`,label:c},t[20]=c,t[21]=l);let f;t[22]===i?f=t[23]:(f=i({id:`4KmEoC`}),t[22]=i,t[23]=f);let p;t[24]===f?p=t[25]:(p={id:`hotkeys`,label:f},t[24]=f,t[25]=p);let m;t[26]===i?m=t[27]:(m=i({id:`AeXO77`}),t[26]=i,t[27]=m);let h;t[28]===m?h=t[29]:(h={id:`account`,label:m},t[28]=m,t[29]=h);let g;t[30]===i?g=t[31]:(g=i({id:`ohUJJM`}),t[30]=i,t[31]=g);let T;t[32]===g?T=t[33]:(T={id:`user-plugins-manage`,label:g},t[32]=g,t[33]=T);let E;t[34]===i?E=t[35]:(E=v?[{id:`ai-tools`,label:i({id:`_5qBNl`})}]:[],t[34]=i,t[35]=E);let D;t[36]!==l||t[37]!==p||t[38]!==h||t[39]!==T||t[40]!==E?(D=[l,p,h,T,...E],t[36]=l,t[37]=p,t[38]=h,t[39]=T,t[40]=E,t[41]=D):D=t[41],t[42]!==s||t[43]!==D?(C={id:`user`,label:s,enabled:!0,items:D},t[42]=s,t[43]=D,t[44]=C):C=t[44];let O;t[45]===i?O=t[46]:(O=i({id:`ZWyHmq`}),t[45]=i,t[46]=O);let k;t[47]===i?k=t[48]:(k=i({id:`Nu4DdT`}),t[47]=i,t[48]=k);let A;t[49]===k?A=t[50]:(A={id:`sync`,label:k},t[49]=k,t[50]=A);let j;t[51]===i?j=t[52]:(j=i({id:`A1taO8`}),t[51]=i,t[52]=j);let M;t[53]===j?M=t[54]:(M={id:`search`,label:j},t[53]=j,t[54]=M);let N;t[55]===i?N=t[56]:(N=i({id:`ohUJJM`}),t[55]=i,t[56]=N);let P;t[57]===N?P=t[58]:(P={id:`plugins-manage`,label:N},t[57]=N,t[58]=P);let F,I,L;t[59]===i?(F=t[60],I=t[61],L=t[62]):(F=o?[]:[{id:`link-previews`,label:i({id:`gh27t1`})}],I=v?[{id:`terminal`,label:i({id:`ALhMYW`})}]:[],L=v?[{id:`project-ai-tools`,label:i({id:`crqzW5`})}]:[],t[59]=i,t[60]=F,t[61]=I,t[62]=L);let R;t[63]===i?R=t[64]:(R=i({id:`iTylMl`}),t[63]=i,t[64]=R);let z;t[65]===R?z=t[66]:(z={id:`project-templates`,label:R},t[65]=R,t[66]=z);let B;t[67]===i?B=t[68]:(B=i({id:`PCSkw2`}),t[67]=i,t[68]=B);let V;t[69]===B?V=t[70]:(V={id:`skills`,label:B},t[69]=B,t[70]=V);let H;t[71]===i?H=t[72]:(H=i({id:`3zyg_A`}),t[71]=i,t[72]=H);let U;t[73]===H?U=t[74]:(U={id:`okignore`,label:H},t[73]=H,t[74]=U);let W;t[75]===i?W=t[76]:(W=i({id:`cs4mps`}),t[75]=i,t[76]=W);let G;t[77]===W?G=t[78]:(G={id:`sharing`,label:W},t[77]=W,t[78]=G);let K;t[79]!==A||t[80]!==M||t[81]!==P||t[82]!==F||t[83]!==I||t[84]!==L||t[85]!==z||t[86]!==V||t[87]!==U||t[88]!==G?(K=[A,M,P,...F,...I,...L,z,V,U,G],t[79]=A,t[80]=M,t[81]=P,t[82]=F,t[83]=I,t[84]=L,t[85]=z,t[86]=V,t[87]=U,t[88]=G,t[89]=K):K=t[89],t[90]!==_||t[91]!==O||t[92]!==K?(w={id:`project`,label:O,enabled:_,items:K},t[90]=_,t[91]=O,t[92]=K,t[93]=w):w=t[93],y=`plugins`,t[94]===i?b=t[95]:(b=i({id:`ohUJJM`}),t[94]=i,t[95]=b),x=!0;let q;t[96]!==i||t[97]!==r?(q=r?[{id:`plugin:theme`,label:i({id:`fJ3EbT`})}]:[],t[96]=i,t[97]=r,t[98]=q):q=t[98],S=[..._?n:[],...q],t[3]=i,t[4]=_,t[5]=d?.appearance?.colorThemeEnabled,t[6]=u?.contentRules,t[7]=y,t[8]=b,t[9]=x,t[10]=S,t[11]=C,t[12]=w}else y=t[7],b=t[8],x=t[9],S=t[10],C=t[11],w=t[12];let T;t[99]!==y||t[100]!==b||t[101]!==x||t[102]!==S?(T={id:y,label:b,enabled:x,items:S},t[99]=y,t[100]=b,t[101]=x,t[102]=S,t[103]=T):T=t[103];let E;t[104]===i?E=t[105]:(E=i({id:`nbfdhU`}),t[104]=i,t[105]=E);let D;t[106]!==i||t[107]!==f?(D=[],t[106]=i,t[107]=f,t[108]=D):D=t[108];let O;t[109]!==E||t[110]!==D?(O={id:`integrations`,label:E,enabled:!0,items:D},t[109]=E,t[110]=D,t[111]=O):O=t[111];let k;t[112]!==O||t[113]!==C||t[114]!==w||t[115]!==T?(k=[C,w,T,O],t[112]=O,t[113]=C,t[114]=w,t[115]=T,t[116]=k):k=t[116];let A=k,j;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(On,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[117]=j):j=t[117];let M;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(Dn,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[118]=M):M=t[118];let N;t[119]!==p||t[120]!==A?(N=(0,Z.jsx)(Jw,{groups:A,activeId:p,onSelect:m}),t[119]=p,t[120]=A,t[121]=N):N=t[121];let P;t[122]===i?P=t[123]:(P=i({id:`OXb_Df`}),t[122]=i,t[123]=P);let F;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Zw,{}),t[124]=F):F=t[124];let I=s?o:null,L;t[125]!==p||t[126]!==c||t[127]!==l||t[128]!==I?(L=(0,Z.jsx)(Vw,{children:(0,Z.jsx)(Q.Suspense,{fallback:F,children:(0,Z.jsx)(Rw,{activeId:p,userBinding:I,okignoreBinding:c,okignoreSynced:l})})}),t[125]=p,t[126]=c,t[127]=l,t[128]=I,t[129]=L):L=t[129];let R;t[130]!==P||t[131]!==L?(R=(0,Z.jsx)(`section`,{"aria-label":P,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:L}),t[130]=P,t[131]=L,t[132]=R):R=t[132];let z;t[133]!==N||t[134]!==R?(z=(0,Z.jsxs)(kn,{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:[j,M,N,R]}),t[133]=N,t[134]=R,t[135]=z):z=t[135];let B;return t[136]!==r||t[137]!==n||t[138]!==z?(B=(0,Z.jsx)(Nn,{open:n,onOpenChange:r,children:z}),t[136]=r,t[137]=n,t[138]=z,t[139]=B):B=t[139],B}function qw(e){return{id:`plugin:${e.id}`,label:e.label}}function Jw(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:i}=e,{_:a}=jt(),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)(Xw,{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)(Yw,{}),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 Yw(){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=Gw(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:X(`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)(J,{id:`_PACVa`}),(0,Z.jsx)(fs,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=s):s=e[3],s}function Xw(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=X(`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)(J,{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:X(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],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 Zw(){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)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(su,{className:`h-5 w-32`}),r=(0,Z.jsx)(su,{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)(su,{className:`h-9 w-full`}),(0,Z.jsx)(su,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function Qw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(lS,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function $w(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)(pS,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function eT(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=X(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(_S,{"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 tT(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var nT=un(`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 rT(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=X(nT({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:iT,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function iT(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}un(`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 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=X(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oT(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ml,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sT(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:u,onQueryChange:d,onReplacementChange:f,onReplaceOpenChange:p,onCaseSensitiveChange:m,onWholeWordChange:h,onNext:g,onPrevious:_,onReplaceCurrent:v,onReplaceAll:y,onClose:b}=e,{_:x}=jt(),S=r.length>0,C=u>0,w;t[0]!==x||t[1]!==c||t[2]!==C||t[3]!==S||t[4]!==u?(w=S?C?`${c} / ${u}`:x({id:`Ev2r9A`}):``,t[0]=x,t[1]=c,t[2]=C,t[3]=S,t[4]=u,t[5]=w):w=t[5];let T=w,E;t[6]!==b||t[7]!==g||t[8]!==_?(E=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?_():g()):e.key===`Escape`&&(e.preventDefault(),b())},t[6]=b,t[7]=g,t[8]=_,t[9]=E):E=t[9];let D=E,O;t[10]!==b||t[11]!==v?(O=function(e){e.key===`Enter`?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),b())},t[10]=b,t[11]=v,t[12]=O):O=t[12];let k=O,A;t[13]===x?A=t[14]:(A=x({id:`MVxpbf`}),t[13]=x,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=j):j=t[15];let M;t[16]===d?M=t[17]:(M=e=>d(e.target.value),t[16]=d,t[17]=M);let N;t[18]===x?N=t[19]:(N=x({id:`KujtjC`}),t[18]=x,t[19]=N);let P;t[20]!==n||t[21]!==D||t[22]!==r||t[23]!==M||t[24]!==N?(P=(0,Z.jsx)(oT,{ref:n,id:`ok-find-input`,value:r,onChange:M,onKeyDown:D,placeholder:N,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=D,t[22]=r,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]===x?F=t[27]:(F=x({id:`-8PP0T`}),t[26]=x,t[27]=F);let I;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(rm,{"aria-hidden":`true`}),t[28]=I):I=t[28];let L;t[29]!==o||t[30]!==m||t[31]!==F?(L=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(oa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":F,pressed:o,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:I})}),t[29]=o,t[30]=m,t[31]=F,t[32]=L):L=t[32];let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=R):R=t[33];let z;t[34]===L?z=t[35]:(z=(0,Z.jsxs)(Sn,{children:[L,R]}),t[34]=L,t[35]=z);let B;t[36]===x?B=t[37]:(B=x({id:`_7UQ7y`}),t[36]=x,t[37]=B);let V;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(bh,{"aria-hidden":`true`}),t[38]=V):V=t[38];let H;t[39]!==h||t[40]!==B||t[41]!==s?(H=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(oa,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":B,pressed:s,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:V})}),t[39]=h,t[40]=B,t[41]=s,t[42]=H):H=t[42];let U;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=U):U=t[43];let W;t[44]===H?W=t[45]:(W=(0,Z.jsxs)(Sn,{children:[H,U]}),t[44]=H,t[45]=W);let G;t[46]!==z||t[47]!==W?(G=(0,Z.jsxs)(rT,{align:`inline-end`,className:`gap-0.5`,children:[z,W]}),t[46]=z,t[47]=W,t[48]=G):G=t[48];let K;t[49]!==G||t[50]!==P?(K=(0,Z.jsxs)(tT,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[P,G]}),t[49]=G,t[50]=P,t[51]=K):K=t[51];let q;t[52]===T?q=t[53]:(q=(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:T}),t[52]=T,t[53]=q);let ee;t[54]===x?ee=t[55]:(ee=x({id:`oqB2ez`}),t[54]=x,t[55]=ee);let te=!C,ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(l,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=ne):ne=t[56];let re;t[57]!==_||t[58]!==ee||t[59]!==te?(re=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:te,onClick:_,children:ne})}),t[57]=_,t[58]=ee,t[59]=te,t[60]=re):re=t[60];let ie;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=ie):ie=t[61];let ae;t[62]===re?ae=t[63]:(ae=(0,Z.jsxs)(Sn,{children:[re,ie]}),t[62]=re,t[63]=ae);let oe;t[64]===x?oe=t[65]:(oe=x({id:`SiUUCS`}),t[64]=x,t[65]=oe);let se=!C,ce;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(ks,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=ce):ce=t[66];let le;t[67]!==g||t[68]!==oe||t[69]!==se?(le=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":oe,disabled:se,onClick:g,children:ce})}),t[67]=g,t[68]=oe,t[69]=se,t[70]=le):le=t[70];let ue;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=ue):ue=t[71];let de;t[72]===le?de=t[73]:(de=(0,Z.jsxs)(Sn,{children:[le,ue]}),t[72]=le,t[73]=de);let fe=a?`secondary`:`ghost`,pe;t[74]!==x||t[75]!==a?(pe=x(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=x,t[75]=a,t[76]=pe):pe=t[76];let me=a?`ok-replace-input`:void 0,he;t[77]!==p||t[78]!==a?(he=()=>p(!a),t[77]=p,t[78]=a,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Xm,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":me,onClick:he,children:ge})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===a?ve=t[88]:(ve=(0,Z.jsx)(bn,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Sn,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==x||t[93]!==k||t[94]!==C||t[95]!==y||t[96]!==v||t[97]!==f||t[98]!==a||t[99]!==i?(be=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(ml,{id:`ok-replace-input`,value:i,onChange:e=>f(e.target.value),onKeyDown:k,placeholder:x({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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":x({id:`bS_boY`}),disabled:!C,onClick:v,children:(0,Z.jsx)(Xm,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":x({id:`dr1vFs`}),disabled:!C,onClick:y,children:(0,Z.jsx)(Ym,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=x,t[93]=k,t[94]=C,t[95]=y,t[96]=v,t[97]=f,t[98]=a,t[99]=i,t[100]=be):be=t[100];let xe;t[101]===x?xe=t[102]:(xe=x({id:`wJo9oS`}),t[101]=x,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(sl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==b||t[105]!==xe?(Ce=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:b,children:Se})}),t[104]=b,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Sn,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==K||t[111]!==q||t[112]!==ae||t[113]!==de||t[114]!==A||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":A,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:[j,K,q,ae,de,ye,be,Te]}),t[110]=K,t[111]=q,t[112]=ae,t[113]=de,t[114]=A,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var cT={current:0,total:0},lT=120,uT=100;function dT(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?z(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(u,n,fT)}function fT(){return null}function pT(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>lT||i.includes(`
|
|
29
29
|
`)?null:i}function mT(e){let t=fe(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function hT(e,t){return e.current===t.current&&e.total===t.total}function gT(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(cT)}function _T(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=Ln(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 vT(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=dT(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)(cT),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(bT))},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(yT)},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(cT);return}if(!u.open||r){i.commands.clearFindMatches(),p(cT);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=mT(i);p(t=>hT(t,e)?t:e)},uT);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=fe(i.state),t=mT(i);p(e=>hT(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=pT(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(du(t,`find`)){t.preventDefault(),u.open?gT(i,d,p):e(!1);return}if(du(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=du(t,`find-next`),n=du(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&_T(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),gT(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=fe(i.state),t=mT(i);p(e=>hT(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(){gT(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()&&_T(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()&&_T(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)&&_T(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)&&_T(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,ee;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})),ee=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=ee):(W=t[63],G=t[64],K=t[65],q=t[66],ee=t[67]);let te;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?(te=(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)(sT,{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:ee,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]=te):te=t[80],te}function yT(e){return{...e,open:!1,activeIndex:0}}function bT(e){return{...e,activeIndex:0}}var xT=300;function ST(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(rl),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(rl);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(il(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,xT)};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 CT(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function wT(e){let t=(0,$.c)(8),{poolEntries:n}=Xe(),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=()=>CT(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(CT(i));let t=()=>s(CT(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 TT(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>al(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Jc,r)}var ET=`ok-doc-panel-width-v1`;function DT(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function OT(e){try{let t=(e??localStorage).getItem(ET);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?DT(n):320}catch{return 320}}function kT(e,t){try{(t??localStorage).setItem(ET,String(DT(e)))}catch{}}function AT(){try{return typeof localStorage>`u`?320:OT()}catch{return 320}}var jT=1024,MT=1280,NT={left:jT,right:MT};function PT(e,t,n){return e==null?t>=NT[n]?`above`:`below`:`embedded`}function FT(e){return e===`above`?`open`:`collapsed`}var IT=`ok-sidebar-pins-v2`;function LT(e){return e===`open`||e===`collapsed`}function RT(e){return e===`above`||e===`below`||e===`embedded`}function zT(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!RT(e)||!LT(t[e]))return!1;return!0}function BT(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return zT(n.left)&&(r.left=n.left),zT(n.right)&&(r.right=n.right),r}function VT(e){try{let t=(e??localStorage).getItem(IT);return t==null?{}:BT(t)}catch{return{}}}function HT(e,t){try{t.setItem(IT,JSON.stringify(e))}catch{}}function UT(e,t,n){return n[e]?.[t]??FT(t)}function WT(e,t,n,r){let i=r??localStorage,a=VT(i);return a[e]={...a[e],[t]:n},HT(a,i),a}var GT=`ok-terminal-width-v1`;function KT(e){return Number.isFinite(e)?e<320?320:Math.round(e):480}function qT(e){try{let t=(e??localStorage).getItem(GT);if(t==null)return 480;let n=Number.parseInt(t,10);return Number.isFinite(n)?KT(n):480}catch{return 480}}function JT(e,t){try{(t??localStorage).setItem(GT,String(KT(e)))}catch{}}function YT(){try{return typeof localStorage>`u`?480:qT()}catch{return 480}}function XT(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`?ZT: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 ZT(e){return e===`synced`?`synced`:`connected`}function QT(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function $T(e){let t=(0,$.c)(21),{path:n,onRemove:r}=e,{_:i}=jt(),a,o;t[0]!==i||t[1]!==n?(a=QT(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)(Te,{path:n,className:`size-3`,showExtensionBadge:!1})}),t[6]=n,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sl,{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)(Y,{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 eE(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=X(`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)($T,{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 tE(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,{_}=jt(),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)(Y,{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)(ks,{"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)(jr,{asChild:!0,children:(0,Z.jsx)(Y,{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:[b?(0,Z.jsxs)(Kr,{"aria-label":_({id:`ALhMYW`}),children:[(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`ALhMYW`})}),y?y.map(e=>(0,Z.jsxs)(Gr,{onSelect:e.onSelect,"data-testid":C(e.cli),"aria-label":e.ariaLabel,children:[(0,Z.jsx)(rc,{id:Ws(e.cli),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.label}),e.selected?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.cli)):c?(0,Z.jsxs)(Gr,{onSelect:c.onSelect,"data-testid":C(`claude`),"aria-label":_({id:`AcK_r0`}),children:[(0,Z.jsx)(rc,{id:Ws(`claude`),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`fcgvCA`})}),c.selected?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]}):null]}):null,v?(0,Z.jsxs)(Z.Fragment,{children:[b?(0,Z.jsx)(Vr,{}):null,(0,Z.jsxs)(Kr,{"aria-label":_({id:`BBqGS9`}),children:[(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`BBqGS9`})}),a.map(e=>(0,Z.jsxs)(Gr,{onSelect:()=>s(e),"data-testid":m.option(e.id),children:[(0,Z.jsx)(rc,{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)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]})]}):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)(qr,{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)($r,{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)(eC,{children:[w,k]}),t[32]=w,t[33]=k,t[34]=A):A=t[34],A}var nE=`ok-onboarding-card-v1`,rE={initialized:!1,steps:{file:!1,askedAi:!1},fileBaseline:0,dismissed:!1,completed:!1};function iE(e){return e===!0}function aE(e){if(typeof e!=`object`||!e)return rE;let t=e,n=typeof t.steps==`object`&&t.steps!==null?t.steps:{};return{initialized:iE(t.initialized),steps:{file:iE(n.file),askedAi:iE(n.askedAi)},fileBaseline:typeof t.fileBaseline==`number`&&Number.isFinite(t.fileBaseline)&&t.fileBaseline>=0?t.fileBaseline:0,dismissed:iE(t.dismissed),completed:iE(t.completed)}}function oE(e){try{let t=(e??localStorage).getItem(nE);return t==null?rE:aE(JSON.parse(t))}catch(e){return console.warn(`[onboarding-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),rE}}function sE(e,t){try{(t??localStorage).setItem(nE,JSON.stringify(e))}catch(e){console.warn(`[onboarding-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function cE(e){let t=oE(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,sE(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},activate(e=0){t.initialized||a({...t,initialized:!0,fileBaseline:e})},markStepComplete(e){t.steps[e]||a({...t,steps:{...t.steps,[e]:!0}})},dismiss(){t.dismissed||a({...t,dismissed:!0})},markCompleted(){t.completed||a({...t,completed:!0})},install(){r||(r=!0,t=oE(e),i())}}}var lE=cE();function uE(e){let t=e===void 0?lE:e;return(0,Q.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function dE(){lE.install()}function fE(e){return Sl(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}async function pE(){let e=await fetch(`/api/documents`);if(!e.ok)throw Error(`documents request failed: ${e.status}`);let t=await e.json(),n=la.safeParse(t);if(!n.success)throw Error(`documents response did not match schema`,{cause:n.error});return fE(n.data.documents)}async function mE(e=lE){let t=e.getSnapshot();if(!(t.steps.file||!t.initialized))try{await pE()>t.fileBaseline&&e.markStepComplete(`file`)}catch(e){console.warn(`[onboarding-signals] file-step count read failed; leaving step incomplete`,e)}}function hE(e=lE){e.getSnapshot().initialized&&e.markStepComplete(`askedAi`)}var gE=5200,_E=500,vE=/\.(md|mdx)$/i;function yE(e,t){return vE.test(e)?e:t?`${e}${t}`:hc(e)}function bE(e){return vE.test(e)?e.replace(vE,``):null}function xE(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function SE(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(CE),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 CE(){return typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function wE(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),gE);return()=>clearTimeout(e)}let e=setTimeout(()=>{i(TE),o(!0)},_E);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 TE(e){return e+1}function EE(e){let t=(0,$.c)(150),{docName:n,surface:r,folderPath:i,dismissed:a,onDismiss:o,onReopen:s}=e,c=a===void 0?!1:a,{_:l}=jt(),u=i!==void 0,d=u?null:n??null,f=r??`wysiwyg`,p=SE(),m=ac(),{pageMeta:h}=Ps(),{states:g}=ec(),{dispatch:_}=Ls(),v=Ks(),[y]=(0,Q.useState)(LE),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(!1),E=(0,Q.useRef)(null),D=(0,Q.useRef)(null),[O]=(0,Q.useState)(IE),k,A;t[0]!==c||t[1]!==n||t[2]!==u||t[3]!==r?(k=()=>{if(u||n==null)return;let e=document.documentElement,t=PE,i=()=>{r===`wysiwyg`&&requestAnimationFrame(()=>{let e=z(n),t=D.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=D.current;if(c||!a){t(),e.style.removeProperty(`--ask-composer-height`);return}let o=()=>{t(),e.style.setProperty(`--ask-composer-height`,`${a.offsetHeight+56}px`)};o(),i();let s=new ResizeObserver(o);return s.observe(a),()=>{s.disconnect(),t(),e.style.removeProperty(`--ask-composer-height`)}},A=[c,r,n,u],t[0]=c,t[1]=n,t[2]=u,t[3]=r,t[4]=k,t[5]=A):(k=t[4],A=t[5]),(0,Q.useEffect)(k,A);let j=(0,Q.useRef)(c),M=(0,Q.useRef)(s),N;t[6]!==c||t[7]!==s?(N=()=>{j.current=c,M.current=s},t[6]=c,t[7]=s,t[8]=N):N=t[8],(0,Q.useEffect)(N);let P,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>ie(()=>{j.current?M.current?.():E.current?.focus()}),F=[],t[9]=P,t[10]=F):(P=t[9],F=t[10]),(0,Q.useEffect)(P,F);let I;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[11]=I):I=t[11],(0,Q.useEffect)(ME,I);let L=(0,Q.useRef)(c),R,B;t[12]===c?(R=t[13],B=t[14]):(R=()=>{let e=L.current;L.current=c,e&&!c&&E.current?.focus()},B=[c],t[12]=c,t[13]=R,t[14]=B),(0,Q.useEffect)(R,B);let V;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(V=[],t[15]=V):V=t[15];let[H,U]=(0,Q.useState)(V),[W,G]=(0,Q.useState)(jE),K;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(K=[],t[16]=K):K=t[16];let[q,ee]=(0,Q.useState)(K),te;t[17]!==n||t[18]!==u||t[19]!==h?(te=u||n==null?``:yE(n,h.get(n)?.docExt),t[17]=n,t[18]=u,t[19]=h,t[20]=te):te=t[20];let ne=te,re,ae;t[21]!==ne||t[22]!==W||t[23]!==u||t[24]!==S?(re=()=>{u||S||U(e=>{if(W.has(ne))return e;let t=bE(ne),n=t===null?e:e.filter(e=>e===ne||bE(e)!==t);return n.includes(ne)?n.length===e.length?e:n:[...n,ne]})},ae=[u,S,ne,W],t[21]=ne,t[22]=W,t[23]=u,t[24]=S,t[25]=re,t[26]=ae):(re=t[25],ae=t[26]),(0,Q.useEffect)(re,ae);let oe;t[27]!==W||t[28]!==u||t[29]!==i||t[30]!==q||t[31]!==H?(oe=u?i&&!W.has(i)&&!q.includes(i)?[i]:[]:H.filter(e=>!W.has(e)&&!q.includes(e)),t[27]=W,t[28]=u,t[29]=i,t[30]=q,t[31]=H,t[32]=oe):oe=t[32];let se=oe,ce=bs(d,f),le=bs(d,`frontmatter`),[ue,de]=(0,Q.useState)(null),[fe,pe]=(0,Q.useState)(!1),me,he;t[33]===ce?(me=t[34],he=t[35]):(me=()=>{ce&&de(ce)},he=[ce],t[33]=ce,t[34]=me,t[35]=he),(0,Q.useEffect)(me,he);let ge,_e;t[36]===le?(ge=t[37],_e=t[38]):(ge=()=>{le&&de(le)},_e=[le],t[36]=le,t[37]=ge,t[38]=_e),(0,Q.useEffect)(ge,_e);let ve=b??y,ye=v===null?null:Dv(ve),be=v!==null&&ve===null?Mv(null,v.installedClis):null,xe=ye??be,Se=xe!==null,Ce;t[39]!==ve||t[40]!==Se||t[41]!==g?(Ce=Se?null:jv(g,ve),t[39]=ve,t[40]=Se,t[41]=g,t[42]=Ce):Ce=t[42];let we=Ce,Te=!w&&(!S||ue!==null)&&(Se||we!==null),Ee;t[43]===g?Ee=t[44]:(Ee=Bs.filter(e=>g[e.id]?.installed===!0),t[43]=g,t[44]=Ee);let De=Ee,Oe;t[45]===g?Oe=t[46]:(Oe=Bs.some(e=>g[e.id]?.installed==null),t[45]=g,t[46]=Oe);let ke=Oe,Ae=v===null?void 0:Xs(v.installedClis,xe).map(e=>{let{displayName:t}=ka[e];return{cli:e,label:t,ariaLabel:l({id:`QYfQdv`,values:{displayName:t}}),selected:xe===e,onSelect:()=>ze(e)}}),je;t[47]===l?je=t[48]:(je=l({id:`KYSocE`}),t[47]=l,t[48]=je);let Me;t[49]===l?Me=t[50]:(Me=l({id:`7Ongq0`}),t[49]=l,t[50]=Me);let Ne;t[51]===l?Ne=t[52]:(Ne=l({id:`HPTPGr`}),t[51]=l,t[52]=Ne);let Pe;t[53]===l?Pe=t[54]:(Pe=l({id:`qiRoLb`}),t[53]=l,t[54]=Pe);let Fe;t[55]!==je||t[56]!==Me||t[57]!==Ne||t[58]!==Pe?(Fe=[je,Me,Ne,Pe],t[55]=je,t[56]=Me,t[57]=Ne,t[58]=Pe,t[59]=Fe):Fe=t[59];let Ie=wE(Fe,!p&&S&&!c),Le;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(Le=e=>{x(e.id),Av(e.id)},t[60]=Le):Le=t[60];let Re=Le,ze=e=>{let t=Ev(e);x(t),Av(t)},Be;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>{E.current?.clear(),de(null),pe(!1),U([]),G(new Set),XS()},t[61]=Be):Be=t[61];let Ve=Be,He;t[62]!==l||t[63]!==_||t[64]!==we||t[65]!==xe||t[66]!==v?(He=e=>{if(e===null){cl.error(l({id:`y8B54M`}));return}if(xe!==null&&v!==null){try{v.launchInTerminal(e,xe)}catch{cl.error(l({id:`jBVUXo`}));return}hE(),Ve();return}we!==null&&(T(!0),_(we.id,e).then(AE).finally(()=>{T(!1),Ve()}))},t[62]=l,t[63]=_,t[64]=we,t[65]=xe,t[66]=v,t[67]=He):He=t[67];let Ue=He,We;t[68]!==ne||t[69]!==Te||t[70]!==Ue||t[71]!==n||t[72]!==se||t[73]!==u||t[74]!==i||t[75]!==h||t[76]!==ue||t[77]!==m?(We=()=>{if(!Te)return;let{instruction:e,mentions:t}=E.current?.getContent()??{instruction:``,mentions:[]};if(u){Ue(Zs({docName:null,folderRelativePath:i,workspace:m,instruction:e,mentions:[...new Set([...se,...t])].filter(e=>e!==i)}));return}let r=ue?Uu(ue):void 0,a=ue?.docName??null,o=ue?a:se.includes(ne)?n??null:null,s=o===null?null:yE(o,h.get(o)?.docExt),c=[...new Set([...se,...t])].filter(e=>e!==s);Ue(Zs({docName:o,...s===null?{}:{docRelativePath:s},workspace:m,instruction:e,mentions:c,selection:r}))},t[68]=ne,t[69]=Te,t[70]=Ue,t[71]=n,t[72]=se,t[73]=u,t[74]=i,t[75]=h,t[76]=ue,t[77]=m,t[78]=We):We=t[78];let Ge=We;if(c)return null;let Ke=``,qe=``;if(ue){let e;t[79]!==h||t[80]!==ue?(e=Wu(ue,yE(ue.docName,h.get(ue.docName)?.docExt).split(`/`).pop()??``),t[79]=h,t[80]=ue,t[81]=e):e=t[81],Ke=e;let n;t[82]===ue.markdown?n=t[83]:(n=Gu(ue.markdown),t[82]=ue.markdown,t[83]=n),qe=n}let Je;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(Je=e=>QS(e,E),t[84]=Je):Je=t[84];let Ye;t[85]!==l||t[86]!==u||t[87]!==o?(Ye=u?null:(0,Z.jsx)(Y,{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)(ks,{className:`size-3.5`,"aria-hidden":!0})}),t[85]=l,t[86]=u,t[87]=o,t[88]=Ye):Ye=t[88];let Xe;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>G(t=>{let n=new Set(t);return n.add(e),n}),t[89]=Xe):Xe=t[89];let Ze;t[90]!==l||t[91]!==Ke||t[92]!==qe||t[93]!==ue||t[94]!==fe?(Ze=ue?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-testid":`composer-selection-pill`,title:Ke,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)(Y,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":l({id:`irrm_E`}),onClick:()=>{de(null),pe(!1)},className:`group/remove relative size-3.5 shrink-0 rounded-sm text-muted-foreground/80 hover:text-foreground`,children:[(0,Z.jsx)(hh,{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)(sl,{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)(Y,{type:`button`,variant:`ghost`,"aria-expanded":fe,"aria-label":l(fe?{id:`UaDyeb`}:{id:`eTL5y9`}),onClick:()=>pe(kE),"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:Ke})})]}),fe&&qe!==``?(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:qe}):null]}):null,t[90]=l,t[91]=Ke,t[92]=qe,t[93]=ue,t[94]=fe,t[95]=Ze):Ze=t[95];let Qe;t[96]!==se||t[97]!==Ze?(Qe=(0,Z.jsx)(eE,{files:se,onRemoveFile:Xe,children:Ze}),t[96]=se,t[97]=Ze,t[98]=Qe):Qe=t[98];let $e;t[99]===l?$e=t[100]:($e=l({id:`xWEvuo`}),t[99]=l,t[100]=$e);let et;t[101]!==O||t[102]!==Ge||t[103]!==$e?(et=(0,Z.jsx)(yC,{ref:E,ariaLabel:$e,onEmptyChange:C,onContentChange:YS,onMentionsChange:ee,onSubmit:Ge,initialDoc:O,className:`max-h-[200px] overflow-y-auto text-base md:text-sm`}),t[101]=O,t[102]=Ge,t[103]=$e,t[104]=et):et=t[104];let tt;t[105]!==S||t[106]!==p||t[107]!==Ie?(tt=S?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:X(`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`,Ie.visible?`opacity-100`:`opacity-0`),children:Ie.text}):null,t[105]=S,t[106]=p,t[107]=Ie,t[108]=tt):tt=t[108];let nt;t[109]!==et||t[110]!==tt?(nt=(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[et,tt]}),t[109]=et,t[110]=tt,t[111]=nt):nt=t[111];let rt;t[112]!==we||t[113]!==xe?(rt=xe===null?we?(0,Z.jsx)(rc,{id:we.id,className:`size-4`,"aria-hidden":!0}):null:(0,Z.jsx)(rc,{id:Ws(xe),className:`size-4`,"aria-hidden":!0}),t[112]=we,t[113]=xe,t[114]=rt):rt=t[114];let it;t[115]!==we||t[116]!==xe?(it=(0,Z.jsx)(`span`,{children:xe===null?we?(0,Z.jsx)(J,{id:`nUNZL4`,values:{0:we.displayName}}):(0,Z.jsx)(J,{id:`F-vBv0`}):(0,Z.jsx)(J,{id:`ti6aF_`,values:{0:ka[xe].displayName}})}),t[115]=we,t[116]=xe,t[117]=it):it=t[117];let at;t[118]===w?at=t[119]:(at=w?(0,Z.jsx)(Ic,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t[118]=w,t[119]=at);let ot;t[120]!==rt||t[121]!==it||t[122]!==at?(ot=(0,Z.jsxs)(Z.Fragment,{children:[rt,it,at]}),t[120]=rt,t[121]=it,t[122]=at,t[123]=ot):ot=t[123];let st=!Te,ct=Se?null:we?.id??null,lt;t[124]===ke?lt=t[125]:(lt=(0,Z.jsx)(`p`,{className:`px-2 py-1.5 text-sm text-muted-foreground`,"aria-live":`polite`,children:ke?(0,Z.jsx)(J,{id:`EcR0fl`}):(0,Z.jsx)(J,{id:`l6OXqI`})}),t[124]=ke,t[125]=lt);let ut;t[126]===l?ut=t[127]:(ut=l({id:`nskygk`}),t[126]=l,t[127]=ut);let dt;t[128]===Symbol.for(`react.memo_cache_sentinel`)?(dt={primary:`ask-ai-send`,trigger:`ask-ai-agent-trigger`,menu:`ask-ai-agent-menu`,option:OE,terminal:DE},t[128]=dt):dt=t[128];let ft;t[129]!==Ae||t[130]!==Re||t[131]!==De||t[132]!==Ge||t[133]!==ot||t[134]!==st||t[135]!==ct||t[136]!==lt||t[137]!==ut?(ft=(0,Z.jsx)(tE,{primary:ot,onPrimary:Ge,primaryDisabled:st,installedTargets:De,selectedTargetId:ct,onSelectTarget:Re,terminals:Ae,menuEmptyState:lt,triggerAriaLabel:ut,testIds:dt}),t[129]=Ae,t[130]=Re,t[131]=De,t[132]=Ge,t[133]=ot,t[134]=st,t[135]=ct,t[136]=lt,t[137]=ut,t[138]=ft):ft=t[138];let pt;t[139]!==nt||t[140]!==ft?(pt=(0,Z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[nt,ft]}),t[139]=nt,t[140]=ft,t[141]=pt):pt=t[141];let mt;t[142]!==Ye||t[143]!==Qe||t[144]!==pt?(mt=(0,Z.jsxs)(`div`,{ref:D,onMouseDown:Je,className:`pointer-events-auto group relative flex cursor-text 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:[Ye,Qe,pt]}),t[142]=Ye,t[143]=Qe,t[144]=pt,t[145]=mt):mt=t[145];let ht=mt;if(u){let e;return t[146]===ht?e=t[147]:(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:ht})}),t[146]=ht,t[147]=e),e}let gt;return t[148]===ht?gt=t[149]:(gt=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-[var(--conflict-footer-height,0px)] 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:ht}),t[148]=ht,t[149]=gt),gt}function DE(e){return e===`claude`?`ask-ai-agent-option-terminal`:`ask-ai-agent-option-terminal-${e}`}function OE(e){return`ask-ai-agent-option-${e}`}function kE(e){return!e}function AE(e){e.ok&&hE()}function jE(){return new Set}function ME(){let e=NE;return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})}function NE(e){du(e,`open-ask-ai`)&&(xE(e.target)||(e.preventDefault(),d()))}function PE(){let e=[...document.querySelectorAll(`.editor-doc-scroll`)].filter(FE);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 FE(e){let t=e.scrollHeight-e.clientHeight;return t>0&&e.scrollTop>=t-40}function IE(){return JS().doc??void 0}function LE(){return kv()}function RE(e){return!e.terminalVisible&&!e.isEmbedded&&e.activeDocName!==null}function zE(e){return!e.terminalVisible&&!e.isEmbedded}function BE(e,t={}){let n=C(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var VE=200,HE=`Outside any block`;function UE(e){let t=(0,$.c)(5),{editor:n}=e,r=Et(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?WE(n,r):o.current?HE:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},VE),()=>{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 WE(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=BE(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=BE(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}`}}var GE=!1;function KE(e,t,n,r){let i=e[t];if(typeof i!=`function`){console.warn(`[cold-mount-instrumentation] target missing method "${t}"`);return}e[t]=function(...e){let t=performance.now(),a,o=!1;try{return a=i.apply(this,e),o=!0,a}finally{let e=performance.now()-t,i;if(o&&r)try{i=r(this,a,t,e)}catch(e){i={"instrumentation-error":e instanceof Error?e.message:String(e)}}try{Ul(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function qE(e){return e?.doc?typeof e.doc.nodeSize==`number`?e.doc.nodeSize:e.doc.content&&typeof e.doc.content.size==`number`?e.doc.content.size:null:null}var JE=0,YE=0,XE=0,ZE=0,QE=null,$E=[`linkResolutionDecoration$`],eD=new WeakSet,tD=new WeakSet;function nD(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function rD(){return!1}function iD(){return!rD()}function aD(e,t){if(iD())return t;let n=`ok/cold/nodeview-factory-${nD(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Ul(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function oD(e){if(iD())return;let t=e.state.plugins;for(let e of t){if(tD.has(e))continue;let t=e.spec?.key?.key;if(!t||!$E.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){tD.add(e);continue}let i=`ok/cold/decoration-${nD(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Ul(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},tD.add(e)}}function sD(e){if(iD())return;let t=e._props?.nodeViews;if(!(!t||typeof t!=`object`))for(let[e,n]of Object.entries(t)){if(typeof n!=`function`||n.__okWrapped===!0)continue;let r=aD(e,n);r.__okWrapped=!0,t[e]=r}}function cD(e){return iD()?e:e.map(e=>{let t=e.name??`unknown`,n=nD(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ul(`ok/cold/ext-${n}-on-before-create`,{ext:t,hook:`onBeforeCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ul(`ok/cold/ext-${n}-on-create`,{ext:t,hook:`onCreate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onUpdate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ul(`ok/cold/ext-${n}-on-update`,{ext:t,hook:`onUpdate`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}},onDestroy(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ul(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function lD(){if(!GE){GE=!0,KE(io.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return iD()||(QE=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:qE(i.editorState),durationMs:r}}),KE(io.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!iD()&&!eD.has(e)&&t.view&&(oD(t.view),sD(t.view),eD.add(e)),{docSize:qE(t.editorState)}}),KE(io.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{ZE+=1;let i=e;return!iD()&&i.view&&sD(i.view),{docSize:qE(i.view),seq:ZE,durationMs:r}}),KE(Ba.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(YE+=1,{seq:YE,docSize:qE(e.state),durationMs:r})),KE(Ba.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(XE+=1,{seq:XE,docSize:qE(e.state),durationMs:r})),KE(Ct.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{JE+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:JE,topLevelYElements:a,durationMs:r}}),KE(sr.prototype,`init`,`ok/cold/ec-init`,e=>({editorPresent:!!e.props?.editor}));try{typeof PerformanceObserver<`u`&&new PerformanceObserver(e=>{for(let t of e.getEntries()){let e=t.name;if((e===`first-paint`||e===`first-contentful-paint`)&&(Ul(e===`first-paint`?`ok/cold/paint-fp`:`ok/cold/paint-fcp`,{entryType:t.entryType,startTime:Math.round(t.startTime*1e3)/1e3},{startTime:t.startTime,duration:0}),!iD()&&e===`first-paint`&&QE!==null)){let e=QE,n=Math.max(0,t.startTime-e);Ul(`ok/cold/append-to-paint`,{paintEntryType:t.entryType,durationMs:Math.round(n*1e3)/1e3,paintAt:Math.round(t.startTime*1e3)/1e3},{startTime:e,duration:n}),QE=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}function uD(){let[e]=(0,Q.useState)(Ga);return e}function dD({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Ha(e.display_name),color:uo(e.id,fa),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:uo(e.id,fa),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function fD(e,t){return e>t}function pD(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 mD=3,hD=6e4;function gD(e,t){let n=0;for(let r of e)t-r<hD&&(n+=1);return n<mD}var _D=new Map;function vD(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 yD(e){let t=_.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function bD(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=_.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){Ul.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=>{fD(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!fD(i,a)||l!==null&&yD(l.state))return;o=!0;let e=Date.now();for(let[t,n]of _D)n.every(t=>e-t>=hD)&&_D.delete(t);let t=(_D.get(n)??[]).filter(t=>e-t<hD);if(!gD(t,e)){_D.set(n,t),Ul.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),_D.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,Ul.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==_&&vD(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ja({state:{init:()=>null,apply:e=>(pD(e.getMeta(_))&&(a=i,o&&Ul.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!fD(i,a)||yD(t)?!0:e.getMeta(_)!==void 0,view:e=>{let r=t.doc;return r==null?(Ul.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 xD(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 SD=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&&Ya(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(mr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Cr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_r(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Sr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(hr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(vr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(yr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(xr(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=xa(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof Da){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 fo){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():xD(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&gr(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()}},CD=e=>new ja({key:typeof e.pluginKey==`string`?new Ia(e.pluginKey):e.pluginKey,view:t=>new SD({view:t,...e})});ko.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[CD({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 wD=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 so(e,{textSerializers:Go(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(mr(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Cr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_r(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Sr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(hr(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(vr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(yr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(xr(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=xa(this.view,e.from,e.to);gr({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()}},TD=e=>new ja({key:typeof e.pluginKey==`string`?new Ia(e.pluginKey):e.pluginKey,view:t=>new wD({view:t,...e})});ko.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?[TD({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 ED(e,t){return e??new Ia(t)}var DD=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,OD=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),kD=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(`.`)),AD=new Set([`children`,`className`,`style`]),jD=new Set([`tabIndex`]),MD=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),ND={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function PD(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function FD(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function ID(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||MD.has(e)}function LD(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function RD(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:ND[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function zD(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 BD(e){return jD.has(e)}function VD(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function HD(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 UD(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||kD.has(e)?String(t):`${t}px`}function WD(e,t){OD.has(t)||e.style.removeProperty(LD(t))}function GD(e,t,n){OD.has(t)||e.style.setProperty(LD(t),UD(t,n))}function KD(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(AD.has(r)||!ID(r)||PD(r,t[r])||PD(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=FD(r);if(a==null||a===!1){BD(r)&&HD(e,r),e.removeAttribute(o);return}if(a===!0){BD(r)&&VD(e,r,!0),e.setAttribute(o,``);return}if(BD(r)){VD(e,r,a);return}e.setAttribute(o,String(a))})}function qD(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function JD(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){WD(e,t);return}GD(e,t,a)}})}function YD(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(!PD(t,n))return;let{eventName:i,options:a}=RD(t),o=t=>{n(zD(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function XD(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);DD(()=>{let i=n.current;return qD(e,i.className,t.className),JD(e,i.style,t.style),KD(e,i,t),r.current=YD(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 ZD=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)(ED(e,`bubbleMenu`)).current;XD(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=ar(),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=CD({...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,tm.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)(ED(e,`floatingMenu`)).current;XD(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=ar(),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=TD({...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,tm.createPortal)(s,u.current)});var QD=[{name:`paragraph`,label:`Text`,icon:Gm,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:K,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:wt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:ye,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:Je,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:Ae,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ne,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:we,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:rh,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function $D(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:eO},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Zn(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)(ks,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(jr,{asChild:!0,children:(0,Z.jsxs)(Y,{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=QD.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Gr,{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)(qr,{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)($r,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function eO(e){let t=Object.fromEntries(QD.map(t=>[t.name,t.isActive(e.editor)]));return{current:QD.find(e=>t[e.name])??QD[0],activeStates:t}}var tO=`0 2px 4px rgba(0, 0, 0, 0.08)`,nO=150,rO=globalThis.ScrollTimeline;function iO(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+56);return{startOffset:o,endOffset:o+a,maxShift:a}}var aO=new WeakMap;function oO(e){let t=aO.get(e);if(t){for(let e of t.animations)e.cancel();aO.delete(e)}}function sO(e){for(let t of Array.from(e.cells))oO(t)}var cO=e=>e.cellIndex===0?`3`:`2`;function lO(e,t){return uO(e,t,e=>({transform:`translateY(${e}px)`}))}function uO(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 dO(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 fO(e,t,n){return dO(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:tO})}function pO(e,t){return dO(e,t,{opacity:`0`},{opacity:`1`})}function mO(e,t,n,r){let i=cO(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=aO.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(lO(n,r),s),l=e.animate(fO(n,r,i),s),u=e.animate(pO(n,r),{...s,pseudoElement:`::before`});aO.set(e,{key:a,animations:[c,l,u]})}function hO(e,t){let n=cO(e),r=`in|${t}|${n}`,i=aO.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:tO}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});aO.set(e,{key:r,animations:[a,o]})}function gO(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=iO(a,i,c.top,c.height,l.height);if(!u){sO(s);continue}if(n){if(o<=0){sO(s);continue}for(let e of Array.from(s.cells))mO(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+56){sO(s);continue}for(let e of Array.from(s.cells))hO(e,d)}}var _O=ko.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ja({key:new Ia(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||gO(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()},nO);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&rO)try{n=new rO({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`))sO(t)}}}})]}});function vO(e){return()=>{let t=null;try{t=e.view.dom.closest(`.editor-doc-scroll`)}catch{}let n={top:56,bottom:yO(`--ask-composer-height`)+yO(`--conflict-footer-height`)};return t?{boundary:t,padding:n}:{padding:n}}}function yO(e){let t=Number.parseFloat(document.documentElement.style.getPropertyValue(e));return Number.isFinite(t)?t:0}function bO(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 xO(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:x(typeof n.src==`string`?n.src:``)}function SO(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 CO(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=jt(),i;if(t[0]===n?i=t[1]:(i={editor:n,selector:wO},t[0]=n,t[1]=i),Zn(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=bO(n);t&&SO(t,xO(n))},t[4]=n,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Li,{className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{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)(bn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{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)(Sn,{children:[c,l]})}),t[11]=c,t[12]=u),u}function wO(e){return bO(e.editor)}function TO(e){return bO(e)!==null}var EO=`img, .ok-embed, .ok-video`,DO=220,OO=`cubic-bezier(0.23, 1, 0.32, 1)`,kO=`ok-image-align-flip`,AO=.5;function jO(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function MO(){return typeof requestAnimationFrame==`function`}function NO(e){return e?e.querySelector(EO):null}function PO(e,t){if(jO()||!MO()){t();return}let n=NO(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=NO(e);if(!t)return;for(let e of t.getAnimations())e.id===kO&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<AO)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:DO,easing:OO,fill:`none`});i.id=kO})}var FO=[{value:`left`,label:`Align left`,icon:mh},{value:`center`,label:`Align center`,icon:fh},{value:`right`,label:`Align right`,icon:ph}];function IO(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!yt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function LO(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:RO},t[0]=n,t[1]=r);let i=Zn(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=FO.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(!yt.has(a)||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(Da.create(u.doc,s)),PO(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(bn,{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 RO(e){return IO(e.editor)}function zO(e){return IO(e)!==null}function BO({editor:e}){if(fe(e.state).query||e.isActive(`codeBlock`))return!1;if(zO(e)||TO(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 VO(e){throw Error(`Unhandled AddLinkShortcutAction variant: ${JSON.stringify(e)}`)}function HO(e){let{selection:t}=e.state;if(t.empty){if(!e.isActive(`link`))return null;let n=D(e.state,t.from,`link`);return n===null?null:{kind:`edit-link`,markId:n}}return!BO({editor:e})||zO(e)||TO(e)?null:{kind:`open-popover`}}function UO(e,t){return ho({relativePath:hc(e),instruction:``,selectionMarkdown:t,target:`claude-code`})}function WO(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function GO(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r;if(pc())return null;let a;return t[0]!==n||t[1]!==i?(a=(0,Z.jsx)(KO,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}function KO(e){let t=(0,$.c)(11),{editor:n,shortcutEnabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Vo(),t[0]=i):i=t[0];let a=i,o,s;t[1]===r?(o=t[2],s=t[3]):(o=()=>{if(!a)return;let e=e=>{r&&du(e,`edit-with-ai`)&&(WO(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),d()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},s=[r,a],t[1]=r,t[2]=o,t[3]=s),(0,Q.useEffect)(o,s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(qi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[4]=l):l=t[4];let u;t[5]===n?u=t[6]:(u=()=>{let e=Bn(n),t=c(n);requestAnimationFrame(()=>{if(e===null||t.trim()===``){d();return}W(UO(e,t))})},t[5]=n,t[6]=u);let f,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(uc,{className:`size-3.5`,"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`xWEvuo`})}),t[7]=f,t[8]=p):(f=t[7],p=t[8]);let m;return t[9]===u?m=t[10]:(m=(0,Z.jsxs)(Z.Fragment,{children:[l,(0,Z.jsxs)(Y,{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:u,children:[f,p]})]}),t[9]=u,t[10]=m),m}function qO(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function JO(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 YO(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function XO(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=jt(),i;t[0]===n?i=t[1]:(i={editor:n,selector:ZO},t[0]=n,t[1]=i);let a=Zn(i),o;t[2]!==a||t[3]!==n?(o=()=>{if(a||!qO(n)||n.state.selection.empty||YO(n)||JO(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=Jo(Po(n.state.doc)),o=vo(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)(Ge,{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)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{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)(bn,{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)(Sn,{children:[d,p]}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function ZO(e){let t=e.editor;return!!(!qO(t)||t.state.selection.empty||YO(t)||JO(t))}var QO=[{name:`bold`,icon:$p,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:Om,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:_h,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:lh,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:g,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Em,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function $O(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:ek},t[0]=n,t[1]=r);let i=Zn(r),a;t[2]!==i||t[3]!==n?(a=QO.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{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)(bn,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Re,{"aria-label":ou(e.shortcutId),children:uu(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 ek(e){return Object.fromEntries(QO.map(t=>[t.name,t.isActive(e.editor)]))}var tk=`open-knowledge:open-link-edit-popover`;function nk(e=typeof window>`u`?new EventTarget:window){e.dispatchEvent(new CustomEvent(tk))}function rk(e,t=typeof window>`u`?new EventTarget:window){let n=()=>e();return t.addEventListener(tk,n),()=>t.removeEventListener(tk,n)}function ik(e){return e.state.selection.empty&&e.isActive(`link`)?e.getAttributes(`link`).href??``:``}async function ak(e,t){let n;try{n=await navigator.clipboard.readText()}catch(e){e instanceof DOMException||console.warn(`[link-popover] clipboard pre-fill read failed unexpectedly`,e);return}let r=j(n);r!==null&&(t(e=>e===``?r:e),requestAnimationFrame(()=>{let t=e.current;t&&t.value===r&&t.select()}))}function ok(e,t,n,r){let i=ik(e);n(i),r(!0),i===``&&ak(t,n)}function sk(e){let t=(0,$.c)(72),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,{_:a}=jt(),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:f,pages:p}=Ps(),m;t[0]===n?m=t[1]:(m=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=m);let g=m,_;t[2]===n?_=t[3]:(_=n.getAttributes(`link`).href??``,t[2]=n,t[3]=_);let v=_,y,b;t[4]!==n||t[5]!==i?(y=()=>rk(()=>{i&&ok(n,u,l,s)}),b=[i,n],t[4]=n,t[5]=i,t[6]=y,t[7]=b):(y=t[6],b=t[7]),(0,Q.useEffect)(y,b);let x,S;t[8]!==n||t[9]!==i?(x=()=>{let e=e=>{if(!i||!du(e,`add-link`)||!n.editorView?.hasFocus())return;let t=HO(n);if(t!==null)switch(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t.kind){case`open-popover`:nk();return;case`edit-link`:{let{markId:e}=t;ue(e),requestAnimationFrame(()=>{k(n).setActiveNode(e)});return}default:VO(t)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},S=[i,n],t[8]=n,t[9]=i,t[10]=x,t[11]=S):(x=t[10],S=t[11]),(0,Q.useEffect)(x,S);let C,w;t[12]===n?(C=t[13],w=t[14]):(C=()=>{let e=function(){n.state.selection.empty&&s(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},w=[n],t[12]=n,t[13]=C,t[14]=w),(0,Q.useEffect)(C,w);let T,E;t[15]===o?(T=t[16],E=t[17]):(T=()=>{if(!o)return;let e=!1,t=0,n=r=>{if(e)return;let i=u.current;i&&(i.focus(),document.activeElement===i)||(r<60?t=requestAnimationFrame(()=>n(r+1)):console.warn(`[link-popover] URL input never became focusable`))};return t=requestAnimationFrame(()=>n(0)),()=>{e=!0,cancelAnimationFrame(t)}},E=[o],t[15]=o,t[16]=T,t[17]=E),(0,Q.useEffect)(T,E);let D;t[18]!==n||t[19]!==g||t[20]!==c?(D=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),s(!1)},t[18]=n,t[19]=g,t[20]=c,t[21]=D):D=t[21];let O=D,A;t[22]===n?A=t[23]:(A=function(){n.chain().focus().unsetLink().run(),s(!1)},t[22]=n,t[23]=A);let j=A,M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){l(rr(e.path,null))},t[24]=M):M=t[24];let N=M,P;t[25]!==O||t[26]!==n?(P=function(e){e.key===`Enter`&&(e.preventDefault(),O()),e.key===`Escape`&&(e.preventDefault(),s(!1),n.chain().focus().run())},t[25]=O,t[26]=n,t[27]=P):P=t[27];let F=P;if(o){let e;t[28]===a?e=t[29]:(e=a({id:`ZsGpr_`}),t[28]=a,t[29]=e);let n;t[30]===a?n=t[31]:(n=a({id:`roAe2K`}),t[30]=a,t[31]=n);let r;t[32]!==d||t[33]!==F||t[34]!==f||t[35]!==p||t[36]!==e||t[37]!==n||t[38]!==c?(r=(0,Z.jsx)(h,{ref:u,type:`text`,placeholder:e,value:c,pages:p,folderPaths:d,loading:f,onValueChange:l,onSuggestionSelect:N,onKeyDown:F,"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[32]=d,t[33]=F,t[34]=f,t[35]=p,t[36]=e,t[37]=n,t[38]=c,t[39]=r):r=t[39];let i;t[40]===a?i=t[41]:(i=a({id:`tP5DDk`}),t[40]=a,t[41]=i);let o;t[42]===O?o=t[43]:(o=()=>{O()},t[42]=O,t[43]=o);let s;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(dm,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[44]=s):s=t[44];let m;t[45]!==i||t[46]!==o?(m=(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":i,onClick:o,children:s}),t[45]=i,t[46]=o,t[47]=m):m=t[47];let _;t[48]!==r||t[49]!==m?(_=(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:[r,m]}),t[48]=r,t[49]=m,t[50]=_):_=t[50];let y;t[51]!==a||t[52]!==v||t[53]!==g||t[54]!==j?(y=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),qn(v)},children:(0,Z.jsx)(fs,{className:`size-3.5`})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":a({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),j()},children:(0,Z.jsx)(zc,{className:`size-3.5`})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`484LKL`})})]})]}),t[51]=a,t[52]=v,t[53]=g,t[54]=j,t[55]=y):y=t[55];let b;return t[56]!==_||t[57]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[_,y]}),t[56]=_,t[57]=y,t[58]=b):b=t[58],b}let I;t[59]===a?I=t[60]:(I=a({id:`p0Iq25`}),t[59]=a,t[60]=I);let L=g?`bg-accent text-primary`:`text-accent-foreground`,R;t[61]===n?R=t[62]:(R=e=>{e.preventDefault(),ok(n,u,l,s)},t[61]=n,t[62]=R);let z;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Am,{className:`size-3.5`}),t[63]=z):z=t[63];let B;t[64]!==I||t[65]!==L||t[66]!==R?(B=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-xs`,"aria-label":I,className:L,onMouseDown:R,children:z})}),t[64]=I,t[65]=L,t[66]=R,t[67]=B):B=t[67];let V;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(J,{id:`yzF66j`}),t[68]=V):V=t[68];let H;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsxs)(bn,{side:`bottom`,sideOffset:8,children:[V,(0,Z.jsx)(Re,{children:uu(`add-link`)})]}),t[69]=H):H=t[69];let U;return t[70]===B?U=t[71]:(U=(0,Z.jsxs)(Sn,{children:[B,H]}),t[70]=B,t[71]=U),U}function ck(e){let t=(0,$.c)(30),{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:pk},t[0]=n,t[1]=l);let u=Zn(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:fk},t[2]=n,t[3]=d);let f=Zn(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return xa(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;t[7]!==n.view.dom||t[8]!==p?(m={getBoundingClientRect:p,contextElement:n.view.dom},t[7]=n.view.dom,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]===n?g=t[11]:(g=vO(n),t[10]=n,t[11]=g);let _=g,v;t[12]!==_||t[13]!==h?(v=()=>{let e=a.current;e&&(c.current?.(),c.current=br(h,e,()=>{gr(h,e,{placement:`top`,strategy:`fixed`,middleware:[_r(8),mr(_),Cr({padding:8}),yr(_)]}).then(t=>{let{x:n,y:r,middlewareData:i}=t;e.isConnected&&(e.style.position=`fixed`,e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.visibility=i.hide?.referenceHidden?`hidden`:`visible`)}).catch(dk)}))},t[12]=_,t[13]=h,t[14]=v):v=t[14];let y=v,b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{c.current?.(),c.current=null,s(uk)},t[15]=b):b=t[15];let x=b,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S={padding:8},t[16]=S):S=t[16];let C;t[17]!==_||t[18]!==y?(C={onShow:y,onHide:x,strategy:`fixed`,flip:_,shift:S,hide:_},t[17]=_,t[18]=y,t[19]=C):C=t[19];let w;t[20]!==n||t[21]!==f||t[22]!==u||t[23]!==i||t[24]!==o?(w=u?(0,Z.jsx)(LO,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(CO,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($D,{editor:n}),(0,Z.jsx)(qi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)($O,{editor:n},o),(0,Z.jsx)(qi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(sk,{editor:n,shortcutEnabled:i},`${o}-link`),(0,Z.jsx)(XO,{editor:n},`${o}-footnote`),(0,Z.jsx)(GO,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[20]=n,t[21]=f,t[22]=u,t[23]=i,t[24]=o,t[25]=w):w=t[25];let T;return t[26]!==n||t[27]!==C||t[28]!==w?(T=(0,Z.jsx)(ZD,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:lk,shouldShow:BO,updateDelay:250,options:C,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:w}),t[26]=n,t[27]=C,t[28]=w,t[29]=T):T=t[29],T}function lk(){return document.body}function uk(e){return e+1}function dk(){}function fk(e){return TO(e.editor)}function pk(e){return zO(e.editor)}var mk=new Ia(`markdownLintDecorations`),hk=`ok-lint-block`,gk=`ok-lint-block-error`,_k=`ok-lint-block-atom`,vk=400;function yk(e,t){let{frontmatter:n,body:r}=Xo(e),i=n===``?0:n.split(`
|
|
30
30
|
`).length-1;return{spans:t.parseToMdast(r).children.map(e=>({start:(e.position?.start.line??1/0)+i,end:(e.position?.end.line??-1/0)+i})),fmLineCount:i}}function bk(e,t){let n=e.findIndex(e=>t>=e.start&&t<=e.end);if(n>=0)return n;let r=e.findIndex(e=>e.start>t);return r>=0?r:e.length>0?e.length-1:null}function xk(e,t,n){let r=new Map;if(t.length===0)return r;let{spans:i,fmLineCount:a}=yk(e,n);for(let e of t){let t=e.range.start.line+1;if(a>0&&t<=a)continue;let n=bk(i,t);if(n===null)continue;let o=r.get(n);o?o.push(e):r.set(n,[e])}return r}function Sk(e){let t=e.childCount>0?e.child(e.childCount-1):null;return t!==null&&t.type.name===`paragraph`&&t.content.size===0?e.childCount-1:e.childCount}var Ck=`data-ok-lint`,wk=`data-ok-lint-fixable`;function Tk(e,t){let n=new Map;if(t.size===0)return{set:Ra.empty,fixesByOffset:n};let r=[],i=0;return e.forEach((e,a)=>{let o=t.get(i);if(i+=1,!o||o.length===0)return;let s=o.some(e=>e.severity===`error`),c=o.map(e=>`${e.source}/${e.code}: ${e.message}`).join(`
|
|
31
31
|
`),l=[hk];e.textContent.length===0&&l.push(_k),s&&l.push(gk);let u={class:l.join(` `),[Ck]:c},d=lb(o);d.length>0&&(u[wk]=`1`,n.set(a,d)),r.push(_o.node(a,a+e.nodeSize,u))}),{set:Ra.create(e,r),fixesByOffset:n}}function Ek(e,t){let n=document.createElement(`div`);n.className=`ok-lint-tooltip`,n.hidden=!0;let r=document.createElement(`div`);r.className=`ok-lint-tooltip-message`,n.appendChild(r);let i=document.createElement(`button`);i.type=`button`,i.className=`ok-lint-tooltip-fix`,i.hidden=!0,n.appendChild(i),n.style.position=`fixed`,n.style.top=`0`,n.style.left=`0`,document.body.appendChild(n);let a=null,o=!1,s=null,c=null,l=0,u=0,d={getBoundingClientRect:()=>({width:0,height:0,x:l,y:u,top:u,left:l,right:l,bottom:u})};function f(){s!==null&&(clearTimeout(s),s=null)}function p(){f(),a=null,n.hidden=!0,c?.(),c=null}function m(){o||(f(),s=setTimeout(p,140))}function h(){gr(d,n,{placement:`top-start`,middleware:[_r(6),mr(),Cr({padding:8})]}).then(({x:e,y:t})=>{n.isConnected&&(n.style.left=`${e}px`,n.style.top=`${t}px`)}).catch(e=>{n.isConnected&&console.warn(`[markdown-lint] tooltip computePosition failed`,e)})}function g(e){let s=e.getAttribute(Ck);if(!s){m();return}f(),a=e,r.textContent=s;let l=t.applyFix?t.getFixes(e):[];l.length>0&&t.applyFix?(i.hidden=!1,i.textContent=gl._({id:`c4fVUV`}),i.onclick=()=>{t.applyFix?.(l),o=!1,p()}):(i.hidden=!0,i.onclick=null),n.hidden=!1,c?.(),c=br(d,n,h)}function _(e){let t=e,n=e.target?.closest(`.${hk}`)??null;n?n===a?f():(l=t.clientX,u=t.clientY,g(n)):a&&m()}function v(e){let t=e.relatedTarget;if(t===n||t?.closest(`.ok-lint-tooltip`)){f();return}t?.closest(`.${hk}`)||m()}function y(){o=!0,f()}function b(e){o=!1;let t=e.relatedTarget;t!==a&&!t?.closest(`.${hk}`)&&m()}return n.addEventListener(`pointerenter`,y),n.addEventListener(`pointerleave`,b),e.dom.addEventListener(`pointerover`,_),e.dom.addEventListener(`pointerout`,v),{destroy(){f(),c?.(),e.dom.removeEventListener(`pointerover`,_),e.dom.removeEventListener(`pointerout`,v),n.remove()}}}var Dk=ko.create({name:`markdownLintDecorations`,addOptions(){return{docName:``,getSource:void 0,applyFix:void 0}},addProseMirrorPlugins(){let{docName:e,getSource:t,applyFix:n}=this.options,r=new Do({extensions:Na});return[new ja({key:mk,state:{init:()=>Ra.empty,apply(e,t){return e.getMeta(mk)||t.map(e.mapping,e.doc)}},props:{decorations(e){return mk.getState(e)??null}},view(i){let a=null,o=null,s=!1,c=0,l=new Map;async function u(){if(s)return;let n=t?.()??null,r=a?.enabled?await d(a):{kind:`ok`,set:Ra.empty,fixesByOffset:new Map};if(s||r.kind===`stale`)return;if(r.kind===`mismatch`){c<2&&(c+=1,f());return}c=0,l=r.fixesByOffset;let o=r.set,u=mk.getState(i.state)??Ra.empty;if((o.find().length>0||u.find().length>0)&&i.dispatch(i.state.tr.setMeta(mk,o)),a?.enabled){let t=tl(e);t?.kind===`lint`&&g(t.detail)&&Zc(e)}n!==null&&!s&&t?.()!==n&&f()}async function d(n){let a=i.state.doc,o=t?.()??r.serialize(a.toJSON()),s=await jo(o,n,e);if(!i.state.doc.eq(a))return{kind:`stale`};let{spans:c}=yk(o,r);return c.length===Sk(a)?{kind:`ok`,...Tk(a,xk(o,s,r))}:{kind:`mismatch`}}function f(){o&&clearTimeout(o),o=setTimeout(()=>{u().catch(e=>{console.warn(`[markdown-lint] decoration pass failed`,e)})},vk)}let p=0;async function m(){let t=++p,n=await cu(e);s||t!==p||(a=n,await u())}let h=()=>{m().catch(e=>{console.warn(`[markdown-lint] config load/lint pass failed`,e)})};function g(e){if(!i.dom.isConnected||i.dom.offsetParent===null)return!1;let{spans:n,fmLineCount:a}=yk(t?.()??r.serialize(i.state.doc.toJSON()),r);if(n.length!==Sk(i.state.doc)||a>0&&e.line<=a)return!1;let o=bk(n,e.line);if(o===null)return!1;let s=-1;if(i.state.doc.forEach((e,t,n)=>{n===o&&(s=t)}),s<0)return!1;i.dispatch(i.state.tr.setSelection(pa.near(i.state.doc.resolve(s+1)))),i.focus();let c=i.nodeDOM(s);return c instanceof HTMLElement&&c.scrollIntoView({behavior:`smooth`,block:`start`}),!0}function _(t){let n=t.detail;!n||s||g(n)&&Zc(e)}h();let v=au(h),y=Ek(i,{getFixes:e=>{if(e.getAttribute(wk)!==`1`||l.size===0)return[];let t;try{t=i.posAtDOM(e,0)}catch(e){return console.warn(`[markdown-lint] posAtDOM failed on lint block; Fix button suppressed`,e),[]}let n=Math.min(Math.max(t,0),i.state.doc.content.size),r=i.state.doc.resolve(n),a=r.depth>=1?r.before(1):0;return l.get(a)??[]},applyFix:n});window.addEventListener(Yc,_);let b=()=>{s||f()};return window.addEventListener(ob,b),{update(e,t){e.state.doc.eq(t.doc)||f()},destroy(){s=!0,o&&clearTimeout(o),v(),y.destroy(),window.removeEventListener(Yc,_),window.removeEventListener(ob,b)}}}})]}});function Ok(e,t){return(n,r)=>{let i=r,a=vd(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function kk(e,t){let n=od(e);t(n.target,{tabBehavior:`append`}),Jl(n.hash)}var Ak=5,jk=1;function Mk(e){let t=(0,$.c)(14),{editor:n,axis:r,anchor:i,onClickGesture:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(a),l,u;t[0]===a?(l=t[1],u=t[2]):(l=()=>{c.current=a},u=[a],t[0]=a,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{s.current?.abort(),s.current=null,o.current=null,document.body.style.cursor=``,document.body.style.userSelect=``},f=[],t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f);let[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>!(e&&o.current!==null),t[5]=_):_=t[5];let v=_,y;t[6]!==i||t[7]!==r||t[8]!==n?(y=e=>{if(e.button!==0)return;s.current?.abort(),o.current={startX:e.clientX,startY:e.clientY,isDragging:!1,lastTarget:null};let t=new AbortController;s.current=t;let{signal:a}=t,l=e=>{let t=o.current;if(!t)return;if(!t.isDragging){let n=e.clientX-t.startX,r=e.clientY-t.startY;if(Math.hypot(n,r)<Ak)return;t.isDragging=!0,m(!0),document.body.style.cursor=`grabbing`,document.body.style.userSelect=`none`}let n=Nk(i,r,e.clientX,e.clientY);t.lastTarget=n,g(n)},u=()=>{t.abort(),s.current===t&&(s.current=null),document.body.style.cursor=``,document.body.style.userSelect=``;let e=o.current;o.current=null,m(!1),g(null),e&&(e.isDragging&&e.lastTarget?Lk(n,i,r,e.lastTarget.index):e.isDragging||c.current())};document.addEventListener(`pointermove`,l,{signal:a}),document.addEventListener(`pointerup`,u,{signal:a}),document.addEventListener(`pointercancel`,u,{signal:a})},t[6]=i,t[7]=r,t[8]=n,t[9]=y):y=t[9];let b=y,x;return t[10]!==h||t[11]!==p||t[12]!==b?(x={onPointerDown:b,shouldAllowOpen:v,isDragging:p,indicator:h},t[10]=h,t[11]=p,t[12]=b,t[13]=x):x=t[13],x}function Nk(e,t,n,r){let i=e.closest(`table`);if(!i)return null;let a=i.getBoundingClientRect();if(t===`row`){let e=Array.from(i.rows);if(e.length===0)return null;for(let t=0;t<e.length;t++){let n=e[t].getBoundingClientRect();if(r<n.top)return{index:jk,rect:Fk(a,Pk(e,0,n.top))};if(r<=n.bottom){let i=r>=n.top+n.height/2,o=i?t+1:t,s=Math.max(jk,o);return{index:s,rect:Fk(a,s===o?i?n.bottom:n.top:Pk(e,0,n.top))}}}let t=e[e.length-1].getBoundingClientRect();return{index:e.length,rect:Fk(a,t.bottom)}}let o=i.rows[0];if(!o)return null;let s=Array.from(o.cells);if(s.length===0)return null;for(let e=0;e<s.length;e++){let t=s[e].getBoundingClientRect();if(n<t.left)return{index:0,rect:Ik(a,t.left)};if(n<=t.right){let r=n>=t.left+t.width/2,i=r?t.right:t.left;return{index:r?e+1:e,rect:Ik(a,i)}}}let c=s[s.length-1].getBoundingClientRect();return{index:s.length,rect:Ik(a,c.right)}}function Pk(e,t,n){let r=e[t];return r?r.getBoundingClientRect().bottom:n}function Fk(e,t){return{left:e.left,top:t-1,width:e.width,height:2}}function Ik(e,t){return{left:t-1,top:e.top,width:2,height:e.height}}function Lk(e,t,n,r){let i=n===`row`?Rk(t):t.cellIndex;if(i<0||n===`row`&&(i<jk||r<jk)||r===i||r===i+1)return;let{state:a,view:o}=e,s=zk(a.selection.$from);if(s<0){console.warn(`[table-drag-reorder] no table found at selection depth`);return}let c=a.doc.nodeAt(s);if(!c){console.warn(`[table-drag-reorder] nodeAt returned null at tablePos`,s);return}let l=a.tr;Hk(l,s,c,n===`row`?Bk(c,i,r):Vk(c,i,r)),o.dispatch(l)}function Rk(e){let t=e.parentElement,n=t?.closest(`table`);return n?Array.prototype.indexOf.call(n.rows,t):-1}function zk(e){for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole===`table`)return e.before(t);return-1}function Bk(e,t,n){let r=[];e.forEach(e=>{r.push(e)});let[i]=r.splice(t,1),a=n>t?n-1:n;return r.splice(a,0,i),e.type.create(e.attrs,r,e.marks)}function Vk(e,t,n){let r=n>t?n-1:n,i=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e)});let[a]=n.splice(t,1);n.splice(r,0,a),i.push(e.type.create(e.attrs,n,e.marks))}),e.type.create(e.attrs,i,e.marks)}function Hk(e,t,n,r){e.replaceRangeWith(t,t+n.nodeSize,r)}function Uk(e){return[...e?[{label:`Toggle header column`,icon:lm,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:ur,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:Jn,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:zc,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Cm,run:e=>e.chain().focus().deleteTable().run()}]}function Wk(e){return[...e?[{label:`Toggle header row`,icon:uh,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:er,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:fr,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:zc,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Cm,run:e=>e.chain().focus().deleteTable().run()}]}function Gk(e){if(!e.isEditable||fe(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 Kk(e){let t=(0,$.c)(37),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>c(!0),t[0]=l):l=t[0];let u;t[1]!==r||t[2]!==i||t[3]!==n?(u={editor:n,axis:i,anchor:r,onClickGesture:l},t[1]=r,t[2]=i,t[3]=n,t[4]=u):u=t[4];let d=Mk(u),f,p;t[5]!==r||t[6]!==i?(f=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return br(r,e,()=>{gr(r,e,{strategy:`absolute`,placement:t,middleware:[_r(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(qk)})},p=[r,i],t[5]=r,t[6]=i,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Q.useEffect)(f,p);let m=i===`column`?pm:ea,h;t[9]===d?h=t[10]:(h=e=>{d.shouldAllowOpen(e)&&c(e)},t[9]=d,t[10]=h);let g=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 cursor-grab 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 cursor-grab before:absolute before:-inset-[6px] before:content-[""]`,_=i===`column`?`Column options`:`Row options`,v;t[11]===m?v=t[12]:(v=(0,Z.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),t[11]=m,t[12]=v);let y;t[13]!==d.onPointerDown||t[14]!==g||t[15]!==_||t[16]!==v?(y=(0,Z.jsx)(jr,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`secondary`,onPointerDown:d.onPointerDown,className:g,"aria-label":_,children:v})}),t[13]=d.onPointerDown,t[14]=g,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b=i===`column`?`center`:`start`,x=i===`column`?`bottom`:`right`,S;if(t[18]!==n||t[19]!==a){let e;t[21]===n?e=t[22]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(Vr,{}),(0,Z.jsxs)(Gr,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[21]=n,t[22]=e),S=a.map(e),t[18]=n,t[19]=a,t[20]=S}else S=t[20];let C;t[23]!==b||t[24]!==x||t[25]!==S?(C=(0,Z.jsx)(qr,{align:b,side:x,className:`w-auto min-w-44 whitespace-nowrap`,children:S}),t[23]=b,t[24]=x,t[25]=S,t[26]=C):C=t[26];let w;t[27]!==s||t[28]!==C||t[29]!==h||t[30]!==y?(w=(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)($r,{open:s,onOpenChange:h,children:[y,C]})}),t[27]=s,t[28]=C,t[29]=h,t[30]=y,t[31]=w):w=t[31];let T;t[32]===d.indicator?T=t[33]:(T=d.indicator&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none fixed z-50 bg-primary`,style:{left:d.indicator.rect.left,top:d.indicator.rect.top,width:d.indicator.rect.width,height:d.indicator.rect.height}}),t[32]=d.indicator,t[33]=T);let E;return t[34]!==w||t[35]!==T?(E=(0,Z.jsxs)(Z.Fragment,{children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function qk(){}function Jk(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=Gk(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=Uk(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)(Kk,{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=Wk(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)(Kk,{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 Yk(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=_.getState(e.state)?.binding;if(!t){Ul.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){Ul.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}Ul.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ko.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ja({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var Xk=new WeakMap;function Zk(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=ya(e.color),n.textContent=e.name,t.append(n),t}var Qk={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},$k=100,eA=100,tA=3,nA=250;function rA(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function iA(e,t){let n=Ln(e);if(!n||t.contains(n.dom))return!1;if(!rA(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 aA(){let e=new Do({extensions:Na});return{mdManager:e,text:B({mdManager:e}),html:F({mdManager:e}),paste:T({mdManager:e}),drop:y({mdManager:e})}}function oA(e,t){return t?{collaboration:Ve.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[Yk({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:Ve.configure({document:e.document}),guard:[]}}function sA(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=oA(t,r);return[...nt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),tC.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ko.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[ce]}}),ko.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[v(e,{cursorBuilder:Zk})]}}),ko.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[bD({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,_O,Dk.configure({docName:t.configuration.name??``,getSource:()=>t.document.getText(`source`).toString(),applyFix:e=>ub(t,e)})]}function cA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{Xk.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=Xk.get(e);if(Xk.delete(e),r==null)return;let i=performance.now();Ul(`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:Ok(n.drop,e.onSidebarDrop)},extensions:cD(sA(e))}}function lA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=cA({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}=te(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var uA=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(Qk),c=uD(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=Xe(),p=n.configuration.name??``,[m]=(0,Q.useState)(aA),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new io(lA({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;Ul(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{kk(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=q(p)??crypto.randomUUID();_=Q.use,v=Ot({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=()=>()=>{it(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)(dA,{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},dA=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(0),h,g;t[0]===d?(h=t[1],g=t[2]):(h=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},g=[d],t[0]=d,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _,v;t[3]!==c||t[4]!==d?(_=()=>{iA(c,d)&&m(fA)},v=[c,d],t[3]=c,t[4]=d,t[5]=_,t[6]=v):(_=t[5],v=t[6]),(0,Q.useEffect)(_,v);let y;t[7]!==c||t[8]!==n.configuration.name?(y=()=>(or(c,n.configuration.name??null),()=>{or(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=y):y=t[9];let b;t[10]!==c||t[11]!==n?(b=[c,n],t[10]=c,t[11]=n,t[12]=b):b=t[12],(0,Q.useEffect)(y,b);let x;t[13]!==c||t[14]!==n.configuration.name?(x=()=>{let e=n.configuration.name;if(e)return Ue(e,c),()=>Be(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=x):x=t[15];let S;t[16]!==c||t[17]!==n?(S=[c,n],t[16]=c,t[17]=n,t[18]=S):S=t[18],(0,Q.useEffect)(x,S);let C;t[19]!==c||t[20]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,nl(e,`wysiwyg`,$c(c)),Ku(e,`wysiwyg`,qu(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),nl(e,`wysiwyg`,null),Ku(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=C):C=t[21];let w;t[22]!==c||t[23]!==n?(w=[c,n],t[22]=c,t[23]=n,t[24]=w):w=t[24],(0,Q.useEffect)(C,w);let T;t[25]!==c||t[26]!==n.configuration.name?(T=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=T):T=t[27];let E;t[28]!==c||t[29]!==n?(E=[c,n],t[28]=c,t[29]=n,t[30]=E):E=t[30],(0,Q.useEffect)(T,E);let D,O;t[31]===c?(D=t[32],O=t[33]):(D=()=>{let e=pA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=Ln(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 Ln(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},O=[c],t[31]=c,t[32]=D,t[33]=O),(0,Q.useEffect)(D,O);let A,j;t[34]!==i||t[35]!==c?(A=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!Ln(c))return;e=!0;let t=Ye(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})),Ul(`ok/editor/selection-restore-failed`,{docName:i,message:n})}vt(i)};if(Ln(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)},Ea)};c(Qk);let f=()=>{if(Ca(e),!ma(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`?ma(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,F;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<$k){e+=1,t=window.setTimeout(p,eA);return}r=null,o=null,e=0},u=function(e){let t=Ln(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=tA,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,nA)))};t=window.setTimeout(o,nA)};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=nu(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)}},F=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=P,t[48]=F):(P=t[47],F=t[48]),(0,Q.useEffect)(P,F);let I,L;t[49]===c?(I=t[50],L=t[51]):(I=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=Ln(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(ol,e),()=>window.removeEventListener(ol,e)},L=[c],t[49]=c,t[50]=I,t[51]=L),(0,Q.useEffect)(I,L);let R;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(R=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:dD({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]=R):R=t[58];let z;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(z=[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]=z):z=t[65],(0,Q.useEffect)(R,z);let B,V;t[66]!==c||t[67]!==r?(B=()=>(Un(c,r),()=>{Un(c,!1)}),V=[c,r],t[66]=c,t[67]=r,t[68]=B,t[69]=V):(B=t[68],V=t[69]),(0,Q.useEffect)(B,V);let H;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(H=!r&&(0,Z.jsx)(ck,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=H):H=t[74];let U;t[75]!==c||t[76]!==r?(U=!r&&(0,Z.jsx)(Jk,{editor:c}),t[75]=c,t[76]=r,t[77]=U):U=t[77];let W;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[78]=W):W=t[78];let G;t[79]!==c||t[80]!==p?(G=(0,Z.jsx)(Qn,{editor:c,className:`tiptap-editor-portal-content h-full`},p),t[79]=c,t[80]=p,t[81]=G):G=t[81];let K;t[82]!==d||t[83]!==G?(K=(0,tm.createPortal)(G,d),t[82]=d,t[83]=G,t[84]=K):K=t[84];let q;t[85]===c?q=t[86]:(q=(0,Z.jsx)(UE,{editor:c}),t[85]=c,t[86]=q);let ee;t[87]===c?ee=t[88]:(ee=k(c),t[87]=c,t[88]=ee);let te;t[89]===ee.store?te=t[90]:(te=(0,Z.jsx)(at,{store:ee.store}),t[89]=ee.store,t[90]=te);let ne;return t[91]!==H||t[92]!==U||t[93]!==K||t[94]!==q||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:[H,U,W,K,q,te]}),t[91]=H,t[92]=U,t[93]=K,t[94]=q,t[95]=te,t[96]=l,t[97]=ne):ne=t[97],ne};function fA(e){return e+1}function pA(){return Hn()}var mA=null;function hA(e){let t=(0,$.c)(3),n=(0,Q.useRef)(null),r,i;return t[0]===e?(r=t[1],i=t[2]):(r=()=>{if(!e)return;let t=n.current;if(!t)return;let r={};mA=r;let i=document.documentElement,a=null,o=()=>{if(mA!==r)return;let e=`${t.offsetHeight}px`;e!==a&&(a=e,i.style.setProperty(`--conflict-footer-height`,e))};o();let s=new ResizeObserver(o);return s.observe(t),()=>{s.disconnect(),mA===r&&(mA=null,i.style.removeProperty(`--conflict-footer-height`))}},i=[e],t[0]=e,t[1]=r,t[2]=i),(0,Q.useEffect)(r,i),n}var gA=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 _A(e,t,n,r,i,a){if(e==r)return[];let o=DA(e,t,n,r,i,a),s=OA(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 gA(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new gA(t,t+o,i,i),new gA(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 gA(t,t,i,i+o),new gA(n,n,i+o+c,a)]}if(c==1||l==1)return[new gA(t,n,i,a)];let u=AA(e,t,n,r,i,a);if(u){let[o,s,c]=u;return _A(e,t,o,r,i,s).concat(_A(e,o+c,n,r,s+c,a))}return xA(e,t,n,r,i,a)}var vA=1e9,yA=0,bA=!1;function xA(e,t,n,r,i,a){let o=n-t,s=a-i;if(vA<1e9&&Math.min(o,s)>vA*16||yA>0&&Date.now()>yA)return Math.min(o,s)>vA*64?[new gA(t,n,i,a)]:jA(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);CA.reset(c),wA.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:wA,f=d?null:CA;for(let p=0;p<c;p++){if(p>vA||yA>0&&!(p&63)&&Date.now()>yA)return jA(e,t,n,r,i,a);let m=CA.advance(p,o,s,c,d,!1,l)||wA.advance(p,o,s,c,f,!0,u);if(m)return TA(e,t,n,t+m[0],r,i,a,i+m[1])}return[new gA(t,n,i,a)]}var SA=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}},CA=new SA,wA=new SA;function TA(e,t,n,r,i,a,o,s){let c=!1;return!KA(e,r)&&++r==n&&(c=!0),!KA(i,s)&&++s==o&&(c=!0),c?[new gA(t,n,a,o)]:_A(e,t,r,i,a,s).concat(_A(e,r,n,i,s,o))}function EA(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function DA(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=EA(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-+!KA(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function OA(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=EA(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-+!KA(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function kA(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;;){KA(e,s)||s++;let u=s+o;if(KA(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=DA(e,u,n,r,i+f+d.length,a),c=OA(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 AA(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=AA(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:kA(e,t,n,r,i,a,Math.floor(o/4),-1)}function jA(e,t,n,r,i,a){bA=!0;let o=n-t,s=a-i,c;if(o<s){let s=kA(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=kA(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new gA(t,n,i,a)];let[l,u,d]=c;return _A(e,t,l,r,i,u).concat(_A(e,l+d,n,r,u+d,a))}function MA(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 gA(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function NA(e,t,n){for(;;){MA(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=DA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new gA(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=OA(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new gA(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 gA(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 gA(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function PA(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=VA(t,a.fromA,l),f=BA(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 gA(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=BA(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new gA(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=VA(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new gA(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=UA(n,a.fromB,a.toB),r,o=t<0?-1:HA(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=UA(t,a.fromA,a.toA),r,o=n<0?-1:HA(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 MA(e,3),e}var FA;try{FA=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function IA(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function LA(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!IA(n):FA?!WA(n)||t==e.length-1?+!!FA.test(String.fromCharCode(n)):FA.test(e.slice(t,t+2))?2:0:0}function RA(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!IA(n):FA?!GA(n)||t==1?+!!FA.test(String.fromCharCode(n)):FA.test(e.slice(t-2,t))?2:0:0}var zA=8;function BA(e,t,n){if(t==e.length||!RA(e,t))return t;for(let r=t,i=t+n,a=0;a<zA;a++){let t=LA(e,r);if(!t||r+t>i)return r;r+=t}return t}function VA(e,t,n){if(!t||!LA(e,t))return t;for(let r=t,i=t-n,a=0;a<zA;a++){let t=RA(e,r);if(!t||r-t<i)return r;r-=t}return t}function HA(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function UA(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var WA=e=>e>=55296&&e<=56319,GA=e=>e>=56320&&e<=57343;function KA(e,t){return!t||t==e.length||!WA(e.charCodeAt(t-1))||!GA(e.charCodeAt(t))}function qA(e,t,n){let r=n?.override;return r?r(e,t):(vA=(n?.scanLimit??1e9)>>1,yA=n?.timeout?Date.now()+n.timeout:0,bA=!1,NA(e,t,_A(e,0,e.length,t,0,t.length)))}function JA(){return!bA}function YA(e,t,n){return PA(qA(e,t,n),e,t)}var XA=Mu.define({combine:e=>e[0]}),ZA=yu.define(),QA=Mu.define(),$A=xu.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(ZA)&&(e=n.value);for(let n of t.state.facet(QA))e=n(e,t);return e}});function ej(e){let t=e.field($A,!1);if(!t)return null;let n=e.facet(XA);return{chunks:t,side:n?n.side:null}}var tj=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 ij(YA(e.toString(),t.toString(),n),e,t,0,0,JA())}static updateA(e,t,n,r,i){return cj(sj(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return cj(sj(e,r,!1,t.length),e,t,n,i)}};function nj(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 rj(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 ij(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=nj(c.fromA+r,c.fromB+i,t,n),[d,f]=rj(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]=nj(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]=rj(a.toA+r,a.toB+i,t,n),s++}o.push(new tj(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var aj=1e3;function oj(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 sj(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>aj&&([l,d]=oj(e,a-aj,n,!0)),o<t.length-aj&&([u,f]=oj(e,o+aj,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 cj(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=YA(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of ij(h,n,r,d,f,JA()))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 lj={scanLimit:500},uj=Du.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=bj(e))}update(e){(e.docChanged||e.viewportChanged||fj(e.startState,e.state)||pj(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=bj(e.view))}},{decorations:e=>e.deco}),dj=Au.low(Nu({class:`cm-changeGutter`,markers:e=>e.plugin(uj)?.gutter||wu.empty}));function fj(e,t){return e.field($A,!1)!=t.field($A,!1)}function pj(e,t){return e.facet(XA)!=t.facet(XA)}var mj=Su.line({class:`cm-changedLine`}),hj=Su.mark({class:`cm-changedText`}),gj=Su.mark({tagName:`ins`,class:`cm-insertedLine`}),_j=Su.mark({tagName:`del`,class:`cm-deletedLine`}),vj=new class extends ku{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function yj(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,mj),i.add(o,s,n?_j:gj),a&&a.add(o,o,vj);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,mj),a&&a.add(u,u,vj);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,hj),s<t)c++;else break}u=t}}}function bj(e){let t=e.state.field($A),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(XA),o=n==`a`,s=new Tu,c=i?new Tu: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))&&yj(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var xj=class extends _u{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}},Sj=yu.define({map:(e,t)=>e.map(t)}),Cj=xu.define({create:()=>Su.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Sj))return e.value;return e.map(t.changes)},provide:e=>Ou.decorations.from(e)}),wj=.01;function Tj(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 Ej(e,t,n){let r=new Tu,i=new Tu,a=e.state.field(Cj).iter(),o=t.state.field(Cj).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<-wj?(l-=n,r.add(s,s,Su.widget({widget:new xj(-n),block:!0,side:-1}))):n>wj&&(u+=n,i.add(c,c,Su.widget({widget:new xj(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<wj?r.add(e.state.doc.length,e.state.doc.length,Su.widget({widget:new xj(-p),block:!0,side:1})):p>wj&&i.add(t.state.doc.length,t.state.doc.length,Su.widget({widget:new xj(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Tj(m,e.state.field(Cj))||e.dispatch({effects:Sj.of(m)}),Tj(h,t.state.field(Cj))||t.dispatch({effects:Sj.of(h)})}var Dj=yu.define({map:(e,t)=>t.mapPos(e)}),Oj=class extends _u{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:Dj.of(n)});let{side:r,sibling:i}=e.state.facet(XA);i&&i().dispatch({effects:Dj.of(kj(n,e.state.field($A),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function kj(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 Aj=xu.define({create(e){return Su.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Dj)&&(e=e.update({filter:e=>e!=n.value}));if(e.size&&t.state.field($A)!=t.startState.field($A,!1)){let n=t.state.facet(XA).side==`a`,r=[];for(let i of t.state.field($A))e.between(n?i.fromA:i.fromB,n?i.toA:i.toB,e=>{r.push(e)});r.length&&(e=e.update({filter:e=>r.indexOf(e)<0}))}return e},provide:e=>Ou.decorations.from(e)});function jj({margin:e=3,minSize:t=4}){return Aj.init(n=>Mj(n,e,t))}function Mj(e,t,n){let r=new Tu,i=e.facet(XA).side==`a`,a=e.field($A),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,Su.replace({widget:new Oj(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Nj=Ou.styleModule.of(new Iu({".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`}})),Pj=Ou.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`}}),Fj=new vu,Ij=new vu,Lj=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||lj;let t=[Au.low(uj),Pj,Nj,Cj,Ou.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Sj)))&&this.measure()})],n=[XA.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(dj);let r=Eu.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Ou.editorAttributes.of({class:`cm-merge-a`}),Ij.of(n),t]}),i=[XA.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(dj);let a=Eu.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Ou.editorAttributes.of({class:`cm-merge-b`}),Ij.of(i),t]});this.chunks=tj.build(r.doc,a.doc,this.diffConf);let o=[$A.init(()=>this.chunks),Fj.of(e.collapseUnchanged?jj(e.collapseUnchanged):[])];r=r.update({effects:yu.appendConfig.of(o)}).state,a=a.update({effects:yu.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 Ou({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new Ou({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),Fu.empty(e[0].startState.doc.length));this.chunks=t==this.a?tj.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):tj.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:ZA.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:ZA.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(XA),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Ij.reconfigure([XA.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?dj:[]])),a.push(Ij.reconfigure([XA.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?dj:[]]))}if(r){let t=Fj.reconfigure(e.collapseUnchanged?jj(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(){Ej(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=Rj(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=Rj(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 Rj(e){let t=e.nextSibling;return e.remove(),t}var zj=new class extends ku{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Bj=Au.low(Nu({class:`cm-changeGutter`,markers:e=>e.plugin(uj)?.gutter||wu.empty,widgetMarker:(e,t)=>t instanceof Gj?zj:null}));function Vj(e){let t=typeof e.original==`string`?Cu.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||lj;return[Au.low(uj),Xj,Pj,Ou.editorAttributes.of({class:`cm-merge-b`}),QA.of((e,t)=>{let r=t.effects.find(e=>e.is(Hj));return r&&(e=tj.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=tj.updateB(e,t.state.field(Uj),t.newDoc,t.changes,n)),e}),XA.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?nM:void 0,side:`b`}),Uj.init(()=>t),e.gutter===!1?[]:Bj,e.collapseUnchanged?jj(e.collapseUnchanged):[],$A.init(e=>tj.build(t,e.doc,n))]}var Hj=yu.define(),Uj=xu.define({create:()=>Cu.empty,update(e,t){for(let n of t.effects)n.is(Hj)&&(e=n.value.doc);return e}}),Wj=new WeakMap,Gj=class extends _u{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 Kj(e,t,n){let r=Wj.get(t.changes);if(r)return r;let i=Su.widget({block:!0,side:-1,widget:new Gj(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(XA),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(),qj(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Jj(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(Uj).sliceString(t.fromA,t.endA),u=a&&e.facet(ju),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)==`
|
|
32
32
|
`){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
|
|
33
|
-
`,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;bu(t,{style:t=>Pu(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 Wj.set(t.changes,i),i}function qj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field($A).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(Uj);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Fu.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Hj.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Jj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field($A).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Uj).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 Yj(e){let t=new Tu;for(let n of e.field($A)){let r=e.facet(XA).overrideChunk&&Qj(e,n);t.add(n.fromB,n.fromB,Kj(e,n,!!r))}return t.finish()}var Xj=xu.define({create:e=>Yj(e),update(e,t){return t.state.field($A,!1)==t.startState.field($A,!1)?e:Yj(t.state)},provide:e=>Ou.decorations.from(e)}),Zj=new WeakMap;function Qj(e,t){let n=Zj.get(t);if(n!==void 0)return n;n=null;let r=e.field(Uj),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(Su.widget({widget:new $j(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(hj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Zj.set(t,n),n}var $j=class extends _u{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}},eM=new class extends ku{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},tM=Su.line({class:`cm-inlineChangedLine`});function nM(e,t,n,r){let i=Qj(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,eM),n.add(o.from,o.from,tM);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 rM=Wn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),iM=dr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),aM=Ou.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 oM({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 sM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=jt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=on(),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=hA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{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`?rM:iM,u=[Ou.editable.of(!1),Eu.readOnly.of(!0)],g=[ed,Lu(),...u,l,Ou.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Ou({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=oM({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 Ou({doc:d,extensions:[ed,Lu(),Ou.editable.of(!1),l,aM,Ou.lineWrapping,Vj({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Ou.updateListener.of(e=>{let t=ej(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=ej(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new Lj({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Ou({doc:d,extensions:[...g,Vj({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)}},E=[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]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Ou)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Ou)||Rn(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):gl._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,tm.createPortal)((0,Z.jsx)(Y,{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),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(Y,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function cM(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 lM(e,t){return cM(e,`content`,t)}async function uM(e){return cM(e,`mine`)}async function dM(e){return cM(e,`theirs`)}async function fM(e){return cM(e,`delete`)}async function pM(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 mM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=jt(),{conflicts:i,loading:a}=Ci(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Kl(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=hA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(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}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),pM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await lM(c,e);t.ok||cl.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),cl.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;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)(J,{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)(J,{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)(sM,{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)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(fM),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Y,{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]===w?u=t[36]:(u=()=>void w(dM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Y,{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 g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,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]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(sM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(uM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(Y,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(fM),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,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[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(sM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function hM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(gt(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 gM=`__back-nav__`;function _M(e){return e instanceof xe||e instanceof $e||e instanceof ge||e instanceof Fe||e instanceof ut||e instanceof je?e.docName:null}function vM(e){return e instanceof xe||e instanceof $e}function yM(e){if(e instanceof xe){let t=e.docName;return{title:gl._({id:`Jejur6`}),summary:gl._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:gl._({id:`V7QxyT`}),summary:gl._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ge){let t=e.docName;return{title:gl._({id:`1di5fu`}),summary:gl._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Fe){let t=e.docName;return{title:gl._({id:`wvbc1r`}),summary:gl._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof ut)return{title:gl._({id:`Gfr4fu`}),summary:gl._({id:`UW2Fg3`})};if(e instanceof je){let t=e.docName;return{title:gl._({id:`vv7kpg`}),summary:gl._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:gl._({id:`W5A0Ly`});return{title:gl._({id:`29VNqC`}),summary:t}}function bM(e){let t=(0,$.c)(37),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=yM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),m=typeof window<`u`?window.okDesktop:void 0,h=m&&vM(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vf,{size:80,variant:`sleeping`}),t[4]=v):v=t[4];let y;t[5]===c?y=t[6]:(y=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=y);let b;t[7]===l?b=t[8]:(b=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[y,b]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=S):S=t[12];let C;t[13]===r?C=t[14]:(C=(0,Z.jsx)(Y,{ref:d,variant:`default`,onClick:r,children:S}),t[13]=r,t[14]=C);let w;t[15]===h?w=t[16]:(w=h?(0,Z.jsx)(Y,{variant:`secondary`,onClick:()=>{Q_(h).then(SM).catch(xM)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=h,t[16]=w);let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=m?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[17]=T):T=t[17];let E;t[18]!==i||t[19]!==u||t[20]!==n||t[21]!==o||t[22]!==a||t[23]!==r?(E=u?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(We(_M(n)??i),o(a),r(gM))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[18]=i,t[19]=u,t[20]=n,t[21]=o,t[22]=a,t[23]=r,t[24]=E):E=t[24];let D;t[25]!==w||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[C,w,T,E]}),t[25]=w,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==i||t[30]!==n||t[31]!==f?(O=m?(0,Z.jsx)(Df,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:_M(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n)}}):null,t[29]=i,t[30]=n,t[31]=f,t[32]=O):O=t[32];let k;return t[33]!==D||t[34]!==O||t[35]!==x?(k=(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:[v,x,D,O]}),t[33]=D,t[34]=O,t[35]=x,t[36]=k):k=t[36],k}function xM(){}function SM(e){e.ok||cl.error(e.message,{id:`server-restart-error`,duration:1/0})}function CM(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)(bM,{...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]===gM){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}: ${yM(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)(I,{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 wM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=yo(t);return{map:n,keys:da(t),parseError:r}}function TM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>wM(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=Mo(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=Me(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=qe(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)(EM,{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)(DM,{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 EM(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 DM(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 OM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-_V5aR-6k.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([97,1,88,15,10,16,48,6,2,3,7,8,49,51,9,72,56,57,58,59,60,61,62,63,64,65,66,13,67,53,68,69,33,70,71,25,47,28,50,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,52,77,78,79,24,80,81,26,82,89,36,98,11,99,100,27]),import.meta.url)).ManagedArtifactProperties})),kM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-dbbj76iW.js`);return{MermaidDocEditor:e}},__vite__mapDeps([101,1,56,2,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,102,103]),import.meta.url)).MermaidDocEditor})),AM=Gl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function jM(e){let t=e.threshold??AM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function MM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var NM=Gl(`ACTIVITY_MOUNT_LIMIT`,3);function PM(){return n(()=>import(`./SourceEditor-FX3akQbF.js`),__vite__mapDeps([104,1,56,2,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,102,72,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,49,51,52,77,78,79,24,80,81,26,82,105,34,36,37,95,96,103,100]),import.meta.url)}var FM=(0,Q.lazy)(async()=>({default:(await PM()).SourceEditor}));function IM(e,t,n){if(n<=0)return[];let r=e.filter(e=>!De(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 LM(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:gl._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?gl._({id:`Sc1bKE`,values:{docName:e}}):gl._({id:`ovIGrT`,values:{docName:e}}),actionLabel:gl._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:gl._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?gl._({id:`bmC18N`,values:{docName:e}}):gl._({id:`pAgkuZ`,values:{docName:e}})}:null}function RM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Wl,{name:`activity-pool`,children:(0,Z.jsx)(zM,{...e})}),t[0]=e,t[1]=n),n}function zM(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Xe(),{pages:u,loading:d}=Ps(),f=IM(c,n,NM),p=(0,Q.useRef)(``),h=f.map(BM).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)Tt(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;m(e,t&&t.length>0?t:crypto.randomUUID())}Ul(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Pe(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)(KM,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Fo(e.docName)&&!mo(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=f.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 BM(e){return e.docName}function VM(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&&Ul(`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&&(Ul(`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&&Ul(`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 HM(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)(PS,{}),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)(FM,{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 UM(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)(Rc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Ic,{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)(Y,{type:`button`,onClick:WM,children:[(0,Z.jsx)(Rc,{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 WM(){return window.location.reload()}function GM(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 KM(e){let t=(0,$.c)(56),{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=LM(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=wT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=mo(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=n.provider.document.getText(`source`).length,[y,b]=(0,Q.useState)(i),[x,S]=(0,Q.useState)(!i),C,w;t[7]!==i||t[8]!==y||t[9]!==x?(C=()=>{i&&!y?b(!0):!i&&!x&&S(!0)},w=[i,y,x],t[7]=i,t[8]=y,t[9]=x,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T=jM({ytextLength:v,isSourceMode:i,visitedSource:y,visitedVisual:x}),E=(0,Q.useRef)(``),D=`${T.isLarge}-${T.renderSource}-${T.renderVisual}`,O,k;t[12]!==n.docName||t[13]!==T.isLarge||t[14]!==T.renderSource||t[15]!==T.renderVisual||t[16]!==D||t[17]!==i||t[18]!==v?(O=()=>{E.current!==D&&(E.current=D,T.isLarge&&Ul(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:v,isSourceMode:i,renderSource:T.renderSource,renderVisual:T.renderVisual}))},k=[D,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[12]=n.docName,t[13]=T.isLarge,t[14]=T.renderSource,t[15]=T.renderVisual,t[16]=D,t[17]=i,t[18]=v,t[19]=O,t[20]=k):(O=t[19],k=t[20]),(0,Q.useEffect)(O,k);let A;t[21]===n.docName?A=t[22]:(A=()=>Ye(n.docName),t[21]=n.docName,t[22]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[23]!==n.docName||t[24]!==T.isLarge||t[25]!==T.renderSource||t[26]!==T.renderVisual||t[27]!==N||t[28]!==i||t[29]!==v?(I=()=>{MM({isLarge:T.isLarge,renderSource:T.renderSource,renderVisual:T.renderVisual,hasEmittedFirstToggle:N})&&(Ul(`ok/cold/first-toggle`,{docName:n.docName,mountId:q(n.docName),ytextLength:v,modeEnteredFirst:i?`source`:`visual`}),P(!0))},F=[N,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[23]=n.docName,t[24]=T.isLarge,t[25]=T.renderSource,t[26]=T.renderVisual,t[27]=N,t[28]=i,t[29]=v,t[30]=F,t[31]=I):(F=t[30],I=t[31]),(0,Q.useEffect)(I,F);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[32]!==a||t[33]!==n||t[34]!==T.renderSource||t[35]!==T.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==M?(B=f?(0,Z.jsx)(UM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(CM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(GM,{html:M}):(0,Z.jsx)(PS,{}),children:(0,Z.jsx)(hM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(mM,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(kM,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Fo(n.docName)||tt(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(OM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(TM,{provider:n.provider}),(0,Z.jsx)(Ts,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[T.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(HM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,T.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(uA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=T.renderSource,t[35]=T.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=M,t[47]=B):B=t[47];let V;t[48]!==r||t[49]!==z||t[50]!==B?(V=(0,Z.jsx)(VM,{isActive:r,initialScrollTop:z,children:B}),t[48]=r,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;return t[52]!==L||t[53]!==R||t[54]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[52]=L,t[53]=R,t[54]=V,t[55]=H):H=t[55],H}function qM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function JM(e){let{value:t,unit:n}=qM(e);return n===`rem`?t*16:t}function YM(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var XM=3600*24*7;function ZM(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?QM:m,O=g===void 0?XM: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=JM(b),ee;t[6]===x?ee=t[7]:(ee=JM(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){E&&(P.current=!0,j.current=H.current?0:JM(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]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=qM(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(te,t)),u=YM(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(te,u)),f=YM(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,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]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function QM(){}var $M=3600*24*7,eN=`18rem`,tN=`3rem`,nN=`app-file-sidebar`,rN=`14.625rem`,iN=`32rem`,aN=`sidebar_width`,oN=/^\d+(?:\.\d+)?(?:rem|px)$/,sN=Q.createContext(null);function cN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${aN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return oN.test(n)?n:e}function lN(){let e=Q.use(sN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function uN(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?eN:c,[u]=Q.useState(fN),d;t[8]===u?d=t[9]:(d=()=>PT(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>cN(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=VT();return UT(`left`,PT(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),WT(`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(dN)},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: ${jT}px)`),t=()=>{let e=PT(u,window.innerWidth,`left`);p(e),C(UT(`left`,e,VT())===`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(nN)?.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=>{du(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":tN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=X(`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)(sN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function dN(e){return!e}function fN(){return Ho()}function pN(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}=jt(),{state:f,isDraggingRail:p}=lN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=X(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let 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=X(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,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=X(`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:nN,"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 mN(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}=jt(),{toggleSidebar:o,state:s}=lN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=ou(`toggle-files-sidebar`);c=Y,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=nN,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=X(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)(rt,{}):(0,Z.jsx)(Bm,{}),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 hN(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}=jt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=lN(),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:rN,maxResizeWidth:iN,setIsDraggingRail:m,widthCookieName:aN,widthCookieMaxAge:$M},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}=ZM(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=X(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=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 gN(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}=lN(),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=X(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,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 _N(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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 xN(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?ln:`div`,o;t[4]===n?o=t[5]:(o=X(`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 SN(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?ln:`button`,o;t[4]===n?o=t[5]:(o=X(`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 CN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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 wN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var EN=un(`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 DN(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?ln:`button`,{state:m}=lN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=X(EN({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)(yn,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(bn,{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)(Sn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function ON(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?ln:`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=X(`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 kN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`mx-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 AN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`group/menu-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 jN(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?ln:`a`,d;t[6]===n?d=t[7]:(d=X(`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 MN(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 NN(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Ta.safeParse(t);return n.success?n.data.currentBranch??null:null}var PN=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:MN({fetchBranch:NN,subscribeToEvent:Il}),FN=PN.subscribe,IN=PN.getSnapshot;function LN(){return(0,Q.useSyncExternalStore)(FN,IN,IN)}function RN(){let e=(0,$.c)(6),t=LN(),n=ac(),{state:r}=lN(),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&&yi(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 zN(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:u}=jt(),d=RN();if(!s&&d===null&&a==null)return null;let f=r??n,p=r!=null,{words:m,chars:h,tokens:g}=f,_;t[0]!==u||t[1]!==p||t[2]!==s?(_=u(s?p?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=u,t[1]=p,t[2]=s,t[3]=_):_=t[3];let v=c&&`pr-12`,y;t[4]===v?y=t[5]:(y=X(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,v),t[4]=v,t[5]=y);let b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=(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[6]=b):b=t[6];let x;t[7]!==u||t[8]!==a?(x=a?(0,Z.jsxs)(Y,{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)(uc,{className:`size-3`,"aria-hidden":!0}),u({id:`xWEvuo`}),(0,Z.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=u,t[8]=a,t[9]=x):x=t[9];let S;t[10]===d?S=t[11]:(S=d===null?null:(0,Z.jsx)(BN,{identity:d}),t[10]=d,t[11]=S);let C;t[12]===S?C=t[13]:(C=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:S}),t[12]=S,t[13]=C);let w;t[14]!==u||t[15]!==f.chars||t[16]!==f.tokens||t[17]!==f.words||t[18]!==h||t[19]!==p||t[20]!==s||t[21]!==g||t[22]!==m?(w=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[p?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:u({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:m}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:h}})]}),(0,Z.jsxs)(`span`,{children:[f.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:g}})]})]}):null,t[14]=u,t[15]=f.chars,t[16]=f.tokens,t[17]=f.words,t[18]=h,t[19]=p,t[20]=s,t[21]=g,t[22]=m,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==_||t[26]!==y||t[27]!==x||t[28]!==C?(T=(0,Z.jsxs)(`section`,{"aria-label":_,className:y,children:[b,x,C,w]}),t[24]=w,t[25]=_,t[26]=y,t[27]=x,t[28]=C,t[29]=T):T=t[29],T}function BN(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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(bn,{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)(Qo,{"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 VN(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}=jt(),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=X(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 HN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=X(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function GN(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(As,{}),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 KN=1,qN=2,JN=4;function YN(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=Uo(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ve(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>JN?[...u.slice(0,KN).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(KN,-qN)},...u.slice(-qN).map((e,t)=>d(e,u.length-qN+t))]:u.map((e,t)=>d(e,t));a=VN,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=HN,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(XN)}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 XN(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(GN,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(UN,{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)(pm,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(UN,{className:`min-w-0`,children:(0,Z.jsx)(WN,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var ZN={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`},QN=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`,...ZN,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},$N=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)(QN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},eP=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)(QN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function tP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=jt(),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)(yn,{children:(0,Z.jsx)(eP,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(aa,{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)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Sn,{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)($N,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(aa,{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)(bn,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`G-JBA1`}):(0,Z.jsx)(J,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Sn,{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)(sa,{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 nP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-DG7dmv6Z.js`);return{SkillEditorActions:e}},__vite__mapDeps([106,1,6,2,3,7,8,9,10,15,89,12,13,14,16,35,19,20,36,18,76,49,51,75,94,33,90,77,23,70,24,95,71,53,80,84,26,69,29]),import.meta.url)).SkillEditorActions}));function rP(e){let t=(0,$.c)(85),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=jt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=uu(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=ou(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?Uo(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?tt(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(YN,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===n?P=t[37]:(P=n===null?null:(0,Z.jsx)(kS,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[36]=n,t[37]=P);let F;t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40];let I;t[41]!==r||t[42]!==a||t[43]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(tP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[41]=r,t[42]=a,t[43]=i,t[44]=I):I=t[44],t[45]!==F||t[46]!==I?(S=(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:[F,I]})}),t[45]=F,t[46]=I,t[47]=S):S=t[47];let L=d&&`pr-9`;t[48]===L?_=t[49]:(_=X(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[48]=L,t[49]=_),t[50]===M?v=t[51]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(nP,{scope:M.scope,name:M.name})}):null,t[50]=M,t[51]=v),t[52]!==f||t[53]!==s||t[54]!==o?(y=o&&(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(yn,{children:(0,Z.jsx)(Mm,{})})}),(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[52]=f,t[53]=s,t[54]=o,t[55]=y):y=t[55],g=Sn,h=Y,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,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]=O,t[25]=k}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A;t[56]===c?A=t[57]:(A=(0,Z.jsx)(yn,{children:c?(0,Z.jsx)(Hm,{}):(0,Z.jsx)(Vm,{})}),t[56]=c,t[57]=A);let j;t[58]!==h||t[59]!==A||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D||t[65]!==O||t[66]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[58]=h,t[59]=A,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=O,t[66]=k,t[67]=j):j=t[67];let M;t[68]===c?M=t[69]:(M=(0,Z.jsx)(bn,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[68]=c,t[69]=M);let N;t[70]!==g||t[71]!==j||t[72]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[70]=g,t[71]=j,t[72]=M,t[73]=N):N=t[73];let P;t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=N,t[78]=P):P=t[78];let F;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[79]=F):F=t[79];let I;return t[80]!==b||t[81]!==x||t[82]!==S||t[83]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[80]=b,t[81]=x,t[82]=S,t[83]=P,t[84]=I):I=t[84],I}function iP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function aP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var oP=`ok-terminal-height-v1`,sP=1/3,cP=.5;function lP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*cP))}function uP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*sP)}function dP(e,t){let n=lP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(uP(t),n)}function fP(){return typeof window>`u`?0:window.innerHeight}function pP(e,t){try{let n=e??localStorage,r=t??fP(),i=n.getItem(oP);if(i==null)return dP(uP(r),r);let a=Number.parseInt(i,10);return dP(Number.isFinite(a)?a:uP(r),r)}catch{return 240}}function mP(e,t,n){try{let r=t??localStorage,i=n??fP();r.setItem(oP,String(dP(e,i)))}catch{}}function hP(){try{return typeof localStorage>`u`?240:pP()}catch{return 240}}function gP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=jt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,u=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,d;t[2]!==i||t[3]!==u?(d=X(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,u,i),t[2]=i,t[3]=u,t[4]=d):d=t[4];let f;t[5]===o?f=t[6]:(f=o?(0,Z.jsx)(Os,{"aria-hidden":`true`}):(0,Z.jsx)(l,{"aria-hidden":`true`}),t[5]=o,t[6]=f);let p;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:d,children:f})}),t[7]=n,t[8]=c,t[9]=r,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m=o?`left`:`top`,h;t[13]!==c||t[14]!==m?(h=(0,Z.jsx)(bn,{side:m,sideOffset:8,children:c}),t[13]=c,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==p||t[17]!==h?(g=(0,Z.jsxs)(Sn,{children:[p,h]}),t[16]=p,t[17]=h,t[18]=g):g=t[18],g}var _P=`terminal-dock-panel`;function vP(e){let t=(0,$.c)(42),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=on(),d=hS(),[f,p]=(0,Q.useState)(!r),m=ad(u).background,h=r&&l===`bottom`,g=!r&&l===`bottom`&&c!=null,[_]=(0,Q.useState)(yP),v=(0,Q.useRef)(_),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),S=(0,Q.useRef)(null),C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{mP(e),S.current=null},100)},t[0]=C):C=t[0];let w=C,T=(0,Q.useRef)(null),E,D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>()=>{S.current!=null&&clearTimeout(S.current),T.current!=null&&(window.removeEventListener(`pointerup`,T.current),T.current=null)},D=[],t[1]=E,t[2]=D):(E=t[1],D=t[2]),(0,Q.useEffect)(E,D);let O,k;t[3]!==h||t[4]!==d?(O=()=>{let e=d.current;e!=null&&(h?e.resize(`${v.current}px`):e.collapse())},k=[h,d],t[3]=h,t[4]=d,t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A=y||void 0,j;t[7]!==c||t[8]!==g?(j=g&&c?(0,Z.jsx)(gP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[7]=c,t[8]=g,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==s||t[12]!==j?(M=(0,Z.jsx)($w,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,j]})}),t[10]=n,t[11]=s,t[12]=j,t[13]=M):M=t[13];let N=!h,P;t[14]===h?P=t[15]:(P=()=>{if(!h)return;b(!0),x.current=!0;let e=()=>{b(!1),x.current=!1,window.removeEventListener(`pointerup`,e),T.current=null};T.current=e,window.addEventListener(`pointerup`,e)},t[14]=h,t[15]=P);let F;t[16]!==h||t[17]!==N||t[18]!==P?(F=(0,Z.jsx)(eT,{withHandle:h,disabled:N,onPointerDown:P}),t[16]=h,t[17]=N,t[18]=P,t[19]=F):F=t[19];let I;t[20]===m?I=t[21]:(I={backgroundColor:m},t[20]=m,t[21]=I);let L=h?`${_}px`:0,R;t[22]!==i||t[23]!==r?(R=e=>{let t=e.asPercentage===0;p(t),x.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(v.current=e.inPixels,w(e.inPixels)))},t[22]=i,t[23]=r,t[24]=R):R=t[24];let z=!y&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,B;t[25]===z?B=t[26]:(B=X(`flex flex-col`,z),t[25]=z,t[26]=B);let V;t[27]===o?V=t[28]:(V=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[27]=o,t[28]=V);let H;t[29]!==f||t[30]!==d||t[31]!==I||t[32]!==L||t[33]!==R||t[34]!==B||t[35]!==V?(H=(0,Z.jsx)($w,{id:_P,style:I,panelRef:d,defaultSize:L,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:R,inert:f,className:B,children:V}),t[29]=f,t[30]=d,t[31]=I,t[32]=L,t[33]=R,t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;return t[37]!==F||t[38]!==H||t[39]!==A||t[40]!==M?(U=(0,Z.jsxs)(Qw,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":A,children:[M,F,H]}),t[37]=F,t[38]=H,t[39]=A,t[40]=M,t[41]=U):U=t[41],U}function yP(){return hP()}var bP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DBgWJhkx.js`),__vite__mapDeps([55,1,2,56,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,72,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,49,51,52,77,78,79,24,80,81,26,82,83,84]),import.meta.url)).ActivityModeContent})),xP=`300px`,SP=`600px`,CP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function wP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(EP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(TP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Wl,{name:`editor-area`,children:(0,Z.jsxs)(_s,{children:[n,r]})}),t[3]=n,t[4]=i),i}function TP(){let e=(0,$.c)(5),t=Si(),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)(Kw,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function EP(e){let t=(0,$.c)(246),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=jt(),{resolvedTheme:h}=on(),g=ad(h).background,{activeDocName:_,activeProvider:v,activeTarget:y,recycleDocument:b,docPanelMode:x,docPanelAgentId:S,docPanelExpandSignal:C}=Xe(),{openDocumentTransition:w}=st(),{requestAddProperty:T}=ps(),E=ST(v,_),D=TT(_,n===`source`?`source`:`wysiwyg`),O=XT(v),k=O===`connected`||O===`synced`,A=wT(_)===`conflict`,[j,N]=(0,Q.useState)(!1),P,F;t[0]!==v||t[1]!==j?(P=()=>{v!=null&&!j&&N(!0)},F=[v,j],t[0]=v,t[1]=j,t[2]=P,t[3]=F):(P=t[2],F=t[3]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(_),L=y?.kind===`missing`,R=!!_&&y?.kind!==`folder`,z;t[4]!==m||t[5]!==L?(z=L?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=L,t[6]=z):z=t[6];let B=z,V=(0,Q.useSyncExternalStore)(ns.subscribe,ns.getSnapshot,ns.getSnapshot),H;t[7]!==y||t[8]!==V?(H=os(y,V),t[7]=y,t[8]=V,t[9]=H):H=t[9];let U=H,[W]=(0,Q.useState)(jP),G=W!==null,K;t[10]===W?K=t[11]:(K=()=>PT(W,window.innerWidth,`right`),t[10]=W,t[11]=K);let[q,ee]=(0,Q.useState)(K),te=(0,Q.useRef)(q),ne,re;t[12]===q?(ne=t[13],re=t[14]):(ne=()=>{te.current=q},re=[q],t[12]=q,t[13]=ne,t[14]=re),(0,Q.useEffect)(ne,re);let ie=hS(),ae=hS(),oe;t[15]===q?oe=t[16]:(oe=()=>UT(`right`,q,VT())===`collapsed`,t[15]=q,t[16]=oe);let[se]=(0,Q.useState)(oe),[ce,le]=(0,Q.useState)(se),ue=(0,Q.useRef)(ce),[de,fe]=(0,Q.useState)(null),[pe,me]=(0,Q.useState)(null),[he,ge]=(0,Q.useState)(null),_e=p===`right`,ve=_e?`right`:`bottom`,ye=o!=null&&_e&&f,be=o!=null&&!f&&d!=null,xe=be&&!_e,Se=be&&_e,we=_e&&f&&de!=null,Te=we?de:pe,Ee=(_e?we:f)&&Te!=null,De,Oe;t[17]!==Te||t[18]!==u||t[19]!==ve||t[20]!==he||t[21]!==Ee?(De=()=>{u?.({container:Te,isShowing:Ee,dockPosition:ve,editorRegion:he})},Oe=[u,Te,Ee,ve,he],t[17]=Te,t[18]=u,t[19]=ve,t[20]=he,t[21]=Ee,t[22]=De,t[23]=Oe):(De=t[22],Oe=t[23]),(0,Q.useEffect)(De,Oe);let ke,Ae;t[24]===ce?(ke=t[25],Ae=t[26]):(ke=()=>{ue.current=ce},Ae=[ce],t[24]=ce,t[25]=ke,t[26]=Ae),(0,Q.useEffect)(ke,Ae);let[je,Me]=(0,Q.useState)(!1),Ne=(0,Q.useRef)(!1),[Pe]=(0,Q.useState)(AP),Fe=(0,Q.useRef)(Pe),Ie=(0,Q.useRef)(null),Le;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(e){Ie.current!=null&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{kT(e),Ie.current=null},100)},t[27]=Le):Le=t[27];let Re=Le,[ze]=(0,Q.useState)(kP),Be=(0,Q.useRef)(ze),[Ve,He]=(0,Q.useState)(!1),Ue=(0,Q.useRef)(!1),We=(0,Q.useRef)(null),Ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=function(e){We.current!=null&&clearTimeout(We.current),We.current=setTimeout(()=>{JT(e),We.current=null},100)},t[28]=Ge):Ge=t[28];let Ke=Ge,qe,Je;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(qe=()=>()=>{Ie.current!=null&&clearTimeout(Ie.current),We.current!=null&&clearTimeout(We.current)},Je=[],t[29]=qe,t[30]=Je):(qe=t[29],Je=t[30]),(0,Q.useEffect)(qe,Je);let[Ye,Ze]=(0,Q.useState)(null),Qe=(0,Q.useRef)(null),$e=uS(),et=(0,Q.useRef)(ye),tt,nt;t[31]===ye?(tt=t[32],nt=t[33]):(tt=()=>{et.current=ye},nt=[ye],t[31]=ye,t[32]=tt,t[33]=nt),(0,Q.useEffect)(tt,nt);let rt;t[34]!==ie||t[35]!==ae?(rt=function(){for(let e of[ie,ae]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Qe.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[34]=ie,t[35]=ae,t[36]=rt):rt=t[36];let it=rt,at;t[37]!==$e||t[38]!==it?(at=function(e){if(Ne.current||Ue.current)return;let t=$e.current;if(t!=null)try{let n=it();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(OP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Fe.current),`terminal-column`in r&&(o[`terminal-column`]=Be.current),Object.keys(o).length===0)return;let s=aP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[37]=$e,t[38]=it,t[39]=at):at=t[39];let ot=at,ct=(0,Q.useRef)(ot),lt;t[40]===ot?lt=t[41]:(lt=()=>{ct.current=ot},t[40]=ot,t[41]=lt),(0,Q.useEffect)(lt);let ut;t[42]!==ot||t[43]!==ie?(ut=function(){et.current?ot(!1):ie.current?.expand()},t[42]=ot,t[43]=ie,t[44]=ut):ut=t[44];let dt=ut,ft;t[45]!==ot||t[46]!==ce||t[47]!==ie?(ft=function(){if(ie.current==null)return;let e=te.current;ce?(WT(`right`,e,`open`),et.current?ot(!1):ie.current?.expand()):(WT(`right`,e,`collapsed`),et.current?ot(!0):ie.current?.collapse())},t[45]=ot,t[46]=ce,t[47]=ie,t[48]=ft):ft=t[48];let pt=ft,mt,ht;t[49]!==ot||t[50]!==W||t[51]!==ie?(mt=()=>{let e=window.matchMedia(`(min-width: ${MT}px)`),t=()=>{let e=PT(W,window.innerWidth,`right`);ee(e);let t=UT(`right`,e,VT())===`collapsed`;le(t),et.current?ot(t):t?ie.current?.collapse():ie.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ht=[W,ie,ot],t[49]=ot,t[50]=W,t[51]=ie,t[52]=mt,t[53]=ht):(mt=t[52],ht=t[53]),(0,Q.useEffect)(mt,ht);let gt,_t;t[54]!==Ye||t[55]!==G?(gt=()=>{if(Ye==null||G)return;let e=new ResizeObserver(()=>{ct.current(ue.current)});return e.observe(Ye),()=>e.disconnect()},_t=[Ye,G],t[54]=Ye,t[55]=G,t[56]=gt,t[57]=_t):(gt=t[56],_t=t[57]),(0,Q.useEffect)(gt,_t);let vt,yt;t[58]!==dt||t[59]!==a?(vt=()=>{let e=e=>{a(e),dt()},t=yg();return t&&e(t),xg(t=>{yg(),e(t)})},yt=[a,dt],t[58]=dt,t[59]=a,t[60]=vt,t[61]=yt):(vt=t[60],yt=t[61]),(0,Q.useEffect)(vt,yt);let bt,St;t[62]!==C||t[63]!==dt?(bt=()=>{C!==0&&dt()},St=[C,dt],t[62]=C,t[63]=dt,t[64]=bt,t[65]=St):(bt=t[64],St=t[65]),(0,Q.useEffect)(bt,St);let Ct=(0,Q.useRef)(ye),wt,Tt;t[66]!==ce||t[67]!==ye?(wt=()=>{if(Ct.current===ye)return;Ct.current=ye;let e=ce;queueMicrotask(()=>{ct.current(e)})},Tt=[ye,ce],t[66]=ce,t[67]=ye,t[68]=wt,t[69]=Tt):(wt=t[68],Tt=t[69]),(0,Q.useLayoutEffect)(wt,Tt);let Et,Dt;t[70]===ce?(Et=t[71],Dt=t[72]):(Et=()=>{if(!ce||!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()},Dt=[ce],t[70]=ce,t[71]=Et,t[72]=Dt),(0,Q.useLayoutEffect)(Et,Dt);let Ot,kt;t[73]===ce?(Ot=t[74],kt=t[75]):(Ot=()=>{E_({docPanelVisible:!ce}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ce})},kt=[ce],t[73]=ce,t[74]=Ot,t[75]=kt),(0,Q.useEffect)(Ot,kt);let At,Mt;t[76]===pt?(At=t[77],Mt=t[78]):(At=()=>M(e=>{e===`toggle-doc-panel`&&pt()}),Mt=[pt],t[76]=pt,t[77]=At,t[78]=Mt),(0,Q.useEffect)(At,Mt);let Nt,Pt;t[79]===pt?(Nt=t[80],Pt=t[81]):(Nt=()=>{if(window.okDesktop!=null)return;let e=e=>{du(e,`toggle-document-panel`)&&(e.preventDefault(),pt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Pt=[pt],t[79]=pt,t[80]=Nt,t[81]=Pt),(0,Q.useEffect)(Nt,Pt);let Ft=(0,Q.useRef)(null),[It,Lt]=(0,Q.useState)(null),[Rt,zt]=(0,Q.useState)(!1),Bt=y?.kind===`large-file`?y.docName:_,Vt,Ht;t[82]===Bt?(Vt=t[83],Ht=t[84]):(Vt=()=>{if(Bt&&Bt!==Ft.current){let e=Ft.current;Ft.current=Bt,Lt(e)}},Ht=[Bt],t[82]=Bt,t[83]=Vt,t[84]=Ht),(0,Q.useEffect)(Vt,Ht);let Ut;t[85]===w?Ut=t[86]:(Ut=function(e){let t=tu(e);window.location.hash===t?w(e):window.location.hash=t},t[85]=w,t[86]=Ut);let Wt=Ut,Gt,Kt=null;if(y?.kind===`large-file`){let e;t[87]!==Wt||t[88]!==It?(e=It?{previousDocName:It,onNavigateBack:Wt}:void 0,t[87]=Wt,t[88]=It,t[89]=e):e=t[89];let n;t[90]!==y.docName||t[91]!==y.limit||t[92]!==y.size||t[93]!==e?(n=(0,Z.jsx)(Cw,{docName:y.docName,size:y.size,limit:y.limit,backNav:e}),t[90]=y.docName,t[91]=y.limit,t[92]=y.size,t[93]=e,t[94]=n):n=t[94],Gt=n}else if(y?.kind===`folder`){let e;t[95]!==G||t[96]!==f?(e=zE({terminalVisible:f,isEmbedded:G}),t[95]=G,t[96]=f,t[97]=e):e=t[97];let n=e,r;t[98]===y.folderPath?r=t[99]:(r=(0,Z.jsx)(yw,{folderPath:y.folderPath}),t[98]=y.folderPath,t[99]=r);let i;t[100]===n?i=t[101]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[100]=n,t[101]=i);let a;t[102]!==r||t[103]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[102]=r,t[103]=i,t[104]=a):a=t[104];let o;t[105]!==y.folderPath||t[106]!==n?(o=n?(0,Z.jsx)(EE,{folderPath:y.folderPath}):null,t[105]=y.folderPath,t[106]=n,t[107]=o):o=t[107];let s;if(t[108]!==a||t[109]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[108]=a,t[109]=o,t[110]=s):s=t[110],Gt=s,x===`agent`&&S!==null){let e;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(eT,{withHandle:!0}),t[111]=e):e=t[111];let n;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)($w,{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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(bP,{showBackButton:!1})})})]}),t[112]=n):n=t[112],Kt=n}}else if(y?.kind===`asset`){let e;t[113]!==y.assetPath||t[114]!==y.mediaKind?(e=(0,Z.jsx)(MS,{assetPath:y.assetPath,mediaKind:y.mediaKind},y.assetPath),t[113]=y.assetPath,t[114]=y.mediaKind,t[115]=e):e=t[115],Gt=e}else if(y?.kind===`skill-file`){let e=`${y.scope}/${y.name}/${y.path}`,n;t[116]!==y.name||t[117]!==y.path||t[118]!==y.scope||t[119]!==e?(n=(0,Z.jsx)(Iw,{scope:y.scope,name:y.name,path:y.path},e),t[116]=y.name,t[117]=y.path,t[118]=y.scope,t[119]=e,t[120]=n):n=t[120],Gt=n}else if(U){let e;t[121]===U?e=t[122]:(e=(0,Z.jsx)(Ew,{nav:U},U.path),t[121]=U,t[122]=e),Gt=e}else if(!v||!_)if((typeof window<`u`?eu(window.location.hash):null)!==null)if(o!=null&&j){let e;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(PS,{}),t[123]=e):e=t[123],Gt=e;let n;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(eT,{withHandle:!0,disabled:!0}),t[124]=n):n=t[124];let r=se?0:`${Pe}px`,i;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[125]=i):i=t[125];let a;t[126]===r?a=t[127]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)($w,{id:`doc-panel`,defaultSize:r,minSize:xP,maxSize:SP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[126]=r,t[127]=a),Kt=a}else{let e;return t[128]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(PS,{}),t[128]=e):e=t[128],e}else{let e=f?ve:null,n;t[129]===e?n=t[130]:(n=(0,Z.jsx)(BC,{terminalDock:e}),t[129]=e,t[130]=n),Gt=n}else{let e=n===`source`,o=!k,s=ce,c;t[131]!==_||t[132]!==T?(c=function(){_&&T(_)},t[131]=_,t[132]=T,t[133]=c):c=t[133];let l=c,u;t[134]!==_||t[135]!==G||t[136]!==f?(u=RE({terminalVisible:f,isEmbedded:G,activeDocName:_}),t[134]=_,t[135]=G,t[136]=f,t[137]=u):u=t[137];let d=u,p=I??_,m=It??void 0,h;t[138]!==B||t[139]!==e||t[140]!==Wt||t[141]!==b||t[142]!==p||t[143]!==m?(h=(0,Z.jsx)(RM,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:Wt,onRecycle:b}),t[138]=B,t[139]=e,t[140]=Wt,t[141]=b,t[142]=p,t[143]=m,t[144]=h):h=t[144];let g;t[145]!==_||t[146]!==e?(g=(0,Z.jsx)(vT,{activeDocName:_,isSourceMode:e}),t[145]=_,t[146]=e,t[147]=g):g=t[147];let v;t[148]!==_||t[149]!==I?(v=iP({activeDocName:_,deferredActiveDocName:I,mountResolved:_!==null&&xt(_),syncResolved:_!==null&&Ce(_)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(PS,{}),_===null?null:(0,Z.jsx)(ww,{docName:_})]}):null,t[148]=_,t[149]=I,t[150]=v):v=t[150];let y;t[151]!==h||t[152]!==g||t[153]!==v?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,v]}),t[151]=h,t[152]=g,t[153]=v,t[154]=y):y=t[154];let S;t[155]!==_||t[156]!==A||t[157]!==s||t[158]!==e||t[159]!==r||t[160]!==l||t[161]!==Se||t[162]!==o||t[163]!==pt?(S=!A&&(0,Z.jsx)(rP,{activeDocName:_,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:pt,reserveRightGutter:Se&&s}),t[155]=_,t[156]=A,t[157]=s,t[158]=e,t[159]=r,t[160]=l,t[161]=Se,t[162]=o,t[163]=pt,t[164]=S):S=t[164];let C;t[165]!==_||t[166]!==Rt||t[167]!==e||t[168]!==d?(C=d?(0,Z.jsx)(EE,{docName:_,surface:e?`source`:`wysiwyg`,dismissed:Rt,onDismiss:()=>zt(!0),onReopen:()=>zt(!1)}):null,t[165]=_,t[166]=Rt,t[167]=e,t[168]=d,t[169]=C):C=t[169];let w;t[170]!==y||t[171]!==S||t[172]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,S,C]}),t[170]=y,t[171]=S,t[172]=C,t[173]=w):w=t[173];let O;t[174]!==Rt||t[175]!==d?(O=d&&Rt?{onReopen:()=>zt(!1)}:null,t[174]=Rt,t[175]=d,t[176]=O):O=t[176];let j;t[177]!==xe||t[178]!==D||t[179]!==R||t[180]!==E||t[181]!==O?(j=(0,Z.jsx)(zN,{stats:E,selectionStats:D,showStats:R,composerBadge:O,reserveRightGutter:xe}),t[177]=xe,t[178]=D,t[179]=R,t[180]=E,t[181]=O,t[182]=j):j=t[182];let M;t[183]!==w||t[184]!==j?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,j]}),t[183]=w,t[184]=j,t[185]=M):M=t[185],Gt=M;let N=ye&&ce,P=!ce,F;t[186]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Me(!0),Ne.current=!0;let e=()=>{Me(!1),Ne.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[186]=F):F=t[186];let L;t[187]!==ce||t[188]!==P?(L=(0,Z.jsx)(eT,{withHandle:P,disabled:ce,onPointerDown:F}),t[187]=ce,t[188]=P,t[189]=L):L=t[189];let z=se?0:`${Pe}px`,V=N?`0px`:xP,H;t[190]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{le(e.asPercentage===0),e.inPixels>0&&Ne.current&&(Fe.current=e.inPixels,Re(e.inPixels))},t[190]=H):H=t[190];let U=!je&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[191]===U?W=t[192]:(W=X(`flex flex-col bg-muted/20`,U),t[191]=U,t[192]=W);let K;t[193]!==_||t[194]!==i||t[195]!==x||t[196]!==e||t[197]!==a?(K=(0,Z.jsx)(yb,{docName:_,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:x}),t[193]=_,t[194]=i,t[195]=x,t[196]=e,t[197]=a,t[198]=K):K=t[198];let q;t[199]!==N||t[200]!==ce||t[201]!==ie||t[202]!==z||t[203]!==V||t[204]!==W||t[205]!==K?(q=(0,Z.jsx)($w,{id:`doc-panel`,panelRef:ie,disabled:N,defaultSize:z,minSize:V,maxSize:SP,collapsible:!0,collapsedSize:0,onResize:H,inert:ce,className:W,children:K}),t[199]=N,t[200]=ce,t[201]=ie,t[202]=z,t[203]=V,t[204]=W,t[205]=K,t[206]=q):q=t[206];let ee;t[207]!==L||t[208]!==q?(ee=(0,Z.jsxs)(Z.Fragment,{children:[L,q]}),t[207]=L,t[208]=q,t[209]=ee):ee=t[209],Kt=ee}let qt;t[210]!==d||t[211]!==c||t[212]!==o||t[213]!==ve||t[214]!==f||t[215]!==Gt?(qt=o==null?Gt:(0,Z.jsx)(vP,{visible:f,onVisibleChange:c??DP,dockPosition:ve,onBottomContainer:me,onEditorRegion:ge,onReveal:d,children:Gt}),t[210]=d,t[211]=c,t[212]=o,t[213]=ve,t[214]=f,t[215]=Gt,t[216]=qt):qt=t[216];let Jt=qt,Yt;t[217]!==ze||t[218]!==Ve||t[219]!==c||t[220]!==ae||t[221]!==ye||t[222]!==g?(Yt=ye?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eT,{withHandle:!0,onPointerDown:()=>{He(!0),Ue.current=!0;let e=()=>{He(!1),Ue.current=!1,window.removeEventListener(`pointerup`,e),ae.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)($w,{id:`terminal-column`,panelRef:ae,style:{backgroundColor:g},defaultSize:`${ze}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&Ue.current&&(Be.current=e.inPixels,Ke(e.inPixels))},className:X(`flex flex-col`,!Ve&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:fe,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[217]=ze,t[218]=Ve,t[219]=c,t[220]=ae,t[221]=ye,t[222]=g,t[223]=Yt):Yt=t[223];let Xt=Yt,Zt=Kt!=null&&!se||ye,Qt;t[224]===Symbol.for(`react.memo_cache_sentinel`)?(Qt=e=>{Ze(e),Qe.current=e},t[224]=Qt):Qt=t[224];let $t=je||Ve||void 0,en=ye?`5%`:`30%`,tn;t[225]===Zt?tn=t[226]:(tn=Zt?{}:{defaultSize:`100%`},t[225]=Zt,t[226]=tn);let nn=!(je||Ve)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,rn;t[227]===nn?rn=t[228]:(rn=X(nn),t[227]=nn,t[228]=rn);let an;t[229]!==Jt||t[230]!==en||t[231]!==tn||t[232]!==rn?(an=(0,Z.jsx)($w,{minSize:en,...tn,className:rn,children:Jt}),t[229]=Jt,t[230]=en,t[231]=tn,t[232]=rn,t[233]=an):an=t[233];let sn;t[234]!==$e||t[235]!==Kt||t[236]!==$t||t[237]!==an||t[238]!==Xt?(sn=(0,Z.jsxs)(Qw,{orientation:`horizontal`,groupRef:$e,"data-dragging":$t,children:[an,Kt,Xt]}),t[234]=$e,t[235]=Kt,t[236]=$t,t[237]=an,t[238]=Xt,t[239]=sn):sn=t[239];let cn;t[240]!==d||t[241]!==Se?(cn=Se?(0,Z.jsx)(gP,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[240]=d,t[241]=Se,t[242]=cn):cn=t[242];let ln;return t[243]!==sn||t[244]!==cn?(ln=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:Qt,children:[sn,cn]}),t[243]=sn,t[244]=cn,t[245]=ln):ln=t[245],ln}function DP(){}function OP(e){return!CP.has(e)}function kP(){return YT()}function AP(){return AT()}function jP(){return Ho()}function MP(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 NP(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 PP=1e3,FP=!1;function IP(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function LP(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:qc(i)?a=i:(a=void 0,FP||(FP=!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`&&(IP({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=NP(i),{current:c,crossDoc:l}=a?Uc(a,n,Date.now()):{current:[],crossDoc:[]},u=RP,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>MP(e.current,p)&&MP(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,PP);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 RP(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var zP=!1,BP=new Set,VP=!1;function HP(){for(let e of BP)e()}function UP(e){zP!==e&&(zP=e,HP())}function WP(){return zP}function GP(e){return BP.add(e),()=>{BP.delete(e)}}function KP(e){let t=[e.onUpdateRelaunching(()=>UP(!0)),e.onUpdateRelaunchFailed(()=>UP(!1))];return()=>{for(let e of t)e()}}function qP(){if(VP||typeof window>`u`)return;let e=window.okDesktop;e&&(VP=!0,KP(e))}function JP(){return(0,Q.useSyncExternalStore)(GP,WP,YP)}function YP(){return!1}var XP=`sync-status`;async function ZP(e){try{let t=await Q_(e);t.ok||cl.error(t.message,{id:XP,duration:1/0})}catch{}}function QP(e,t){let n=(0,$.c)(6),{_:r}=jt(),i=JP(),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){cl.dismiss(XP);return}o.current=!0;let e=window.okDesktop;cl.warning(r({id:`HGNCsl`}),{id:XP,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{ZP(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,cl.success(r({id:`GhjUB_`}),{id:XP,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 $P=4,eF=3,tF={Bird:Zp,Cat:im,Dog:fm,Fish:vm,Mouse:Jm,Rabbit:qm,Shrimp:eh,Snail:th,Squirrel:oh,Turtle:gh};Object.freeze(Object.keys(tF));function nF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(tF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var rF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function iF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=jt(),o=nF(n),s=o.kind===`animal`?tF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=zo(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=ya(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)(yn,{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)(bn,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Sn,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function aF(e){let t=rF[e.icon];return e.displayName||t||gl._({id:`iEQQyu`})}function oF(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 sF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=jt(),{activeDocName:s}=Xe(),{presence:c,agentId:l}=n,u=aF(c),d=oF(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)(Gc,{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)(Gc,{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)(yn,{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)(J,{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)(bn,{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)(Sn,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function cF(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?gl._({id:`9euN0m`,values:{count:n}}):gl._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(iF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(sF,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(re,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(ae,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function lF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(iF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(sF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function uF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Xe(),{current:s,crossDoc:c}=LP(t,r,n);if(QP(XT(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,$P),n;e[6]===s?n=e[7]:(n=s.slice($P),e[6]=s,e[7]=n);let r=n,u=c.slice(0,eF),d;e[8]===c?d=e[9]:(d=c.slice(eF),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=>lF(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)(cF,{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=>lF(e,p,!0,m)),f.length>0?(0,Z.jsx)(cF,{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}function dF(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(fF),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function fF(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function pF(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=jt(),{channel:i}=dF();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(js,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function mF(e,t){return t.trim()}function hF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function gF(e,t){let n=mF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function _F(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(wl(e)){let t=s.get(Td(e.docName,e.docExt));if(t){let n=xl(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Ao(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(Pl(e))return{...e,path:wF(e.path,n)};if(Fl(e)){let t=s.get(e.path);return t&&_l(t)?{kind:`document`,docName:dd(t),docExt:yl(t),size:e.size,modified:e.modified}:{...e,path:t??wF(e.path,n)}}return e})}function vF(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=>wl(e)?!i.has(e.docName)&&!OF(e.docName,n):Pl(e)?!OF(e.path,n):Fl(e)?!a.has(e.path)&&!OF(e.path,n):!0)}function yF(e,t){if(e.kind!==`asset`||t.some(t=>Fl(t)&&t.path===e.path))return e;let n=Od(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function bF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>TF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>wl(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=>Pl(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(wl(i)){let e=DF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Pl(i)){let e=EF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function xF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function SF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function CF(e,t){let n=e.kind===`file`?Td(e.path,e.docExt):e.path;return dc(t.contentDir,n,t.pathSeparator)}function wF(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 TF(e,t){return wl(e)&&wl(t)?e.docName===t.docName:Pl(e)&&Pl(t)||Fl(e)&&Fl(t)?e.path===t.path:!1}function EF(e,t,n){return e===t?n:DF(e,t,n)}function DF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function OF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function kF(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)(fp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function AF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(pp,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jF(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)(gp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function MF(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)(Sp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function NF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mp,{children:(0,Z.jsx)(hp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PF(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=X(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(vp,{"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 FF(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(As,{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)(Cp,{"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 IF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-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)(wp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LF(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=X(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(bp,{children:(0,Z.jsx)(Ds,{})})}),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)(yp,{"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 RF(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=X(`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)(_p,{"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 zF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var BF=`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`,VF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,HF={start:[Oc.Space],cancel:[Oc.Esc],end:[Oc.Space,Oc.Enter]};function UF(e){return X(BF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function WF(e){return e?void 0:-1}function GF({className:e,isDragging:t}){return X(e,t&&VF)}function KF(e){return e.code===Oc.Enter&&e.target===e.currentTarget}function qF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&KF(e)?`activate-tab`:`delegate-sortable`}function JF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Sc.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 YF(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function XF(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 ZF=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 bc(e)},QF=[`.md`,`.mdx`],$F=`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`,eI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,tI=X(eI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),nI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function rI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function iI(e){let t=tu(e);window.location.hash!==t&&(window.location.hash=t)}function aI(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function oI(e,t){let n=[t,...QF].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 sI(e){return e.metaKey||e.ctrlKey}var cI=1e3;function lI(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function uI(e,t){return lI(e,t)}function dI(e,t){let n=lI(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function fI(e,t){if(!sI(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function pI(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=X(UF(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(Re,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function mI(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:_}=wc(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=JF({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=qF({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=GF({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 hI(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=Ee(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?(_=Ee(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)(AF,{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)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(PF,{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)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(PF,{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)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(PF,{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)(zF,{}),(0,Z.jsx)(PF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{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)(NF,{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)(kF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function gI(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=jt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(pI,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Km,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(Y,{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[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=UF(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=WF(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(sl,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function _I(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Bc,{"aria-hidden":`true`,"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 vI(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=jt(),d=wT(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(_I,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:nI,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function yI(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:s,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,reopenClosedTab:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=Xe(),{_:E}=jt(),{pageMeta:D}=Ps(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(null),G=(0,Q.useRef)(t),K=(0,Q.useRef)(null),q=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te;e[0]!==n||e[1]!==t||e[2]!==i?(te=n??(i?Le(i):t?o(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=te):te=e[3];let ne=te,re;e[4]!==r||e[5]!==ne||e[6]!==h||e[7]!==g||e[8]!==v?(re=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:ne?`${ne}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=ne,e[6]=h,e[7]=g,e[8]=v,e[9]=re):re=e[9];let ie=re,ae,oe;e[10]===t?(ae=e[11],oe=e[12]):(ae=()=>{G.current=t},oe=[t],e[10]=t,e[11]=ae,e[12]=oe),(0,Q.useEffect)(ae,oe);let se,ce;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>()=>{K.current!==null&&(window.clearTimeout(K.current),K.current=null)},ce=[],e[13]=se,e[14]=ce):(se=e[13],ce=e[14]),(0,Q.useEffect)(se,ce);let le,ue;e[15]===ie?(le=e[16],ue=e[17]):(le=()=>{ie&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ue=[ie],e[15]=ie,e[16]=le,e[17]=ue),(0,Q.useEffect)(le,ue);let de,fe;e[18]===j?(de=e[19],fe=e[20]):(de=()=>{j&&(V.current?.focus(),V.current?.select())},fe=[j],e[18]=j,e[19]=de,e[20]=fe),(0,Q.useEffect)(de,fe);let pe,me;e[21]!==v||e[22]!==j?(pe=()=>{!j||v.includes(j.tabId)||(U.current=!0,W.current=null,M(null),P(``),I(null),R(!1))},me=[v,j],e[21]=v,e[22]=j,e[23]=pe,e[24]=me):(pe=e[23],me=e[24]),(0,Q.useEffect)(pe,me);let he;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e,t){let n=t.split(`/`);U.current=!1,W.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},e[25]=he):he=e[25];let ge=he,_e=function(){U.current=!0,W.current=null,M(null),P(``),I(null),R(!1)},ye=async function(){if(U.current){U.current=!1;return}if(H.current)return;let e=j?.docName;if(!e){_e();return}let t=mF(`file`,oI(N,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){_e();return}if(t===W.current){V.current?.focus();return}if(!hF(t)){I(E({id:`P8yDjG`})),V.current?.focus();return}let i=gF({kind:`file`,path:e,name:r},t);H.current=!0,R(!0),I(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(U.current){R(!1),H.current=!1;return}let r=await At(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),H.current=!1,W.current=t,V.current?.focus();return}let a=f(co,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=G.current,s=xF(o,a);Ke(a);let l=!0;try{let e=SF(a,p(),m);await Promise.all(e.map(e=>c(e))),S(a),Rl([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),cl.error(E({id:`MUBR8r`}))}U.current=!0,M(null),P(``),I(null),R(!1),H.current=!1,W.current=null,l&&s&&s!==o&&iI(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(E({id:`HIb0vl`})),R(!1),H.current=!1,W.current=t,V.current?.focus()}},be=typeof window<`u`&&window.okDesktop!=null,xe;e[26]===g?xe=e[27]:(xe=new Set(g),e[26]=g,e[27]=xe);let Se=xe,Ce;e[28]===k?Ce=e[29]:(Ce=XF(k),e[28]=k,e[29]=Ce);let we;e[30]===Ce?we=e[31]:(we=[Ce],e[30]=Ce,e[31]=we);let Te=we,Ee;e[32]!==l||e[33]!==d||e[34]!==Se?(Ee=function(e){let t=[],n=[];for(let r of e)Se.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[32]=l,e[33]=d,e[34]=Se,e[35]=Ee):Ee=e[35];let De=Ee,ke,Ae;e[36]!==s||e[37]!==a||e[38]!==r||e[39]!==ne||e[40]!==h||e[41]!==g||e[42]!==_||e[43]!==x||e[44]!==T?(ke=()=>{let e=new Set(g),t=function(){K.current!==null&&(window.clearTimeout(K.current),K.current=null)},n=function(e){q.current!==e&&(q.current=e)},i=function(e){ee.current!==e&&(ee.current=e,B(e))},o=function(){n(!0),!(ee.current||K.current!==null)&&(K.current=window.setTimeout(()=>{K.current=null,q.current&&i(!0)},cI))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?s(t):a(t)},u=function(e){if(T.length===0)return;let t=h?r:ne,n=t?T.indexOf(t):-1;l(T[((n>=0?n:0)+e+T.length)%T.length])},d=function(e){if(sI(e)&&o(),du(e,`tab-new`)){e.preventDefault(),_();return}if(du(e,`tab-reopen-closed`)){e.preventDefault(),x();return}if(du(e,`tab-next`)){e.preventDefault(),u(1);return}if(du(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=fI(e,T.length);t!==null&&(e.preventDefault(),l(T[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},Ae=[r,ne,s,a,h,g,_,x,T],e[36]=s,e[37]=a,e[38]=r,e[39]=ne,e[40]=h,e[41]=g,e[42]=_,e[43]=x,e[44]=T,e[45]=ke,e[46]=Ae):(ke=e[45],Ae=e[46]),(0,Q.useEffect)(ke,Ae);let je;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(je={activationConstraint:{distance:8}},e[47]=je):je=e[47];let Me;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Me={coordinateGetter:Mc,keyboardCodes:HF},e[48]=Me):Me=e[48];let Ne=Pc(Nc(Tc,je),Nc(Ec,Me)),Pe=z,Fe;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){A(YF(O.current,`[data-editor-tab-sortable]`))},e[49]=Fe):Fe=e[49];let Ie=Fe,Re;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(){A(null)},e[50]=Re):Re=e[50];let ze=Re,Be;e[51]!==ze||e[52]!==C||e[53]!==T?(Be=function(e){ze();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(Cc([...T],r,i),t)},e[51]=ze,e[52]=C,e[53]=T,e[54]=Be):Be=e[54];let Ve=Be,He=be?``:void 0,Ue;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=X(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,be&&`[-webkit-app-region:drag]`),e[55]=Ue):Ue=e[55];let We=aI,Ge;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=X(`flex items-end gap-1`,be&&`[-webkit-app-region:no-drag]`),e[56]=Ge):Ge=e[56];let qe=kc,Je=ZF,Ye;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ye={container:typeof document<`u`?document.body:void 0},e[57]=Ye):Ye=e[57];let Ze=Ac,$e;e[58]===T?$e=e[59]:($e=[...T],e[58]=T,e[59]=$e);let et=Dc,tt=T.map((e,t)=>{let n=z?uI(t,T.length):null,i=dI(t,T.length);if(Se.has(e)){let t=e===r;return(0,Z.jsx)(hI,{tabId:e,canPin:!1,openTabs:T,closeTab:l,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsxs)(mI,{tabId:e,activateFromKeyboard:()=>s(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:X($F,t?eI:tI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&s(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:nI,onClick:()=>s(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(pI,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:UF(Pe||t),tabIndex:WF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let o=Qe(e),c=e===ne,d=b.includes(e);if(o.kind===`folder`){let{baseName:t,label:r,prefix:s}=ve(o.folderPath,`/`),l=`${s}${r}`;return(0,Z.jsx)(hI,{tabId:e,openTabs:T,closeTab:u,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsxs)(mI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":c?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":c?`true`:void 0,className:X($F,c?eI:tI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":l,title:l,className:nI,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,c&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:X(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(gI,{accessibleLabel:l,closeTab:u,forceCloseVisible:Pe,isActive:c,isPinned:d,shortcutHint:n,tabId:e,unpinTab:w})]})},e)}if(o.kind===`asset`||o.kind===`skill-file`){let{baseName:t,label:r,prefix:s}=ve(o.kind===`asset`?o.assetPath:o.path,``),l=`${s}${r}`;return(0,Z.jsx)(hI,{tabId:e,openTabs:T,closeTab:u,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsxs)(mI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":c?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":c?`true`:void 0,className:X($F,c?eI:tI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":l,className:nI,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,c&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(gI,{accessibleLabel:l,closeTab:u,forceCloseVisible:Pe,isActive:c,isPinned:d,shortcutHint:n,tabId:e,unpinTab:w})]})},e)}let f=o.docName,p=D.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:_}=ve(f,p),v=`${_}${g}`,x=p===`.md`||p===`.mdx`,S=j?.tabId===e,C=`editor-tab-rename-error-${rI(f)}`;return(0,Z.jsx)(hI,{disabled:S,tabId:e,openTabs:T,closeTab:u,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsx)(mI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:S,"aria-current":c?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":c?`true`:void 0,className:X($F,c?eI:tI,S&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(tT,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(oT,{ref:V,value:N,disabled:L,"aria-label":E({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?C:void 0,"aria-busy":L||void 0,title:F??f,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=>{P(oI(e.target.value,p)),I(null),W.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ye()):e.key===`Escape`&&(e.preventDefault(),_e())},onBlur:ye}),(0,Z.jsx)(rT,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(aT,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),F?(0,Z.jsx)(`span`,{id:C,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vI,{accessibleLabel:v,activateTab:a,baseName:m,docName:f,enterRenameMode:ge,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(gI,{accessibleLabel:v,closeTab:u,forceCloseVisible:Pe,isActive:c,isPinned:d,shortcutHint:n,tabId:e,unpinTab:w})]})})},e)}),nt;e[60]!==Ze||e[61]!==$e||e[62]!==et||e[63]!==tt?(nt=(0,Z.jsx)(Ze,{items:$e,strategy:et,children:tt}),e[60]=Ze,e[61]=$e,e[62]=et,e[63]=tt,e[64]=nt):nt=e[64];let rt;e[65]!==qe||e[66]!==ze||e[67]!==Ve||e[68]!==Ie||e[69]!==Ne||e[70]!==!1||e[71]!==Je||e[72]!==Ye||e[73]!==nt||e[74]!==Te?(rt=(0,Z.jsx)(qe,{sensors:Ne,autoScroll:!1,collisionDetection:Je,modifiers:Te,onDragStart:Ie,onDragEnd:Ve,onDragCancel:ze,accessibility:Ye,children:nt}),e[65]=qe,e[66]=ze,e[67]=Ve,e[68]=Ie,e[69]=Ne,e[70]=!1,e[71]=Je,e[72]=Ye,e[73]=nt,e[74]=Te,e[75]=rt):rt=e[75];let it;e[76]===E?it=e[77]:(it=E({id:`3YvS-c`}),e[76]=E,e[77]=it);let at;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Oe,{"aria-hidden":`true`}),e[78]=at):at=e[78];let ot;e[79]!==_||e[80]!==it?(ot=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":it,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:at})}),e[79]=_,e[80]=it,e[81]=ot):ot=e[81];let st;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=st):st=e[82];let ct;e[83]===ot?ct=e[84]:(ct=(0,Z.jsxs)(Sn,{children:[ot,st]}),e[83]=ot,e[84]=ct);let lt;e[85]!==Ge||e[86]!==rt||e[87]!==ct?(lt=(0,Z.jsxs)(`div`,{className:Ge,children:[rt,ct]}),e[85]=Ge,e[86]=rt,e[87]=ct,e[88]=lt):lt=e[88];let ut;return e[89]!==He||e[90]!==Ue||e[91]!==We||e[92]!==lt?(ut=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":He,className:Ue,onWheel:We,children:lt}),e[89]=He,e[90]=Ue,e[91]=We,e[92]=lt,e[93]=ut):ut=e[93],ut}var bI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=bi(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},xI=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?bI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>bI(t,n,e))}},SI=(e,t)=>{t.shouldUseNativeValidation&&xI(e,t);let n={};for(let r in e){let i=bi(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(CI(t.names||Object.keys(e),r)){let e=Object.assign({},bi(n,r));Vi(e,`root`,a),Vi(n,r,e)}else Vi(n,r,a)}return n},CI=(e,t)=>{let n=wI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>wI(e).match(`^${n}\\.\\d+`))};function wI(e){return e.replace(/[\[\]]/g,``)}function TI(){return TI=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},TI.apply(null,arguments)}function EI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DI(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]=fi(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function OI(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(TI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=fi(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function kI(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(EI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:SI(DI(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(EI(function(){return Promise.resolve((n.mode===`sync`?Wo:qa)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof va}(e))return{values:{},errors:SI(OI(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 AI=`https://openknowledge.ai/api/subscribe`;async function jI(e,t){try{let n=await fetch(AI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.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 MI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=jt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=qo({email:ro({message:u({id:`Wq6Wcm`})})});_=ui,g=kI(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await jI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=X(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ds,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(sl,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(wi,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(tT,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(rT,{className:`pl-2.5`,children:(0,Z.jsx)(Pm,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(oT,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Y,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:X(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ic,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jn,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var NI=`https://github.com/inkeep/open-knowledge`,PI=`https://discord.gg/VRKk2EaGHN`,FI=`https://x.com/OpenKnowledge`,II=`ok-subscribe-card-v1`,LI={subscribed:!1,dismissed:!1,shownVersions:[]};function RI(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function zI(e){return e===!0}function BI(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function VI(e){if(typeof e!=`object`||!e)return LI;let t=e;return{subscribed:zI(t.subscribed),dismissed:zI(t.dismissed),shownVersions:BI(t.shownVersions)}}function HI(e){try{let t=(e??localStorage).getItem(II);return t==null?LI:VI(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),LI}}function UI(e,t){try{(t??localStorage).setItem(II,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function WI(e){let t=HI(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,UI(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=HI(e),i())}}}var GI=WI();function KI(){GI.install()}function qI(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 JI(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 YI=`${NI}/issues/new`,XI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:N},{label:{id:`PCNIuJ`},href:YI,icon:om},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Ns}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:PI,icon:qI},{label:`X (Twitter)`,href:FI,icon:JI},{label:`GitHub`,href:NI,icon:Sg}]}],ZI=`${NI}/releases`,QI=`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 $I(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var eL=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=jt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=$I(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)(sh,{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},tL=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=jt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>zu(e,o),l=e=>zu(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:QI,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},nL=e=>{let t=(0,$.c)(5),{onSelect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=X(QI,`h-auto w-full justify-start font-normal`),t[0]=r):r=t[0];let i,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ze,{"aria-hidden":`true`,className:`size-4 shrink-0`}),a=(0,Z.jsx)(J,{id:`cd5EXh`}),t[1]=i,t[2]=a):(i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{variant:`ghost`,className:r,onClick:n,children:[i,a]})}),t[3]=n,t[4]=o),o},rL=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},iL=()=>{let e=(0,$.c)(33),{_:t}=jt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=typeof window<`u`&&window.okDesktop!=null,d,f;e[0]!==n||e[1]!==c?(d=()=>{if(!n||c!==null)return;let e=new AbortController;return Ma({signal:e.signal}).then(e=>{e!==null&&l(e)}),()=>e.abort()},f=[n,c],e[0]=n,e[1]=c,e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{r(e),e||a(!1)},e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(He,{className:`size-4`}),e[5]=m):m=e[5];let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[m,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=h):h=e[6];let g;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Sn,{children:[h,(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=g):g=e[7];let _;e[8]!==t||e[9]!==c?(_=XI.map((e,n)=>(0,Z.jsxs)(`div`,{className:X(n>0&&`mt-3`),children:[(0,Z.jsx)(rL,{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.jsxs)(Q.Fragment,{children:[(0,Z.jsx)(tL,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&c!==null?(0,Z.jsx)(eL,{count:c}):void 0}),u&&e.href===YI&&(0,Z.jsx)(nL,{onSelect:()=>{r(!1),s(!0)}})]},e.href))})})]},e.key)),e[8]=t,e[9]=c,e[10]=_):_=e[10];let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(rL,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=v):v=e[11];let y;e[12]===t?y=e[13]:(y=t({id:`arUUsK`}),e[12]=t,e[13]=y);let b;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(tL,{link:{label:{id:`3ePd3I`},href:ZI,icon:Fm}}),e[14]=b):b=e[14];let x;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,className:X(QI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Pm,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=x):x=e[15];let S;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(re,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(MI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:aL})}),e[16]=S):S=e[16];let C;e[17]===i?C=e[18]:(C=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[b,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ae,{open:i,onOpenChange:a,children:[x,S]})})]}),e[17]=i,e[18]=C);let w;e[19]!==C||e[20]!==y?(w=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[v,(0,Z.jsx)(`nav`,{"aria-label":y,children:C})]}),e[19]=C,e[20]=y,e[21]=w):w=e[21];let T;e[22]!==w||e[23]!==_?(T=(0,Z.jsxs)(re,{align:`end`,className:`w-56 p-3`,children:[_,w]}),e[22]=w,e[23]=_,e[24]=T):T=e[24];let E;e[25]!==n||e[26]!==T?(E=(0,Z.jsxs)(ae,{open:n,onOpenChange:p,children:[g,T]}),e[25]=n,e[26]=T,e[27]=E):E=e[27];let D;e[28]===o?D=e[29]:(D=u&&(0,Z.jsx)(Df,{open:o,onOpenChange:s}),e[28]=o,e[29]=D);let O;return e[30]!==E||e[31]!==D?(O=(0,Z.jsxs)(Z.Fragment,{children:[E,D]}),e[30]=E,e[31]=D,e[32]=O):O=e[32],O};function aL(){return GI.markSubscribed()}function oL(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=jt(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Qo,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsxs)(js,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(bn,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(Sn,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var sL=50,cL=()=>{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,Rw.preload()},sL))},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=Oi)},l=(0,Z.jsx)(Qm,{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)(yn,{asChild:!0,children:(0,Z.jsxs)(Y,{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)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Sn,{children:[u,(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},lL=`https://openknowledge.ai/docs/features/share`;function uL(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=jt(),{status:a}=ls(),[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=as(c?.freshness,a),g;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(g=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await gi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:td,toastSuccess:vL,toastError:_L,logEvent:gL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{cl.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=g):g=t[9];let _=g,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)($m,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let T;t[16]!==_||t[17]!==b||t[18]!==x?(T=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:_,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=_,t[17]=b,t[18]=x,t[19]=T):T=t[19];let E=h?`w-96`:`w-80`,D;t[20]===E?D=t[21]:(D=X(`flex flex-col gap-2`,E),t[20]=E,t[21]=D);let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[22]=O):O=t[22];let k;t[23]===c?.autoCopyFailed?k=t[24]:(k=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=k);let A=c?.url??``,j;t[25]===i?j=t[26]:(j=i({id:`5-FeN2`}),t[25]=i,t[26]=j);let M;t[27]!==A||t[28]!==j?(M=(0,Z.jsx)(ml,{ref:u,readOnly:!0,value:A,onFocus:hL,onClick:mL,onContextMenu:pL,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":j}),t[27]=A,t[28]=j,t[29]=M):M=t[29];let N=c?.url??``,P=c?.autoCopyFailed===!1,F;t[30]!==N||t[31]!==P?(F=(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)(Ms,{copyContent:N,clipboardWrite:td,initialCopied:P})})}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==M||t[34]!==F?(I=(0,Z.jsxs)(`div`,{className:`relative`,children:[M,F]}),t[33]=M,t[34]=F,t[35]=I):I=t[35];let L=c?.freshness,R=n?.kind??`doc`,z;t[36]!==a||t[37]!==L||t[38]!==R?(z=(0,Z.jsx)(rs,{freshness:L,status:a,kind:R}),t[36]=a,t[37]=L,t[38]=R,t[39]=z):z=t[39];let B;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(`a`,{href:lL,target:`_blank`,rel:`noopener noreferrer`,onClick:fL,onAuxClick:dL,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)(He,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=B):B=t[40];let V;t[41]!==D||t[42]!==k||t[43]!==I||t[44]!==z?(V=(0,Z.jsxs)(re,{align:`end`,className:D,"data-testid":`share-button-popover`,children:[O,k,I,z,B]}),t[41]=D,t[42]=k,t[43]=I,t[44]=z,t[45]=V):V=t[45];let H;return t[46]!==T||t[47]!==V||t[48]!==v?(H=(0,Z.jsxs)(ae,{open:v,onOpenChange:y,children:[T,V]}),t[46]=T,t[47]=V,t[48]=v,t[49]=H):H=t[49],H}function dL(e){return zu(e,lL)}function fL(e){return zu(e,lL)}function pL(e){return e.currentTarget.select()}function mL(e){return e.currentTarget.select()}function hL(e){return e.currentTarget.select()}function gL(e){return console.log(e)}function _L(e){e!==`Link ready but could not copy to clipboard.`&&cl.error(e)}function vL(e){return cl.success(e)}function yL(e){let t=(0,$.c)(36),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=jt(),{activeDocName:o,activeTarget:s}=Xe(),c=o?Uo(o):null,{state:l,isDraggingRail:u}=lN(),d=S_(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=uu(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=uu(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=pi(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=xi(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=pi(``),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=X(`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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(mN,{className:X(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(bn,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:X(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(_t,{"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(qi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(yI,{})]}),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=X(`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)(uL,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(na,{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)(Pi,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(uF,{}),j=(0,Z.jsx)(qi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(oL,{}),N=(0,Z.jsx)(pF,{}),t[20]=A,t[21]=j,t[22]=M,t[23]=N):(A=t[20],j=t[21],M=t[22],N=t[23]);let P;t[24]===d?P=t[25]:(P=!d&&(0,Z.jsx)(cL,{}),t[24]=d,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(iL,{}),t[26]=F):F=t[26];let I;t[27]!==O||t[28]!==k||t[29]!==P?(I=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P,F]}),t[27]=O,t[28]=k,t[29]=P,t[30]=I):I=t[30];let L;return t[31]!==I||t[32]!==x||t[33]!==w||t[34]!==E?(L=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,I]}),t[31]=I,t[32]=x,t[33]=w,t[34]=E,t[35]=L):L=t[35],L}var bL=`open-knowledge:terminal-launch`;function xL(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(bL,{detail:{prompt:e,cli:t}}))}function SL(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(bL,n),()=>t.removeEventListener(bL,n)}function CL(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=X(`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)(Bp,{"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 wL=un(`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 TL(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=X(wL({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)(Vp,{"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 EL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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)(Hp,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Up,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var OL=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-N3nlUpP9.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([107,1,6,2,3,7,8,9,10,15,20,53,80,16,108,81,47,48,68,69,109]),import.meta.url));function kL(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ta(),f=ra(),{_:p}=jt(),m=d&&u===!1,h;t[0]!==p||t[1]!==f?(h=function(){if(f===null){cl.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||cl.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=h):h=t[2];let g=h;if(d&&!m){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]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(I,{fallbackRender:jL,onError:AL,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(OL,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let _;return t[11]!==g||t[12]!==m?(_=m?(0,Z.jsx)(PL,{onEnable:g}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=g,t[12]=m,t[13]=_):_=t[13],_}function AL(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function jL(e){return(0,Z.jsx)(ML,{...e})}function ML(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=jt(),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)(Y,{onClick:NL,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 NL(){return window.location.reload()}function PL(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=jt(),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)(Y,{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 FL(e){let t=(0,$.c)(53),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,visibleClis:o,className:s}=e,c=o===void 0?nc:o,{_:l}=jt(),u=n===`terminal`,d;t[0]!==l||t[1]!==u||t[2]!==n?(d=l(u?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:ka[n].displayName}}),t[0]=l,t[1]=u,t[2]=n,t[3]=d):d=t[3];let f=d,p;t[4]===s?p=t[5]:(p=X(`flex shrink-0 items-center`,s),t[4]=s,t[5]=p);let m;t[6]!==u||t[7]!==n?(m=u?(0,Z.jsx)(ah,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(rc,{id:Ws(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=u,t[7]=n,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3`}),t[9]=h):h=t[9];let g;t[10]!==r||t[11]!==f||t[12]!==m?(g=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":f,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[m,h]})}),t[10]=r,t[11]=f,t[12]=m,t[13]=g):g=t[13];let _;t[14]===f?_=t[15]:(_=(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:f}),t[14]=f,t[15]=_);let v;t[16]!==g||t[17]!==_?(v=(0,Z.jsxs)(Sn,{children:[g,_]}),t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;t[19]===l?y=t[20]:(y=l({id:`QJaG-9`}),t[19]=l,t[20]=y);let b;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3`}),t[21]=b):b=t[21];let x;t[22]===y?x=t[23]:(x=(0,Z.jsx)(jr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":y,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:b})}),t[22]=y,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`hIQkLb`})}),t[24]=S):S=t[24];let C;if(t[25]!==l||t[26]!==i||t[27]!==n||t[28]!==c){let e;t[30]!==l||t[31]!==i||t[32]!==n?(e=e=>{let{displayName:t}=ka[e];return(0,Z.jsxs)(Gr,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":l({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(rc,{id:Ws(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)},t[30]=l,t[31]=i,t[32]=n,t[33]=e):e=t[33],C=c.map(e),t[25]=l,t[26]=i,t[27]=n,t[28]=c,t[29]=C}else C=t[29];let w;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Vr,{}),t[34]=w):w=t[34];let T=u?`true`:void 0,E;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ah,{"aria-hidden":`true`,className:`size-4`}),t[35]=E):E=t[35];let D;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`ALhMYW`})}),t[36]=D):D=t[36];let O;t[37]===u?O=t[38]:(O=u?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[37]=u,t[38]=O);let k;t[39]!==a||t[40]!==T||t[41]!==O?(k=(0,Z.jsxs)(Gr,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":T,children:[E,D,O]}),t[39]=a,t[40]=T,t[41]=O,t[42]=k):k=t[42];let A;t[43]!==C||t[44]!==k?(A=(0,Z.jsxs)(qr,{align:`start`,className:`min-w-[180px]`,children:[S,C,w,k]}),t[43]=C,t[44]=k,t[45]=A):A=t[45];let j;t[46]!==x||t[47]!==A?(j=(0,Z.jsxs)($r,{children:[x,A]}),t[46]=x,t[47]=A,t[48]=j):j=t[48];let M;return t[49]!==j||t[50]!==p||t[51]!==v?(M=(0,Z.jsxs)(`div`,{className:p,children:[v,j]}),t[49]=j,t[50]=p,t[51]=v,t[52]=M):M=t[52],M}var IL=`[data-terminal-tab-sortable]`;function LL(e){let t=(0,$.c)(17),{id:n,disabled:r,isActive:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o={id:n,disabled:r},t[0]=r,t[1]=n,t[2]=o):o=t[2];let{setNodeRef:s,listeners:c,rect:l,transform:u,transition:d,isDragging:f}=wc(o),p=l.current?.width,m;t[3]!==f||t[4]!==p||t[5]!==u||t[6]!==d?(m=JF({activeWidth:p,isDragging:f,transform:u,transition:d}),t[3]=f,t[4]=p,t[5]=u,t[6]=d,t[7]=m):m=t[7];let h=m,g=i?`bg-muted`:`hover:bg-muted/50`,_=f&&`z-10`,v;t[8]!==g||t[9]!==_?(v=X(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,g,_),t[8]=g,t[9]=_,t[10]=v):v=t[10];let y;return t[11]!==a||t[12]!==c||t[13]!==s||t[14]!==h||t[15]!==v?(y=(0,Z.jsx)(`div`,{ref:s,"data-terminal-tab-sortable":``,style:h,className:v,...c,children:a}),t[11]=a,t[12]=c,t[13]=s,t[14]=h,t[15]=v,t[16]=y):y=t[16],y}function RL(e){let t=(0,$.c)(85),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,newChatVisibleClis:u,onClose:d,onRename:f,onReorder:p,onDragActiveChange:m,dockPosition:h,onToggleDock:g,onCollapse:_,children:v,className:y,draggable:b}=e,{_:x}=jt(),S=h===`right`,[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(``),D=(0,Q.useRef)(null),O=(0,Q.useRef)(!1),k=f!=null,A,j;t[0]===C?(A=t[1],j=t[2]):(A=()=>{C!=null&&(D.current?.focus(),D.current?.select())},j=[C],t[0]=C,t[1]=A,t[2]=j),(0,Q.useEffect)(A,j);let M,N;t[3]!==C||t[4]!==n?(M=()=>{C!=null&&!n.some(e=>e.id===C)&&(O.current=!1,w(null),E(``))},N=[n,C],t[3]=C,t[4]=n,t[5]=M,t[6]=N):(M=t[5],N=t[6]),(0,Q.useEffect)(M,N);let P=function(e){k&&(O.current=!1,w(e.id),E(e.label))},F;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e):e;queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${t}"]`)?.focus()})},t[7]=F):F=t[7];let I=F,L=function(e){O.current||f?.(e,T.trim()),O.current=!1,w(null),E(``),I(e)},R=(0,Q.useRef)(null),[z,B]=(0,Q.useState)(null),V;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(V={activationConstraint:{distance:8}},t[8]=V):V=t[8];let H=Pc(Nc(Tc,V)),U=p!=null,W;t[9]===z?W=t[10]:(W=XF(z),t[9]=z,t[10]=W);let G;t[11]===W?G=t[12]:(G=[W],t[11]=W,t[12]=G);let K=G,q;t[13]===m?q=t[14]:(q=function(){B(YF(R.current,IL)),m?.(!0)},t[13]=m,t[14]=q);let ee=q,te;t[15]!==m||t[16]!==p||t[17]!==n?(te=function(e){B(null),m?.(!1);let t=String(e.active.id),r=e.over?String(e.over.id):null;if(!r||t===r)return;let i=n.map(BL),a=i.indexOf(t),o=i.indexOf(r);a<0||o<0||a===o||p?.(Cc(i,a,o))},t[15]=m,t[16]=p,t[17]=n,t[18]=te):te=t[18];let ne=te,re;t[19]===m?re=t[20]:(re=function(){B(null),m?.(!1)},t[19]=m,t[20]=re);let ie=re,ae=CL,oe;t[21]===y?oe=t[22]:(oe=X(`flex min-h-0 min-w-0 flex-1 flex-col`,y),t[21]=y,t[22]=oe);let se=b?``:void 0,ce=b&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,le;t[23]===ce?le=t[24]:(le=X(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,ce),t[23]=ce,t[24]=le);let ue=TL,de;t[25]===x?de=t[26]:(de=x({id:`1MGRQl`}),t[25]=x,t[26]=de);let fe=b&&`[-webkit-app-region:no-drag]`,pe;t[27]===fe?pe=t[28]:(pe=X(`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,fe),t[27]=fe,t[28]=pe);let me=kc,he=ZF,ge;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ge={container:typeof document<`u`?document.body:void 0},t[29]=ge):ge=t[29];let _e=Ac,ve;t[30]===n?ve=t[31]:(ve=n.map(zL),t[30]=n,t[31]=ve);let ye=Dc,be=n.map(e=>{let t=e.id===r;return(0,Z.jsx)(LL,{id:e.id,disabled:!U||C!=null,isActive:t,children:C===e.id?(0,Z.jsx)(tT,{className:X(`h-7 w-40 rounded-md border-0 bg-transparent dark:bg-transparent`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(oT,{ref:D,value:T,"aria-label":x({id:`0TnCvC`,values:{0:e.label}}),"data-testid":`terminal-tab-rename-input`,className:`h-7 px-2 text-xs`,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),D.current?.blur()):e.key===`Escape`&&(e.preventDefault(),O.current=!0,D.current?.blur())},onBlur:()=>L(e.id)})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(EL,{value:e.id,"data-tab-id":e.id,onClick:t=>{t.detail>=2||a?.(e.id)},onDoubleClick:()=>P(e),onKeyDown:t=>{t.key===`F2`&&(t.preventDefault(),P(e))},className:X(`h-7 flex-none rounded-md px-2 text-xs`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":x({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:X(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`,b&&`[-webkit-app-region:no-drag]`),onClick:t=>{t.stopPropagation(),d(e.id)},children:(0,Z.jsx)(sl,{"aria-hidden":`true`})})]})},e.id)}),xe;t[32]!==_e||t[33]!==ve||t[34]!==ye||t[35]!==be?(xe=(0,Z.jsx)(_e,{items:ve,strategy:ye,children:be}),t[32]=_e,t[33]=ve,t[34]=ye,t[35]=be,t[36]=xe):xe=t[36];let Se;t[37]!==me||t[38]!==ie||t[39]!==ne||t[40]!==ee||t[41]!==K||t[42]!==H||t[43]!==!1||t[44]!==he||t[45]!==ge||t[46]!==xe?(Se=(0,Z.jsx)(me,{sensors:H,autoScroll:!1,collisionDetection:he,modifiers:K,onDragStart:ee,onDragEnd:ne,onDragCancel:ie,accessibility:ge,children:xe}),t[37]=me,t[38]=ie,t[39]=ne,t[40]=ee,t[41]=K,t[42]=H,t[43]=!1,t[44]=he,t[45]=ge,t[46]=xe,t[47]=Se):Se=t[47];let Ce;t[48]!==ue||t[49]!==de||t[50]!==pe||t[51]!==Se?(Ce=(0,Z.jsx)(ue,{variant:`line`,"aria-label":de,className:pe,children:Se}),t[48]=ue,t[49]=de,t[50]=pe,t[51]=Se,t[52]=Ce):Ce=t[52];let we=b&&`[-webkit-app-region:no-drag]`,Te;t[53]===we?Te=t[54]:(Te=X(`shrink-0`,we),t[53]=we,t[54]=Te);let Ee;t[55]!==o||t[56]!==u||t[57]!==s||t[58]!==c||t[59]!==l||t[60]!==Te?(Ee=(0,Z.jsx)(FL,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,visibleClis:u,className:Te}),t[55]=o,t[56]=u,t[57]=s,t[58]=c,t[59]=l,t[60]=Te,t[61]=Ee):Ee=t[61];let De;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(`div`,{className:`flex-1`}),t[62]=De):De=t[62];let Oe;t[63]!==x||t[64]!==g||t[65]!==S?(Oe=g==null?null:(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":x(S?{id:`rf6x3F`}:{id:`QNxpRm`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:g,children:S?(0,Z.jsx)(zm,{"aria-hidden":`true`}):(0,Z.jsx)(Um,{"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:S?(0,Z.jsx)(J,{id:`rf6x3F`}):(0,Z.jsx)(J,{id:`QNxpRm`})})]}),t[63]=x,t[64]=g,t[65]=S,t[66]=Oe):Oe=t[66];let ke;t[67]!==x||t[68]!==_||t[69]!==S?(ke=_==null?null:(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":x({id:`VZGGPK`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:_,children:S?(0,Z.jsx)(As,{"aria-hidden":`true`}):(0,Z.jsx)(ks,{"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`VZGGPK`})})]}),t[67]=x,t[68]=_,t[69]=S,t[70]=ke):ke=t[70];let Ae;t[71]!==se||t[72]!==le||t[73]!==Ce||t[74]!==Ee||t[75]!==Oe||t[76]!==ke?(Ae=(0,Z.jsxs)(`div`,{ref:R,"data-electron-drag":se,className:le,children:[Ce,Ee,De,Oe,ke]}),t[71]=se,t[72]=le,t[73]=Ce,t[74]=Ee,t[75]=Oe,t[76]=ke,t[77]=Ae):Ae=t[77];let je;return t[78]!==ae||t[79]!==r||t[80]!==v||t[81]!==i||t[82]!==oe||t[83]!==Ae?(je=(0,Z.jsxs)(ae,{value:r,onValueChange:i,className:oe,children:[Ae,v]}),t[78]=ae,t[79]=r,t[80]=v,t[81]=i,t[82]=oe,t[83]=Ae,t[84]=je):je=t[84],je}function zL(e){return e.id}function BL(e){return e.id}function VL(e){return`terminal-session-${e}`}function HL(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function UL(e){return e?.contains(document.activeElement)??!1}function WL(e,t){return t===`window`||UL(e)}function GL(e){let t=(0,$.c)(67),{bridge:n,variant:r,visible:i,onVisibleChange:a,launch:o,installedClis:s,container:c,isShowing:l,onRequestEditorFocus:u,dockPosition:d,onToggleDock:f,onHasSessionsChange:p,onActiveSessionCliChange:m}=e,h=r===void 0?`dock`:r,g=o===void 0?null:o,{_}=jt(),[v]=(0,Q.useState)(nR),y,b;t[0]!==c||t[1]!==v?(y=()=>{v==null||c==null||v.parentElement!==c&&c.appendChild(v)},b=[v,c],t[0]=c,t[1]=v,t[2]=y,t[3]=b):(y=t[2],b=t[3]),(0,Q.useLayoutEffect)(y,b);let x=typeof n.terminal?.list==`function`,S;t[4]!==x||t[5]!==g||t[6]!==i?(S=()=>!x&&i?[{id:VL(1),launch:g,title:null,customLabel:null,ordinal:1,adoptPtyId:null}]:[],t[4]=x,t[5]=g,t[6]=i,t[7]=S):S=t[7];let[C,w]=(0,Q.useState)(S),T;t[8]!==x||t[9]!==i?(T=()=>!x&&i?VL(1):``,t[8]=x,t[9]=i,t[10]=T):T=t[10];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!x),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(E),N=(0,Q.useRef)(C),P=(0,Q.useRef)(!x&&i?1:0),F=(0,Q.useRef)(i&&g?g.nonce:null),I=(0,Q.useRef)(h===`window`?!1:i),L=(0,Q.useRef)(new Map),R=function(e,t){if(t===null){L.current.delete(e);return}L.current.set(e,t);let r=N.current.find(t=>t.id===e);r!=null&&n.terminal?.setMeta?.(t,{ordinal:r.ordinal,customLabel:r.customLabel})},z=(0,Q.useRef)(0),B=function(e){P.current+=1;let t=VL(P.current);w(n=>[...n,{id:t,launch:e,title:null,customLabel:null,ordinal:P.current,adoptPtyId:null}]),D(t)},[V,H]=(0,Q.useState)(tR),[U,W]=(0,Q.useState)(eR),G;t[11]===s?G=t[12]:(G=s??{},t[11]=s,t[12]=G);let K=Mv(V,G),q=U?`terminal`:K,ee=Xs(s??{},K),te=function(e){z.current+=1,B({prompt:null,cli:e,nonce:z.current})},ne=function(){U?B(null):te(K)},re=function(e){W(!1),Vv(!1);let t=Ev(e);H(t),Av(t),te(e)},ie=function(){W(!0),Vv(!0),B(null)},ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){let n=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[13]=ae):ae=t[13];let oe=ae,se=function(e,t){let r=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.customLabel!==r)?t.map(t=>t.id===e?{...t,customLabel:r}:t):t);let i=L.current.get(e);i!=null&&n.terminal?.setMeta?.(i,{customLabel:r})},ce;t[14]===_?ce=t[15]:(ce=function(e){return e.customLabel??e.title??_({id:`OVjNeX`,values:{0:e.ordinal}})},t[14]=_,t[15]=ce);let le=ce,ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=function(e){w(t=>{if(e.length!==t.length)return t;let n=new Map(t.map($L)),r=[];for(let i of e){let e=n.get(i);if(e==null)return t;r.push(e)}return r.every((e,n)=>e===t[n])?t:r});let t=e.map(e=>L.current.get(e)).filter(QL);t.length>0&&n.terminal?.setOrder?.(t)},me=function(e){let t=N.current,n=t.findIndex(e=>e.id===j.current);if(n<0)return null;let r=n+e;if(r<0||r>=t.length)return null;let i=t.map(ZL),[a]=i.splice(n,1);return i.splice(r,0,a),pe(i),{label:le(t[n]),position:r+1,total:t.length}},he=(0,Q.useRef)(me),ge=(0,Q.useRef)(B),_e=function(e){let t=N.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===E){let e=(t[n-1]??t[n+1])?.id??``;D(e),e!==``&&queueMicrotask(()=>HL(e))}w(r),r.length===0&&(a(!1),u())},ve=(0,Q.useRef)(XL);(0,Q.useEffect)(()=>{ge.current=B,he.current=me,j.current=E,N.current=C,ve.current=()=>{E!==``&&_e(E)}});let ye;t[16]!==g||t[17]!==O||t[18]!==C.length||t[19]!==i?(ye=[i,g,C.length,O],t[16]=g,t[17]=O,t[18]=C.length,t[19]=i,t[20]=ye):ye=t[20],(0,Q.useEffect)(()=>{if(!O)return;let e=I.current;if(I.current=i,g!=null&&g.nonce!==F.current){F.current=g.nonce,ge.current(g);return}i&&!e&&C.length===0&&ge.current(null)},ye);let be;t[21]===n?be=t[22]:(be=[n],t[21]=n,t[22]=be),(0,Q.useEffect)(()=>{if(typeof n.terminal?.list!=`function`||A.current)return;A.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(YL);P.current=Math.max(e.length,...e.map(JL)),w(e),D(e[0]?.id??``)}k(!0)}})(),()=>{e=!0,A.current=!1}},be);let xe;t[23]===n?xe=t[24]:(xe=[n],t[23]=n,t[24]=xe),(0,Q.useEffect)(()=>kt(e=>{let t=j.current,r=t===``?void 0:L.current.get(t);r==null?xL(e,`claude`):(n.terminal.input(r,e),queueMicrotask(()=>HL(t)))}),xe);let Se;t[25]===h?Se=t[26]:(Se=[h],t[25]=h,t[26]=Se),(0,Q.useEffect)(()=>M(e=>{e===`new-terminal`?ge.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&h===`window`)&&ve.current()}),Se);let Ce;t[27]!==v||t[28]!==h?(Ce=[v,h],t[27]=v,t[28]=h,t[29]=Ce):Ce=t[29],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!WL(v,h))return;let t=N.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),D(t.id),queueMicrotask(()=>HL(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Ce);let we;t[30]!==_||t[31]!==v||t[32]!==h?(we=[v,h,_],t[30]=_,t[31]=v,t[32]=h,t[33]=we):we=t[33],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||!e.shiftKey||e.ctrlKey||e.altKey)return;let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);if(t===0||!WL(v,h)||ue.current)return;let n=e.target;if(n?.tagName===`INPUT`||n?.isContentEditable)return;let r=he.current(t);if(r==null)return;e.preventDefault(),e.stopPropagation(),queueMicrotask(()=>HL(j.current));let i=_({id:`CoHvYd`,values:{0:r.label,1:r.position,2:r.total}});fe.current!=null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,de.current!=null&&(de.current.textContent=i)},60)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>{window.removeEventListener(`keydown`,e,{capture:!0}),fe.current!=null&&(window.clearTimeout(fe.current),fe.current=null)}},we);let Te;t[34]!==n.editor||t[35]!==C.length?(Te=()=>{let e=C.length>0;E_({terminalLive:e}),n.editor.notifyViewMenuStateChanged({terminalLive:e})},t[34]=n.editor,t[35]=C.length,t[36]=Te):Te=t[36];let Ee;t[37]!==n||t[38]!==C.length?(Ee=[n,C.length],t[37]=n,t[38]=C.length,t[39]=Ee):Ee=t[39],(0,Q.useEffect)(Te,Ee);let De,Oe;t[40]!==p||t[41]!==C.length?(De=()=>{p?.(C.length>0)},Oe=[p,C.length],t[40]=p,t[41]=C.length,t[42]=De,t[43]=Oe):(De=t[42],Oe=t[43]),(0,Q.useEffect)(De,Oe);let ke;t[44]!==E||t[45]!==C?(ke=C.find(e=>e.id===E)?.launch?.cli,t[44]=E,t[45]=C,t[46]=ke):ke=t[46];let Ae=ke!=null,je,Me;t[47]!==Ae||t[48]!==m?(je=()=>{m?.(Ae)},Me=[m,Ae],t[47]=Ae,t[48]=m,t[49]=je,t[50]=Me):(je=t[49],Me=t[50]),(0,Q.useEffect)(je,Me);let Ne,Pe;t[51]!==v||t[52]!==l||t[53]!==u||t[54]!==i?(Ne=()=>{l||i||UL(v)&&u()},Pe=[l,i,v,u],t[51]=v,t[52]=l,t[53]=u,t[54]=i,t[55]=Ne,t[56]=Pe):(Ne=t[55],Pe=t[56]),(0,Q.useLayoutEffect)(Ne,Pe);let Fe;t[57]===l?Fe=t[58]:(Fe=[l],t[57]=l,t[58]=Fe),(0,Q.useEffect)(()=>{l&&HL(j.current)},Fe);let Ie;if(t[59]!==_||t[60]!==C){let e;t[62]===_?e=t[63]:(e=e=>({id:e.id,label:e.customLabel??e.title??_({id:`OVjNeX`,values:{0:e.ordinal}})}),t[62]=_,t[63]=e),Ie=C.map(e),t[59]=_,t[60]=C,t[61]=Ie}else Ie=t[61];let Le=Ie,Re=[...C].sort(qL),ze=C.length>0?(0,Z.jsx)(RL,{sessions:Le,activeSessionId:E,onSelect:D,onTabActivate:KL,newChatSelected:q,onNewChatLaunch:ne,onNewChatPickCli:re,onNewChatPickTerminal:ie,newChatVisibleClis:ee,onClose:_e,onRename:se,onReorder:pe,onDragActiveChange:e=>{ue.current=e},dockPosition:d,onToggleDock:f,onCollapse:h===`window`?void 0:()=>a(!1),draggable:h===`window`,className:`h-full`,children:Re.map(e=>(0,Z.jsx)(DL,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:X(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,h===`window`&&`px-[22px] pb-[22px]`),children:(0,Z.jsx)(kL,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>R(e.id,t),onTitleChange:t=>oe(e.id,t),onClose:()=>_e(e.id)})},e.id))}):null,Be;return t[64]!==v||t[65]!==ze?(Be=v==null?null:(0,tm.createPortal)((0,Z.jsxs)(Z.Fragment,{children:[ze,(0,Z.jsx)(`span`,{ref:de,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,"data-testid":`terminal-reorder-announcer`})]}),v),t[64]=v,t[65]=ze,t[66]=Be):Be=t[66],Be}function KL(e){return queueMicrotask(()=>HL(e))}function qL(e,t){return e.ordinal-t.ordinal}function JL(e){return e.ordinal}function YL(e,t){return{id:VL(t+1),launch:null,title:null,customLabel:e.customLabel??null,ordinal:e.ordinal??t+1,adoptPtyId:e.ptyId}}function XL(){}function ZL(e){return e.id}function QL(e){return e!=null}function $L(e){return[e.id,e]}function eR(){return Hv()}function tR(){return kv()}function nR(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function rR(e){let t=(0,$.c)(86),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=_v(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(mb[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=vv(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(Rv),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),Lv(e),y(!0)},t[2]=A):A=t[2];let j=A,N;t[3]===O?N=t[4]:(N=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=N);let P=N,F;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(F={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=F):F=t[5];let[I,L]=(0,Q.useState)(F),R=(0,Q.useRef)(0),z;t[6]===b?z=t[7]:(z=function(e,t){let n=e??Mv(kv(),b);y(!0),R.current+=1,D({prompt:null,cli:n,nonce:R.current,stagePaste:t})},t[6]=b,t[7]=z);let B=z,V;t[8]!==x||t[9]!==B?(V=function(){y(!0),!x&&!Bv()&&B()},t[8]=x,t[9]=B,t[10]=V):V=t[10];let H=V,U=cs(),{projectConfig:G,projectLocalConfig:K,projectLocalSynced:q,projectSynced:ee}=Ru(),{activeDocName:te}=Xe(),ne=U?.hasRemote,re=U?.pushPermission?.checkStatus,ie;t[11]!==m||t[12]!==G||t[13]!==K||t[14]!==q||t[15]!==ee||t[16]!==ne||t[17]!==re?(ie=Gv({autoSyncOnboardingDismissed:m,hasRemote:ne,projectLocalSynced:q,projectSynced:ee,projectLocalConfig:K,projectConfig:G,pushPermissionCheckStatus:re}),t[11]=m,t[12]=G,t[13]=K,t[14]=q,t[15]=ee,t[16]=ne,t[17]=re,t[18]=ie):ie=t[18];let ae=ie,oe,se;t[19]===te?(oe=t[20],se=t[21]):(oe=()=>{let e=function(e){let t=e.detail;t&&te&&Qc(te,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(lv,e),()=>window.removeEventListener(lv,e)},se=[te],t[19]=te,t[20]=oe,t[21]=se),(0,Q.useEffect)(oe,se);let ce=(0,Q.useRef)(!1),le;t[22]!==te||t[23]!==o||t[24]!==B?(le=function(e){if(!_||te==null)return!1;let t=Ju(te,o)?.markdown??``;if(t.trim()===``)return!1;let n=`${UO(te,t)}\n\n`;return!e&&ce.current?(y(!0),W(n)):B(void 0,n),!0},t[22]=te,t[23]=o,t[24]=B,t[25]=le):le=t[25];let ue=(0,Q.useEffectEvent)(le),de;t[26]===B?de=t[27]:(de=()=>B(),t[26]=B,t[27]=de);let fe=(0,Q.useEffectEvent)(de),pe;t[28]===ue?pe=t[29]:(pe=()=>M(e=>{if(e===`toggle-terminal`){if(ue(!1))return;y(oR)}else e===`new-terminal`&&y(!0)}),t[28]=ue,t[29]=pe);let me;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(me=[],t[30]=me):me=t[30],(0,Q.useEffect)(pe,me);let he;t[31]===ue?he=t[32]:(he=()=>{if(window.okDesktop!=null)return;let e=function(e){if(du(e,`toggle-terminal-panel`)){if(e.preventDefault(),ue(!1))return;y(aR)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[31]=ue,t[32]=he);let ge;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ge=[],t[33]=ge):ge=t[33],(0,Q.useEffect)(he,ge);let _e;t[34]!==fe||t[35]!==ue?(_e=()=>{if(!_)return;let e=function(e){du(e,`new-terminal-tab`)&&(e.preventDefault(),ue(!0)||fe())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[34]=fe,t[35]=ue,t[36]=_e):_e=t[36];let ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ve=[_],t[37]=ve):ve=t[37],(0,Q.useEffect)(_e,ve);let ye,be;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>SL((e,t)=>{y(!0),R.current+=1,D({prompt:e,cli:t,nonce:R.current})}),be=[],t[38]=ye,t[39]=be):(ye=t[38],be=t[39]),(0,Q.useEffect)(ye,be);let xe,Se;t[40]===v?(xe=t[41],Se=t[42]):(xe=()=>{v||D(null)},Se=[v],t[40]=v,t[41]=xe,t[42]=Se),(0,Q.useEffect)(xe,Se);let Ce,we;t[43]!==C||t[44]!==v?(Ce=()=>{window.okDesktop!=null&&C&&(E_({terminalVisible:v}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v}))},we=[v,C],t[43]=C,t[44]=v,t[45]=Ce,t[46]=we):(Ce=t[45],we=t[46]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Te=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(iR).finally(()=>{t||w(!0)}),()=>{t=!0}},Ee=[],t[47]=Te,t[48]=Ee):(Te=t[47],Ee=t[48]),(0,Q.useEffect)(Te,Ee);let De,Oe;t[49]===v?(De=t[50],Oe=t[51]):(De=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ki()}},Oe=[v],t[49]=v,t[50]=De,t[51]=Oe),(0,Q.useEffect)(De,Oe),bv(U?.pausedReason),xv();let ke;t[52]===a?ke=t[53]:(ke=function(e){s(e),a(e)},t[52]=a,t[53]=ke);let Ae=ke,je,Me;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>{d(`auth`),l(!0)},Me=()=>{d(`identity`),l(!0)},t[54]=je,t[55]=Me):(je=t[54],Me=t[55]);let Ne;t[56]===r?Ne=t[57]:(Ne=(0,Z.jsx)(yL,{onSignIn:je,onSetIdentity:Me,onOpenSearch:r}),t[56]=r,t[57]=Ne);let Pe=_?H:void 0,Fe;t[58]!==f||t[59]!==o||t[60]!==Ae||t[61]!==Pe||t[62]!==O||t[63]!==v?(Fe=(0,Z.jsx)(wP,{editorMode:o,onModeChange:Ae,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:L,onRevealTerminal:Pe}),t[58]=f,t[59]=o,t[60]=Ae,t[61]=Pe,t[62]=O,t[63]=v,t[64]=Fe):Fe=t[64];let Ie;t[65]!==b||t[66]!==O||t[67]!==E||t[68]!==I||t[69]!==v||t[70]!==P?(Ie=_&&g!=null?(0,Z.jsx)(GL,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:I.container,isShowing:I.isShowing,onRequestEditorFocus:()=>I.editorRegion?.focus(),dockPosition:O,onToggleDock:P,onHasSessionsChange:S,onActiveSessionCliChange:e=>{ce.current=e}}):null,t[65]=b,t[66]=O,t[67]=E,t[68]=I,t[69]=v,t[70]=P,t[71]=Ie):Ie=t[71];let Le=u===`identity`,Re;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{l(!1)},t[72]=Re):Re=t[72];let ze;t[73]!==c||t[74]!==Le?(ze=(0,Z.jsx)(Di,{open:c,onOpenChange:l,identityPrompt:Le,onSuccess:Re}),t[73]=c,t[74]=Le,t[75]=ze):ze=t[75];let Be;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>h(!0),t[76]=Be):Be=t[76];let Ve;t[77]===ae?Ve=t[78]:(Ve=(0,Z.jsx)(Uv,{open:ae,onResolved:Be}),t[77]=ae,t[78]=Ve);let He;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(ov,{}),t[79]=He):He=t[79];let Ue;return t[80]!==Ne||t[81]!==Fe||t[82]!==Ie||t[83]!==ze||t[84]!==Ve?(Ue=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Fe,Ie,ze,Ve,He]}),t[80]=Ne,t[81]=Fe,t[82]=Ie,t[83]=ze,t[84]=Ve,t[85]=Ue):Ue=t[85],Ue}function iR(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function aR(e){return!e}function oR(e){return!e}function sR(e){let t=tu(Kl(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cR(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ci();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)(Bc,{"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)(Bc,{"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(lR),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 lR(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{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:()=>sR(e.file),children:[(0,Z.jsx)(Bc,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uR=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
33
|
+
`,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;bu(t,{style:t=>Pu(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 Wj.set(t.changes,i),i}function qj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field($A).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(Uj);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Fu.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Hj.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Jj(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field($A).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Uj).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 Yj(e){let t=new Tu;for(let n of e.field($A)){let r=e.facet(XA).overrideChunk&&Qj(e,n);t.add(n.fromB,n.fromB,Kj(e,n,!!r))}return t.finish()}var Xj=xu.define({create:e=>Yj(e),update(e,t){return t.state.field($A,!1)==t.startState.field($A,!1)?e:Yj(t.state)},provide:e=>Ou.decorations.from(e)}),Zj=new WeakMap;function Qj(e,t){let n=Zj.get(t);if(n!==void 0)return n;n=null;let r=e.field(Uj),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(Su.widget({widget:new $j(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(hj.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Zj.set(t,n),n}var $j=class extends _u{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}},eM=new class extends ku{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},tM=Su.line({class:`cm-inlineChangedLine`});function nM(e,t,n,r){let i=Qj(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,eM),n.add(o.from,o.from,tM);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 rM=Wn({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),iM=dr({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),aM=Ou.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 oM({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 sM(e){let t=(0,$.c)(33),{oldContent:n,newContent:r,layout:i,conflictMode:a,previewMode:o,oursOverride:s,onResolve:c,onAbort:l}=e,{_:u}=jt(),d=s??r,f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),{resolvedTheme:h}=on(),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=hA(a===!0),w;t[1]!==l||t[2]!==c?(w=()=>{g.current=c,_.current=l},t[1]=l,t[2]=c,t[3]=w):w=t[3],(0,Q.useEffect)(w);let T,E;t[4]!==a||t[5]!==d||t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==h?(T=()=>{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`?rM:iM,u=[Ou.editable.of(!1),Eu.readOnly.of(!0)],g=[ed,Lu(),...u,l,Ou.lineWrapping];if(p.current&&=(p.current.destroy(),null),o)p.current=new Ou({doc:d,extensions:g,parent:e}),y(null);else if(a){let i=oM({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 Ou({doc:d,extensions:[ed,Lu(),Ou.editable.of(!1),l,aM,Ou.lineWrapping,Vj({original:n,highlightChanges:!0,gutter:!0,mergeControls:i,collapseUnchanged:{margin:3,minSize:4}}),Ou.updateListener.of(e=>{let t=ej(e.state);y(t?t.chunks.length:0)})],parent:e});p.current=a;let o=ej(a.state);y(o?o.chunks.length:0)}else i===`split`?p.current=new Lj({a:{doc:n,extensions:g},b:{doc:d,extensions:g},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):p.current=new Ou({doc:d,extensions:[...g,Vj({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)}},E=[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]=T,t[11]=E):(T=t[10],E=t[11]),(0,Q.useEffect)(T,E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(){let e=p.current;!e||!(e instanceof Ou)||g.current?.(e.state.doc.toString())},t[12]=D):D=t[12];let O=D,k;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(k=function(){let e=p.current;!e||!(e instanceof Ou)||Rn(e)},t[13]=k):k=t[13];let A=k,j=v===0,M;t[14]!==u||t[15]!==v?(M=v===null?``:v===0?u({id:`lPzyrU`}):gl._({id:`8FqTCr`,values:{chunksRemaining:v}}),t[14]=u,t[15]=v,t[16]=M):M=t[16];let N=M,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{ref:f,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=P):P=t[17];let F;if(t[18]!==u||t[19]!==x){let e;t[21]===u?e=t[22]:(e=e=>(0,tm.createPortal)((0,Z.jsx)(Y,{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),F=x.map(e),t[18]=u,t[19]=x,t[20]=F}else F=t[20];let I;t[23]!==j||t[24]!==C||t[25]!==a||t[26]!==N||t[27]!==l||t[28]!==c?(I=a&&(0,Z.jsxs)(`div`,{ref:C,className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${j?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:N}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:l,children:(0,Z.jsx)(J,{id:`XyOUTJ`})}),(0,Z.jsx)(Y,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:A,children:`Undo`}),c&&(0,Z.jsx)(Y,{variant:`default`,size:`sm`,disabled:!j,onClick:O,children:(0,Z.jsx)(J,{id:`Lcehxn`})})]})]}),t[23]=j,t[24]=C,t[25]=a,t[26]=N,t[27]=l,t[28]=c,t[29]=I):I=t[29];let L;return t[30]!==I||t[31]!==F?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[P,F,I]}),t[30]=I,t[31]=F,t[32]=L):L=t[32],L}async function cM(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 lM(e,t){return cM(e,`content`,t)}async function uM(e){return cM(e,`mine`)}async function dM(e){return cM(e,`theirs`)}async function fM(e){return cM(e,`delete`)}async function pM(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 mM(e){let t=(0,$.c)(86),{docName:n}=e,{_:r}=jt(),{conflicts:i,loading:a}=Ci(),o;if(t[0]!==i||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Kl(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=hA(l?.kind===`delete-modify`||l?.kind===`modify-delete`),g,_;t[5]===n?(g=t[6],_=t[7]):(g=()=>(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}))}),_=[n],t[5]=n,t[6]=g,t[7]=_),(0,Q.useEffect)(g,_);let v=a||s===void 0,y,b;t[8]!==v||t[9]!==c?(y=()=>{if(v)return;let e=!1;return u(null),f(!1),pM(c).then(t=>{e||(t===null?f(!0):u(t))}),()=>{e=!0}},b=[c,v],t[8]=v,t[9]=c,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,Q.useEffect)(y,b);let x;t[12]!==r||t[13]!==c?(x=async function(e){let t=await lM(c,e);t.ok||cl.error(r({id:`K-h9cT`,values:{filePath:c}}),{description:t.detail})},t[12]=r,t[13]=c,t[14]=x):x=t[14];let S=x,C;t[15]!==r||t[16]!==c?(C=async function(e){m(!0);let t=await e(c);t.ok||(m(!1),cl.error(r({id:`jPUPvG`,values:{filePath:c}}),{description:t.detail}))},t[15]=r,t[16]=c,t[17]=C):C=t[17];let w=C;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)(J,{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)(J,{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)(sM,{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)(J,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===w?a=t[30]:(a=()=>void w(fM),t[29]=w,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`Vlc75q`}),t[31]=o):o=t[31];let s;t[32]!==p||t[33]!==a?(s=(0,Z.jsx)(Y,{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]===w?u=t[36]:(u=()=>void w(dM),t[35]=w,t[36]=u);let d;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`3mFsc3`}),t[37]=d):d=t[37];let f;t[38]!==p||t[39]!==u?(f=(0,Z.jsx)(Y,{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 g;t[44]!==h||t[45]!==i||t[46]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,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]=h,t[45]=i,t[46]=m,t[47]=g):g=t[47];let _;return t[48]!==g||t[49]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[48]=g,t[49]=e,t[50]=_):_=t[50],_}if(l.kind===`modify-delete`){let e;t[51]===l.ours?e=t[52]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(sM,{oldContent:``,newContent:l.ours,layout:`unified`,previewMode:!0})}),t[51]=l.ours,t[52]=e);let n;t[53]===c?n=t[54]:(n={filePath:c},t[53]=c,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[55]=r):r=t[55];let i;t[56]===n?i=t[57]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`EhDLBx`,values:n,components:r})}),t[56]=n,t[57]=i);let a;t[58]===w?a=t[59]:(a=()=>void w(uM),t[58]=w,t[59]=a);let o;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`0NA4b3`}),t[60]=o):o=t[60];let s;t[61]!==p||t[62]!==a?(s=(0,Z.jsx)(Y,{type:`button`,variant:`default`,disabled:p,onClick:a,children:o}),t[61]=p,t[62]=a,t[63]=s):s=t[63];let u;t[64]===w?u=t[65]:(u=()=>void w(fM),t[64]=w,t[65]=u);let d;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(J,{id:`qSxaOz`}),t[66]=d):d=t[66];let f;t[67]!==p||t[68]!==u?(f=(0,Z.jsx)(Y,{type:`button`,variant:`destructive`,disabled:p,onClick:u,children:d}),t[67]=p,t[68]=u,t[69]=f):f=t[69];let m;t[70]!==s||t[71]!==f?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[s,f]}),t[70]=s,t[71]=f,t[72]=m):m=t[72];let g;t[73]!==h||t[74]!==i||t[75]!==m?(g=(0,Z.jsxs)(`div`,{ref:h,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[73]=h,t[74]=i,t[75]=m,t[76]=g):g=t[76];let _;return t[77]!==g||t[78]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[77]=g,t[78]=e,t[79]=_):_=t[79],_}let T;t[80]===S?T=t[81]:(T=e=>void S(e),t[80]=S,t[81]=T);let E;return t[82]!==l.ours||t[83]!==l.theirs||t[84]!==T?(E=(0,Z.jsx)(sM,{oldContent:l.theirs,newContent:l.ours,layout:`unified`,conflictMode:!0,onResolve:T}),t[82]=l.ours,t[83]=l.theirs,t[84]=T,t[85]=E):E=t[85],E}function hM(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(gt(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 gM=`__back-nav__`;function _M(e){return e instanceof xe||e instanceof $e||e instanceof ge||e instanceof Fe||e instanceof ut||e instanceof je?e.docName:null}function vM(e){return e instanceof xe||e instanceof $e}function yM(e){if(e instanceof xe){let t=e.docName;return{title:gl._({id:`Jejur6`}),summary:gl._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof $e){let t=e.docName;return{title:gl._({id:`V7QxyT`}),summary:gl._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof ge){let t=e.docName;return{title:gl._({id:`1di5fu`}),summary:gl._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof Fe){let t=e.docName;return{title:gl._({id:`wvbc1r`}),summary:gl._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof ut)return{title:gl._({id:`Gfr4fu`}),summary:gl._({id:`UW2Fg3`})};if(e instanceof je){let t=e.docName;return{title:gl._({id:`vv7kpg`}),summary:gl._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:gl._({id:`W5A0Ly`});return{title:gl._({id:`29VNqC`}),summary:t}}function bM(e){let t=(0,$.c)(37),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=yM(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),[f,p]=(0,Q.useState)(!1),m=typeof window<`u`?window.okDesktop:void 0,h=m&&vM(n)?m:null,g,_;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{d.current?.focus()},_=[],t[2]=g,t[3]=_):(g=t[2],_=t[3]),(0,Q.useEffect)(g,_);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(vf,{size:80,variant:`sleeping`}),t[4]=v):v=t[4];let y;t[5]===c?y=t[6]:(y=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=y);let b;t[7]===l?b=t[8]:(b=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[y,b]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(J,{id:`KDw4GX`}),t[12]=S):S=t[12];let C;t[13]===r?C=t[14]:(C=(0,Z.jsx)(Y,{ref:d,variant:`default`,onClick:r,children:S}),t[13]=r,t[14]=C);let w;t[15]===h?w=t[16]:(w=h?(0,Z.jsx)(Y,{variant:`secondary`,onClick:()=>{Q_(h).then(SM).catch(xM)},children:(0,Z.jsx)(J,{id:`uaUc6t`})}):null,t[15]=h,t[16]=w);let T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=m?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>p(!0),children:(0,Z.jsx)(J,{id:`ii5mVn`})}):null,t[17]=T):T=t[17];let E;t[18]!==i||t[19]!==u||t[20]!==n||t[21]!==o||t[22]!==a||t[23]!==r?(E=u?(0,Z.jsx)(Y,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(We(_M(n)??i),o(a),r(gM))},children:(0,Z.jsx)(J,{id:`CKyk7Q`})}):null,t[18]=i,t[19]=u,t[20]=n,t[21]=o,t[22]=a,t[23]=r,t[24]=E):E=t[24];let D;t[25]!==w||t[26]!==E||t[27]!==C?(D=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[C,w,T,E]}),t[25]=w,t[26]=E,t[27]=C,t[28]=D):D=t[28];let O;t[29]!==i||t[30]!==n||t[31]!==f?(O=m?(0,Z.jsx)(Df,{open:f,onOpenChange:p,crashContext:{source:`document view`,docName:_M(n)??i,errorMessage:n instanceof Error&&n.message?n.message:String(n)}}):null,t[29]=i,t[30]=n,t[31]=f,t[32]=O):O=t[32];let k;return t[33]!==D||t[34]!==O||t[35]!==x?(k=(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:[v,x,D,O]}),t[33]=D,t[34]=O,t[35]=x,t[36]=k):k=t[36],k}function xM(){}function SM(e){e.ok||cl.error(e.message,{id:`server-restart-error`,duration:1/0})}function CM(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)(bM,{...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]===gM){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}: ${yM(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)(I,{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 wM(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=yo(t);return{map:n,keys:da(t),parseError:r}}function TM(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>wM(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=Mo(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=Me(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=qe(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)(EM,{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)(DM,{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 EM(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 DM(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 OM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{ManagedArtifactProperties:e}=await import(`./ManagedArtifactProperties-CgjKuRi_.js`);return{ManagedArtifactProperties:e}},__vite__mapDeps([97,1,88,15,10,16,48,6,2,3,7,8,49,51,9,72,56,57,58,59,60,61,62,63,64,65,66,13,67,53,68,69,33,70,71,25,47,28,50,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,52,77,78,79,24,80,81,26,82,89,36,98,11,99,100,27]),import.meta.url)).ManagedArtifactProperties})),kM=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{MermaidDocEditor:e}=await import(`./MermaidDocEditor-dbbj76iW.js`);return{MermaidDocEditor:e}},__vite__mapDeps([101,1,56,2,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,102,103]),import.meta.url)).MermaidDocEditor})),AM=Gl(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function jM(e){let t=e.threshold??AM;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function MM(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var NM=Gl(`ACTIVITY_MOUNT_LIMIT`,3);function PM(){return n(()=>import(`./SourceEditor-dylchaTN.js`),__vite__mapDeps([104,1,56,2,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,102,72,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,49,51,52,77,78,79,24,80,81,26,82,105,34,36,37,95,96,103,100]),import.meta.url)}var FM=(0,Q.lazy)(async()=>({default:(await PM()).SourceEditor}));function IM(e,t,n){if(n<=0)return[];let r=e.filter(e=>!De(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 LM(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:gl._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?gl._({id:`Sc1bKE`,values:{docName:e}}):gl._({id:`ovIGrT`,values:{docName:e}}),actionLabel:gl._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:gl._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?gl._({id:`bmC18N`,values:{docName:e}}):gl._({id:`pAgkuZ`,values:{docName:e}})}:null}function RM(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Wl,{name:`activity-pool`,children:(0,Z.jsx)(zM,{...e})}),t[0]=e,t[1]=n),n}function zM(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=Xe(),{pages:u,loading:d}=Ps(),f=IM(c,n,NM),p=(0,Q.useRef)(``),h=f.map(BM).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)Tt(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;m(e,t&&t.length>0?t:crypto.randomUUID())}Ul(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Pe(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)(KM,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName)&&!Fo(e.docName)&&!mo(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=f.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 BM(e){return e.docName}function VM(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&&Ul(`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&&(Ul(`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&&Ul(`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 HM(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)(PS,{}),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)(FM,{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 UM(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)(Rc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Ic,{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)(Y,{type:`button`,onClick:WM,children:[(0,Z.jsx)(Rc,{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 WM(){return window.location.reload()}function GM(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 KM(e){let t=(0,$.c)(56),{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=LM(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=wT(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=mo(n.docName),t[3]=n.docName,t[4]=m);let h=m,g;t[5]===n.docName?g=t[6]:(g=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[5]=n.docName,t[6]=g);let[_]=(0,Q.useState)(g),v=n.provider.document.getText(`source`).length,[y,b]=(0,Q.useState)(i),[x,S]=(0,Q.useState)(!i),C,w;t[7]!==i||t[8]!==y||t[9]!==x?(C=()=>{i&&!y?b(!0):!i&&!x&&S(!0)},w=[i,y,x],t[7]=i,t[8]=y,t[9]=x,t[10]=C,t[11]=w):(C=t[10],w=t[11]),(0,Q.useEffect)(C,w);let T=jM({ytextLength:v,isSourceMode:i,visitedSource:y,visitedVisual:x}),E=(0,Q.useRef)(``),D=`${T.isLarge}-${T.renderSource}-${T.renderVisual}`,O,k;t[12]!==n.docName||t[13]!==T.isLarge||t[14]!==T.renderSource||t[15]!==T.renderVisual||t[16]!==D||t[17]!==i||t[18]!==v?(O=()=>{E.current!==D&&(E.current=D,T.isLarge&&Ul(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:v,isSourceMode:i,renderSource:T.renderSource,renderVisual:T.renderVisual}))},k=[D,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[12]=n.docName,t[13]=T.isLarge,t[14]=T.renderSource,t[15]=T.renderVisual,t[16]=D,t[17]=i,t[18]=v,t[19]=O,t[20]=k):(O=t[19],k=t[20]),(0,Q.useEffect)(O,k);let A;t[21]===n.docName?A=t[22]:(A=()=>Ye(n.docName),t[21]=n.docName,t[22]=A);let[j]=(0,Q.useState)(A),M=j?.html??null,[N,P]=(0,Q.useState)(!1),F,I;t[23]!==n.docName||t[24]!==T.isLarge||t[25]!==T.renderSource||t[26]!==T.renderVisual||t[27]!==N||t[28]!==i||t[29]!==v?(I=()=>{MM({isLarge:T.isLarge,renderSource:T.renderSource,renderVisual:T.renderVisual,hasEmittedFirstToggle:N})&&(Ul(`ok/cold/first-toggle`,{docName:n.docName,mountId:q(n.docName),ytextLength:v,modeEnteredFirst:i?`source`:`visual`}),P(!0))},F=[N,T.isLarge,T.renderSource,T.renderVisual,n.docName,v,i],t[23]=n.docName,t[24]=T.isLarge,t[25]=T.renderSource,t[26]=T.renderVisual,t[27]=N,t[28]=i,t[29]=v,t[30]=F,t[31]=I):(F=t[30],I=t[31]),(0,Q.useEffect)(I,F);let L=r?`visible`:`hidden`,R=`editor:${n.docName}`,z=j?.scrollTop,B;t[32]!==a||t[33]!==n||t[34]!==T.renderSource||t[35]!==T.renderVisual||t[36]!==r||t[37]!==p||t[38]!==h||t[39]!==o||t[40]!==i||t[41]!==c||t[42]!==l||t[43]!==_||t[44]!==s||t[45]!==f||t[46]!==M?(B=f?(0,Z.jsx)(UM,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(CM,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:M?(0,Z.jsx)(GM,{html:M}):(0,Z.jsx)(PS,{}),children:(0,Z.jsx)(hM,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(mM,{docName:n.docName,provider:n.provider}):h?(0,Z.jsx)(kM,{docName:n.docName,provider:n.provider,isSourceMode:i}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(Fo(n.docName)||tt(n.docName)?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(OM,{docName:n.docName,provider:n.provider})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(TM,{provider:n.provider}),(0,Z.jsx)(Ts,{provider:n.provider})]})),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[T.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(HM,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,T.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(uA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:_},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[32]=a,t[33]=n,t[34]=T.renderSource,t[35]=T.renderVisual,t[36]=r,t[37]=p,t[38]=h,t[39]=o,t[40]=i,t[41]=c,t[42]=l,t[43]=_,t[44]=s,t[45]=f,t[46]=M,t[47]=B):B=t[47];let V;t[48]!==r||t[49]!==z||t[50]!==B?(V=(0,Z.jsx)(VM,{isActive:r,initialScrollTop:z,children:B}),t[48]=r,t[49]=z,t[50]=B,t[51]=V):V=t[51];let H;return t[52]!==L||t[53]!==R||t[54]!==V?(H=(0,Z.jsx)(Q.Activity,{mode:L,name:R,children:V}),t[52]=L,t[53]=R,t[54]=V,t[55]=H):H=t[55],H}function qM(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function JM(e){let{value:t,unit:n}=qM(e);return n===`rem`?t*16:t}function YM(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var XM=3600*24*7;function ZM(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?QM:m,O=g===void 0?XM: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=JM(b),ee;t[6]===x?ee=t[7]:(ee=JM(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){E&&(P.current=!0,j.current=H.current?0:JM(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]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=qM(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(te,t)),u=YM(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(te,u)),f=YM(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,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]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function QM(){}var $M=3600*24*7,eN=`18rem`,tN=`3rem`,nN=`app-file-sidebar`,rN=`14.625rem`,iN=`32rem`,aN=`sidebar_width`,oN=/^\d+(?:\.\d+)?(?:rem|px)$/,sN=Q.createContext(null);function cN(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${aN}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return oN.test(n)?n:e}function lN(){let e=Q.use(sN);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function uN(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?eN:c,[u]=Q.useState(fN),d;t[8]===u?d=t[9]:(d=()=>PT(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>cN(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=VT();return UT(`left`,PT(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),WT(`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(dN)},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: ${jT}px)`),t=()=>{let e=PT(u,window.innerWidth,`left`);p(e),C(UT(`left`,e,VT())===`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(nN)?.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=>{du(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":tN,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=X(`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)(sN.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function dN(e){return!e}function fN(){return Ho()}function pN(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}=jt(),{state:f,isDraggingRail:p}=lN();if(u===`none`){let e;t[7]===r?e=t[8]:(e=X(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let 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=X(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,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=X(`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:nN,"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 mN(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}=jt(),{toggleSidebar:o,state:s}=lN(),c,l,u,d,f,p,m,h;if(t[4]!==a||t[5]!==s){let e=ou(`toggle-files-sidebar`);c=Y,l=`trigger`,u=`sidebar-trigger`,d=`ghost`,f=`icon-sm`,p=s===`expanded`,m=nN,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=X(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)(rt,{}):(0,Z.jsx)(Bm,{}),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 hN(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}=jt(),{toggleSidebar:u,setWidth:d,state:f,width:p,setIsDraggingRail:m}=lN(),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:rN,maxResizeWidth:iN,setIsDraggingRail:m,widthCookieName:aN,widthCookieMaxAge:$M},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}=ZM(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=X(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=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 gN(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}=lN(),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=X(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,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 _N(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function yN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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 xN(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?ln:`div`,o;t[4]===n?o=t[5]:(o=X(`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 SN(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?ln:`button`,o;t[4]===n?o=t[5]:(o=X(`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 CN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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 wN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var EN=un(`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 DN(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?ln:`button`,{state:m}=lN(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=X(EN({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)(yn,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(bn,{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)(Sn,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function ON(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?ln:`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=X(`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 kN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`mx-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 AN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`group/menu-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 jN(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?ln:`a`,d;t[6]===n?d=t[7]:(d=X(`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 MN(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 NN(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Ta.safeParse(t);return n.success?n.data.currentBranch??null:null}var PN=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:MN({fetchBranch:NN,subscribeToEvent:Il}),FN=PN.subscribe,IN=PN.getSnapshot;function LN(){return(0,Q.useSyncExternalStore)(FN,IN,IN)}function RN(){let e=(0,$.c)(6),t=LN(),n=ac(),{state:r}=lN(),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&&yi(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 zN(e){let t=(0,$.c)(30),{stats:n,selectionStats:r,showStats:i,composerBadge:a,reserveRightGutter:o}=e,s=i===void 0?!0:i,c=o===void 0?!1:o,{_:u}=jt(),d=RN();if(!s&&d===null&&a==null)return null;let f=r??n,p=r!=null,{words:m,chars:h,tokens:g}=f,_;t[0]!==u||t[1]!==p||t[2]!==s?(_=u(s?p?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=u,t[1]=p,t[2]=s,t[3]=_):_=t[3];let v=c&&`pr-12`,y;t[4]===v?y=t[5]:(y=X(`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,v),t[4]=v,t[5]=y);let b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=(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[6]=b):b=t[6];let x;t[7]!==u||t[8]!==a?(x=a?(0,Z.jsxs)(Y,{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)(uc,{className:`size-3`,"aria-hidden":!0}),u({id:`xWEvuo`}),(0,Z.jsx)(l,{className:`size-3`,"aria-hidden":!0})]}):null,t[7]=u,t[8]=a,t[9]=x):x=t[9];let S;t[10]===d?S=t[11]:(S=d===null?null:(0,Z.jsx)(BN,{identity:d}),t[10]=d,t[11]=S);let C;t[12]===S?C=t[13]:(C=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:S}),t[12]=S,t[13]=C);let w;t[14]!==u||t[15]!==f.chars||t[16]!==f.tokens||t[17]!==f.words||t[18]!==h||t[19]!==p||t[20]!==s||t[21]!==g||t[22]!==m?(w=s?(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[p?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:u({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f.words.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`gljvbT`,values:{words:m}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f.chars.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`d5rK4X`,values:{chars:h}})]}),(0,Z.jsxs)(`span`,{children:[f.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:f.tokens.toLocaleString()}),` `,(0,Z.jsx)(J,{id:`uynXup`,values:{tokens:g}})]})]}):null,t[14]=u,t[15]=f.chars,t[16]=f.tokens,t[17]=f.words,t[18]=h,t[19]=p,t[20]=s,t[21]=g,t[22]=m,t[23]=w):w=t[23];let T;return t[24]!==w||t[25]!==_||t[26]!==y||t[27]!==x||t[28]!==C?(T=(0,Z.jsxs)(`section`,{"aria-label":_,className:y,children:[b,x,C,w]}),t[24]=w,t[25]=_,t[26]=y,t[27]=x,t[28]=C,t[29]=T):T=t[29],T}function BN(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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(bn,{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)(Qo,{"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 VN(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}=jt(),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=X(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 HN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UN(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WN(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=X(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function GN(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=X(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(As,{}),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 KN=1,qN=2,JN=4;function YN(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=Uo(n),u=e?e.kind===`template`?e.folder.split(`/`).filter(Boolean):[]:ve(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>JN?[...u.slice(0,KN).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(KN,-qN)},...u.slice(-qN).map((e,t)=>d(e,u.length-qN+t))]:u.map((e,t)=>d(e,t));a=VN,t[8]===r?c=t[9]:(c=X(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=HN,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(XN)}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 XN(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(GN,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(UN,{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)(pm,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(UN,{className:`min-w-0`,children:(0,Z.jsx)(WN,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var ZN={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`},QN=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`,...ZN,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},$N=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)(QN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},eP=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)(QN,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function tP(e){let t=(0,$.c)(29),{isSourceMode:n,onModeChange:r,sourceDisabled:i}=e,a=i===void 0?!1:i,{_:o}=jt(),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)(yn,{children:(0,Z.jsx)(eP,{className:`size-4`})}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Z.jsx)(aa,{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)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`Mb_20S`})}),t[9]=p):p=t[9];let m;t[10]===f?m=t[11]:(m=(0,Z.jsxs)(Sn,{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)($N,{className:`size-4`}),t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==h?(_=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(aa,{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)(bn,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`G-JBA1`}):(0,Z.jsx)(J,{id:`u6Hp4N`})}),t[18]=a,t[19]=v);let y;t[20]!==_||t[21]!==v?(y=(0,Z.jsxs)(Sn,{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)(sa,{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 nP=(0,Q.lazy)(async()=>({default:(await n(async()=>{let{SkillEditorActions:e}=await import(`./SkillEditorActions-DG7dmv6Z.js`);return{SkillEditorActions:e}},__vite__mapDeps([106,1,6,2,3,7,8,9,10,15,89,12,13,14,16,35,19,20,36,18,76,49,51,75,94,33,90,77,23,70,24,95,71,53,80,84,26,69,29]),import.meta.url)).SkillEditorActions}));function rP(e){let t=(0,$.c)(85),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l,reserveRightGutter:u}=e,d=u===void 0?!1:u,{_:f}=jt(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=uu(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k;if(t[1]!==f||t[2]!==n||t[3]!==c||t[4]!==r||t[5]!==s||t[6]!==a||t[7]!==l||t[8]!==d||t[9]!==o||t[10]!==i){let e=ou(`toggle-document-panel`),u;t[26]===n?u=t[27]:(u=n?Uo(n):null,t[26]=n,t[27]=u);let p=u,m;t[28]===n?m=t[29]:(m=n?tt(n):null,t[28]=n,t[29]=m);let A=m,j;t[30]!==p||t[31]!==A?(j=p?.kind===`skill`?{scope:p.scope,name:p.name}:A?{scope:`project`,name:A}:null,t[30]=p,t[31]=A,t[32]=j):j=t[32];let M=j;b=`editor-toolbar`,x=`pointer-events-none absolute inset-x-0 top-0 z-10`;let N;t[33]!==n||t[34]!==M?(N=M?null:(0,Z.jsx)(YN,{docName:n}),t[33]=n,t[34]=M,t[35]=N):N=t[35];let P;t[36]===n?P=t[37]:(P=n===null?null:(0,Z.jsx)(kS,{entry:{kind:`document`,docName:n},className:`shrink-0`}),t[36]=n,t[37]=P);let F;t[38]!==N||t[39]!==P?(F=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 items-center gap-2`,children:[N,P]}),t[38]=N,t[39]=P,t[40]=F):F=t[40];let I;t[41]!==r||t[42]!==a||t[43]!==i?(I=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsx)(tP,{isSourceMode:r,onModeChange:a,sourceDisabled:i})}),t[41]=r,t[42]=a,t[43]=i,t[44]=I):I=t[44],t[45]!==F||t[46]!==I?(S=(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:[F,I]})}),t[45]=F,t[46]=I,t[47]=S):S=t[47];let L=d&&`pr-9`;t[48]===L?_=t[49]:(_=X(`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,L),t[48]=L,t[49]=_),t[50]===M?v=t[51]:(v=M?(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(nP,{scope:M.scope,name:M.name})}):null,t[50]=M,t[51]=v),t[52]!==f||t[53]!==s||t[54]!==o?(y=o&&(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(yn,{children:(0,Z.jsx)(Mm,{})})}),(0,Z.jsx)(bn,{side:`bottom`,children:(0,Z.jsx)(J,{id:`81H_23`})})]}),t[52]=f,t[53]=s,t[54]=o,t[55]=y):y=t[55],g=Sn,h=Y,C=``,w=`ghost`,T=`icon`,E=l,D=!c,O=`doc-panel`,k=f(c?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=c,t[4]=r,t[5]=s,t[6]=a,t[7]=l,t[8]=d,t[9]=o,t[10]=i,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]=O,t[25]=k}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A;t[56]===c?A=t[57]:(A=(0,Z.jsx)(yn,{children:c?(0,Z.jsx)(Hm,{}):(0,Z.jsx)(Vm,{})}),t[56]=c,t[57]=A);let j;t[58]!==h||t[59]!==A||t[60]!==C||t[61]!==w||t[62]!==T||t[63]!==E||t[64]!==D||t[65]!==O||t[66]!==k?(j=(0,Z.jsx)(h,{"data-doc-panel-toggle":C,variant:w,size:T,onClick:E,"aria-expanded":D,"aria-controls":O,"aria-label":k,asChild:!0,children:A}),t[58]=h,t[59]=A,t[60]=C,t[61]=w,t[62]=T,t[63]=E,t[64]=D,t[65]=O,t[66]=k,t[67]=j):j=t[67];let M;t[68]===c?M=t[69]:(M=(0,Z.jsx)(bn,{side:`bottom`,children:c?(0,Z.jsx)(J,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(J,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[68]=c,t[69]=M);let N;t[70]!==g||t[71]!==j||t[72]!==M?(N=(0,Z.jsxs)(g,{children:[j,M]}),t[70]=g,t[71]=j,t[72]=M,t[73]=N):N=t[73];let P;t[74]!==_||t[75]!==v||t[76]!==y||t[77]!==N?(P=(0,Z.jsxs)(`div`,{className:_,children:[v,y,N]}),t[74]=_,t[75]=v,t[76]=y,t[77]=N,t[78]=P):P=t[78];let F;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[79]=F):F=t[79];let I;return t[80]!==b||t[81]!==x||t[82]!==S||t[83]!==P?(I=(0,Z.jsxs)(`div`,{"data-testid":b,className:x,children:[S,P,F]}),t[80]=b,t[81]=x,t[82]=S,t[83]=P,t[84]=I):I=t[84],I}function iP(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function aP(e){let{currentLayout:t,containerPx:n,pinnedPx:r,residualId:i}=e;if(n<=0||!(i in t))return t;let a={...t},o=0;for(let[e,i]of Object.entries(r)){if(!(e in t))continue;let r=i/n*100;a[e]=r,o+=r}let s=0;for(let[e,n]of Object.entries(t))e===i||e in r||(s+=n);let c=100-o-s;return c<0?t:(a[i]=c,a)}var oP=`ok-terminal-height-v1`,sP=1/3,cP=.5;function lP(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*cP))}function uP(e){let t=Number.isFinite(e)?e:0;return t<=0?240:Math.round(t*sP)}function dP(e,t){let n=lP(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(uP(t),n)}function fP(){return typeof window>`u`?0:window.innerHeight}function pP(e,t){try{let n=e??localStorage,r=t??fP(),i=n.getItem(oP);if(i==null)return dP(uP(r),r);let a=Number.parseInt(i,10);return dP(Number.isFinite(a)?a:uP(r),r)}catch{return 240}}function mP(e,t,n){try{let r=t??localStorage,i=n??fP();r.setItem(oP,String(dP(e,i)))}catch{}}function hP(){try{return typeof localStorage>`u`?240:pP()}catch{return 240}}function gP(e){let t=(0,$.c)(19),{dockPosition:n,onReveal:r,className:i}=e,{_:a}=jt(),o=n===`right`,s;t[0]===a?s=t[1]:(s=a({id:`0SBTff`}),t[0]=a,t[1]=s);let c=s,u=o?`rounded-r-none border-r-0`:`rounded-b-none border-b-0`,d;t[2]!==i||t[3]!==u?(d=X(`absolute z-20 shrink-0 bg-background text-muted-foreground shadow-sm hover:text-foreground`,u,i),t[2]=i,t[3]=u,t[4]=d):d=t[4];let f;t[5]===o?f=t[6]:(f=o?(0,Z.jsx)(Os,{"aria-hidden":`true`}):(0,Z.jsx)(l,{"aria-hidden":`true`}),t[5]=o,t[6]=f);let p;t[7]!==n||t[8]!==c||t[9]!==r||t[10]!==d||t[11]!==f?(p=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":c,"data-terminal-reveal":n,onClick:r,className:d,children:f})}),t[7]=n,t[8]=c,t[9]=r,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m=o?`left`:`top`,h;t[13]!==c||t[14]!==m?(h=(0,Z.jsx)(bn,{side:m,sideOffset:8,children:c}),t[13]=c,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==p||t[17]!==h?(g=(0,Z.jsxs)(Sn,{children:[p,h]}),t[16]=p,t[17]=h,t[18]=g):g=t[18],g}var _P=`terminal-dock-panel`;function vP(e){let t=(0,$.c)(42),{children:n,visible:r,onVisibleChange:i,dockPosition:a,onBottomContainer:o,onEditorRegion:s,onReveal:c}=e,l=a===void 0?`bottom`:a,{resolvedTheme:u}=on(),d=hS(),[f,p]=(0,Q.useState)(!r),m=ad(u).background,h=r&&l===`bottom`,g=!r&&l===`bottom`&&c!=null,[_]=(0,Q.useState)(yP),v=(0,Q.useRef)(_),[y,b]=(0,Q.useState)(!1),x=(0,Q.useRef)(!1),S=(0,Q.useRef)(null),C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{mP(e),S.current=null},100)},t[0]=C):C=t[0];let w=C,T=(0,Q.useRef)(null),E,D;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>()=>{S.current!=null&&clearTimeout(S.current),T.current!=null&&(window.removeEventListener(`pointerup`,T.current),T.current=null)},D=[],t[1]=E,t[2]=D):(E=t[1],D=t[2]),(0,Q.useEffect)(E,D);let O,k;t[3]!==h||t[4]!==d?(O=()=>{let e=d.current;e!=null&&(h?e.resize(`${v.current}px`):e.collapse())},k=[h,d],t[3]=h,t[4]=d,t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A=y||void 0,j;t[7]!==c||t[8]!==g?(j=g&&c?(0,Z.jsx)(gP,{dockPosition:`bottom`,onReveal:c,className:`right-3 bottom-0`}):null,t[7]=c,t[8]=g,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==s||t[12]!==j?(M=(0,Z.jsx)($w,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsxs)(`div`,{ref:s,tabIndex:-1,className:`relative flex h-full min-h-0 flex-col outline-none`,children:[n,j]})}),t[10]=n,t[11]=s,t[12]=j,t[13]=M):M=t[13];let N=!h,P;t[14]===h?P=t[15]:(P=()=>{if(!h)return;b(!0),x.current=!0;let e=()=>{b(!1),x.current=!1,window.removeEventListener(`pointerup`,e),T.current=null};T.current=e,window.addEventListener(`pointerup`,e)},t[14]=h,t[15]=P);let F;t[16]!==h||t[17]!==N||t[18]!==P?(F=(0,Z.jsx)(eT,{withHandle:h,disabled:N,onPointerDown:P}),t[16]=h,t[17]=N,t[18]=P,t[19]=F):F=t[19];let I;t[20]===m?I=t[21]:(I={backgroundColor:m},t[20]=m,t[21]=I);let L=h?`${_}px`:0,R;t[22]!==i||t[23]!==r?(R=e=>{let t=e.asPercentage===0;p(t),x.current&&(t&&r?i(!1):!t&&!r&&i(!0),e.inPixels>0&&(v.current=e.inPixels,w(e.inPixels)))},t[22]=i,t[23]=r,t[24]=R):R=t[24];let z=!y&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,B;t[25]===z?B=t[26]:(B=X(`flex flex-col`,z),t[25]=z,t[26]=B);let V;t[27]===o?V=t[28]:(V=(0,Z.jsx)(`div`,{ref:o,className:`flex min-h-0 flex-1 flex-col overflow-hidden`}),t[27]=o,t[28]=V);let H;t[29]!==f||t[30]!==d||t[31]!==I||t[32]!==L||t[33]!==R||t[34]!==B||t[35]!==V?(H=(0,Z.jsx)($w,{id:_P,style:I,panelRef:d,defaultSize:L,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:R,inert:f,className:B,children:V}),t[29]=f,t[30]=d,t[31]=I,t[32]=L,t[33]=R,t[34]=B,t[35]=V,t[36]=H):H=t[36];let U;return t[37]!==F||t[38]!==H||t[39]!==A||t[40]!==M?(U=(0,Z.jsxs)(Qw,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":A,children:[M,F,H]}),t[37]=F,t[38]=H,t[39]=A,t[40]=M,t[41]=U):U=t[41],U}function yP(){return hP()}var bP=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-BNz82usM.js`),__vite__mapDeps([55,1,2,56,57,58,8,59,60,61,62,63,64,65,66,13,6,3,7,67,53,10,68,69,33,9,15,70,71,25,16,47,48,28,50,72,12,14,4,73,35,19,20,22,17,74,18,75,76,21,23,46,49,51,52,77,78,79,24,80,81,26,82,83,84]),import.meta.url)).ActivityModeContent})),xP=`300px`,SP=`600px`,CP=new Set([`doc-panel`,`terminal-column`,`agent-panel`]);function wP(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(EP,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(TP,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Wl,{name:`editor-area`,children:(0,Z.jsxs)(_s,{children:[n,r]})}),t[3]=n,t[4]=i),i}function TP(){let e=(0,$.c)(5),t=Si(),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)(Kw,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function EP(e){let t=(0,$.c)(246),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a,terminalBridge:o,terminalVisible:s,onTerminalVisibleChange:c,terminalDock:l,onTerminalPlacement:u,onRevealTerminal:d}=e,f=s===void 0?!1:s,p=l===void 0?`right`:l,{_:m}=jt(),{resolvedTheme:h}=on(),g=ad(h).background,{activeDocName:_,activeProvider:v,activeTarget:y,recycleDocument:b,docPanelMode:x,docPanelAgentId:S,docPanelExpandSignal:C}=Xe(),{openDocumentTransition:w}=st(),{requestAddProperty:T}=ps(),E=ST(v,_),D=TT(_,n===`source`?`source`:`wysiwyg`),O=XT(v),k=O===`connected`||O===`synced`,A=wT(_)===`conflict`,[j,N]=(0,Q.useState)(!1),P,F;t[0]!==v||t[1]!==j?(P=()=>{v!=null&&!j&&N(!0)},F=[v,j],t[0]=v,t[1]=j,t[2]=P,t[3]=F):(P=t[2],F=t[3]),(0,Q.useEffect)(P,F);let I=(0,Q.useDeferredValue)(_),L=y?.kind===`missing`,R=!!_&&y?.kind!==`folder`,z;t[4]!==m||t[5]!==L?(z=L?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=L,t[6]=z):z=t[6];let B=z,V=(0,Q.useSyncExternalStore)(ns.subscribe,ns.getSnapshot,ns.getSnapshot),H;t[7]!==y||t[8]!==V?(H=os(y,V),t[7]=y,t[8]=V,t[9]=H):H=t[9];let U=H,[W]=(0,Q.useState)(jP),G=W!==null,K;t[10]===W?K=t[11]:(K=()=>PT(W,window.innerWidth,`right`),t[10]=W,t[11]=K);let[q,ee]=(0,Q.useState)(K),te=(0,Q.useRef)(q),ne,re;t[12]===q?(ne=t[13],re=t[14]):(ne=()=>{te.current=q},re=[q],t[12]=q,t[13]=ne,t[14]=re),(0,Q.useEffect)(ne,re);let ie=hS(),ae=hS(),oe;t[15]===q?oe=t[16]:(oe=()=>UT(`right`,q,VT())===`collapsed`,t[15]=q,t[16]=oe);let[se]=(0,Q.useState)(oe),[ce,le]=(0,Q.useState)(se),ue=(0,Q.useRef)(ce),[de,fe]=(0,Q.useState)(null),[pe,me]=(0,Q.useState)(null),[he,ge]=(0,Q.useState)(null),_e=p===`right`,ve=_e?`right`:`bottom`,ye=o!=null&&_e&&f,be=o!=null&&!f&&d!=null,xe=be&&!_e,Se=be&&_e,we=_e&&f&&de!=null,Te=we?de:pe,Ee=(_e?we:f)&&Te!=null,De,Oe;t[17]!==Te||t[18]!==u||t[19]!==ve||t[20]!==he||t[21]!==Ee?(De=()=>{u?.({container:Te,isShowing:Ee,dockPosition:ve,editorRegion:he})},Oe=[u,Te,Ee,ve,he],t[17]=Te,t[18]=u,t[19]=ve,t[20]=he,t[21]=Ee,t[22]=De,t[23]=Oe):(De=t[22],Oe=t[23]),(0,Q.useEffect)(De,Oe);let ke,Ae;t[24]===ce?(ke=t[25],Ae=t[26]):(ke=()=>{ue.current=ce},Ae=[ce],t[24]=ce,t[25]=ke,t[26]=Ae),(0,Q.useEffect)(ke,Ae);let[je,Me]=(0,Q.useState)(!1),Ne=(0,Q.useRef)(!1),[Pe]=(0,Q.useState)(AP),Fe=(0,Q.useRef)(Pe),Ie=(0,Q.useRef)(null),Le;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(e){Ie.current!=null&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{kT(e),Ie.current=null},100)},t[27]=Le):Le=t[27];let Re=Le,[ze]=(0,Q.useState)(kP),Be=(0,Q.useRef)(ze),[Ve,He]=(0,Q.useState)(!1),Ue=(0,Q.useRef)(!1),We=(0,Q.useRef)(null),Ge;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=function(e){We.current!=null&&clearTimeout(We.current),We.current=setTimeout(()=>{JT(e),We.current=null},100)},t[28]=Ge):Ge=t[28];let Ke=Ge,qe,Je;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(qe=()=>()=>{Ie.current!=null&&clearTimeout(Ie.current),We.current!=null&&clearTimeout(We.current)},Je=[],t[29]=qe,t[30]=Je):(qe=t[29],Je=t[30]),(0,Q.useEffect)(qe,Je);let[Ye,Ze]=(0,Q.useState)(null),Qe=(0,Q.useRef)(null),$e=uS(),et=(0,Q.useRef)(ye),tt,nt;t[31]===ye?(tt=t[32],nt=t[33]):(tt=()=>{et.current=ye},nt=[ye],t[31]=ye,t[32]=tt,t[33]=nt),(0,Q.useEffect)(tt,nt);let rt;t[34]!==ie||t[35]!==ae?(rt=function(){for(let e of[ie,ae]){let t=e.current?.getSize();if(t!=null&&t.asPercentage>1&&t.inPixels>0)return t.inPixels/t.asPercentage*100}let e=Qe.current;return e!=null&&e.offsetWidth>0?e.offsetWidth:null},t[34]=ie,t[35]=ae,t[36]=rt):rt=t[36];let it=rt,at;t[37]!==$e||t[38]!==it?(at=function(e){if(Ne.current||Ue.current)return;let t=$e.current;if(t!=null)try{let n=it();if(n==null)return;let r=t.getLayout(),i=Object.keys(r);if(i.length===0)return;let a=i.find(OP);if(a==null)return;let o={};if(`doc-panel`in r&&(o[`doc-panel`]=e?0:Fe.current),`terminal-column`in r&&(o[`terminal-column`]=Be.current),Object.keys(o).length===0)return;let s=aP({currentLayout:r,containerPx:n,pinnedPx:o,residualId:a});s!==r&&t.setLayout(s)}catch{}},t[37]=$e,t[38]=it,t[39]=at):at=t[39];let ot=at,ct=(0,Q.useRef)(ot),lt;t[40]===ot?lt=t[41]:(lt=()=>{ct.current=ot},t[40]=ot,t[41]=lt),(0,Q.useEffect)(lt);let ut;t[42]!==ot||t[43]!==ie?(ut=function(){et.current?ot(!1):ie.current?.expand()},t[42]=ot,t[43]=ie,t[44]=ut):ut=t[44];let dt=ut,ft;t[45]!==ot||t[46]!==ce||t[47]!==ie?(ft=function(){if(ie.current==null)return;let e=te.current;ce?(WT(`right`,e,`open`),et.current?ot(!1):ie.current?.expand()):(WT(`right`,e,`collapsed`),et.current?ot(!0):ie.current?.collapse())},t[45]=ot,t[46]=ce,t[47]=ie,t[48]=ft):ft=t[48];let pt=ft,mt,ht;t[49]!==ot||t[50]!==W||t[51]!==ie?(mt=()=>{let e=window.matchMedia(`(min-width: ${MT}px)`),t=()=>{let e=PT(W,window.innerWidth,`right`);ee(e);let t=UT(`right`,e,VT())===`collapsed`;le(t),et.current?ot(t):t?ie.current?.collapse():ie.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ht=[W,ie,ot],t[49]=ot,t[50]=W,t[51]=ie,t[52]=mt,t[53]=ht):(mt=t[52],ht=t[53]),(0,Q.useEffect)(mt,ht);let gt,_t;t[54]!==Ye||t[55]!==G?(gt=()=>{if(Ye==null||G)return;let e=new ResizeObserver(()=>{ct.current(ue.current)});return e.observe(Ye),()=>e.disconnect()},_t=[Ye,G],t[54]=Ye,t[55]=G,t[56]=gt,t[57]=_t):(gt=t[56],_t=t[57]),(0,Q.useEffect)(gt,_t);let vt,yt;t[58]!==dt||t[59]!==a?(vt=()=>{let e=e=>{a(e),dt()},t=yg();return t&&e(t),xg(t=>{yg(),e(t)})},yt=[a,dt],t[58]=dt,t[59]=a,t[60]=vt,t[61]=yt):(vt=t[60],yt=t[61]),(0,Q.useEffect)(vt,yt);let bt,St;t[62]!==C||t[63]!==dt?(bt=()=>{C!==0&&dt()},St=[C,dt],t[62]=C,t[63]=dt,t[64]=bt,t[65]=St):(bt=t[64],St=t[65]),(0,Q.useEffect)(bt,St);let Ct=(0,Q.useRef)(ye),wt,Tt;t[66]!==ce||t[67]!==ye?(wt=()=>{if(Ct.current===ye)return;Ct.current=ye;let e=ce;queueMicrotask(()=>{ct.current(e)})},Tt=[ye,ce],t[66]=ce,t[67]=ye,t[68]=wt,t[69]=Tt):(wt=t[68],Tt=t[69]),(0,Q.useLayoutEffect)(wt,Tt);let Et,Dt;t[70]===ce?(Et=t[71],Dt=t[72]):(Et=()=>{if(!ce||!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()},Dt=[ce],t[70]=ce,t[71]=Et,t[72]=Dt),(0,Q.useLayoutEffect)(Et,Dt);let Ot,kt;t[73]===ce?(Ot=t[74],kt=t[75]):(Ot=()=>{E_({docPanelVisible:!ce}),window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!ce})},kt=[ce],t[73]=ce,t[74]=Ot,t[75]=kt),(0,Q.useEffect)(Ot,kt);let At,Mt;t[76]===pt?(At=t[77],Mt=t[78]):(At=()=>M(e=>{e===`toggle-doc-panel`&&pt()}),Mt=[pt],t[76]=pt,t[77]=At,t[78]=Mt),(0,Q.useEffect)(At,Mt);let Nt,Pt;t[79]===pt?(Nt=t[80],Pt=t[81]):(Nt=()=>{if(window.okDesktop!=null)return;let e=e=>{du(e,`toggle-document-panel`)&&(e.preventDefault(),pt())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Pt=[pt],t[79]=pt,t[80]=Nt,t[81]=Pt),(0,Q.useEffect)(Nt,Pt);let Ft=(0,Q.useRef)(null),[It,Lt]=(0,Q.useState)(null),[Rt,zt]=(0,Q.useState)(!1),Bt=y?.kind===`large-file`?y.docName:_,Vt,Ht;t[82]===Bt?(Vt=t[83],Ht=t[84]):(Vt=()=>{if(Bt&&Bt!==Ft.current){let e=Ft.current;Ft.current=Bt,Lt(e)}},Ht=[Bt],t[82]=Bt,t[83]=Vt,t[84]=Ht),(0,Q.useEffect)(Vt,Ht);let Ut;t[85]===w?Ut=t[86]:(Ut=function(e){let t=tu(e);window.location.hash===t?w(e):window.location.hash=t},t[85]=w,t[86]=Ut);let Wt=Ut,Gt,Kt=null;if(y?.kind===`large-file`){let e;t[87]!==Wt||t[88]!==It?(e=It?{previousDocName:It,onNavigateBack:Wt}:void 0,t[87]=Wt,t[88]=It,t[89]=e):e=t[89];let n;t[90]!==y.docName||t[91]!==y.limit||t[92]!==y.size||t[93]!==e?(n=(0,Z.jsx)(Cw,{docName:y.docName,size:y.size,limit:y.limit,backNav:e}),t[90]=y.docName,t[91]=y.limit,t[92]=y.size,t[93]=e,t[94]=n):n=t[94],Gt=n}else if(y?.kind===`folder`){let e;t[95]!==G||t[96]!==f?(e=zE({terminalVisible:f,isEmbedded:G}),t[95]=G,t[96]=f,t[97]=e):e=t[97];let n=e,r;t[98]===y.folderPath?r=t[99]:(r=(0,Z.jsx)(yw,{folderPath:y.folderPath}),t[98]=y.folderPath,t[99]=r);let i;t[100]===n?i=t[101]:(i=n?(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-2 bg-linear-to-t from-background to-transparent`}):null,t[100]=n,t[101]=i);let a;t[102]!==r||t[103]!==i?(a=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[r,i]}),t[102]=r,t[103]=i,t[104]=a):a=t[104];let o;t[105]!==y.folderPath||t[106]!==n?(o=n?(0,Z.jsx)(EE,{folderPath:y.folderPath}):null,t[105]=y.folderPath,t[106]=n,t[107]=o):o=t[107];let s;if(t[108]!==a||t[109]!==o?(s=(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[a,o]}),t[108]=a,t[109]=o,t[110]=s):s=t[110],Gt=s,x===`agent`&&S!==null){let e;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(eT,{withHandle:!0}),t[111]=e):e=t[111];let n;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)($w,{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)(J,{id:`ONPvOb`})}),children:(0,Z.jsx)(bP,{showBackButton:!1})})})]}),t[112]=n):n=t[112],Kt=n}}else if(y?.kind===`asset`){let e;t[113]!==y.assetPath||t[114]!==y.mediaKind?(e=(0,Z.jsx)(MS,{assetPath:y.assetPath,mediaKind:y.mediaKind},y.assetPath),t[113]=y.assetPath,t[114]=y.mediaKind,t[115]=e):e=t[115],Gt=e}else if(y?.kind===`skill-file`){let e=`${y.scope}/${y.name}/${y.path}`,n;t[116]!==y.name||t[117]!==y.path||t[118]!==y.scope||t[119]!==e?(n=(0,Z.jsx)(Iw,{scope:y.scope,name:y.name,path:y.path},e),t[116]=y.name,t[117]=y.path,t[118]=y.scope,t[119]=e,t[120]=n):n=t[120],Gt=n}else if(U){let e;t[121]===U?e=t[122]:(e=(0,Z.jsx)(Ew,{nav:U},U.path),t[121]=U,t[122]=e),Gt=e}else if(!v||!_)if((typeof window<`u`?eu(window.location.hash):null)!==null)if(o!=null&&j){let e;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(PS,{}),t[123]=e):e=t[123],Gt=e;let n;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(eT,{withHandle:!0,disabled:!0}),t[124]=n):n=t[124];let r=se?0:`${Pe}px`,i;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[125]=i):i=t[125];let a;t[126]===r?a=t[127]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)($w,{id:`doc-panel`,defaultSize:r,minSize:xP,maxSize:SP,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[126]=r,t[127]=a),Kt=a}else{let e;return t[128]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(PS,{}),t[128]=e):e=t[128],e}else{let e=f?ve:null,n;t[129]===e?n=t[130]:(n=(0,Z.jsx)(BC,{terminalDock:e}),t[129]=e,t[130]=n),Gt=n}else{let e=n===`source`,o=!k,s=ce,c;t[131]!==_||t[132]!==T?(c=function(){_&&T(_)},t[131]=_,t[132]=T,t[133]=c):c=t[133];let l=c,u;t[134]!==_||t[135]!==G||t[136]!==f?(u=RE({terminalVisible:f,isEmbedded:G,activeDocName:_}),t[134]=_,t[135]=G,t[136]=f,t[137]=u):u=t[137];let d=u,p=I??_,m=It??void 0,h;t[138]!==B||t[139]!==e||t[140]!==Wt||t[141]!==b||t[142]!==p||t[143]!==m?(h=(0,Z.jsx)(RM,{activeDocName:p,isSourceMode:e,editorPlaceholder:B,previousDocName:m,onNavigateBack:Wt,onRecycle:b}),t[138]=B,t[139]=e,t[140]=Wt,t[141]=b,t[142]=p,t[143]=m,t[144]=h):h=t[144];let g;t[145]!==_||t[146]!==e?(g=(0,Z.jsx)(vT,{activeDocName:_,isSourceMode:e}),t[145]=_,t[146]=e,t[147]=g):g=t[147];let v;t[148]!==_||t[149]!==I?(v=iP({activeDocName:_,deferredActiveDocName:I,mountResolved:_!==null&&xt(_),syncResolved:_!==null&&Ce(_)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(PS,{}),_===null?null:(0,Z.jsx)(ww,{docName:_})]}):null,t[148]=_,t[149]=I,t[150]=v):v=t[150];let y;t[151]!==h||t[152]!==g||t[153]!==v?(y=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[h,g,v]}),t[151]=h,t[152]=g,t[153]=v,t[154]=y):y=t[154];let S;t[155]!==_||t[156]!==A||t[157]!==s||t[158]!==e||t[159]!==r||t[160]!==l||t[161]!==Se||t[162]!==o||t[163]!==pt?(S=!A&&(0,Z.jsx)(rP,{activeDocName:_,isSourceMode:e,sourceDisabled:o,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:pt,reserveRightGutter:Se&&s}),t[155]=_,t[156]=A,t[157]=s,t[158]=e,t[159]=r,t[160]=l,t[161]=Se,t[162]=o,t[163]=pt,t[164]=S):S=t[164];let C;t[165]!==_||t[166]!==Rt||t[167]!==e||t[168]!==d?(C=d?(0,Z.jsx)(EE,{docName:_,surface:e?`source`:`wysiwyg`,dismissed:Rt,onDismiss:()=>zt(!0),onReopen:()=>zt(!1)}):null,t[165]=_,t[166]=Rt,t[167]=e,t[168]=d,t[169]=C):C=t[169];let w;t[170]!==y||t[171]!==S||t[172]!==C?(w=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[y,S,C]}),t[170]=y,t[171]=S,t[172]=C,t[173]=w):w=t[173];let O;t[174]!==Rt||t[175]!==d?(O=d&&Rt?{onReopen:()=>zt(!1)}:null,t[174]=Rt,t[175]=d,t[176]=O):O=t[176];let j;t[177]!==xe||t[178]!==D||t[179]!==R||t[180]!==E||t[181]!==O?(j=(0,Z.jsx)(zN,{stats:E,selectionStats:D,showStats:R,composerBadge:O,reserveRightGutter:xe}),t[177]=xe,t[178]=D,t[179]=R,t[180]=E,t[181]=O,t[182]=j):j=t[182];let M;t[183]!==w||t[184]!==j?(M=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[w,j]}),t[183]=w,t[184]=j,t[185]=M):M=t[185],Gt=M;let N=ye&&ce,P=!ce,F;t[186]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>{Me(!0),Ne.current=!0;let e=()=>{Me(!1),Ne.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[186]=F):F=t[186];let L;t[187]!==ce||t[188]!==P?(L=(0,Z.jsx)(eT,{withHandle:P,disabled:ce,onPointerDown:F}),t[187]=ce,t[188]=P,t[189]=L):L=t[189];let z=se?0:`${Pe}px`,V=N?`0px`:xP,H;t[190]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{le(e.asPercentage===0),e.inPixels>0&&Ne.current&&(Fe.current=e.inPixels,Re(e.inPixels))},t[190]=H):H=t[190];let U=!je&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,W;t[191]===U?W=t[192]:(W=X(`flex flex-col bg-muted/20`,U),t[191]=U,t[192]=W);let K;t[193]!==_||t[194]!==i||t[195]!==x||t[196]!==e||t[197]!==a?(K=(0,Z.jsx)(yb,{docName:_,isSourceMode:e,activeTab:i,onActiveTabChange:a,mode:x}),t[193]=_,t[194]=i,t[195]=x,t[196]=e,t[197]=a,t[198]=K):K=t[198];let q;t[199]!==N||t[200]!==ce||t[201]!==ie||t[202]!==z||t[203]!==V||t[204]!==W||t[205]!==K?(q=(0,Z.jsx)($w,{id:`doc-panel`,panelRef:ie,disabled:N,defaultSize:z,minSize:V,maxSize:SP,collapsible:!0,collapsedSize:0,onResize:H,inert:ce,className:W,children:K}),t[199]=N,t[200]=ce,t[201]=ie,t[202]=z,t[203]=V,t[204]=W,t[205]=K,t[206]=q):q=t[206];let ee;t[207]!==L||t[208]!==q?(ee=(0,Z.jsxs)(Z.Fragment,{children:[L,q]}),t[207]=L,t[208]=q,t[209]=ee):ee=t[209],Kt=ee}let qt;t[210]!==d||t[211]!==c||t[212]!==o||t[213]!==ve||t[214]!==f||t[215]!==Gt?(qt=o==null?Gt:(0,Z.jsx)(vP,{visible:f,onVisibleChange:c??DP,dockPosition:ve,onBottomContainer:me,onEditorRegion:ge,onReveal:d,children:Gt}),t[210]=d,t[211]=c,t[212]=o,t[213]=ve,t[214]=f,t[215]=Gt,t[216]=qt):qt=t[216];let Jt=qt,Yt;t[217]!==ze||t[218]!==Ve||t[219]!==c||t[220]!==ae||t[221]!==ye||t[222]!==g?(Yt=ye?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(eT,{withHandle:!0,onPointerDown:()=>{He(!0),Ue.current=!0;let e=()=>{He(!1),Ue.current=!1,window.removeEventListener(`pointerup`,e),ae.current?.isCollapsed()&&c?.(!1)};window.addEventListener(`pointerup`,e)}}),(0,Z.jsx)($w,{id:`terminal-column`,panelRef:ae,style:{backgroundColor:g},defaultSize:`${ze}px`,minSize:`320px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:e=>{e.inPixels>0&&Ue.current&&(Be.current=e.inPixels,Ke(e.inPixels))},className:X(`flex flex-col`,!Ve&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`),children:(0,Z.jsx)(`div`,{ref:fe,className:`flex min-h-0 flex-1 flex-col overflow-hidden`})})]}):null,t[217]=ze,t[218]=Ve,t[219]=c,t[220]=ae,t[221]=ye,t[222]=g,t[223]=Yt):Yt=t[223];let Xt=Yt,Zt=Kt!=null&&!se||ye,Qt;t[224]===Symbol.for(`react.memo_cache_sentinel`)?(Qt=e=>{Ze(e),Qe.current=e},t[224]=Qt):Qt=t[224];let $t=je||Ve||void 0,en=ye?`5%`:`30%`,tn;t[225]===Zt?tn=t[226]:(tn=Zt?{}:{defaultSize:`100%`},t[225]=Zt,t[226]=tn);let nn=!(je||Ve)&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,rn;t[227]===nn?rn=t[228]:(rn=X(nn),t[227]=nn,t[228]=rn);let an;t[229]!==Jt||t[230]!==en||t[231]!==tn||t[232]!==rn?(an=(0,Z.jsx)($w,{minSize:en,...tn,className:rn,children:Jt}),t[229]=Jt,t[230]=en,t[231]=tn,t[232]=rn,t[233]=an):an=t[233];let sn;t[234]!==$e||t[235]!==Kt||t[236]!==$t||t[237]!==an||t[238]!==Xt?(sn=(0,Z.jsxs)(Qw,{orientation:`horizontal`,groupRef:$e,"data-dragging":$t,children:[an,Kt,Xt]}),t[234]=$e,t[235]=Kt,t[236]=$t,t[237]=an,t[238]=Xt,t[239]=sn):sn=t[239];let cn;t[240]!==d||t[241]!==Se?(cn=Se?(0,Z.jsx)(gP,{dockPosition:`right`,onReveal:d,className:`top-2.5 right-0`}):null,t[240]=d,t[241]=Se,t[242]=cn):cn=t[242];let ln;return t[243]!==sn||t[244]!==cn?(ln=(0,Z.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,ref:Qt,children:[sn,cn]}),t[243]=sn,t[244]=cn,t[245]=ln):ln=t[245],ln}function DP(){}function OP(e){return!CP.has(e)}function kP(){return YT()}function AP(){return AT()}function jP(){return Ho()}function MP(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 NP(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 PP=1e3,FP=!1;function IP(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function LP(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:qc(i)?a=i:(a=void 0,FP||(FP=!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`&&(IP({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=NP(i),{current:c,crossDoc:l}=a?Uc(a,n,Date.now()):{current:[],crossDoc:[]},u=RP,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>MP(e.current,p)&&MP(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,PP);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 RP(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var zP=!1,BP=new Set,VP=!1;function HP(){for(let e of BP)e()}function UP(e){zP!==e&&(zP=e,HP())}function WP(){return zP}function GP(e){return BP.add(e),()=>{BP.delete(e)}}function KP(e){let t=[e.onUpdateRelaunching(()=>UP(!0)),e.onUpdateRelaunchFailed(()=>UP(!1))];return()=>{for(let e of t)e()}}function qP(){if(VP||typeof window>`u`)return;let e=window.okDesktop;e&&(VP=!0,KP(e))}function JP(){return(0,Q.useSyncExternalStore)(GP,WP,YP)}function YP(){return!1}var XP=`sync-status`;async function ZP(e){try{let t=await Q_(e);t.ok||cl.error(t.message,{id:XP,duration:1/0})}catch{}}function QP(e,t){let n=(0,$.c)(6),{_:r}=jt(),i=JP(),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){cl.dismiss(XP);return}o.current=!0;let e=window.okDesktop;cl.warning(r({id:`HGNCsl`}),{id:XP,duration:1/0,...e?{action:{label:r({id:`uaUc6t`}),onClick:()=>{ZP(e)}}}:{}})}else o.current&&e===`synced`&&(o.current=!1,cl.success(r({id:`GhjUB_`}),{id:XP,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 $P=4,eF=3,tF={Bird:Zp,Cat:im,Dog:fm,Fish:vm,Mouse:Jm,Rabbit:qm,Shrimp:eh,Snail:th,Squirrel:oh,Turtle:gh};Object.freeze(Object.keys(tF));function nF(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(tF,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var rF={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function iF(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:i}=e,{_:a}=jt(),o=nF(n),s=o.kind===`animal`?tF[o.animal]:void 0,c;t[0]===n.name?c=t[1]:(c=zo(n.name),t[0]=n.name,t[1]=c);let l=c,u;t[2]===n.color?u=t[3]:(u=ya(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)(yn,{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)(bn,{children:m}),t[23]=m,t[24]=b);let x;return t[25]!==y||t[26]!==b?(x=(0,Z.jsxs)(Sn,{children:[y,b]}),t[25]=y,t[26]=b,t[27]=x):x=t[27],x}function aF(e){let t=rF[e.icon];return e.displayName||t||gl._({id:`iEQQyu`})}function oF(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 sF(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{_:o}=jt(),{activeDocName:s}=Xe(),{presence:c,agentId:l}=n,u=aF(c),d=oF(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)(Gc,{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)(Gc,{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)(yn,{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)(J,{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)(bn,{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)(Sn,{children:[O,j]}),t[30]=O,t[31]=j,t[32]=M):M=t[32],M}function cF(e){let t=(0,$.c)(21),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s;t[0]!==n||t[1]!==i?(s=i?gl._({id:`9euN0m`,values:{count:n}}):gl._({id:`uhJEA2`,values:{count:n}}),t[0]=n,t[1]=i,t[2]=s):s=t[2];let c=s,l=i?`true`:void 0,u;t[3]!==n||t[4]!==c||t[5]!==l?(u=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":l,className:`inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full bg-muted font-medium text-muted-foreground text-xs ring-2 ring-background hover:bg-muted/80`,"aria-label":c,children:[`+`,n]})}),t[3]=n,t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;if(t[7]!==i||t[8]!==o||t[9]!==r||t[10]!==a){let e;t[12]!==i||t[13]!==o||t[14]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(iF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(sF,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(re,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(ae,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function lF(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(iF,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(sF,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function uF(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=Xe(),{current:s,crossDoc:c}=LP(t,r,n);if(QP(XT(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,$P),n;e[6]===s?n=e[7]:(n=s.slice($P),e[6]=s,e[7]=n);let r=n,u=c.slice(0,eF),d;e[8]===c?d=e[9]:(d=c.slice(eF),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=>lF(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)(cF,{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=>lF(e,p,!0,m)),f.length>0?(0,Z.jsx)(cF,{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}function dF(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(fF),()=>{t=!0}},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;return e[2]===t?a=e[3]:(a={channel:t},e[2]=t,e[3]=a),a}function fF(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function pF(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=jt(),{channel:i}=dF();if(i!==`beta`)return null;let a;t[0]===r?a=t[1]:(a=r({id:`9fhQRL`}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(J,{id:`cSCbv3`}),t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==a?(s=(0,Z.jsx)(js,{variant:`secondary`,"aria-label":a,"data-testid":`beta-badge`,className:n,children:o}),t[3]=n,t[4]=a,t[5]=s):s=t[5],s}function mF(e,t){return t.trim()}function hF(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function gF(e,t){let n=mF(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function _F(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(wl(e)){let t=s.get(Td(e.docName,e.docExt));if(t){let n=xl(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:Ao(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(Pl(e))return{...e,path:wF(e.path,n)};if(Fl(e)){let t=s.get(e.path);return t&&_l(t)?{kind:`document`,docName:dd(t),docExt:yl(t),size:e.size,modified:e.modified}:{...e,path:t??wF(e.path,n)}}return e})}function vF(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=>wl(e)?!i.has(e.docName)&&!OF(e.docName,n):Pl(e)?!OF(e.path,n):Fl(e)?!a.has(e.path)&&!OF(e.path,n):!0)}function yF(e,t){if(e.kind!==`asset`||t.some(t=>Fl(t)&&t.path===e.path))return e;let n=Od(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function bF(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>TF(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>wl(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=>Pl(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(wl(i)){let e=DF(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Pl(i)){let e=EF(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function xF(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function SF(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function CF(e,t){let n=e.kind===`file`?Td(e.path,e.docExt):e.path;return dc(t.contentDir,n,t.pathSeparator)}function wF(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 TF(e,t){return wl(e)&&wl(t)?e.docName===t.docName:Pl(e)&&Pl(t)||Fl(e)&&Fl(t)?e.path===t.path:!1}function EF(e,t,n){return e===t?n:DF(e,t,n)}function DF(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function OF(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function kF(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)(fp,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function AF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(pp,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jF(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)(gp,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function MF(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)(Sp,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function NF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(mp,{children:(0,Z.jsx)(hp,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function PF(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=X(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(vp,{"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 FF(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=X(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(As,{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)(Cp,{"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 IF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-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)(wp,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function LF(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=X(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(bp,{children:(0,Z.jsx)(Ds,{})})}),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)(yp,{"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 RF(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=X(`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)(_p,{"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 zF(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xp,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var BF=`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`,VF=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,HF={start:[Oc.Space],cancel:[Oc.Esc],end:[Oc.Space,Oc.Enter]};function UF(e){return X(BF,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function WF(e){return e?void 0:-1}function GF({className:e,isDragging:t}){return X(e,t&&VF)}function KF(e){return e.code===Oc.Enter&&e.target===e.currentTarget}function qF({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&KF(e)?`activate-tab`:`delegate-sortable`}function JF({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Sc.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 YF(e,t){let n=e?.querySelectorAll(t)??[],r=1/0,i=-1/0;for(let e of n){let t=e.getBoundingClientRect();r=Math.min(r,t.left),i=Math.max(i,t.right)}return Number.isFinite(r)&&Number.isFinite(i)?{left:r,right:i}:null}function XF(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 ZF=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 bc(e)},QF=[`.md`,`.mdx`],$F=`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`,eI=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,tI=X(eI,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),nI=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function rI(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function iI(e){let t=tu(e);window.location.hash!==t&&(window.location.hash=t)}function aI(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function oI(e,t){let n=[t,...QF].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 sI(e){return e.metaKey||e.ctrlKey}var cI=1e3;function lI(e,t){return e<0||e>=t?null:e<8?String(e+1):e===t-1?`9`:null}function uI(e,t){return lI(e,t)}function dI(e,t){let n=lI(e,t);if(n)return[`Meta+${n}`,`Control+${n}`].join(` `)}function fI(e,t){if(!sI(e)||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key))return null;let n=Number(e.key);if(n===9)return t>0?t-1:null;let r=n-1;return r<Math.min(8,t)?r:null}function pI(e){let t=(0,$.c)(3),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=X(UF(!0),`font-mono tabular-nums hover:bg-transparent animate-in fade-in-0 zoom-in-95 duration-150 motion-reduce:animate-none motion-reduce:duration-0`),t[0]=r):r=t[0];let i=`⌘${n}`,a;return t[1]===i?a=t[2]:(a=(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`editor-tab-shortcut-hint`,className:r,children:(0,Z.jsx)(Re,{className:`text-[10px]`,children:i})}),t[1]=i,t[2]=a),a}function mI(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:_}=wc(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=JF({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=qF({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=GF({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 hI(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=Ee(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?(_=Ee(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)(AF,{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)(J,{id:`yz7wBu`}),t[18]=x):x=t[18];let S;t[19]!==m||t[20]!==b?(S=(0,Z.jsx)(PF,{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)(J,{id:`omXJcU`}),t[25]=T):T=t[25];let E;t[26]!==C||t[27]!==w?(E=(0,Z.jsx)(PF,{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)(J,{id:`U2Kx6T`}):(0,Z.jsx)(J,{id:`WyXG7w`}),t[32]=l.length,t[33]=k);let A;t[34]!==D||t[35]!==O||t[36]!==k?(A=(0,Z.jsx)(PF,{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)(zF,{}),(0,Z.jsx)(PF,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>m?d(u):c(u),children:m?(0,Z.jsx)(J,{id:`SYfHmN`}):(0,Z.jsx)(J,{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)(NF,{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)(kF,{children:[y,M]}),t[49]=M,t[50]=y,t[51]=N):N=t[51],N}function gI(e){let t=(0,$.c)(28),{accessibleLabel:n,closeTab:r,forceCloseVisible:i,isActive:a,isPinned:o,shortcutHint:s,tabId:c,unpinTab:l}=e,u=i===void 0?!1:i,d=s===void 0?null:s,{_:f}=jt();if(d){let e;return t[0]===d?e=t[1]:(e=(0,Z.jsx)(pI,{value:d}),t[0]=d,t[1]=e),e}if(o){let e;t[2]!==f||t[3]!==n?(e=f({id:`t18QYR`,values:{accessibleLabel:n}}),t[2]=f,t[3]=n,t[4]=e):e=t[4];let r;t[5]!==c||t[6]!==l?(r=e=>{e.stopPropagation(),l(c)},t[5]=c,t[6]=l,t[7]=r):r=t[7];let i;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Km,{"aria-hidden":`true`}),t[8]=i):i=t[8];let a;return t[9]!==e||t[10]!==r?(a=(0,Z.jsx)(Y,{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[9]=e,t[10]=r,t[11]=a):a=t[11],a}let p;t[12]!==f||t[13]!==n?(p=f({id:`JLzQi_`,values:{accessibleLabel:n}}),t[12]=f,t[13]=n,t[14]=p):p=t[14];let m=u||a,h;t[15]===m?h=t[16]:(h=UF(m),t[15]=m,t[16]=h);let g;t[17]===a?g=t[18]:(g=WF(a),t[17]=a,t[18]=g);let _;t[19]!==r||t[20]!==c?(_=e=>{e.stopPropagation(),r(c)},t[19]=r,t[20]=c,t[21]=_):_=t[21];let v;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(sl,{"aria-hidden":`true`}),t[22]=v):v=t[22];let y;return t[23]!==p||t[24]!==h||t[25]!==g||t[26]!==_?(y=(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":p,"data-testid":`editor-tab-close-button`,className:h,tabIndex:g,onClick:_,children:v}),t[23]=p,t[24]=h,t[25]=g,t[26]=_,t[27]=y):y=t[27],y}function _I(e){let t=(0,$.c)(1),{hasConflict:n}=e;if(!n)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Bc,{"aria-hidden":`true`,"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 vI(e){let t=(0,$.c)(27),{accessibleLabel:n,activateTab:r,baseName:i,docName:a,enterRenameMode:o,extension:s,hideDocExtension:c,tabId:l}=e,{_:u}=jt(),d=wT(a)===`conflict`,f;t[0]!==u||t[1]!==n||t[2]!==d?(f=d?u({id:`mVFyH-`,values:{accessibleLabel:n}}):n,t[0]=u,t[1]=n,t[2]=d,t[3]=f):f=t[3];let p=f,m;t[4]!==r||t[5]!==l?(m=()=>{r(l)},t[4]=r,t[5]=l,t[6]=m):m=t[6];let h;t[7]!==a||t[8]!==o||t[9]!==l?(h=e=>{e.preventDefault(),e.stopPropagation(),o(l,a)},t[7]=a,t[8]=o,t[9]=l,t[10]=h):h=t[10];let g;t[11]===d?g=t[12]:(g=(0,Z.jsx)(_I,{hasConflict:d}),t[11]=d,t[12]=g);let _;t[13]===i?_=t[14]:(_=(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:i}),t[13]=i,t[14]=_);let v;t[15]!==s||t[16]!==c?(v=!c&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:s}),t[15]=s,t[16]=c,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==g||t[25]!==y?(b=(0,Z.jsxs)(`button`,{type:`button`,"aria-label":p,title:p,className:nI,onClick:m,onDoubleClick:h,tabIndex:-1,children:[g,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=g,t[25]=y,t[26]=b):b=t[26],b}function yI(){let e=(0,$.c)(94),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:s,closeAndClearForRename:c,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,reopenClosedTab:x,remapTabsForRename:S,reorderTabs:C,unpinTab:w,visibleTabIds:T}=Xe(),{_:E}=jt(),{pageMeta:D}=Ps(),O=(0,Q.useRef)(null),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(!1),V=(0,Q.useRef)(null),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(!1),W=(0,Q.useRef)(null),G=(0,Q.useRef)(t),K=(0,Q.useRef)(null),q=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te;e[0]!==n||e[1]!==t||e[2]!==i?(te=n??(i?Le(i):t?o(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=te):te=e[3];let ne=te,re;e[4]!==r||e[5]!==ne||e[6]!==h||e[7]!==g||e[8]!==v?(re=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:ne?`${ne}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=ne,e[6]=h,e[7]=g,e[8]=v,e[9]=re):re=e[9];let ie=re,ae,oe;e[10]===t?(ae=e[11],oe=e[12]):(ae=()=>{G.current=t},oe=[t],e[10]=t,e[11]=ae,e[12]=oe),(0,Q.useEffect)(ae,oe);let se,ce;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>()=>{K.current!==null&&(window.clearTimeout(K.current),K.current=null)},ce=[],e[13]=se,e[14]=ce):(se=e[13],ce=e[14]),(0,Q.useEffect)(se,ce);let le,ue;e[15]===ie?(le=e[16],ue=e[17]):(le=()=>{ie&&(O.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ue=[ie],e[15]=ie,e[16]=le,e[17]=ue),(0,Q.useEffect)(le,ue);let de,fe;e[18]===j?(de=e[19],fe=e[20]):(de=()=>{j&&(V.current?.focus(),V.current?.select())},fe=[j],e[18]=j,e[19]=de,e[20]=fe),(0,Q.useEffect)(de,fe);let pe,me;e[21]!==v||e[22]!==j?(pe=()=>{!j||v.includes(j.tabId)||(U.current=!0,W.current=null,M(null),P(``),I(null),R(!1))},me=[v,j],e[21]=v,e[22]=j,e[23]=pe,e[24]=me):(pe=e[23],me=e[24]),(0,Q.useEffect)(pe,me);let he;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e,t){let n=t.split(`/`);U.current=!1,W.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},e[25]=he):he=e[25];let ge=he,_e=function(){U.current=!0,W.current=null,M(null),P(``),I(null),R(!1)},ye=async function(){if(U.current){U.current=!1;return}if(H.current)return;let e=j?.docName;if(!e){_e();return}let t=mF(`file`,oI(N,D.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){_e();return}if(t===W.current){V.current?.focus();return}if(!hF(t)){I(E({id:`P8yDjG`})),V.current?.focus();return}let i=gF({kind:`file`,path:e,name:r},t);H.current=!0,R(!0),I(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(U.current){R(!1),H.current=!1;return}let r=await At(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),H.current=!1,W.current=t,V.current?.focus();return}let a=f(co,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=G.current,s=xF(o,a);Ke(a);let l=!0;try{let e=SF(a,p(),m);await Promise.all(e.map(e=>c(e))),S(a),Rl([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),cl.error(E({id:`MUBR8r`}))}U.current=!0,M(null),P(``),I(null),R(!1),H.current=!1,W.current=null,l&&s&&s!==o&&iI(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(E({id:`HIb0vl`})),R(!1),H.current=!1,W.current=t,V.current?.focus()}},be=typeof window<`u`&&window.okDesktop!=null,xe;e[26]===g?xe=e[27]:(xe=new Set(g),e[26]=g,e[27]=xe);let Se=xe,Ce;e[28]===k?Ce=e[29]:(Ce=XF(k),e[28]=k,e[29]=Ce);let we;e[30]===Ce?we=e[31]:(we=[Ce],e[30]=Ce,e[31]=we);let Te=we,Ee;e[32]!==l||e[33]!==d||e[34]!==Se?(Ee=function(e){let t=[],n=[];for(let r of e)Se.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[32]=l,e[33]=d,e[34]=Se,e[35]=Ee):Ee=e[35];let De=Ee,ke,Ae;e[36]!==s||e[37]!==a||e[38]!==r||e[39]!==ne||e[40]!==h||e[41]!==g||e[42]!==_||e[43]!==x||e[44]!==T?(ke=()=>{let e=new Set(g),t=function(){K.current!==null&&(window.clearTimeout(K.current),K.current=null)},n=function(e){q.current!==e&&(q.current=e)},i=function(e){ee.current!==e&&(ee.current=e,B(e))},o=function(){n(!0),!(ee.current||K.current!==null)&&(K.current=window.setTimeout(()=>{K.current=null,q.current&&i(!0)},cI))},c=function(){t(),n(!1),i(!1)},l=function(t){e.has(t)?s(t):a(t)},u=function(e){if(T.length===0)return;let t=h?r:ne,n=t?T.indexOf(t):-1;l(T[((n>=0?n:0)+e+T.length)%T.length])},d=function(e){if(sI(e)&&o(),du(e,`tab-new`)){e.preventDefault(),_();return}if(du(e,`tab-reopen-closed`)){e.preventDefault(),x();return}if(du(e,`tab-next`)){e.preventDefault(),u(1);return}if(du(e,`tab-previous`)){e.preventDefault(),u(-1);return}let t=fI(e,T.length);t!==null&&(e.preventDefault(),l(T[t]))},f=function(e){!e.metaKey&&!e.ctrlKey&&c()};return window.addEventListener(`keydown`,d,{capture:!0}),window.addEventListener(`keyup`,f,{capture:!0}),window.addEventListener(`blur`,c),document.addEventListener(`visibilitychange`,c),()=>{window.removeEventListener(`keydown`,d,{capture:!0}),window.removeEventListener(`keyup`,f,{capture:!0}),window.removeEventListener(`blur`,c),document.removeEventListener(`visibilitychange`,c)}},Ae=[r,ne,s,a,h,g,_,x,T],e[36]=s,e[37]=a,e[38]=r,e[39]=ne,e[40]=h,e[41]=g,e[42]=_,e[43]=x,e[44]=T,e[45]=ke,e[46]=Ae):(ke=e[45],Ae=e[46]),(0,Q.useEffect)(ke,Ae);let je;e[47]===Symbol.for(`react.memo_cache_sentinel`)?(je={activationConstraint:{distance:8}},e[47]=je):je=e[47];let Me;e[48]===Symbol.for(`react.memo_cache_sentinel`)?(Me={coordinateGetter:Mc,keyboardCodes:HF},e[48]=Me):Me=e[48];let Ne=Pc(Nc(Tc,je),Nc(Ec,Me)),Pe=z,Fe;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){A(YF(O.current,`[data-editor-tab-sortable]`))},e[49]=Fe):Fe=e[49];let Ie=Fe,Re;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Re=function(){A(null)},e[50]=Re):Re=e[50];let ze=Re,Be;e[51]!==ze||e[52]!==C||e[53]!==T?(Be=function(e){ze();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=T.indexOf(t),i=T.indexOf(n);r<0||i<0||r===i||C(Cc([...T],r,i),t)},e[51]=ze,e[52]=C,e[53]=T,e[54]=Be):Be=e[54];let Ve=Be,He=be?``:void 0,Ue;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=X(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,be&&`[-webkit-app-region:drag]`),e[55]=Ue):Ue=e[55];let We=aI,Ge;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=X(`flex items-end gap-1`,be&&`[-webkit-app-region:no-drag]`),e[56]=Ge):Ge=e[56];let qe=kc,Je=ZF,Ye;e[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ye={container:typeof document<`u`?document.body:void 0},e[57]=Ye):Ye=e[57];let Ze=Ac,$e;e[58]===T?$e=e[59]:($e=[...T],e[58]=T,e[59]=$e);let et=Dc,tt=T.map((e,t)=>{let n=z?uI(t,T.length):null,i=dI(t,T.length);if(Se.has(e)){let t=e===r;return(0,Z.jsx)(hI,{tabId:e,canPin:!1,openTabs:T,closeTab:l,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsxs)(mI,{tabId:e,activateFromKeyboard:()=>s(e),"aria-current":t?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":t?`true`:void 0,className:X($F,t?eI:tI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&s(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:nI,onClick:()=>s(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(J,{id:`3YvS-c`})})}),n?(0,Z.jsx)(pI,{value:n}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":E({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:UF(Pe||t),tabIndex:WF(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(sl,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let o=Qe(e),c=e===ne,d=b.includes(e);if(o.kind===`folder`){let{baseName:t,label:r,prefix:s}=ve(o.folderPath,`/`),l=`${s}${r}`;return(0,Z.jsx)(hI,{tabId:e,openTabs:T,closeTab:u,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsxs)(mI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":c?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":c?`true`:void 0,className:X($F,c?eI:tI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":l,title:l,className:nI,onClick:()=>{a(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate`,c&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:X(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(gI,{accessibleLabel:l,closeTab:u,forceCloseVisible:Pe,isActive:c,isPinned:d,shortcutHint:n,tabId:e,unpinTab:w})]})},e)}if(o.kind===`asset`||o.kind===`skill-file`){let{baseName:t,label:r,prefix:s}=ve(o.kind===`asset`?o.assetPath:o.path,``),l=`${s}${r}`;return(0,Z.jsx)(hI,{tabId:e,openTabs:T,closeTab:u,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsxs)(mI,{tabId:e,activateFromKeyboard:()=>a(e),"aria-current":c?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":c?`true`:void 0,className:X($F,c?eI:tI),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":l,className:nI,onClick:()=>{a(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:X(`min-w-0 flex-1 truncate text-muted-foreground/60`,c&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:X(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(gI,{accessibleLabel:l,closeTab:u,forceCloseVisible:Pe,isActive:c,isPinned:d,shortcutHint:n,tabId:e,unpinTab:w})]})},e)}let f=o.docName,p=D.get(f)?.docExt??`.md`,{baseName:m,extension:h,label:g,prefix:_}=ve(f,p),v=`${_}${g}`,x=p===`.md`||p===`.mdx`,S=j?.tabId===e,C=`editor-tab-rename-error-${rI(f)}`;return(0,Z.jsx)(hI,{disabled:S,tabId:e,openTabs:T,closeTab:u,closeTabs:De,pinTab:y,pinnedTabIds:b,unpinTab:w,children:(0,Z.jsx)(mI,{tabId:e,activateFromKeyboard:()=>a(e),disabled:S,"aria-current":c?`page`:void 0,"aria-keyshortcuts":i,"data-active-tab":c?`true`:void 0,className:X($F,c?eI:tI,S&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(tT,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(oT,{ref:V,value:N,disabled:L,"aria-label":E({id:`Dw1T_W`,values:{label:g}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?C:void 0,"aria-busy":L||void 0,title:F??f,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=>{P(oI(e.target.value,p)),I(null),W.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ye()):e.key===`Escape`&&(e.preventDefault(),_e())},onBlur:ye}),(0,Z.jsx)(rT,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(aT,{className:`text-muted-foreground/60 text-xs`,children:p})})]}),F?(0,Z.jsx)(`span`,{id:C,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(vI,{accessibleLabel:v,activateTab:a,baseName:m,docName:f,enterRenameMode:ge,extension:h,hideDocExtension:x,tabId:e}),(0,Z.jsx)(gI,{accessibleLabel:v,closeTab:u,forceCloseVisible:Pe,isActive:c,isPinned:d,shortcutHint:n,tabId:e,unpinTab:w})]})})},e)}),nt;e[60]!==Ze||e[61]!==$e||e[62]!==et||e[63]!==tt?(nt=(0,Z.jsx)(Ze,{items:$e,strategy:et,children:tt}),e[60]=Ze,e[61]=$e,e[62]=et,e[63]=tt,e[64]=nt):nt=e[64];let rt;e[65]!==qe||e[66]!==ze||e[67]!==Ve||e[68]!==Ie||e[69]!==Ne||e[70]!==!1||e[71]!==Je||e[72]!==Ye||e[73]!==nt||e[74]!==Te?(rt=(0,Z.jsx)(qe,{sensors:Ne,autoScroll:!1,collisionDetection:Je,modifiers:Te,onDragStart:Ie,onDragEnd:Ve,onDragCancel:ze,accessibility:Ye,children:nt}),e[65]=qe,e[66]=ze,e[67]=Ve,e[68]=Ie,e[69]=Ne,e[70]=!1,e[71]=Je,e[72]=Ye,e[73]=nt,e[74]=Te,e[75]=rt):rt=e[75];let it;e[76]===E?it=e[77]:(it=E({id:`3YvS-c`}),e[76]=E,e[77]=it);let at;e[78]===Symbol.for(`react.memo_cache_sentinel`)?(at=(0,Z.jsx)(Oe,{"aria-hidden":`true`}),e[78]=at):at=e[78];let ot;e[79]!==_||e[80]!==it?(ot=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":it,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:at})}),e[79]=_,e[80]=it,e[81]=ot):ot=e[81];let st;e[82]===Symbol.for(`react.memo_cache_sentinel`)?(st=(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`3YvS-c`})}),e[82]=st):st=e[82];let ct;e[83]===ot?ct=e[84]:(ct=(0,Z.jsxs)(Sn,{children:[ot,st]}),e[83]=ot,e[84]=ct);let lt;e[85]!==Ge||e[86]!==rt||e[87]!==ct?(lt=(0,Z.jsxs)(`div`,{className:Ge,children:[rt,ct]}),e[85]=Ge,e[86]=rt,e[87]=ct,e[88]=lt):lt=e[88];let ut;return e[89]!==He||e[90]!==Ue||e[91]!==We||e[92]!==lt?(ut=(0,Z.jsx)(`div`,{ref:O,"data-electron-drag":He,className:Ue,onWheel:We,children:lt}),e[89]=He,e[90]=Ue,e[91]=We,e[92]=lt,e[93]=ut):ut=e[93],ut}var bI=(e,t,n)=>{if(e&&`reportValidity`in e){let r=bi(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},xI=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?bI(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>bI(t,n,e))}},SI=(e,t)=>{t.shouldUseNativeValidation&&xI(e,t);let n={};for(let r in e){let i=bi(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.ref});if(CI(t.names||Object.keys(e),r)){let e=Object.assign({},bi(n,r));Vi(e,`root`,a),Vi(n,r,e)}else Vi(n,r,a)}return n},CI=(e,t)=>{let n=wI(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>wI(e).match(`^${n}\\.\\d+`))};function wI(e){return e.replace(/[\[\]]/g,``)}function TI(){return TI=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},TI.apply(null,arguments)}function EI(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function DI(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]=fi(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function OI(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(TI({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=fi(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function kI(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(EI(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:SI(DI(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(EI(function(){return Promise.resolve((n.mode===`sync`?Wo:qa)(e,r,t)).then(function(e){return a.shouldUseNativeValidation&&xI({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return e instanceof va}(e))return{values:{},errors:SI(OI(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 AI=`https://openknowledge.ai/api/subscribe`;async function jI(e,t){try{let n=await fetch(AI,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({email:e,source:t}),signal:AbortSignal.timeout(15e3)});return n.ok?{ok:!0}:n.status===400?{ok:!1,reason:`invalid`}:n.status===503?{ok:!1,reason:`unavailable`}:(console.warn(`[subscribe] action=submit result=http-error status=${n.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 MI(e){let t=(0,$.c)(49),{source:n,title:r,description:i,onSuccess:a,onDismiss:o,autoFocus:s,compactSubmit:c,className:l}=e,{_:u}=jt(),[d,f]=(0,Q.useState)(!1),p=(0,Q.useRef)(null),m,h;t[0]===d?(m=t[1],h=t[2]):(m=()=>{d&&p.current?.focus()},h=[d],t[0]=d,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g,_;if(t[3]!==u){let e=qo({email:ro({message:u({id:`Wq6Wcm`})})});_=ui,g=kI(e),t[3]=u,t[4]=g,t[5]=_}else g=t[4],_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v={email:``},t[6]=v):v=t[6];let y;t[7]===g?y=t[8]:(y={resolver:g,defaultValues:v},t[7]=g,t[8]=y);let b=_(y),{isSubmitting:x}=b.formState,S=b.formState.errors.email?.message??b.formState.errors.root?.message,C;t[9]!==u||t[10]!==b||t[11]!==a||t[12]!==n?(C=async function(e){b.clearErrors(`root`);let t=await jI(e.email,n);if(t.ok){f(!0),a?.();return}if(t.reason===`invalid`){b.setError(`email`,{message:u({id:`Wq6Wcm`})});return}if(t.reason===`unavailable`){b.setError(`root`,{message:u({id:`4mLBx9`})});return}b.setError(`root`,{message:u({id:`fWsBTs`})})},t[9]=u,t[10]=b,t[11]=a,t[12]=n,t[13]=C):C=t[13];let w=C,T;t[14]===l?T=t[15]:(T=X(`flex flex-col gap-3`,l),t[14]=l,t[15]=T);let E=d?-1:void 0,D;t[16]!==d||t[17]!==r?(D=d?(0,Z.jsxs)(`span`,{className:`mb-1.5 inline-flex flex-row items-center gap-2`,children:[(0,Z.jsx)(Ds,{className:`size-4 text-primary`}),(0,Z.jsx)(J,{id:`PIMM5l`})]}):r??(0,Z.jsx)(J,{id:`GzPQ2f`}),t[16]=d,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==D||t[20]!==E?(O=(0,Z.jsx)(`p`,{ref:p,tabIndex:E,className:`text-sm font-medium leading-tight text-foreground focus:outline-none`,children:D}),t[19]=D,t[20]=E,t[21]=O):O=t[21];let k;t[22]!==i||t[23]!==d?(k=d?(0,Z.jsx)(J,{id:`pBROkv`}):i??(0,Z.jsx)(J,{id:`WmPbvm`}),t[22]=i,t[23]=d,t[24]=k):k=t[24];let A;t[25]===k?A=t[26]:(A=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,role:`status`,children:k}),t[25]=k,t[26]=A);let j;t[27]!==O||t[28]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[O,A]}),t[27]=O,t[28]=A,t[29]=j):j=t[29];let M;t[30]!==u||t[31]!==o?(M=o?(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":u({id:`yz7wBu`}),className:`-mr-1.5 -mt-1 size-7 shrink-0 text-muted-foreground opacity-60`,children:(0,Z.jsx)(sl,{className:`size-4`})}):null,t[30]=u,t[31]=o,t[32]=M):M=t[32];let N;t[33]!==j||t[34]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[j,M]}),t[33]=j,t[34]=M,t[35]=N):N=t[35];let P;t[36]!==u||t[37]!==s||t[38]!==c||t[39]!==S||t[40]!==b||t[41]!==x||t[42]!==w||t[43]!==d?(P=d?null:(0,Z.jsxs)(`form`,{onSubmit:b.handleSubmit(w),className:`flex flex-col gap-2`,noValidate:!0,children:[(0,Z.jsx)(wi,{control:b.control,name:`email`,render:e=>{let{field:t,fieldState:n}=e;return(0,Z.jsxs)(tT,{className:`h-10 rounded-xl`,children:[(0,Z.jsx)(rT,{className:`pl-2.5`,children:(0,Z.jsx)(Pm,{className:`size-4 text-muted-foreground opacity-60`})}),(0,Z.jsx)(oT,{...t,id:t.name,type:`email`,inputMode:`email`,autoComplete:`email`,spellCheck:!1,autoFocus:s,placeholder:u({id:`2hYmUH`}),"aria-invalid":n.invalid,"aria-label":u({id:`ATGYL1`}),"data-testid":`subscribe-email`,className:`placeholder:text-muted-foreground/60`}),(0,Z.jsx)(Y,{type:`submit`,disabled:x,size:c?`icon`:`default`,className:X(`mr-1 ml-auto text-1sm`,c&&`size-8 shrink-0 rounded-lg`),"data-testid":`subscribe-submit`,children:x?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ic,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`lCC_D5`})})]}):c?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jn,{className:`size-4`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`EDl9kS`})})]}):(0,Z.jsx)(J,{id:`EDl9kS`})})]})}}),S?(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,role:`alert`,children:S}):null]}),t[36]=u,t[37]=s,t[38]=c,t[39]=S,t[40]=b,t[41]=x,t[42]=w,t[43]=d,t[44]=P):P=t[44];let F;return t[45]!==N||t[46]!==P||t[47]!==T?(F=(0,Z.jsxs)(`div`,{className:T,children:[N,P]}),t[45]=N,t[46]=P,t[47]=T,t[48]=F):F=t[48],F}var NI=`https://github.com/inkeep/open-knowledge`,PI=`https://discord.gg/VRKk2EaGHN`,FI=`https://x.com/OpenKnowledge`,II=`ok-subscribe-card-v1`,LI={subscribed:!1,dismissed:!1,shownVersions:[]};function RI(e,t){return!e.subscribed&&!e.dismissed&&e.shownVersions.length<3&&!e.shownVersions.includes(t)}function zI(e){return e===!0}function BI(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function VI(e){if(typeof e!=`object`||!e)return LI;let t=e;return{subscribed:zI(t.subscribed),dismissed:zI(t.dismissed),shownVersions:BI(t.shownVersions)}}function HI(e){try{let t=(e??localStorage).getItem(II);return t==null?LI:VI(JSON.parse(t))}catch(e){return console.warn(`[subscribe-card-store] readPersistedState failed (corrupt/privacy/SSR)`,e),LI}}function UI(e,t){try{(t??localStorage).setItem(II,JSON.stringify(e))}catch(e){console.warn(`[subscribe-card-store] writePersistedState failed (quota/privacy/SSR)`,e)}}function WI(e){let t=HI(e),n=new Set,r=!1;function i(){for(let e of n)e()}function a(n){t=n,UI(t,e),i()}return{getSnapshot(){return t},subscribe(e){return n.add(e),()=>{n.delete(e)}},markSubscribed(){t.subscribed||a({...t,subscribed:!0})},dismiss(){t.dismissed||a({...t,dismissed:!0})},recordShown(e){t.shownVersions.includes(e)||a({...t,shownVersions:[...t.shownVersions,e]})},install(){r||(r=!0,t=HI(e),i())}}}var GI=WI();function KI(){GI.install()}function qI(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 JI(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 YI=`${NI}/issues/new`,XI=[{key:`resources`,heading:{id:`s-MGs7`},links:[{label:{id:`TbjyhA`},href:`https://openknowledge.ai/docs`,icon:N},{label:{id:`PCNIuJ`},href:YI,icon:om},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Ns}]},{key:`community`,heading:{id:`chL5IG`},links:[{label:`Discord`,href:PI,icon:qI},{label:`X (Twitter)`,href:FI,icon:JI},{label:`GitHub`,href:NI,icon:Sg}]}],ZI=`${NI}/releases`,QI=`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 $I(e){if(e<1e3)return String(e);let t=e/1e3;return`${t>=10?Math.round(t):t.toFixed(1)}k`}var eL=e=>{let t=(0,$.c)(12),{count:n}=e,{_:r}=jt(),i,a,o,s;t[0]!==r||t[1]!==n?(i=$I(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)(sh,{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},tL=e=>{let t=(0,$.c)(15),{link:n,trailing:r}=e,{_:i}=jt(),{label:a,href:o,icon:s}=n,c,l;t[0]===o?(c=t[1],l=t[2]):(c=e=>zu(e,o),l=e=>zu(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:QI,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},nL=e=>{let t=(0,$.c)(5),{onSelect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=X(QI,`h-auto w-full justify-start font-normal`),t[0]=r):r=t[0];let i,a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ze,{"aria-hidden":`true`,className:`size-4 shrink-0`}),a=(0,Z.jsx)(J,{id:`cd5EXh`}),t[1]=i,t[2]=a):(i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{variant:`ghost`,className:r,onClick:n,children:[i,a]})}),t[3]=n,t[4]=o),o},rL=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},iL=()=>{let e=(0,$.c)(33),{_:t}=jt(),[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=typeof window<`u`&&window.okDesktop!=null,d,f;e[0]!==n||e[1]!==c?(d=()=>{if(!n||c!==null)return;let e=new AbortController;return Ma({signal:e.signal}).then(e=>{e!==null&&l(e)}),()=>e.abort()},f=[n,c],e[0]=n,e[1]=c,e[2]=d,e[3]=f):(d=e[2],f=e[3]),(0,Q.useEffect)(d,f);let p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{r(e),e||a(!1)},e[4]=p):p=e[4];let m;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(He,{className:`size-4`}),e[5]=m):m=e[5];let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[m,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`s-MGs7`})})]})})}),e[6]=h):h=e[6];let g;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(Sn,{children:[h,(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`s-MGs7`})})]}),e[7]=g):g=e[7];let _;e[8]!==t||e[9]!==c?(_=XI.map((e,n)=>(0,Z.jsxs)(`div`,{className:X(n>0&&`mt-3`),children:[(0,Z.jsx)(rL,{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.jsxs)(Q.Fragment,{children:[(0,Z.jsx)(tL,{link:e,trailing:e.href===`https://github.com/inkeep/open-knowledge`&&c!==null?(0,Z.jsx)(eL,{count:c}):void 0}),u&&e.href===YI&&(0,Z.jsx)(nL,{onSelect:()=>{r(!1),s(!0)}})]},e.href))})})]},e.key)),e[8]=t,e[9]=c,e[10]=_):_=e[10];let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(rL,{children:(0,Z.jsx)(J,{id:`arUUsK`})}),e[11]=v):v=e[11];let y;e[12]===t?y=e[13]:(y=t({id:`arUUsK`}),e[12]=t,e[13]=y);let b;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(tL,{link:{label:{id:`3ePd3I`},href:ZI,icon:Fm}}),e[14]=b):b=e[14];let x;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,className:X(QI,`h-auto w-full justify-start font-normal`),children:[(0,Z.jsx)(Pm,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Z.jsx)(J,{id:`EDl9kS`})]})}),e[15]=x):x=e[15];let S;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(re,{side:`left`,align:`center`,sideOffset:20,className:`w-80`,children:(0,Z.jsx)(MI,{source:`resources_menu`,autoFocus:!0,onDismiss:()=>a(!1),onSuccess:aL})}),e[16]=S):S=e[16];let C;e[17]===i?C=e[18]:(C=(0,Z.jsxs)(`ul`,{className:`space-y-0.5`,children:[b,(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ae,{open:i,onOpenChange:a,children:[x,S]})})]}),e[17]=i,e[18]=C);let w;e[19]!==C||e[20]!==y?(w=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[v,(0,Z.jsx)(`nav`,{"aria-label":y,children:C})]}),e[19]=C,e[20]=y,e[21]=w):w=e[21];let T;e[22]!==w||e[23]!==_?(T=(0,Z.jsxs)(re,{align:`end`,className:`w-56 p-3`,children:[_,w]}),e[22]=w,e[23]=_,e[24]=T):T=e[24];let E;e[25]!==n||e[26]!==T?(E=(0,Z.jsxs)(ae,{open:n,onOpenChange:p,children:[g,T]}),e[25]=n,e[26]=T,e[27]=E):E=e[27];let D;e[28]===o?D=e[29]:(D=u&&(0,Z.jsx)(Df,{open:o,onOpenChange:s}),e[28]=o,e[29]=D);let O;return e[30]!==E||e[31]!==D?(O=(0,Z.jsxs)(Z.Fragment,{children:[E,D]}),e[30]=E,e[31]=D,e[32]=O):O=e[32],O};function aL(){return GI.markSubscribed()}function oL(e){let t=(0,$.c)(14),{className:n}=e,{_:r}=jt(),i=typeof window<`u`?window.okDesktop?.instanceLabel??null:null;if(!i)return null;let a;t[0]===r?a=t[1]:(a=r({id:`iRdfLr`,values:{label:i}}),t[0]=r,t[1]=a);let o,s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Qo,{"aria-hidden":`true`}),s=(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:i}),t[2]=o,t[3]=s):(o=t[2],s=t[3]);let c;t[4]!==n||t[5]!==a?(c=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsxs)(js,{variant:`secondary`,"aria-label":a,"data-testid":`instance-badge`,className:n,children:[o,s]})}),t[4]=n,t[5]=a,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=r({id:`c5PTFE`,values:{label:i}}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(bn,{children:l}),t[9]=l,t[10]=u);let d;return t[11]!==c||t[12]!==u?(d=(0,Z.jsxs)(Sn,{children:[c,u]}),t[11]=c,t[12]=u,t[13]=d):d=t[13],d}var sL=50,cL=()=>{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,Rw.preload()},sL))},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=Oi)},l=(0,Z.jsx)(Qm,{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)(yn,{asChild:!0,children:(0,Z.jsxs)(Y,{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)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Sn,{children:[u,(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d},lL=`https://openknowledge.ai/docs/features/share`;function uL(e){let t=(0,$.c)(50),{input:n,onClickWhenNoRemote:r}=e,{_:i}=jt(),{status:a}=ls(),[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=as(c?.freshness,a),g;t[4]!==i||t[5]!==o||t[6]!==p||t[7]!==n||t[8]!==r?(g=async function(){if(!o&&n!==null){s(!0),l(null);try{let e=await gi({...n,hasRemote:p,onClickWhenNoRemote:r},{clipboardWrite:td,toastSuccess:vL,toastError:_L,logEvent:gL});e.kind===`copied`?l({url:e.shareUrl,autoCopyFailed:!1,freshness:e.freshness}):e.kind===`clipboard-failed`&&l({url:e.shareUrl,autoCopyFailed:!0,freshness:e.freshness})}catch{cl.error(i({id:`u3YnKw`}))}s(!1)}},t[4]=i,t[5]=o,t[6]=p,t[7]=n,t[8]=r,t[9]=g):g=t[9];let _=g,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)($m,{className:`size-3.5`,"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`Z8lGw6`}),t[14]=S,t[15]=C):(S=t[14],C=t[15]);let T;t[16]!==_||t[17]!==b||t[18]!==x?(T=(0,Z.jsx)(w,{asChild:!0,children:(0,Z.jsxs)(Y,{variant:`ghost`,size:`sm`,"aria-label":b,onClick:_,disabled:x,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[S,C]})}),t[16]=_,t[17]=b,t[18]=x,t[19]=T):T=t[19];let E=h?`w-96`:`w-80`,D;t[20]===E?D=t[21]:(D=X(`flex flex-col gap-2`,E),t[20]=E,t[21]=D);let O;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs`,children:(0,Z.jsx)(J,{id:`Z8lGw6`})}),t[22]=O):O=t[22];let k;t[23]===c?.autoCopyFailed?k=t[24]:(k=c?.autoCopyFailed?(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ndeI89`})}):null,t[23]=c?.autoCopyFailed,t[24]=k);let A=c?.url??``,j;t[25]===i?j=t[26]:(j=i({id:`5-FeN2`}),t[25]=i,t[26]=j);let M;t[27]!==A||t[28]!==j?(M=(0,Z.jsx)(ml,{ref:u,readOnly:!0,value:A,onFocus:hL,onClick:mL,onContextMenu:pL,className:`select-all bg-muted font-mono text-xs text-muted-foreground`,"data-testid":`share-button-url`,"aria-label":j}),t[27]=A,t[28]=j,t[29]=M):M=t[29];let N=c?.url??``,P=c?.autoCopyFailed===!1,F;t[30]!==N||t[31]!==P?(F=(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)(Ms,{copyContent:N,clipboardWrite:td,initialCopied:P})})}),t[30]=N,t[31]=P,t[32]=F):F=t[32];let I;t[33]!==M||t[34]!==F?(I=(0,Z.jsxs)(`div`,{className:`relative`,children:[M,F]}),t[33]=M,t[34]=F,t[35]=I):I=t[35];let L=c?.freshness,R=n?.kind??`doc`,z;t[36]!==a||t[37]!==L||t[38]!==R?(z=(0,Z.jsx)(rs,{freshness:L,status:a,kind:R}),t[36]=a,t[37]=L,t[38]=R,t[39]=z):z=t[39];let B;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(`a`,{href:lL,target:`_blank`,rel:`noopener noreferrer`,onClick:fL,onAuxClick:dL,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)(He,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(J,{id:`aByJ8j`})]}),t[40]=B):B=t[40];let V;t[41]!==D||t[42]!==k||t[43]!==I||t[44]!==z?(V=(0,Z.jsxs)(re,{align:`end`,className:D,"data-testid":`share-button-popover`,children:[O,k,I,z,B]}),t[41]=D,t[42]=k,t[43]=I,t[44]=z,t[45]=V):V=t[45];let H;return t[46]!==T||t[47]!==V||t[48]!==v?(H=(0,Z.jsxs)(ae,{open:v,onOpenChange:y,children:[T,V]}),t[46]=T,t[47]=V,t[48]=v,t[49]=H):H=t[49],H}function dL(e){return zu(e,lL)}function fL(e){return zu(e,lL)}function pL(e){return e.currentTarget.select()}function mL(e){return e.currentTarget.select()}function hL(e){return e.currentTarget.select()}function gL(e){return console.log(e)}function _L(e){e!==`Link ready but could not copy to clipboard.`&&cl.error(e)}function vL(e){return cl.success(e)}function yL(e){let t=(0,$.c)(36),{onSignIn:n,onSetIdentity:r,onOpenSearch:i}=e,{_:a}=jt(),{activeDocName:o,activeTarget:s}=Xe(),c=o?Uo(o):null,{state:l,isDraggingRail:u}=lN(),d=S_(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=uu(`toggle-files-sidebar`),t[0]=f):f=t[0];let p=f,m=uu(`command-palette`),[h,g]=(0,Q.useState)(!1),_;bb0:{if(s?.kind===`folder`){let e;t[1]===s.folderPath?e=t[2]:(e=pi(s.folderPath),t[1]=s.folderPath,t[2]=e),_=e;break bb0}if(o&&!c){let e;t[3]===o?e=t[4]:(e=xi(o),t[3]=o,t[4]=e),_=e;break bb0}if(!s&&!o){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=pi(``),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=X(`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)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(mN,{className:X(`-ml-1 shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(bn,{children:l===`expanded`?(0,Z.jsx)(J,{id:`ZxXhLY`,values:{sidebarShortcut:p}}):(0,Z.jsx)(J,{id:`Zz25kq`,values:{sidebarShortcut:p}})})]}),b&&i&&(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":a({id:`IN4UX8`,values:{searchShortcut:m}}),"data-telemetry-event":`ok.editor_header.search.click`,className:X(`shrink-0 text-muted-foreground`,y&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(_t,{"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{children:(0,Z.jsx)(J,{id:`IN4UX8`,values:{searchShortcut:m}})})]}),(0,Z.jsx)(qi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(yI,{})]}),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=X(`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)(uL,{input:v,onClickWhenNoRemote:()=>g(!0)}),(0,Z.jsx)(na,{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)(Pi,{onSignIn:n,onSetIdentity:r}),t[17]=r,t[18]=n,t[19]=k):k=t[19];let A,j,M,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(uF,{}),j=(0,Z.jsx)(qi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(oL,{}),N=(0,Z.jsx)(pF,{}),t[20]=A,t[21]=j,t[22]=M,t[23]=N):(A=t[20],j=t[21],M=t[22],N=t[23]);let P;t[24]===d?P=t[25]:(P=!d&&(0,Z.jsx)(cL,{}),t[24]=d,t[25]=P);let F;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(iL,{}),t[26]=F):F=t[26];let I;t[27]!==O||t[28]!==k||t[29]!==P?(I=(0,Z.jsxs)(`div`,{className:D,children:[O,k,A,j,M,N,P,F]}),t[27]=O,t[28]=k,t[29]=P,t[30]=I):I=t[30];let L;return t[31]!==I||t[32]!==x||t[33]!==w||t[34]!==E?(L=(0,Z.jsxs)(`header`,{"data-electron-drag":x,className:w,children:[E,I]}),t[31]=I,t[32]=x,t[33]=w,t[34]=E,t[35]=L):L=t[35],L}var bL=`open-knowledge:terminal-launch`;function xL(e,t,n=typeof window>`u`?new EventTarget:window){n.dispatchEvent(new CustomEvent(bL,{detail:{prompt:e,cli:t}}))}function SL(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(bL,n),()=>t.removeEventListener(bL,n)}function CL(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=X(`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)(Bp,{"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 wL=un(`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 TL(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=X(wL({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)(Vp,{"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 EL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`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)(Hp,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function DL(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=X(`flex-1 text-sm outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Up,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var OL=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-N3nlUpP9.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([107,1,6,2,3,7,8,9,10,15,20,53,80,16,108,81,47,48,68,69,109]),import.meta.url));function kL(e){let t=(0,$.c)(14),{bridge:n,onClose:r,onTitleChange:i,launch:a,adoptPtyId:o,onPtyId:s}=e,c=a===void 0?null:a,l=o===void 0?null:o,{enabled:u,synced:d}=ta(),f=ra(),{_:p}=jt(),m=d&&u===!1,h;t[0]!==p||t[1]!==f?(h=function(){if(f===null){cl.error(p({id:`V_6bJ4`}));return}let e=f(!0);e.ok||cl.error(p({id:`jKd3AP`,values:{0:e.error}}))},t[0]=p,t[1]=f,t[2]=h):h=t[2];let g=h;if(d&&!m){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]!==l||t[5]!==n||t[6]!==c||t[7]!==r||t[8]!==s||t[9]!==i?(a=(0,Z.jsx)(I,{fallbackRender:jL,onError:AL,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(OL,{bridge:n,className:`h-full`,onClose:r,onTitleChange:i,launch:c,adoptPtyId:l,onPtyId:s})})}),t[4]=l,t[5]=n,t[6]=c,t[7]=r,t[8]=s,t[9]=i,t[10]=a):a=t[10],a}let _;return t[11]!==g||t[12]!==m?(_=m?(0,Z.jsx)(PL,{onEnable:g}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[11]=g,t[12]=m,t[13]=_):_=t[13],_}function AL(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function jL(e){return(0,Z.jsx)(ML,{...e})}function ML(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=jt(),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)(Y,{onClick:NL,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 NL(){return window.location.reload()}function PL(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=jt(),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)(Y,{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 FL(e){let t=(0,$.c)(53),{selected:n,onLaunchSelected:r,onPickCli:i,onPickTerminal:a,visibleClis:o,className:s}=e,c=o===void 0?nc:o,{_:l}=jt(),u=n===`terminal`,d;t[0]!==l||t[1]!==u||t[2]!==n?(d=l(u?{id:`AB4qw9`}:{id:`nP-KFo`,values:{0:ka[n].displayName}}),t[0]=l,t[1]=u,t[2]=n,t[3]=d):d=t[3];let f=d,p;t[4]===s?p=t[5]:(p=X(`flex shrink-0 items-center`,s),t[4]=s,t[5]=p);let m;t[6]!==u||t[7]!==n?(m=u?(0,Z.jsx)(ah,{"aria-hidden":`true`,className:`size-3.5`}):(0,Z.jsx)(rc,{id:Ws(n),className:`size-3.5`,"aria-hidden":`true`}),t[6]=u,t[7]=n,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3`}),t[9]=h):h=t[9];let g;t[10]!==r||t[11]!==f||t[12]!==m?(g=(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsxs)(Y,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":f,"data-testid":`terminal-new-chat`,className:`cursor-pointer gap-0.5 rounded-r-none px-1.5 text-muted-foreground hover:text-foreground`,onClick:r,children:[m,h]})}),t[10]=r,t[11]=f,t[12]=m,t[13]=g):g=t[13];let _;t[14]===f?_=t[15]:(_=(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:f}),t[14]=f,t[15]=_);let v;t[16]!==g||t[17]!==_?(v=(0,Z.jsxs)(Sn,{children:[g,_]}),t[16]=g,t[17]=_,t[18]=v):v=t[18];let y;t[19]===l?y=t[20]:(y=l({id:`QJaG-9`}),t[19]=l,t[20]=y);let b;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`size-3`}),t[21]=b):b=t[21];let x;t[22]===y?x=t[23]:(x=(0,Z.jsx)(jr,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":y,"data-testid":`terminal-new-chat-menu`,className:`cursor-pointer rounded-l-none text-muted-foreground hover:text-foreground`,children:b})}),t[22]=y,t[23]=x);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(ni,{children:(0,Z.jsx)(J,{id:`hIQkLb`})}),t[24]=S):S=t[24];let C;if(t[25]!==l||t[26]!==i||t[27]!==n||t[28]!==c){let e;t[30]!==l||t[31]!==i||t[32]!==n?(e=e=>{let{displayName:t}=ka[e];return(0,Z.jsxs)(Gr,{onSelect:()=>i(e),"data-testid":`terminal-new-chat-cli-${e}`,"aria-label":l({id:`9mEZeD`,values:{name:t}}),"aria-current":n===e?`true`:void 0,children:[(0,Z.jsx)(rc,{id:Ws(e),className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t}),n===e?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e)},t[30]=l,t[31]=i,t[32]=n,t[33]=e):e=t[33],C=c.map(e),t[25]=l,t[26]=i,t[27]=n,t[28]=c,t[29]=C}else C=t[29];let w;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(Vr,{}),t[34]=w):w=t[34];let T=u?`true`:void 0,E;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ah,{"aria-hidden":`true`,className:`size-4`}),t[35]=E):E=t[35];let D;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`ALhMYW`})}),t[36]=D):D=t[36];let O;t[37]===u?O=t[38]:(O=u?(0,Z.jsx)(Ds,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null,t[37]=u,t[38]=O);let k;t[39]!==a||t[40]!==T||t[41]!==O?(k=(0,Z.jsxs)(Gr,{onSelect:a,"data-testid":`terminal-new-chat-terminal`,"aria-current":T,children:[E,D,O]}),t[39]=a,t[40]=T,t[41]=O,t[42]=k):k=t[42];let A;t[43]!==C||t[44]!==k?(A=(0,Z.jsxs)(qr,{align:`start`,className:`min-w-[180px]`,children:[S,C,w,k]}),t[43]=C,t[44]=k,t[45]=A):A=t[45];let j;t[46]!==x||t[47]!==A?(j=(0,Z.jsxs)($r,{children:[x,A]}),t[46]=x,t[47]=A,t[48]=j):j=t[48];let M;return t[49]!==j||t[50]!==p||t[51]!==v?(M=(0,Z.jsxs)(`div`,{className:p,children:[v,j]}),t[49]=j,t[50]=p,t[51]=v,t[52]=M):M=t[52],M}var IL=`[data-terminal-tab-sortable]`;function LL(e){let t=(0,$.c)(17),{id:n,disabled:r,isActive:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o={id:n,disabled:r},t[0]=r,t[1]=n,t[2]=o):o=t[2];let{setNodeRef:s,listeners:c,rect:l,transform:u,transition:d,isDragging:f}=wc(o),p=l.current?.width,m;t[3]!==f||t[4]!==p||t[5]!==u||t[6]!==d?(m=JF({activeWidth:p,isDragging:f,transform:u,transition:d}),t[3]=f,t[4]=p,t[5]=u,t[6]=d,t[7]=m):m=t[7];let h=m,g=i?`bg-muted`:`hover:bg-muted/50`,_=f&&`z-10`,v;t[8]!==g||t[9]!==_?(v=X(`group flex shrink-0 cursor-default items-center rounded-md pr-0.5 transition-colors`,g,_),t[8]=g,t[9]=_,t[10]=v):v=t[10];let y;return t[11]!==a||t[12]!==c||t[13]!==s||t[14]!==h||t[15]!==v?(y=(0,Z.jsx)(`div`,{ref:s,"data-terminal-tab-sortable":``,style:h,className:v,...c,children:a}),t[11]=a,t[12]=c,t[13]=s,t[14]=h,t[15]=v,t[16]=y):y=t[16],y}function RL(e){let t=(0,$.c)(85),{sessions:n,activeSessionId:r,onSelect:i,onTabActivate:a,newChatSelected:o,onNewChatLaunch:s,onNewChatPickCli:c,onNewChatPickTerminal:l,newChatVisibleClis:u,onClose:d,onRename:f,onReorder:p,onDragActiveChange:m,dockPosition:h,onToggleDock:g,onCollapse:_,children:v,className:y,draggable:b}=e,{_:x}=jt(),S=h===`right`,[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(``),D=(0,Q.useRef)(null),O=(0,Q.useRef)(!1),k=f!=null,A,j;t[0]===C?(A=t[1],j=t[2]):(A=()=>{C!=null&&(D.current?.focus(),D.current?.select())},j=[C],t[0]=C,t[1]=A,t[2]=j),(0,Q.useEffect)(A,j);let M,N;t[3]!==C||t[4]!==n?(M=()=>{C!=null&&!n.some(e=>e.id===C)&&(O.current=!1,w(null),E(``))},N=[n,C],t[3]=C,t[4]=n,t[5]=M,t[6]=N):(M=t[5],N=t[6]),(0,Q.useEffect)(M,N);let P=function(e){k&&(O.current=!1,w(e.id),E(e.label))},F;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e):e;queueMicrotask(()=>{document.querySelector(`[role="tab"][data-tab-id="${t}"]`)?.focus()})},t[7]=F):F=t[7];let I=F,L=function(e){O.current||f?.(e,T.trim()),O.current=!1,w(null),E(``),I(e)},R=(0,Q.useRef)(null),[z,B]=(0,Q.useState)(null),V;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(V={activationConstraint:{distance:8}},t[8]=V):V=t[8];let H=Pc(Nc(Tc,V)),U=p!=null,W;t[9]===z?W=t[10]:(W=XF(z),t[9]=z,t[10]=W);let G;t[11]===W?G=t[12]:(G=[W],t[11]=W,t[12]=G);let K=G,q;t[13]===m?q=t[14]:(q=function(){B(YF(R.current,IL)),m?.(!0)},t[13]=m,t[14]=q);let ee=q,te;t[15]!==m||t[16]!==p||t[17]!==n?(te=function(e){B(null),m?.(!1);let t=String(e.active.id),r=e.over?String(e.over.id):null;if(!r||t===r)return;let i=n.map(BL),a=i.indexOf(t),o=i.indexOf(r);a<0||o<0||a===o||p?.(Cc(i,a,o))},t[15]=m,t[16]=p,t[17]=n,t[18]=te):te=t[18];let ne=te,re;t[19]===m?re=t[20]:(re=function(){B(null),m?.(!1)},t[19]=m,t[20]=re);let ie=re,ae=CL,oe;t[21]===y?oe=t[22]:(oe=X(`flex min-h-0 min-w-0 flex-1 flex-col`,y),t[21]=y,t[22]=oe);let se=b?``:void 0,ce=b&&`h-[62px] [-webkit-app-region:drag] pr-[22px] pl-[calc(var(--ok-titlebar-reserve-left,1rem)+0.75rem)]`,le;t[23]===ce?le=t[24]:(le=X(`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,ce),t[23]=ce,t[24]=le);let ue=TL,de;t[25]===x?de=t[26]:(de=x({id:`1MGRQl`}),t[25]=x,t[26]=de);let fe=b&&`[-webkit-app-region:no-drag]`,pe;t[27]===fe?pe=t[28]:(pe=X(`flex h-auto min-w-0 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,fe),t[27]=fe,t[28]=pe);let me=kc,he=ZF,ge;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(ge={container:typeof document<`u`?document.body:void 0},t[29]=ge):ge=t[29];let _e=Ac,ve;t[30]===n?ve=t[31]:(ve=n.map(zL),t[30]=n,t[31]=ve);let ye=Dc,be=n.map(e=>{let t=e.id===r;return(0,Z.jsx)(LL,{id:e.id,disabled:!U||C!=null,isActive:t,children:C===e.id?(0,Z.jsx)(tT,{className:X(`h-7 w-40 rounded-md border-0 bg-transparent dark:bg-transparent`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(oT,{ref:D,value:T,"aria-label":x({id:`0TnCvC`,values:{0:e.label}}),"data-testid":`terminal-tab-rename-input`,className:`h-7 px-2 text-xs`,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),D.current?.blur()):e.key===`Escape`&&(e.preventDefault(),O.current=!0,D.current?.blur())},onBlur:()=>L(e.id)})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(EL,{value:e.id,"data-tab-id":e.id,onClick:t=>{t.detail>=2||a?.(e.id)},onDoubleClick:()=>P(e),onKeyDown:t=>{t.key===`F2`&&(t.preventDefault(),P(e))},className:X(`h-7 flex-none rounded-md px-2 text-xs`,b&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:e.label})]}),(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":x({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:X(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`,b&&`[-webkit-app-region:no-drag]`),onClick:t=>{t.stopPropagation(),d(e.id)},children:(0,Z.jsx)(sl,{"aria-hidden":`true`})})]})},e.id)}),xe;t[32]!==_e||t[33]!==ve||t[34]!==ye||t[35]!==be?(xe=(0,Z.jsx)(_e,{items:ve,strategy:ye,children:be}),t[32]=_e,t[33]=ve,t[34]=ye,t[35]=be,t[36]=xe):xe=t[36];let Se;t[37]!==me||t[38]!==ie||t[39]!==ne||t[40]!==ee||t[41]!==K||t[42]!==H||t[43]!==!1||t[44]!==he||t[45]!==ge||t[46]!==xe?(Se=(0,Z.jsx)(me,{sensors:H,autoScroll:!1,collisionDetection:he,modifiers:K,onDragStart:ee,onDragEnd:ne,onDragCancel:ie,accessibility:ge,children:xe}),t[37]=me,t[38]=ie,t[39]=ne,t[40]=ee,t[41]=K,t[42]=H,t[43]=!1,t[44]=he,t[45]=ge,t[46]=xe,t[47]=Se):Se=t[47];let Ce;t[48]!==ue||t[49]!==de||t[50]!==pe||t[51]!==Se?(Ce=(0,Z.jsx)(ue,{variant:`line`,"aria-label":de,className:pe,children:Se}),t[48]=ue,t[49]=de,t[50]=pe,t[51]=Se,t[52]=Ce):Ce=t[52];let we=b&&`[-webkit-app-region:no-drag]`,Te;t[53]===we?Te=t[54]:(Te=X(`shrink-0`,we),t[53]=we,t[54]=Te);let Ee;t[55]!==o||t[56]!==u||t[57]!==s||t[58]!==c||t[59]!==l||t[60]!==Te?(Ee=(0,Z.jsx)(FL,{selected:o,onLaunchSelected:s,onPickCli:c,onPickTerminal:l,visibleClis:u,className:Te}),t[55]=o,t[56]=u,t[57]=s,t[58]=c,t[59]=l,t[60]=Te,t[61]=Ee):Ee=t[61];let De;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,Z.jsx)(`div`,{className:`flex-1`}),t[62]=De):De=t[62];let Oe;t[63]!==x||t[64]!==g||t[65]!==S?(Oe=g==null?null:(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":x(S?{id:`rf6x3F`}:{id:`QNxpRm`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:g,children:S?(0,Z.jsx)(zm,{"aria-hidden":`true`}):(0,Z.jsx)(Um,{"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:S?(0,Z.jsx)(J,{id:`rf6x3F`}):(0,Z.jsx)(J,{id:`QNxpRm`})})]}),t[63]=x,t[64]=g,t[65]=S,t[66]=Oe):Oe=t[66];let ke;t[67]!==x||t[68]!==_||t[69]!==S?(ke=_==null?null:(0,Z.jsxs)(Sn,{children:[(0,Z.jsx)(yn,{asChild:!0,children:(0,Z.jsx)(Y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":x({id:`VZGGPK`}),className:`shrink-0 cursor-pointer text-muted-foreground hover:text-foreground`,onClick:_,children:S?(0,Z.jsx)(As,{"aria-hidden":`true`}):(0,Z.jsx)(ks,{"aria-hidden":`true`})})}),(0,Z.jsx)(bn,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(J,{id:`VZGGPK`})})]}),t[67]=x,t[68]=_,t[69]=S,t[70]=ke):ke=t[70];let Ae;t[71]!==se||t[72]!==le||t[73]!==Ce||t[74]!==Ee||t[75]!==Oe||t[76]!==ke?(Ae=(0,Z.jsxs)(`div`,{ref:R,"data-electron-drag":se,className:le,children:[Ce,Ee,De,Oe,ke]}),t[71]=se,t[72]=le,t[73]=Ce,t[74]=Ee,t[75]=Oe,t[76]=ke,t[77]=Ae):Ae=t[77];let je;return t[78]!==ae||t[79]!==r||t[80]!==v||t[81]!==i||t[82]!==oe||t[83]!==Ae?(je=(0,Z.jsxs)(ae,{value:r,onValueChange:i,className:oe,children:[Ae,v]}),t[78]=ae,t[79]=r,t[80]=v,t[81]=i,t[82]=oe,t[83]=Ae,t[84]=je):je=t[84],je}function zL(e){return e.id}function BL(e){return e.id}function VL(e){return`terminal-session-${e}`}function HL(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function UL(e){return e?.contains(document.activeElement)??!1}function WL(e,t){return t===`window`||UL(e)}function GL(e){let t=(0,$.c)(67),{bridge:n,variant:r,visible:i,onVisibleChange:a,launch:o,installedClis:s,container:c,isShowing:l,onRequestEditorFocus:u,dockPosition:d,onToggleDock:f,onHasSessionsChange:p,onActiveSessionCliChange:m}=e,h=r===void 0?`dock`:r,g=o===void 0?null:o,{_}=jt(),[v]=(0,Q.useState)(nR),y,b;t[0]!==c||t[1]!==v?(y=()=>{v==null||c==null||v.parentElement!==c&&c.appendChild(v)},b=[v,c],t[0]=c,t[1]=v,t[2]=y,t[3]=b):(y=t[2],b=t[3]),(0,Q.useLayoutEffect)(y,b);let x=typeof n.terminal?.list==`function`,S;t[4]!==x||t[5]!==g||t[6]!==i?(S=()=>!x&&i?[{id:VL(1),launch:g,title:null,customLabel:null,ordinal:1,adoptPtyId:null}]:[],t[4]=x,t[5]=g,t[6]=i,t[7]=S):S=t[7];let[C,w]=(0,Q.useState)(S),T;t[8]!==x||t[9]!==i?(T=()=>!x&&i?VL(1):``,t[8]=x,t[9]=i,t[10]=T):T=t[10];let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(!x),A=(0,Q.useRef)(!1),j=(0,Q.useRef)(E),N=(0,Q.useRef)(C),P=(0,Q.useRef)(!x&&i?1:0),F=(0,Q.useRef)(i&&g?g.nonce:null),I=(0,Q.useRef)(h===`window`?!1:i),L=(0,Q.useRef)(new Map),R=function(e,t){if(t===null){L.current.delete(e);return}L.current.set(e,t);let r=N.current.find(t=>t.id===e);r!=null&&n.terminal?.setMeta?.(t,{ordinal:r.ordinal,customLabel:r.customLabel})},z=(0,Q.useRef)(0),B=function(e){P.current+=1;let t=VL(P.current);w(n=>[...n,{id:t,launch:e,title:null,customLabel:null,ordinal:P.current,adoptPtyId:null}]),D(t)},[V,H]=(0,Q.useState)(tR),[U,W]=(0,Q.useState)(eR),G;t[11]===s?G=t[12]:(G=s??{},t[11]=s,t[12]=G);let K=Mv(V,G),q=U?`terminal`:K,ee=Xs(s??{},K),te=function(e){z.current+=1,B({prompt:null,cli:e,nonce:z.current})},ne=function(){U?B(null):te(K)},re=function(e){W(!1),Vv(!1);let t=Ev(e);H(t),Av(t),te(e)},ie=function(){W(!0),Vv(!0),B(null)},ae;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){let n=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.title!==n)?t.map(t=>t.id===e?{...t,title:n}:t):t)},t[13]=ae):ae=t[13];let oe=ae,se=function(e,t){let r=t.trim()===``?null:t.trim();w(t=>t.some(t=>t.id===e&&t.customLabel!==r)?t.map(t=>t.id===e?{...t,customLabel:r}:t):t);let i=L.current.get(e);i!=null&&n.terminal?.setMeta?.(i,{customLabel:r})},ce;t[14]===_?ce=t[15]:(ce=function(e){return e.customLabel??e.title??_({id:`OVjNeX`,values:{0:e.ordinal}})},t[14]=_,t[15]=ce);let le=ce,ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=function(e){w(t=>{if(e.length!==t.length)return t;let n=new Map(t.map($L)),r=[];for(let i of e){let e=n.get(i);if(e==null)return t;r.push(e)}return r.every((e,n)=>e===t[n])?t:r});let t=e.map(e=>L.current.get(e)).filter(QL);t.length>0&&n.terminal?.setOrder?.(t)},me=function(e){let t=N.current,n=t.findIndex(e=>e.id===j.current);if(n<0)return null;let r=n+e;if(r<0||r>=t.length)return null;let i=t.map(ZL),[a]=i.splice(n,1);return i.splice(r,0,a),pe(i),{label:le(t[n]),position:r+1,total:t.length}},he=(0,Q.useRef)(me),ge=(0,Q.useRef)(B),_e=function(e){let t=N.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===E){let e=(t[n-1]??t[n+1])?.id??``;D(e),e!==``&&queueMicrotask(()=>HL(e))}w(r),r.length===0&&(a(!1),u())},ve=(0,Q.useRef)(XL);(0,Q.useEffect)(()=>{ge.current=B,he.current=me,j.current=E,N.current=C,ve.current=()=>{E!==``&&_e(E)}});let ye;t[16]!==g||t[17]!==O||t[18]!==C.length||t[19]!==i?(ye=[i,g,C.length,O],t[16]=g,t[17]=O,t[18]=C.length,t[19]=i,t[20]=ye):ye=t[20],(0,Q.useEffect)(()=>{if(!O)return;let e=I.current;if(I.current=i,g!=null&&g.nonce!==F.current){F.current=g.nonce,ge.current(g);return}i&&!e&&C.length===0&&ge.current(null)},ye);let be;t[21]===n?be=t[22]:(be=[n],t[21]=n,t[22]=be),(0,Q.useEffect)(()=>{if(typeof n.terminal?.list!=`function`||A.current)return;A.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(YL);P.current=Math.max(e.length,...e.map(JL)),w(e),D(e[0]?.id??``)}k(!0)}})(),()=>{e=!0,A.current=!1}},be);let xe;t[23]===n?xe=t[24]:(xe=[n],t[23]=n,t[24]=xe),(0,Q.useEffect)(()=>kt(e=>{let t=j.current,r=t===``?void 0:L.current.get(t);r==null?xL(e,`claude`):(n.terminal.input(r,e),queueMicrotask(()=>HL(t)))}),xe);let Se;t[25]===h?Se=t[26]:(Se=[h],t[25]=h,t[26]=Se),(0,Q.useEffect)(()=>M(e=>{e===`new-terminal`?ge.current(null):(e===`kill-terminal`||e===`close-active-tab-or-window`&&h===`window`)&&ve.current()}),Se);let Ce;t[27]!==v||t[28]!==h?(Ce=[v,h],t[27]=v,t[28]=h,t[29]=Ce):Ce=t[29],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!WL(v,h))return;let t=N.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),D(t.id),queueMicrotask(()=>HL(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},Ce);let we;t[30]!==_||t[31]!==v||t[32]!==h?(we=[v,h,_],t[30]=_,t[31]=v,t[32]=h,t[33]=we):we=t[33],(0,Q.useEffect)(()=>{let e=function(e){if(!e.metaKey||!e.shiftKey||e.ctrlKey||e.altKey)return;let t=e.key===`ArrowLeft`?-1:+(e.key===`ArrowRight`);if(t===0||!WL(v,h)||ue.current)return;let n=e.target;if(n?.tagName===`INPUT`||n?.isContentEditable)return;let r=he.current(t);if(r==null)return;e.preventDefault(),e.stopPropagation(),queueMicrotask(()=>HL(j.current));let i=_({id:`CoHvYd`,values:{0:r.label,1:r.position,2:r.total}});fe.current!=null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,de.current!=null&&(de.current.textContent=i)},60)};return window.addEventListener(`keydown`,e,{capture:!0}),()=>{window.removeEventListener(`keydown`,e,{capture:!0}),fe.current!=null&&(window.clearTimeout(fe.current),fe.current=null)}},we);let Te;t[34]!==n.editor||t[35]!==C.length?(Te=()=>{let e=C.length>0;E_({terminalLive:e}),n.editor.notifyViewMenuStateChanged({terminalLive:e})},t[34]=n.editor,t[35]=C.length,t[36]=Te):Te=t[36];let Ee;t[37]!==n||t[38]!==C.length?(Ee=[n,C.length],t[37]=n,t[38]=C.length,t[39]=Ee):Ee=t[39],(0,Q.useEffect)(Te,Ee);let De,Oe;t[40]!==p||t[41]!==C.length?(De=()=>{p?.(C.length>0)},Oe=[p,C.length],t[40]=p,t[41]=C.length,t[42]=De,t[43]=Oe):(De=t[42],Oe=t[43]),(0,Q.useEffect)(De,Oe);let ke;t[44]!==E||t[45]!==C?(ke=C.find(e=>e.id===E)?.launch?.cli,t[44]=E,t[45]=C,t[46]=ke):ke=t[46];let Ae=ke!=null,je,Me;t[47]!==Ae||t[48]!==m?(je=()=>{m?.(Ae)},Me=[m,Ae],t[47]=Ae,t[48]=m,t[49]=je,t[50]=Me):(je=t[49],Me=t[50]),(0,Q.useEffect)(je,Me);let Ne,Pe;t[51]!==v||t[52]!==l||t[53]!==u||t[54]!==i?(Ne=()=>{l||i||UL(v)&&u()},Pe=[l,i,v,u],t[51]=v,t[52]=l,t[53]=u,t[54]=i,t[55]=Ne,t[56]=Pe):(Ne=t[55],Pe=t[56]),(0,Q.useLayoutEffect)(Ne,Pe);let Fe;t[57]===l?Fe=t[58]:(Fe=[l],t[57]=l,t[58]=Fe),(0,Q.useEffect)(()=>{l&&HL(j.current)},Fe);let Ie;if(t[59]!==_||t[60]!==C){let e;t[62]===_?e=t[63]:(e=e=>({id:e.id,label:e.customLabel??e.title??_({id:`OVjNeX`,values:{0:e.ordinal}})}),t[62]=_,t[63]=e),Ie=C.map(e),t[59]=_,t[60]=C,t[61]=Ie}else Ie=t[61];let Le=Ie,Re=[...C].sort(qL),ze=C.length>0?(0,Z.jsx)(RL,{sessions:Le,activeSessionId:E,onSelect:D,onTabActivate:KL,newChatSelected:q,onNewChatLaunch:ne,onNewChatPickCli:re,onNewChatPickTerminal:ie,newChatVisibleClis:ee,onClose:_e,onRename:se,onReorder:pe,onDragActiveChange:e=>{ue.current=e},dockPosition:d,onToggleDock:f,onCollapse:h===`window`?void 0:()=>a(!1),draggable:h===`window`,className:`h-full`,children:Re.map(e=>(0,Z.jsx)(DL,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:X(`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,h===`window`&&`px-[22px] pb-[22px]`),children:(0,Z.jsx)(kL,{bridge:n,launch:e.launch,adoptPtyId:e.adoptPtyId,onPtyId:t=>R(e.id,t),onTitleChange:t=>oe(e.id,t),onClose:()=>_e(e.id)})},e.id))}):null,Be;return t[64]!==v||t[65]!==ze?(Be=v==null?null:(0,tm.createPortal)((0,Z.jsxs)(Z.Fragment,{children:[ze,(0,Z.jsx)(`span`,{ref:de,"aria-live":`polite`,"aria-atomic":`true`,className:`sr-only`,"data-testid":`terminal-reorder-announcer`})]}),v),t[64]=v,t[65]=ze,t[66]=Be):Be=t[66],Be}function KL(e){return queueMicrotask(()=>HL(e))}function qL(e,t){return e.ordinal-t.ordinal}function JL(e){return e.ordinal}function YL(e,t){return{id:VL(t+1),launch:null,title:null,customLabel:e.customLabel??null,ordinal:e.ordinal??t+1,adoptPtyId:e.ptyId}}function XL(){}function ZL(e){return e.id}function QL(e){return e!=null}function $L(e){return[e.id,e]}function eR(){return Hv()}function tR(){return kv()}function nR(){if(typeof document>`u`)return null;let e=document.createElement(`div`);return e.className=`flex min-h-0 flex-1 flex-col overflow-hidden`,e}function rR(e){let t=(0,$.c)(86),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,[i,a]=_v(),[o,s]=(0,Q.useState)(i),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(`auth`),[f,p]=(0,Q.useState)(mb[0].id),[m,h]=(0,Q.useState)(!1),g=typeof window<`u`?window.okDesktop??null:null,_=g!=null&&g.terminal!=null,[v,y]=(0,Q.useState)(!1),b=vv(),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(Rv),A;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){k(e),Lv(e),y(!0)},t[2]=A):A=t[2];let j=A,N;t[3]===O?N=t[4]:(N=function(){j(O===`right`?`bottom`:`right`)},t[3]=O,t[4]=N);let P=N,F;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(F={container:null,isShowing:!1,dockPosition:`bottom`,editorRegion:null},t[5]=F):F=t[5];let[I,L]=(0,Q.useState)(F),R=(0,Q.useRef)(0),z;t[6]===b?z=t[7]:(z=function(e,t){let n=e??Mv(kv(),b);y(!0),R.current+=1,D({prompt:null,cli:n,nonce:R.current,stagePaste:t})},t[6]=b,t[7]=z);let B=z,V;t[8]!==x||t[9]!==B?(V=function(){y(!0),!x&&!Bv()&&B()},t[8]=x,t[9]=B,t[10]=V):V=t[10];let H=V,U=cs(),{projectConfig:G,projectLocalConfig:K,projectLocalSynced:q,projectSynced:ee}=Ru(),{activeDocName:te}=Xe(),ne=U?.hasRemote,re=U?.pushPermission?.checkStatus,ie;t[11]!==m||t[12]!==G||t[13]!==K||t[14]!==q||t[15]!==ee||t[16]!==ne||t[17]!==re?(ie=Gv({autoSyncOnboardingDismissed:m,hasRemote:ne,projectLocalSynced:q,projectSynced:ee,projectLocalConfig:K,projectConfig:G,pushPermissionCheckStatus:re}),t[11]=m,t[12]=G,t[13]=K,t[14]=q,t[15]=ee,t[16]=ne,t[17]=re,t[18]=ie):ie=t[18];let ae=ie,oe,se;t[19]===te?(oe=t[20],se=t[21]):(oe=()=>{let e=function(e){let t=e.detail;t&&te&&Qc(te,{kind:`raw-mdx`,detail:t}),s(`source`)};return window.addEventListener(lv,e),()=>window.removeEventListener(lv,e)},se=[te],t[19]=te,t[20]=oe,t[21]=se),(0,Q.useEffect)(oe,se);let ce=(0,Q.useRef)(!1),le;t[22]!==te||t[23]!==o||t[24]!==B?(le=function(e){if(!_||te==null)return!1;let t=Ju(te,o)?.markdown??``;if(t.trim()===``)return!1;let n=`${UO(te,t)}\n\n`;return!e&&ce.current?(y(!0),W(n)):B(void 0,n),!0},t[22]=te,t[23]=o,t[24]=B,t[25]=le):le=t[25];let ue=(0,Q.useEffectEvent)(le),de;t[26]===B?de=t[27]:(de=()=>B(),t[26]=B,t[27]=de);let fe=(0,Q.useEffectEvent)(de),pe;t[28]===ue?pe=t[29]:(pe=()=>M(e=>{if(e===`toggle-terminal`){if(ue(!1))return;y(oR)}else e===`new-terminal`&&y(!0)}),t[28]=ue,t[29]=pe);let me;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(me=[],t[30]=me):me=t[30],(0,Q.useEffect)(pe,me);let he;t[31]===ue?he=t[32]:(he=()=>{if(window.okDesktop!=null)return;let e=function(e){if(du(e,`toggle-terminal-panel`)){if(e.preventDefault(),ue(!1))return;y(aR)}};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[31]=ue,t[32]=he);let ge;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ge=[],t[33]=ge):ge=t[33],(0,Q.useEffect)(he,ge);let _e;t[34]!==fe||t[35]!==ue?(_e=()=>{if(!_)return;let e=function(e){du(e,`new-terminal-tab`)&&(e.preventDefault(),ue(!0)||fe())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[34]=fe,t[35]=ue,t[36]=_e):_e=t[36];let ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ve=[_],t[37]=ve):ve=t[37],(0,Q.useEffect)(_e,ve);let ye,be;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ye=()=>SL((e,t)=>{y(!0),R.current+=1,D({prompt:e,cli:t,nonce:R.current})}),be=[],t[38]=ye,t[39]=be):(ye=t[38],be=t[39]),(0,Q.useEffect)(ye,be);let xe,Se;t[40]===v?(xe=t[41],Se=t[42]):(xe=()=>{v||D(null)},Se=[v],t[40]=v,t[41]=xe,t[42]=Se),(0,Q.useEffect)(xe,Se);let Ce,we;t[43]!==C||t[44]!==v?(Ce=()=>{window.okDesktop!=null&&C&&(E_({terminalVisible:v}),window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:v}))},we=[v,C],t[43]=C,t[44]=v,t[45]=Ce,t[46]=we):(Ce=t[45],we=t[46]),(0,Q.useEffect)(Ce,we);let Te,Ee;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Te=()=>{let e=window.okDesktop;if(e==null)return;if(typeof e.terminal?.getDockState!=`function`){w(!0);return}let t=!1;return e.terminal.getDockState().then(e=>{t||!e.visible||(T.current=!0,y(!0))}).catch(iR).finally(()=>{t||w(!0)}),()=>{t=!0}},Ee=[],t[47]=Te,t[48]=Ee):(Te=t[47],Ee=t[48]),(0,Q.useEffect)(Te,Ee);let De,Oe;t[49]===v?(De=t[50],Oe=t[51]):(De=()=>{if(window.okDesktop!=null){if(T.current){T.current=!1;return}v&&ki()}},Oe=[v],t[49]=v,t[50]=De,t[51]=Oe),(0,Q.useEffect)(De,Oe),bv(U?.pausedReason),xv();let ke;t[52]===a?ke=t[53]:(ke=function(e){s(e),a(e)},t[52]=a,t[53]=ke);let Ae=ke,je,Me;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(je=()=>{d(`auth`),l(!0)},Me=()=>{d(`identity`),l(!0)},t[54]=je,t[55]=Me):(je=t[54],Me=t[55]);let Ne;t[56]===r?Ne=t[57]:(Ne=(0,Z.jsx)(yL,{onSignIn:je,onSetIdentity:Me,onOpenSearch:r}),t[56]=r,t[57]=Ne);let Pe=_?H:void 0,Fe;t[58]!==f||t[59]!==o||t[60]!==Ae||t[61]!==Pe||t[62]!==O||t[63]!==v?(Fe=(0,Z.jsx)(wP,{editorMode:o,onModeChange:Ae,activeTab:f,onActiveTabChange:p,terminalBridge:g,terminalVisible:v,onTerminalVisibleChange:y,terminalDock:O,onTerminalPlacement:L,onRevealTerminal:Pe}),t[58]=f,t[59]=o,t[60]=Ae,t[61]=Pe,t[62]=O,t[63]=v,t[64]=Fe):Fe=t[64];let Ie;t[65]!==b||t[66]!==O||t[67]!==E||t[68]!==I||t[69]!==v||t[70]!==P?(Ie=_&&g!=null?(0,Z.jsx)(GL,{bridge:g,visible:v,onVisibleChange:y,launch:E,installedClis:b,container:I.container,isShowing:I.isShowing,onRequestEditorFocus:()=>I.editorRegion?.focus(),dockPosition:O,onToggleDock:P,onHasSessionsChange:S,onActiveSessionCliChange:e=>{ce.current=e}}):null,t[65]=b,t[66]=O,t[67]=E,t[68]=I,t[69]=v,t[70]=P,t[71]=Ie):Ie=t[71];let Le=u===`identity`,Re;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{l(!1)},t[72]=Re):Re=t[72];let ze;t[73]!==c||t[74]!==Le?(ze=(0,Z.jsx)(Di,{open:c,onOpenChange:l,identityPrompt:Le,onSuccess:Re}),t[73]=c,t[74]=Le,t[75]=ze):ze=t[75];let Be;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Be=()=>h(!0),t[76]=Be):Be=t[76];let Ve;t[77]===ae?Ve=t[78]:(Ve=(0,Z.jsx)(Uv,{open:ae,onResolved:Be}),t[77]=ae,t[78]=Ve);let He;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(ov,{}),t[79]=He):He=t[79];let Ue;return t[80]!==Ne||t[81]!==Fe||t[82]!==Ie||t[83]!==ze||t[84]!==Ve?(Ue=(0,Z.jsxs)(Z.Fragment,{children:[Ne,Fe,Ie,ze,Ve,He]}),t[80]=Ne,t[81]=Fe,t[82]=Ie,t[83]=ze,t[84]=Ve,t[85]=Ue):Ue=t[85],Ue}function iR(e){console.error(`[terminal] dock-state restore failed; staying hidden:`,e)}function aR(e){return!e}function oR(e){return!e}function sR(e){let t=tu(Kl(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cR(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Ci();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)(Bc,{"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)(Bc,{"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(lR),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 lR(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(Y,{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:()=>sR(e.file),children:[(0,Z.jsx)(Bc,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uR=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
34
34
|
<symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
|
|
35
35
|
<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"/>
|
|
36
36
|
</symbol>
|