@inkeep/open-knowledge 0.16.1-beta.8 → 0.16.1-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +1 -1
  3. package/dist/cli.mjs +6 -6
  4. package/dist/config-schema.json +17 -1
  5. package/dist/config.project-local.schema.json +17 -1
  6. package/dist/config.project.schema.json +17 -1
  7. package/dist/config.user.schema.json +17 -1
  8. package/dist/constants-BIjtqiOK.mjs +2 -0
  9. package/dist/{dist-CdLjGZjc.mjs → dist-DrTAfRJI.mjs} +4 -4
  10. package/dist/{dist-DHvnq6Ai.mjs → dist-LsppKGkv.mjs} +1 -1
  11. package/dist/{gh-detect-Dv4BrBzE.mjs → gh-detect-CEob6rSE.mjs} +2 -2
  12. package/dist/index.mjs +1 -1
  13. package/dist/{init-D21pFsMR.mjs → init-DFtBe01D.mjs} +4 -4
  14. package/dist/init-HMweBYwP.mjs +1 -0
  15. package/dist/loader-BZoZLf96.mjs +1 -0
  16. package/dist/{loader-DpizTs6p.mjs → loader-CEM8OyQh.mjs} +2 -2
  17. package/dist/{preview-DMinlQU3.mjs → preview-UVAJNcc9.mjs} +2 -2
  18. package/dist/preview-gK9vWQSU.mjs +1 -0
  19. package/dist/public/assets/{ActivityModeContent-CvNu5QeL.js → ActivityModeContent-DKpBhLuw.js} +1 -1
  20. package/dist/public/assets/{DocumentContext-B2cgZ6u1.js → DocumentContext-BR6HKC4G.js} +2 -2
  21. package/dist/public/assets/{GraphPanel-BLt5dvIN.js → GraphPanel-5UhSd8l0.js} +1 -1
  22. package/dist/public/assets/{OpenInAgentMenuRequestContext-CoEBuGe4.js → OpenInAgentMenuRequestContext-B3Gxr9nv.js} +1 -1
  23. package/dist/public/assets/SettingsDialogBody-COy0tfdt.js +7 -0
  24. package/dist/public/assets/{SourceEditor-D_Cx18k-.js → SourceEditor-Dv-b05s_.js} +1 -1
  25. package/dist/public/assets/{TerminalPanel-BPH4SxUM.js → TerminalPanel-Bj2Zsd7g.js} +1 -1
  26. package/dist/public/assets/{config-validation-events-CUcTdeK7.js → config-validation-events--3Oa2paZ.js} +6 -6
  27. package/dist/public/assets/{dist-DDSUF34u.js → dist-CSrq-tfq.js} +1 -1
  28. package/dist/public/assets/{index-Cik16V2A.css → index-BQ8I_aNc.css} +1 -1
  29. package/dist/public/assets/{index-DSdwUSf0.js → index-M_7KDjf-.js} +10 -10
  30. package/dist/public/assets/{keyboard-shortcuts-C7gwridP.js → keyboard-shortcuts-DQSB-PIq.js} +1 -1
  31. package/dist/public/assets/{prop-types-Cb0hUmc6.js → prop-types-BegaE8MN.js} +1 -1
  32. package/dist/public/assets/{target-navigation-intent-Cq0mfQqN.js → target-navigation-intent-DK2ymubU.js} +1 -1
  33. package/dist/public/index.html +9 -9
  34. package/dist/{repair-launch-json-hQzZWJEV.mjs → repair-launch-json-DvxyohgY.mjs} +2 -2
  35. package/dist/{repair-mcp-configs-Dk0wiyoG.mjs → repair-mcp-configs-Bph_7d7P.mjs} +2 -2
  36. package/dist/{repair-skills-DPudTR_l.mjs → repair-skills-BgFasQ-j.mjs} +2 -2
  37. package/dist/repair-skills-D4KInMdR.mjs +1 -0
  38. package/dist/schemas/v0/config.project-local.schema.json +17 -1
  39. package/dist/schemas/v0/config.project.schema.json +17 -1
  40. package/dist/schemas/v0/config.user.schema.json +17 -1
  41. package/dist/{server-lock-BpjJj3OD-C32FtL5e.mjs → server-lock-BpjJj3OD-lsTSrbso.mjs} +2 -2
  42. package/dist/server-lock-CyhBidkz-B2MlIotv.mjs +1 -0
  43. package/dist/{src-BzQcpEPg.mjs → src-DjYF9e_T.mjs} +2 -2
  44. package/dist/{start-E4_PXpTr.mjs → start-BvzNcHNT.mjs} +2 -2
  45. package/dist/start-DJMR-pk5.mjs +1 -0
  46. package/dist/{write-project-skill-bJPJ3udE.mjs → write-project-skill-Dj8OKpHt.mjs} +2 -2
  47. package/package.json +1 -1
  48. package/dist/constants-DbENhsxl.mjs +0 -2
  49. package/dist/init-DkUWx0T-.mjs +0 -1
  50. package/dist/loader-T98A78tr.mjs +0 -1
  51. package/dist/preview-wM1DJuPS.mjs +0 -1
  52. package/dist/public/assets/SettingsDialogBody-pUhuKxTx.js +0 -7
  53. package/dist/repair-skills-CPdGe_yS.mjs +0 -1
  54. package/dist/server-lock-CyhBidkz-B9tZw0V1.mjs +0 -1
  55. package/dist/start-CXtw3XDf.mjs +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DMS50lWu.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-DPMyR1_m.js","./propagation-api-qAYD7s-v.js","./ConsentDialogBody-DOf6_QiW.js","./compiler-runtime-Cs91PcD2.js","./checkbox-BlEgF5ZV.js","./dist-CSynDsuh.js","./button-CmLxDlCv.js","./dialog-uOgi9SAD.js","./dist-DuNRfJxD.js","./collapsible-BzkAcCLq.js","./textarea-DV1qaluU.js","./tooltip-DjrmDp0P.js","./dist-C_giuVsx.js","./project-paths-lA0ULe1F.js","./McpConsentDialogBody-stteh15-.js","./mcp-consent-store-BmlKYN7O.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-BLt5dvIN.js","./dist-DDSUF34u.js","./w3c-keyname-nBRha8PK.js","./prop-types-Cb0hUmc6.js","./toggle-group-oSLn0Q3B.js","./panel-BQ1weDcE.js","./min-C7ZjdWf5.js","./src-DXWvEiD2.js","./colors-CzI3Rf3d.js","./ordinal-C2dFitP3.js","./init-Cvjgvi8K.js","./isObjectLike-BWNDxuxw.js","./now-F1RJRIcM.js","./isSymbol-W-l9JIco.js","./target-navigation-intent-Cq0mfQqN.js","./ActivityModeContent-CvNu5QeL.js","./DocumentContext-B2cgZ6u1.js","./dist-Mxq-zflt.js","./dist-C0jOOVYt.js","./dist-B-IVhlJQ.js","./dist-Bn0QvNGs.js","./dist-Bui1BhSw.js","./dist-j3LJSXW6.js","./dist-Debx6b6u.js","./dist-B9B58-J_.js","./dist-pSQcUvmU.js","./stex-CGHNatva.js","./DocumentContext-B0sQn39F.css","./agent-presence-DYKkeiBZ.js","./dist-D1rVZYi52.js","./dist-CjXb6uie.js","./SettingsDialogBody-pUhuKxTx.js","./config-validation-events-CUcTdeK7.js","./keyboard-shortcuts-C7gwridP.js","./SourceEditor-D_Cx18k-.js","./OpenInAgentMenuRequestContext-CoEBuGe4.js","./TerminalPanel-BPH4SxUM.js","./terminal-theme-BhdZI3O9.js","./TerminalPanel-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,Dn as b,Dt as x,En as S,Et as C,F as w,Fn as T,Ft as E,Gn as D,Gt as O,Hn as k,Ht as A,I as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,L as B,Ln as V,Lt as H,M as U,Mt as W,N as G,Nn as K,Nt as q,On as J,Ot as ee,P as Y,Pn as te,Pt as ne,Q as X,Qn as re,Qt as ie,R as ae,Rn as oe,Rt as se,S as ce,Sn as le,St as ue,T as de,Tn as fe,Tt as pe,Un as me,Ut as he,Vn as ge,Vt as _e,W as ve,Wn as ye,Wt as be,X as xe,Xn as Se,Xt as Ce,Y as we,Yn as Te,Yt as Ee,Z as De,Zn as Oe,Zt as ke,_n as Ae,_t as je,a as Me,an as Ne,ar as Pe,at as Fe,bn as Ie,c as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gt as Xe,h as Ze,hr as Qe,ht as $e,i as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lt as ut,m as dt,mr as ft,mt as pt,n as mt,nn as ht,nr as gt,nt as _t,o as vt,or as yt,ot as bt,p as xt,pr as St,pt as Ct,q as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rt as kt,s as At,st as jt,t as Mt,tn as Nt,tt as Pt,u as Ft,ur as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,xn as Wt,y as Gt,yn as Kt,yt as qt,z as Jt,zn as Yt,zt as Xt}from"./DocumentContext-B2cgZ6u1.js";import{A as Zt,C as Qt,D as $t,E as en,O as tn,S as nn,T as rn,_ as an,a as on,b as sn,c as cn,d as ln,f as un,g as dn,h as fn,i as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,r as bn,s as xn,t as Sn,u as Cn,v as wn,w as Tn,x as En,y as Dn}from"./panel-BQ1weDcE.js";import{$n as On,A as kn,An,Ar as jn,At as Mn,B as Nn,C as Pn,Dn as Fn,Dt as In,F as Ln,Ft as Rn,Gn as zn,Gr as Bn,Gt as Vn,Ir as Hn,Jt as Un,Kt as Wn,Lt as Gn,M as Kn,N as qn,Nn as Jn,Nr as Yn,Nt as Xn,O as Zn,Pr as Qn,Pt as $n,Qt as er,St as tr,Un as nr,Ur as rr,Vr as ir,Wr as ar,Wt as or,X as sr,Xn as cr,Xt as lr,Yt as ur,Zt as dr,an as fr,ar as pr,at as mr,b as hr,br as gr,c as _r,ci as vr,cn as yr,dn as br,dr as xr,er as Sr,fn as Cr,fr as wr,gn as Tr,hr as Er,i as Dr,in as Or,ir as kr,j as Ar,jn as jr,kr as Mr,li as Nr,ln as Pr,lr as Fr,mn as Ir,mr as Lr,mt as Rr,n as zr,ni as Br,nn as Vr,or as Hr,pt as Ur,qt as Wr,rn as Gr,rr as Kr,sr as qr,t as Jr,tn as Yr,un as Xr,ut as Zr,vn as Qr,w as $r,xr as ei,xt as ti,z as ni,zt as ri}from"./dist-DDSUF34u.js";import{c as ii,d as ai,l as oi,r as si,t as ci,u as li}from"./button-CmLxDlCv.js";import{a as ui,c as di,d as fi,f as pi,i as mi,l as hi,m as gi,n as _i,o as vi,p as yi,r as bi,s as xi,t as Si,u as Ci}from"./agent-presence-DYKkeiBZ.js";import{$ as wi,$t as Ti,A as Ei,At as Di,B as Oi,Bt as ki,C as Ai,Ct as ji,D as Mi,Dt as Ni,E as Pi,Et as Fi,F as Ii,Ft as Li,G as Ri,Gt as zi,H as Bi,Ht as Vi,I as Hi,It as Ui,J as Wi,Jt as Gi,K as Ki,Kt as qi,L as Ji,Lt as Yi,M as Xi,Mt as Zi,N as Qi,Nt as $i,O as ea,Ot as ta,P as na,Pt as ra,Q as ia,Qt as aa,R as oa,Rt as sa,S as ca,St as la,T as ua,Tt as da,U as fa,Ut as pa,V as ma,Vt as ha,W as ga,Wt as _a,X as va,Xt as ya,Y as ba,Yt as xa,Z as Sa,Zt as Ca,_t as wa,an as Ta,at as Ea,b as Da,bt as Oa,ct as ka,dt as Aa,en as ja,et as Ma,ft as Na,gt as Pa,ht as Fa,in as Ia,it as La,j as Ra,jt as za,k as Ba,kt as Va,lt as Ha,m as Ua,mt as Wa,nn as Ga,nt as Ka,o as qa,on as Ja,ot as Ya,p as Xa,q as Za,qt as Qa,r as $a,rt as eo,sn as to,st as no,t as ro,tn as io,tt as ao,u as oo,ut as so,vt as co,w as lo,wt as uo,x as fo,xt as po,y as mo,yt as ho,z as go,zt as _o}from"./config-validation-events-CUcTdeK7.js";import{i as vo,n as yo,r as bo,t as xo}from"./toggle-group-oSLn0Q3B.js";import{a as So,c as Co,i as wo,n as To,o as Eo,s as Do,t as Oo,v as ko}from"./dialog-uOgi9SAD.js";import{a as Ao,i as jo,n as Mo,o as No,r as Po,t as Fo}from"./collapsible-BzkAcCLq.js";import{A as Io,B as Lo,C as Ro,D as zo,E as Bo,F as Vo,H as Ho,I as Uo,L as Wo,M as Go,N as Ko,O as qo,P as Jo,R as Yo,S as Xo,T as Zo,V as Qo,_ as $o,a as es,c as ts,g as ns,i as rs,j as is,k as as,l as os,m as ss,n as cs,o as ls,s as us,v as ds,w as fs,x as ps,z as ms}from"./prop-types-Cb0hUmc6.js";import{n as hs,r as gs,t as _s}from"./dist-DuNRfJxD.js";import{a as vs,d as ys,f as bs,i as xs,l as Ss,o as Cs,s as ws}from"./dist-CSynDsuh.js";import{_ as Ts,b as Es,d as Ds,f as Os,g as ks,h as As,i as js,m as Ms,n as Ns,p as Ps,r as Fs,t as Is,u as Ls,v as Rs,y as zs}from"./tooltip-DjrmDp0P.js";import{n as Bs,t as Vs}from"./checkbox-BlEgF5ZV.js";import{n as Hs,r as Us,t as Ws}from"./dist-C_giuVsx.js";import{n as Gs,r as Ks,t as qs}from"./textarea-DV1qaluU.js";import{a as Js,i as Ys,n as Xs,r as Zs}from"./project-paths-lA0ULe1F.js";import{n as Qs,t as $s}from"./mcp-consent-store-BmlKYN7O.js";import{c as ec,i as tc,l as nc,o as rc}from"./keyboard-shortcuts-C7gwridP.js";import{$ as ic,At as ac,Ct as oc,Dt as sc,Ft as cc,I as lc,It as uc,J as dc,Mt as fc,Ot as pc,Pt as mc,Q as hc,Tt as gc,X as _c,Z as vc,at as yc,bt as bc,jt as xc,k as Sc,w as Cc}from"./dist-C0jOOVYt.js";import{n as wc}from"./dist-B9B58-J_.js";import{c as Tc,d as Ec,f as Dc,h as Oc,i as kc,l as Ac,o as jc,r as Mc,s as Nc,t as Pc,u as Fc}from"./OpenInAgentMenuRequestContext-CoEBuGe4.js";import{t as Ic}from"./target-navigation-intent-Cq0mfQqN.js";import{t as Lc}from"./terminal-theme-BhdZI3O9.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 Rc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.16.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DMS50lWu.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function zc(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{dn(e,()=>t.signal,()=>n=!0)},u=Dn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?wn:an;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Vc:Bc,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Bc(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Bc(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Vc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Hc=class extends un{#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||Uc(),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=yn({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),fn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Uc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wc=class extends Zt{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 Hc({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=Gc(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=Gc(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=Gc(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=Gc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fn.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=>Qt(t,e))}findAll(e={}){return this.getAll().filter(t=>Qt(e,t))}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fn.batch(()=>Promise.all(e.map(e=>e.continue().catch(rn))))}};function Gc(e){return e.options.scope?.id}var Kc=class extends Zt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??nn(r,t),a=this.get(i);return a||(a=new ln({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(){fn.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=>Tn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Tn(e,t)):t}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},qc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Kc,this.#t=e.mutationCache||new Wc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=mn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=gn.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($t(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=sn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fn.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;fn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e,t={}){return fn.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=fn.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($t(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.behavior=zc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=zc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gn.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(En(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{en(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(En(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{en(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||=nn(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===tn&&(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()}},Jc=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}}}})),Yc=t(((e,t)=>{t.exports=Jc()})),Xc=t((e=>{var t=Yc(),n=r(),i=ai();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var Y,te;function ne(e){if(Y===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Y=t&&t[1]||``,te=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DMS50lWu.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-DPMyR1_m.js","./propagation-api-qAYD7s-v.js","./ConsentDialogBody-DOf6_QiW.js","./compiler-runtime-Cs91PcD2.js","./checkbox-BlEgF5ZV.js","./dist-CSynDsuh.js","./button-CmLxDlCv.js","./dialog-uOgi9SAD.js","./dist-DuNRfJxD.js","./collapsible-BzkAcCLq.js","./textarea-DV1qaluU.js","./tooltip-DjrmDp0P.js","./dist-C_giuVsx.js","./project-paths-lA0ULe1F.js","./McpConsentDialogBody-stteh15-.js","./mcp-consent-store-BmlKYN7O.js","./ActivityPanelDiffView-InYkbArk.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-5UhSd8l0.js","./dist-CSrq-tfq.js","./w3c-keyname-nBRha8PK.js","./prop-types-BegaE8MN.js","./toggle-group-oSLn0Q3B.js","./panel-BQ1weDcE.js","./min-C7ZjdWf5.js","./src-DXWvEiD2.js","./colors-CzI3Rf3d.js","./ordinal-C2dFitP3.js","./init-Cvjgvi8K.js","./isObjectLike-BWNDxuxw.js","./now-F1RJRIcM.js","./isSymbol-W-l9JIco.js","./target-navigation-intent-DK2ymubU.js","./ActivityModeContent-DKpBhLuw.js","./DocumentContext-BR6HKC4G.js","./dist-Mxq-zflt.js","./dist-C0jOOVYt.js","./dist-B-IVhlJQ.js","./dist-Bn0QvNGs.js","./dist-Bui1BhSw.js","./dist-j3LJSXW6.js","./dist-Debx6b6u.js","./dist-B9B58-J_.js","./dist-pSQcUvmU.js","./stex-CGHNatva.js","./DocumentContext-B0sQn39F.css","./agent-presence-DYKkeiBZ.js","./dist-D1rVZYi52.js","./dist-CjXb6uie.js","./SettingsDialogBody-COy0tfdt.js","./config-validation-events--3Oa2paZ.js","./keyboard-shortcuts-DQSB-PIq.js","./SourceEditor-Dv-b05s_.js","./OpenInAgentMenuRequestContext-B3Gxr9nv.js","./TerminalPanel-Bj2Zsd7g.js","./terminal-theme-BhdZI3O9.js","./TerminalPanel-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
+ import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{a as r,i,n as a,o,r as s,t as c}from"./compiler-runtime-Cs91PcD2.js";import{$ as l,$n as u,$t as d,A as f,An as p,At as m,Bn as h,Bt as g,C as _,Cn as v,Ct as y,Dn as b,Dt as x,En as S,Et as C,F as w,Fn as T,Ft as E,Gn as D,Gt as O,Hn as k,Ht as A,I as j,In as M,It as N,J as P,Jn as F,Jt as I,K as L,Kn as R,Kt as z,L as B,Ln as V,Lt as H,M as U,Mt as W,N as G,Nn as K,Nt as q,On as J,Ot as ee,P as Y,Pn as te,Pt as ne,Q as X,Qn as re,Qt as ie,R as ae,Rn as oe,Rt as se,S as ce,Sn as le,St as ue,T as de,Tn as fe,Tt as pe,Un as me,Ut as he,Vn as ge,Vt as _e,W as ve,Wn as ye,Wt as be,X as xe,Xn as Se,Xt as Ce,Y as we,Yn as Te,Yt as Ee,Z as De,Zn as Oe,Zt as ke,_n as Ae,_t as je,a as Me,an as Ne,ar as Pe,at as Fe,bn as Ie,c as Le,cr as Re,ct as ze,d as Be,dr as Ve,dt as He,en as Ue,er as We,et as Ge,f as Ke,fr as qe,ft as Je,g as Ye,gt as Xe,h as Ze,hr as Qe,ht as $e,i as et,ir as tt,it as nt,j as rt,jn as it,jt as at,k as ot,kn as st,kt as ct,l as lt,lt as ut,m as dt,mr as ft,mt as pt,n as mt,nn as ht,nr as gt,nt as _t,o as vt,or as yt,ot as bt,p as xt,pr as St,pt as Ct,q as wt,qn as Tt,qt as Et,r as Dt,rn as Ot,rt as kt,s as At,st as jt,t as Mt,tn as Nt,tt as Pt,u as Ft,ur as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,xn as Wt,y as Gt,yn as Kt,yt as qt,z as Jt,zn as Yt,zt as Xt}from"./DocumentContext-BR6HKC4G.js";import{A as Zt,C as Qt,D as $t,E as en,O as tn,S as nn,T as rn,_ as an,a as on,b as sn,c as cn,d as ln,f as un,g as dn,h as fn,i as pn,k as mn,l as hn,m as gn,n as _n,o as vn,p as yn,r as bn,s as xn,t as Sn,u as Cn,v as wn,w as Tn,x as En,y as Dn}from"./panel-BQ1weDcE.js";import{$n as On,A as kn,An,Ar as jn,At as Mn,B as Nn,C as Pn,Dn as Fn,Dt as In,F as Ln,Ft as Rn,Gn as zn,Gr as Bn,Gt as Vn,Ir as Hn,Jt as Un,Kt as Wn,Lt as Gn,M as Kn,N as qn,Nn as Jn,Nr as Yn,Nt as Xn,O as Zn,Pr as Qn,Pt as $n,Qt as er,St as tr,Un as nr,Ur as rr,Vr as ir,Wr as ar,Wt as or,X as sr,Xn as cr,Xt as lr,Yt as ur,Zt as dr,an as fr,ar as pr,at as mr,b as hr,br as gr,c as _r,ci as vr,cn as yr,dn as br,dr as xr,er as Sr,fn as Cr,fr as wr,gn as Tr,hr as Er,i as Dr,in as Or,ir as kr,j as Ar,jn as jr,kr as Mr,li as Nr,ln as Pr,lr as Fr,mn as Ir,mr as Lr,mt as Rr,n as zr,ni as Br,nn as Vr,or as Hr,pt as Ur,qt as Wr,rn as Gr,rr as Kr,sr as qr,t as Jr,tn as Yr,un as Xr,ut as Zr,vn as Qr,w as $r,xr as ei,xt as ti,z as ni,zt as ri}from"./dist-CSrq-tfq.js";import{c as ii,d as ai,l as oi,r as si,t as ci,u as li}from"./button-CmLxDlCv.js";import{a as ui,c as di,d as fi,f as pi,i as mi,l as hi,m as gi,n as _i,o as vi,p as yi,r as bi,s as xi,t as Si,u as Ci}from"./agent-presence-DYKkeiBZ.js";import{$ as wi,$t as Ti,A as Ei,At as Di,B as Oi,Bt as ki,C as Ai,Ct as ji,D as Mi,Dt as Ni,E as Pi,Et as Fi,F as Ii,Ft as Li,G as Ri,Gt as zi,H as Bi,Ht as Vi,I as Hi,It as Ui,J as Wi,Jt as Gi,K as Ki,Kt as qi,L as Ji,Lt as Yi,M as Xi,Mt as Zi,N as Qi,Nt as $i,O as ea,Ot as ta,P as na,Pt as ra,Q as ia,Qt as aa,R as oa,Rt as sa,S as ca,St as la,T as ua,Tt as da,U as fa,Ut as pa,V as ma,Vt as ha,W as ga,Wt as _a,X as va,Xt as ya,Y as ba,Yt as xa,Z as Sa,Zt as Ca,_t as wa,an as Ta,at as Ea,b as Da,bt as Oa,cn as ka,ct as Aa,dt as ja,en as Ma,et as Na,ft as Pa,gt as Fa,ht as Ia,it as La,j as Ra,jt as za,k as Ba,kt as Va,lt as Ha,m as Ua,nn as Wa,nt as Ga,o as Ka,on as qa,ot as Ja,p as Ya,q as Xa,qt as Za,r as Qa,rn as $a,rt as eo,sn as to,st as no,t as ro,tn as io,tt as ao,u as oo,ut as so,vt as co,w as lo,wt as uo,x as fo,xt as po,y as mo,yt as ho,z as go,zt as _o}from"./config-validation-events--3Oa2paZ.js";import{i as vo,n as yo,r as bo,t as xo}from"./toggle-group-oSLn0Q3B.js";import{a as So,c as Co,i as wo,n as To,o as Eo,s as Do,t as Oo,v as ko}from"./dialog-uOgi9SAD.js";import{a as Ao,i as jo,n as Mo,o as No,r as Po,t as Fo}from"./collapsible-BzkAcCLq.js";import{A as Io,B as Lo,C as Ro,D as zo,E as Bo,F as Vo,H as Ho,I as Uo,L as Wo,M as Go,N as Ko,O as qo,P as Jo,R as Yo,S as Xo,T as Zo,V as Qo,_ as $o,a as es,c as ts,g as ns,i as rs,j as is,k as as,l as os,m as ss,n as cs,o as ls,s as us,v as ds,w as fs,x as ps,z as ms}from"./prop-types-BegaE8MN.js";import{n as hs,r as gs,t as _s}from"./dist-DuNRfJxD.js";import{a as vs,d as ys,f as bs,i as xs,l as Ss,o as Cs,s as ws}from"./dist-CSynDsuh.js";import{_ as Ts,b as Es,d as Ds,f as Os,g as ks,h as As,i as js,m as Ms,n as Ns,p as Ps,r as Fs,t as Is,u as Ls,v as Rs,y as zs}from"./tooltip-DjrmDp0P.js";import{n as Bs,t as Vs}from"./checkbox-BlEgF5ZV.js";import{n as Hs,r as Us,t as Ws}from"./dist-C_giuVsx.js";import{n as Gs,r as Ks,t as qs}from"./textarea-DV1qaluU.js";import{a as Js,i as Ys,n as Xs,r as Zs}from"./project-paths-lA0ULe1F.js";import{n as Qs,t as $s}from"./mcp-consent-store-BmlKYN7O.js";import{c as ec,i as tc,l as nc,o as rc}from"./keyboard-shortcuts-DQSB-PIq.js";import{$ as ic,At as ac,Ct as oc,Dt as sc,Ft as cc,I as lc,It as uc,J as dc,Mt as fc,Ot as pc,Pt as mc,Q as hc,Tt as gc,X as _c,Z as vc,at as yc,bt as bc,jt as xc,k as Sc,w as Cc}from"./dist-C0jOOVYt.js";import{n as wc}from"./dist-B9B58-J_.js";import{c as Tc,d as Ec,f as Dc,h as Oc,i as kc,l as Ac,o as jc,r as Mc,s as Nc,t as Pc,u as Fc}from"./OpenInAgentMenuRequestContext-B3Gxr9nv.js";import{t as Ic}from"./target-navigation-intent-DK2ymubU.js";import{t as Lc}from"./terminal-theme-BhdZI3O9.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 Rc(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.16.0`})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DMS50lWu.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function zc(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{dn(e,()=>t.signal,()=>n=!0)},u=Dn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject();if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?wn:an;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Vc:Bc,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Bc(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function Bc(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Vc(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Hc=class extends un{#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||Uc(),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=yn({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),fn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Uc(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Wc=class extends Zt{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 Hc({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=Gc(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=Gc(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=Gc(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=Gc(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fn.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=>Qt(t,e))}findAll(e={}){return this.getAll().filter(t=>Qt(e,t))}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fn.batch(()=>Promise.all(e.map(e=>e.continue().catch(rn))))}};function Gc(e){return e.options.scope?.id}var Kc=class extends Zt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??nn(r,t),a=this.get(i);return a||(a=new ln({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(){fn.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=>Tn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Tn(e,t)):t}notify(e){fn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},qc=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Kc,this.#t=e.mutationCache||new Wc,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=mn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=gn.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($t(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=sn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fn.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;fn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=fn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(rn).catch(rn)}invalidateQueries(e,t={}){return fn.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=fn.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($t(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.behavior=zc(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=zc(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gn.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(En(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{en(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(En(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{en(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||=nn(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===tn&&(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()}},Jc=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}}}})),Yc=t(((e,t)=>{t.exports=Jc()})),Xc=t((e=>{var t=Yc(),n=r(),i=ai();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function J(e){e.memoizedState!==null&&V(G,e);var t=H.current,n=Hd(t,e.type);t!==n&&(V(U,e),V(H,n))}function ee(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var Y,te;function ne(e){if(Y===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Y=t&&t[1]||``,te=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Y+e+te}var X=!1;function re(e,t){if(!e||X)return``;X=!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(`
@@ -8,8 +8,8 @@ import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2e
8
8
  Error generating stack: `+e.message+`
9
9
  `+e.stack}}var oe=Object.prototype.hasOwnProperty,se=t.unstable_scheduleCallback,ce=t.unstable_cancelCallback,le=t.unstable_shouldYield,ue=t.unstable_requestPaint,de=t.unstable_now,fe=t.unstable_getCurrentPriorityLevel,pe=t.unstable_ImmediatePriority,me=t.unstable_UserBlockingPriority,he=t.unstable_NormalPriority,ge=t.unstable_LowPriority,_e=t.unstable_IdlePriority,ve=t.log,ye=t.unstable_setDisableYieldValue,be=null,xe=null;function Se(e){if(typeof ve==`function`&&ye(e),xe&&typeof xe.setStrictMode==`function`)try{xe.setStrictMode(be,e)}catch{}}var Ce=Math.clz32?Math.clz32:Ee,we=Math.log,Te=Math.LN2;function Ee(e){return e>>>=0,e===0?32:31-(we(e)/Te|0)|0}var De=256,Oe=262144,ke=4194304;function Ae(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function je(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ae(n))):i=Ae(o):i=Ae(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ae(n))):i=Ae(o)):i=Ae(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Me(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ne(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pe(){var e=ke;return ke<<=1,!(ke&62914560)&&(ke=4194304),e}function Fe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ie(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Le(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ce(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Re(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Re(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ce(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ze(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ce(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Be(e,t){var n=t&-t;return n=n&42?1:Ve(n),(n&(e.suspendedLanes|t))===0?n:0}function Ve(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function He(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ue(){var e=F.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function We(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var Ge=Math.random().toString(36).slice(2),Ke=`__reactFiber$`+Ge,qe=`__reactProps$`+Ge,Je=`__reactContainer$`+Ge,Ye=`__reactEvents$`+Ge,Xe=`__reactListeners$`+Ge,Ze=`__reactHandles$`+Ge,Qe=`__reactResources$`+Ge,$e=`__reactMarker$`+Ge;function et(e){delete e[Ke],delete e[qe],delete e[Ye],delete e[Xe],delete e[Ze]}function tt(e){var t=e[Ke];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Je]||n[Ke]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[Ke])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function nt(e){if(e=e[Ke]||e[Je]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function rt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(a(33))}function it(e){var t=e[Qe];return t||=e[Qe]={hoistableStyles:new Map,hoistableScripts:new Map},t}function at(e){e[$e]=!0}var ot=new Set,st={};function ct(e,t){lt(e,t),lt(e+`Capture`,t)}function lt(e,t){for(st[e]=t,e=0;e<t.length;e++)ot.add(t[e])}var ut=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),dt={},ft={};function pt(e){return oe.call(ft,e)?!0:oe.call(dt,e)?!1:ut.test(e)?ft[e]=!0:(dt[e]=!0,!1)}function mt(e,t,n){if(pt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function ht(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function gt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function _t(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function vt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function yt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bt(e){if(!e._valueTracker){var t=vt(e)?`checked`:`value`;e._valueTracker=yt(e,t,``+e[t])}}function xt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=vt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function St(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ct=/[\n"\\]/g;function wt(e){return e.replace(Ct,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Tt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+_t(t)):e.value!==``+_t(t)&&(e.value=``+_t(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Dt(e,o,_t(n)):Dt(e,o,_t(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+_t(s):e.removeAttribute(`name`)}function Et(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){bt(e);return}n=n==null?``:``+_t(n),t=t==null?n:``+_t(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),bt(e)}function Dt(e,t,n){t===`number`&&St(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ot(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+_t(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function kt(e,t,n){if(t!=null&&(t=``+_t(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+_t(n)}function At(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(a(92));if(N(r)){if(1<r.length)throw Error(a(93));r=r[0]}n=r}n??=``,t=n}n=_t(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),bt(e)}function jt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Nt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Mt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Pt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(a(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Nt(e,i,r)}else for(var o in t)t.hasOwnProperty(o)&&Nt(e,o,t[o])}function Ft(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var It=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Lt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Rt(e){return Lt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function zt(){}var Bt=null;function Vt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ht=null,Ut=null;function Wt(e){var t=nt(e);if(t&&(e=t.stateNode)){var n=e[qe]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Tt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+wt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[qe]||null;if(!i)throw Error(a(90));Tt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&xt(r)}break a;case`textarea`:kt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ot(e,!!n.multiple,t,!1)}}}var Gt=!1;function Kt(e,t,n){if(Gt)return e(t,n);Gt=!0;try{return e(t)}finally{if(Gt=!1,(Ht!==null||Ut!==null)&&(_u(),Ht&&(t=Ht,e=Ut,Ut=Ht=null,Wt(t),e)))for(t=0;t<e.length;t++)Wt(e[t])}}function qt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[qe]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(a(231,t,typeof n));return n}var Jt=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Yt=!1;if(Jt)try{var Xt={};Object.defineProperty(Xt,`passive`,{get:function(){Yt=!0}}),window.addEventListener(`test`,Xt,Xt),window.removeEventListener(`test`,Xt,Xt)}catch{Yt=!1}var Zt=null,Qt=null,$t=null;function en(){if($t)return $t;var e,t=Qt,n=t.length,r,i=`value`in Zt?Zt.value:Zt.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return $t=i.slice(e,1<r?1-r:void 0)}function tn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function nn(){return!0}function rn(){return!1}function an(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?nn:rn,this.isPropagationStopped=rn,this}return p(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var on={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sn=an(on),cn=p({},on,{view:0,detail:0}),ln=an(cn),un,dn,fn,pn=p({},cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==fn&&(fn&&e.type===`mousemove`?(un=e.screenX-fn.screenX,dn=e.screenY-fn.screenY):dn=un=0,fn=e),un)},movementY:function(e){return`movementY`in e?e.movementY:dn}}),mn=an(pn),hn=an(p({},pn,{dataTransfer:0})),gn=an(p({},cn,{relatedTarget:0})),_n=an(p({},on,{animationName:0,elapsedTime:0,pseudoElement:0})),vn=an(p({},on,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),yn=an(p({},on,{data:0})),bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},xn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Sn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Cn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sn[e])?!!t[e]:!1}function wn(){return Cn}var Tn=an(p({},cn,{key:function(e){if(e.key){var t=bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=tn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?xn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wn,charCode:function(e){return e.type===`keypress`?tn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?tn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),En=an(p({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Dn=an(p({},cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wn})),On=an(p({},on,{propertyName:0,elapsedTime:0,pseudoElement:0})),kn=an(p({},pn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),An=an(p({},on,{newState:0,oldState:0})),jn=[9,13,27,32],Mn=Jt&&`CompositionEvent`in window,Nn=null;Jt&&`documentMode`in document&&(Nn=document.documentMode);var Pn=Jt&&`TextEvent`in window&&!Nn,Fn=Jt&&(!Mn||Nn&&8<Nn&&11>=Nn),In=` `,Ln=!1;function Rn(e,t){switch(e){case`keyup`:return jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Bn=!1;function Vn(e,t){switch(e){case`compositionend`:return zn(t);case`keypress`:return t.which===32?(Ln=!0,In):null;case`textInput`:return e=t.data,e===In&&Ln?null:e;default:return null}}function Hn(e,t){if(Bn)return e===`compositionend`||!Mn&&Rn(e,t)?(e=en(),$t=Qt=Zt=null,Bn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Fn&&t.locale!==`ko`?null:t.data;default:return null}}var Un={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Un[e.type]:t===`textarea`}function Gn(e,t,n,r){Ht?Ut?Ut.push(r):Ut=[r]:Ht=r,t=Td(t,`onChange`),0<t.length&&(n=new sn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Kn=null,qn=null;function Jn(e){_d(e,0)}function Yn(e){if(xt(rt(e)))return e}function Xn(e,t){if(e===`change`)return t}var Zn=!1;if(Jt){var Qn;if(Jt){var $n=`oninput`in document;if(!$n){var er=document.createElement(`div`);er.setAttribute(`oninput`,`return;`),$n=typeof er.oninput==`function`}Qn=$n}else Qn=!1;Zn=Qn&&(!document.documentMode||9<document.documentMode)}function tr(){Kn&&(Kn.detachEvent(`onpropertychange`,nr),qn=Kn=null)}function nr(e){if(e.propertyName===`value`&&Yn(qn)){var t=[];Gn(t,qn,e,Vt(e)),Kt(Jn,t)}}function rr(e,t,n){e===`focusin`?(tr(),Kn=t,qn=n,Kn.attachEvent(`onpropertychange`,nr)):e===`focusout`&&tr()}function ir(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Yn(qn)}function ar(e,t){if(e===`click`)return Yn(t)}function or(e,t){if(e===`input`||e===`change`)return Yn(t)}function sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var cr=typeof Object.is==`function`?Object.is:sr;function lr(e,t){if(cr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!oe.call(t,i)||!cr(e[i],t[i]))return!1}return!0}function ur(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dr(e,t){var n=ur(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=ur(n)}}function fr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?fr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function pr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=St(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=St(e.document)}return t}function mr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var hr=Jt&&`documentMode`in document&&11>=document.documentMode,gr=null,_r=null,vr=null,yr=!1;function br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;yr||gr==null||gr!==St(r)||(r=gr,`selectionStart`in r&&mr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),vr&&lr(vr,r)||(vr=r,r=Td(_r,`onSelect`),0<r.length&&(t=new sn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=gr)))}function xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Sr={animationend:xr(`Animation`,`AnimationEnd`),animationiteration:xr(`Animation`,`AnimationIteration`),animationstart:xr(`Animation`,`AnimationStart`),transitionrun:xr(`Transition`,`TransitionRun`),transitionstart:xr(`Transition`,`TransitionStart`),transitioncancel:xr(`Transition`,`TransitionCancel`),transitionend:xr(`Transition`,`TransitionEnd`)},Cr={},wr={};Jt&&(wr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),`TransitionEvent`in window||delete Sr.transitionend.transition);function Tr(e){if(Cr[e])return Cr[e];if(!Sr[e])return e;var t=Sr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in wr)return Cr[e]=t[n];return e}var Er=Tr(`animationend`),Dr=Tr(`animationiteration`),Or=Tr(`animationstart`),kr=Tr(`transitionrun`),Ar=Tr(`transitionstart`),jr=Tr(`transitioncancel`),Mr=Tr(`transitionend`),Nr=new Map,Pr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Pr.push(`scrollEnd`);function Fr(e,t){Nr.set(e,t),ct(t,[e])}var Ir=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Lr=[],Rr=0,zr=0;function Br(){for(var e=Rr,t=zr=Rr=0;t<e;){var n=Lr[t];Lr[t++]=null;var r=Lr[t];Lr[t++]=null;var i=Lr[t];Lr[t++]=null;var a=Lr[t];if(Lr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Wr(n,i,a)}}function Vr(e,t,n,r){Lr[Rr++]=e,Lr[Rr++]=t,Lr[Rr++]=n,Lr[Rr++]=r,zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Hr(e,t,n,r){return Vr(e,t,n,r),Gr(e)}function Ur(e,t){return Vr(e,null,null,t),Gr(e)}function Wr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ce(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Gr(e){if(50<cu)throw cu=0,lu=null,Error(a(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Kr={};function qr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jr(e,t,n,r){return new qr(e,t,n,r)}function Yr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xr(e,t){var n=e.alternate;return n===null?(n=Jr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Zr(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Qr(e,t,n,r,i,o){var s=0;if(r=e,typeof e==`function`)Yr(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,H.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=Jr(31,n,t,i),e.elementType=D,e.lanes=o,e;case _:return $r(n.children,i,o,t);case v:s=8,i|=24;break;case y:return e=Jr(12,n,t,i|2),e.elementType=y,e.lanes=o,e;case C:return e=Jr(13,n,t,i),e.elementType=C,e.lanes=o,e;case w:return e=Jr(19,n,t,i),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(a(130,e===null?`null`:typeof e,``)),r=null}return t=Jr(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function $r(e,t,n,r){return e=Jr(7,e,r,t),e.lanes=n,e}function ei(e,t,n){return e=Jr(6,e,null,t),e.lanes=n,e}function ti(e){var t=Jr(18,null,null,0);return t.stateNode=e,t}function ni(e,t,n){return t=Jr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ri=new WeakMap;function ii(e,t){if(typeof e==`object`&&e){var n=ri.get(e);return n===void 0?(t={value:e,source:t,stack:ae(t)},ri.set(e,t),t):n}return{value:e,source:t,stack:ae(t)}}var oi=[],si=0,ci=null,li=0,ui=[],di=0,fi=null,pi=1,mi=``;function hi(e,t){oi[si++]=li,oi[si++]=ci,ci=e,li=t}function gi(e,t,n){ui[di++]=pi,ui[di++]=mi,ui[di++]=fi,fi=e;var r=pi;e=mi;var i=32-Ce(r)-1;r&=~(1<<i),n+=1;var a=32-Ce(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,pi=1<<32-Ce(t)+i|n<<i|r,mi=a+e}else pi=1<<a|n<<i|r,mi=e}function _i(e){e.return!==null&&(hi(e,1),gi(e,1,0))}function vi(e){for(;e===ci;)ci=oi[--si],oi[si]=null,li=oi[--si],oi[si]=null;for(;e===fi;)fi=ui[--di],ui[di]=null,mi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null}function yi(e,t){ui[di++]=pi,ui[di++]=mi,ui[di++]=fi,pi=t.id,mi=t.overflow,fi=e}var bi=null,xi=null,Si=!1,Ci=null,wi=!1,Ti=Error(a(519));function Ei(e){throw Mi(ii(Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ti}function Di(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ke]=e,t[qe]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),Et(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),At(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=zt),t=!0):t=!1,t||Ei(e,!0)}function Oi(e){for(bi=e.return;bi;)switch(bi.tag){case 5:case 31:case 13:wi=!1;return;case 27:case 3:wi=!0;return;default:bi=bi.return}}function ki(e){if(e!==bi)return!1;if(!Si)return Oi(e),Si=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&xi&&Ei(e),Oi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));xi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(317));xi=uf(e)}else t===27?(t=xi,Zd(e.type)?(e=lf,lf=null,xi=e):xi=t):xi=bi?cf(e.stateNode.nextSibling):null;return!0}function Ai(){xi=bi=null,Si=!1}function ji(){var e=Ci;return e!==null&&(Jl===null?Jl=e:Jl.push.apply(Jl,e),Ci=null),e}function Mi(e){Ci===null?Ci=[e]:Ci.push(e)}var Ni=z(null),Pi=null,Fi=null;function Ii(e,t,n){V(Ni,t._currentValue),t._currentValue=n}function Li(e){e._currentValue=Ni.current,B(Ni)}function Ri(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function zi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var o=i.dependencies;if(o!==null){var s=i.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ri(o.return,n,e),r||(s=null);break a}o=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(a(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ri(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Bi(e,t,n,r){e=null;for(var i=t,o=!1;i!==null;){if(!o){if(i.flags&524288)o=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(a(387));if(s=s.memoizedProps,s!==null){var c=i.type;cr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===G.current){if(s=i.alternate,s===null)throw Error(a(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&zi(t,e,n,r),t.flags|=262144}function Vi(e){for(e=e.firstContext;e!==null;){if(!cr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Hi(e){Pi=e,Fi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ui(e){return Gi(Pi,e)}function Wi(e,t){return Pi===null&&Hi(e),Gi(e,t)}function Gi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Fi===null){if(e===null)throw Error(a(308));Fi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Fi=Fi.next=t;return n}var Ki=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},qi=t.unstable_scheduleCallback,Ji=t.unstable_NormalPriority,Yi={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xi(){return{controller:new Ki,data:new Map,refCount:0}}function Zi(e){e.refCount--,e.refCount===0&&qi(Ji,function(){e.controller.abort()})}var Qi=null,$i=0,ea=0,ta=null;function na(e,t){if(Qi===null){var n=Qi=[];$i=0,ea=ld(),ta={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return $i++,t.then(ra,ra),t}function ra(){if(--$i===0&&Qi!==null){ta!==null&&(ta.status=`fulfilled`);var e=Qi;Qi=null,ea=0,ta=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ia(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var aa=P.S;P.S=function(e,t){Zl=de(),typeof t==`object`&&t&&typeof t.then==`function`&&na(e,t),aa!==null&&aa(e,t)};var oa=z(null);function sa(){var e=oa.current;return e===null?Ml.pooledCache:e}function ca(e,t){t===null?V(oa,oa.current):V(oa,t.pool)}function la(){var e=sa();return e===null?null:{parent:Yi._currentValue,pool:e}}var ua=Error(a(460)),da=Error(a(474)),fa=Error(a(542)),pa={then:function(){}};function ma(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ha(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(zt,zt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ya(e),e;default:if(typeof t.status==`string`)t.then(zt,zt);else{if(e=Ml,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ya(e),e}throw _a=t,ua}}function ga(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(_a=e,ua):e}}var _a=null;function va(){if(_a===null)throw Error(a(459));var e=_a;return _a=null,e}function ya(e){if(e===ua||e===fa)throw Error(a(483))}var ba=null,xa=0;function Sa(e){var t=xa;return xa+=1,ba===null&&(ba=[]),ha(ba,e,t)}function Ca(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function wa(e,t){throw t.$$typeof===m?Error(a(525)):(e=Object.prototype.toString.call(t),Error(a(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ta(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Xr(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ei(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===E&&ga(a)===t.type)?(t=i(t,n.props),Ca(t,n),t.return=e,t):(t=Qr(n.type,n.key,n.props,null,e.mode,r),Ca(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ni(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=$r(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ei(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=Qr(t.type,t.key,t.props,null,e.mode,n),Ca(n,t),n.return=e,n;case g:return t=ni(t,e.mode,n),t.return=e,t;case E:return t=ga(t),f(e,t,n)}if(N(t)||A(t))return t=$r(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Sa(t),n);if(t.$$typeof===x)return f(e,Wi(e,t),n);wa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case E:return n=ga(n),p(e,t,n,r)}if(N(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Sa(n),r);if(n.$$typeof===x)return p(e,t,Wi(e,n),r);wa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=ga(r),m(e,t,n,r,i)}if(N(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Sa(r),i);if(r.$$typeof===x)return m(e,t,n,Wi(t,r),i);wa(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Si&&hi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Si&&hi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Si&&hi(i,h),l}function y(i,s,c,l){if(c==null)throw Error(a(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Si&&hi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Si&&hi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Si&&hi(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&ga(l)===r.type){n(e,r.sibling),c=i(r,o.props),Ca(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===_?(c=$r(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=Qr(o.type,o.key,o.props,null,e.mode,c),Ca(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ni(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=ga(o),b(e,r,o,c)}if(N(o))return v(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Sa(o),c);if(o.$$typeof===x)return b(e,r,Wi(e,o),c);wa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=ei(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{xa=0;var i=b(e,t,n,r);return ba=null,i}catch(t){if(t===ua||t===fa)throw t;var a=Jr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ea=Ta(!0),Da=Ta(!1),Oa=!1;function ka(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Aa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ja(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ma(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,jl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Gr(e),Wr(e,null,n),t}return Vr(e,r,t,n),Gr(e)}function Na(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ze(e,n)}}function Pa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Fa=!1;function Ia(){if(Fa){var e=ta;if(e!==null)throw e}}function La(e,t,n,r){Fa=!1;var i=e.updateQueue;Oa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,m=f!==s.lane;if(m?(Pl&f)===f:(r&f)===f){f!==0&&f===ea&&(Fa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:Oa=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Hl|=o,e.lanes=o,e.memoizedState=d}}function Ra(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function za(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ra(n[e],t)}var Ba=z(null),Va=z(0);function Ha(e,t){e=Bl,V(Va,e),V(Ba,t),Bl=e|t.baseLanes}function Ua(){V(Va,Bl),V(Ba,Ba.current)}function Wa(){Bl=Va.current,B(Ba),B(Va)}var Ga=z(null),Ka=null;function qa(e){var t=e.alternate;V(Qa,Qa.current&1),V(Ga,e),Ka===null&&(t===null||Ba.current!==null||t.memoizedState!==null)&&(Ka=e)}function Ja(e){V(Qa,Qa.current),V(Ga,e),Ka===null&&(Ka=e)}function Ya(e){e.tag===22?(V(Qa,Qa.current),V(Ga,e),Ka===null&&(Ka=e)):Xa(e)}function Xa(){V(Qa,Qa.current),V(Ga,Ga.current)}function Za(e){B(Ga),Ka===e&&(Ka=null),B(Qa)}var Qa=z(0);function $a(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var eo=0,to=null,no=null,ro=null,io=!1,ao=!1,oo=!1,so=0,co=0,lo=null,uo=0;function fo(){throw Error(a(321))}function po(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!cr(e[n],t[n]))return!1;return!0}function mo(e,t,n,r,i,a){return eo=a,to=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?js:Ms,oo=!1,a=n(r,i),oo=!1,ao&&(a=go(t,n,r,i)),ho(e),a}function ho(e){P.H=As;var t=no!==null&&no.next!==null;if(eo=0,ro=no=to=null,io=!1,co=0,lo=null,t)throw Error(a(300));e===null||Ys||(e=e.dependencies,e!==null&&Vi(e)&&(Ys=!0))}function go(e,t,n,r){to=e;var i=0;do{if(ao&&(lo=null),co=0,ao=!1,25<=i)throw Error(a(301));if(i+=1,ro=no=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}P.H=Ns,o=t(n,r)}while(ao);return o}function _o(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?wo(t):t,e=e.useState()[0],(no===null?null:no.memoizedState)!==e&&(to.flags|=1024),t}function vo(){var e=so!==0;return so=0,e}function yo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function bo(e){if(io){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}io=!1}eo=0,ro=no=to=null,ao=!1,co=so=0,lo=null}function xo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ro===null?to.memoizedState=ro=e:ro=ro.next=e,ro}function So(){if(no===null){var e=to.alternate;e=e===null?null:e.memoizedState}else e=no.next;var t=ro===null?to.memoizedState:ro.next;if(t!==null)ro=t,no=e;else{if(e===null)throw to.alternate===null?Error(a(467)):Error(a(310));no=e,e={memoizedState:no.memoizedState,baseState:no.baseState,baseQueue:no.baseQueue,queue:no.queue,next:null},ro===null?to.memoizedState=ro=e:ro=ro.next=e}return ro}function Co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wo(e){var t=co;return co+=1,lo===null&&(lo=[]),e=ha(lo,e,t),t=to,(ro===null?t.memoizedState:ro.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?js:Ms),e}function To(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return wo(e);if(e.$$typeof===x)return Ui(e)}throw Error(a(438,String(e)))}function Eo(e){var t=null,n=to.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=to.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Co(),to.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=O;return t.index++,n}function Do(e,t){return typeof t==`function`?t(e):t}function Oo(e){return ko(So(),no,e)}function ko(e,t,n){var r=e.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=n;var i=e.baseQueue,o=r.pending;if(o!==null){if(i!==null){var s=i.next;i.next=o.next,o.next=s}t.baseQueue=i=o,r.pending=null}if(o=e.baseState,i===null)e.memoizedState=o;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(eo&f)===f:(Pl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ea&&(d=!0);else if((eo&p)===p){u=u.next,p===ea&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,to.lanes|=p,Hl|=p;f=u.action,oo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,to.lanes|=f,Hl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!cr(o,e.memoizedState)&&(Ys=!0,d&&(n=ta,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Ao(e){var t=So(),n=t.queue;if(n===null)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,o=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do o=e(o,s.action),s=s.next;while(s!==i);cr(o,t.memoizedState)||(Ys=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function jo(e,t,n){var r=to,i=So(),o=Si;if(o){if(n===void 0)throw Error(a(407));n=n()}else n=t();var s=!cr((no||i).memoizedState,n);if(s&&(i.memoizedState=n,Ys=!0),i=i.queue,ns(Po.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||ro!==null&&ro.memoizedState.tag&1){if(r.flags|=2048,Zo(9,{destroy:void 0},No.bind(null,r,i,n,t),null),Ml===null)throw Error(a(349));o||eo&127||Mo(r,t,n)}return n}function Mo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=to.updateQueue,t===null?(t=Co(),to.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function No(e,t,n,r){t.value=n,t.getSnapshot=r,Fo(t)&&Io(e)}function Po(e,t,n){return n(function(){Fo(t)&&Io(e)})}function Fo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!cr(e,n)}catch{return!0}}function Io(e){var t=Ur(e,2);t!==null&&fu(t,e,2)}function Lo(e){var t=xo();if(typeof e==`function`){var n=e;if(e=n(),oo){Se(!0);try{n()}finally{Se(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:e},t}function Ro(e,t,n,r){return e.baseState=n,ko(e,no,typeof r==`function`?r:Do)}function zo(e,t,n,r,i){if(Ds(e))throw Error(a(485));if(e=t.action,e!==null){var o={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};P.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Bo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Bo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Vo(e,t,s)}catch(n){Uo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Vo(e,t,a)}catch(n){Uo(e,t,n)}}function Vo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ho(e,t,n)},function(n){return Uo(e,t,n)}):Ho(e,t,n)}function Ho(e,t,n){t.status=`fulfilled`,t.value=n,Wo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bo(e,n)))}function Uo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Wo(t),t=t.next;while(t!==r)}e.action=null}function Wo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Go(e,t){return t}function Ko(e,t){if(Si){var n=Ml.formState;if(n!==null){a:{var r=to;if(Si){if(xi){b:{for(var i=xi,a=wi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){xi=cf(i.nextSibling),r=i.data===`F!`;break a}}Ei(r)}r=!1}r&&(t=n[0])}}return n=xo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:t},n.queue=r,n=ws.bind(null,to,r),r.dispatch=n,r=Lo(!1),a=Es.bind(null,to,!1,r.queue),r=xo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=zo.bind(null,to,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function qo(e){return Jo(So(),no,e)}function Jo(e,t,n){if(t=ko(e,t,Go)[0],e=Oo(Do)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=wo(t)}catch(e){throw e===ua?fa:e}else r=t;t=So();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(to.flags|=2048,Zo(9,{destroy:void 0},Yo.bind(null,i,n),null)),[r,a,e]}function Yo(e,t){e.action=t}function Xo(e){var t=So(),n=no;if(n!==null)return Jo(t,n,e);So(),t=t.memoizedState,n=So();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Zo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=to.updateQueue,t===null&&(t=Co(),to.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Qo(){return So().memoizedState}function $o(e,t,n,r){var i=xo();to.flags|=e,i.memoizedState=Zo(1|t,{destroy:void 0},n,r===void 0?null:r)}function es(e,t,n,r){var i=So();r=r===void 0?null:r;var a=i.memoizedState.inst;no!==null&&r!==null&&po(r,no.memoizedState.deps)?i.memoizedState=Zo(t,a,n,r):(to.flags|=e,i.memoizedState=Zo(1|t,a,n,r))}function ts(e,t){$o(8390656,8,e,t)}function ns(e,t){es(2048,8,e,t)}function rs(e){to.flags|=4;var t=to.updateQueue;if(t===null)t=Co(),to.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function is(e){var t=So().memoizedState;return rs({ref:t,nextImpl:e}),function(){if(jl&2)throw Error(a(440));return t.impl.apply(void 0,arguments)}}function as(e,t){return es(4,2,e,t)}function os(e,t){return es(4,4,e,t)}function ss(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function cs(e,t,n){n=n==null?null:n.concat([e]),es(4,4,ss.bind(null,t,e),n)}function ls(){}function us(e,t){var n=So();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&po(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ds(e,t){var n=So();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&po(t,r[1]))return r[0];if(r=e(),oo){Se(!0);try{e()}finally{Se(!1)}}return n.memoizedState=[r,t],r}function fs(e,t,n){return n===void 0||eo&1073741824&&!(Pl&261930)?e.memoizedState=t:(e.memoizedState=n,e=du(),to.lanes|=e,Hl|=e,n)}function ps(e,t,n,r){return cr(n,t)?n:Ba.current===null?!(eo&42)||eo&1073741824&&!(Pl&261930)?(Ys=!0,e.memoizedState=n):(e=du(),to.lanes|=e,Hl|=e,t):(e=fs(e,n,r),cr(e,t)||(Ys=!0),e)}function ms(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,Es(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ts(e,t,ia(c,r),uu(e)):Ts(e,t,r,uu(e))}catch(n){Ts(e,t,{then:function(){},status:`rejected`,reason:n},uu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function hs(){}function gs(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=_s(e).queue;ms(e,i,t,I,n===null?hs:function(){return vs(e),n(r)})}function _s(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Do,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function vs(e){var t=_s(e);t.next===null&&(t=e.alternate.memoizedState),Ts(e,t.next.queue,{},uu())}function ys(){return Ui(Qf)}function bs(){return So().memoizedState}function xs(){return So().memoizedState}function Ss(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=uu();e=ja(n);var r=Ma(t,e,n);r!==null&&(fu(r,t,n),Na(r,t,n)),t={cache:Xi()},e.payload=t;return}t=t.return}}function Cs(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ds(e)?Os(t,n):(n=Hr(e,t,n,r),n!==null&&(fu(n,e,r),ks(n,t,r)))}function ws(e,t,n){Ts(e,t,n,uu())}function Ts(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ds(e))Os(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,cr(s,o))return Vr(e,t,i,0),Ml===null&&Br(),!1}catch{}if(n=Hr(e,t,i,r),n!==null)return fu(n,e,r),ks(n,t,r),!0}return!1}function Es(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ds(e)){if(t)throw Error(a(479))}else t=Hr(e,n,r,2),t!==null&&fu(t,e,2)}function Ds(e){var t=e.alternate;return e===to||t!==null&&t===to}function Os(e,t){ao=io=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ks(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ze(e,n)}}var As={readContext:Ui,use:To,useCallback:fo,useContext:fo,useEffect:fo,useImperativeHandle:fo,useLayoutEffect:fo,useInsertionEffect:fo,useMemo:fo,useReducer:fo,useRef:fo,useState:fo,useDebugValue:fo,useDeferredValue:fo,useTransition:fo,useSyncExternalStore:fo,useId:fo,useHostTransitionStatus:fo,useFormState:fo,useActionState:fo,useOptimistic:fo,useMemoCache:fo,useCacheRefresh:fo};As.useEffectEvent=fo;var js={readContext:Ui,use:To,useCallback:function(e,t){return xo().memoizedState=[e,t===void 0?null:t],e},useContext:Ui,useEffect:ts,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),$o(4194308,4,ss.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $o(4194308,4,e,t)},useInsertionEffect:function(e,t){$o(4,2,e,t)},useMemo:function(e,t){var n=xo();t=t===void 0?null:t;var r=e();if(oo){Se(!0);try{e()}finally{Se(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=xo();if(n!==void 0){var i=n(t);if(oo){Se(!0);try{n(t)}finally{Se(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Cs.bind(null,to,e),[r.memoizedState,e]},useRef:function(e){var t=xo();return e={current:e},t.memoizedState=e},useState:function(e){e=Lo(e);var t=e.queue,n=ws.bind(null,to,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ls,useDeferredValue:function(e,t){return fs(xo(),e,t)},useTransition:function(){var e=Lo(!1);return e=ms.bind(null,to,e.queue,!0,!1),xo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=to,i=xo();if(Si){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Ml===null)throw Error(a(349));Pl&127||Mo(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,ts(Po.bind(null,r,o,e),[e]),r.flags|=2048,Zo(9,{destroy:void 0},No.bind(null,r,o,n,t),null),n},useId:function(){var e=xo(),t=Ml.identifierPrefix;if(Si){var n=mi,r=pi;n=(r&~(1<<32-Ce(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=so++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=uo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ys,useFormState:Ko,useActionState:Ko,useOptimistic:function(e){var t=xo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Es.bind(null,to,!0,n),n.dispatch=t,[e,t]},useMemoCache:Eo,useCacheRefresh:function(){return xo().memoizedState=Ss.bind(null,to)},useEffectEvent:function(e){var t=xo(),n={impl:e};return t.memoizedState=n,function(){if(jl&2)throw Error(a(440));return n.impl.apply(void 0,arguments)}}},Ms={readContext:Ui,use:To,useCallback:us,useContext:Ui,useEffect:ns,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Oo,useRef:Qo,useState:function(){return Oo(Do)},useDebugValue:ls,useDeferredValue:function(e,t){return ps(So(),no.memoizedState,e,t)},useTransition:function(){var e=Oo(Do)[0],t=So().memoizedState;return[typeof e==`boolean`?e:wo(e),t]},useSyncExternalStore:jo,useId:bs,useHostTransitionStatus:ys,useFormState:qo,useActionState:qo,useOptimistic:function(e,t){return Ro(So(),no,e,t)},useMemoCache:Eo,useCacheRefresh:xs};Ms.useEffectEvent=is;var Ns={readContext:Ui,use:To,useCallback:us,useContext:Ui,useEffect:ns,useImperativeHandle:cs,useInsertionEffect:as,useLayoutEffect:os,useMemo:ds,useReducer:Ao,useRef:Qo,useState:function(){return Ao(Do)},useDebugValue:ls,useDeferredValue:function(e,t){var n=So();return no===null?fs(n,e,t):ps(n,no.memoizedState,e,t)},useTransition:function(){var e=Ao(Do)[0],t=So().memoizedState;return[typeof e==`boolean`?e:wo(e),t]},useSyncExternalStore:jo,useId:bs,useHostTransitionStatus:ys,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){var n=So();return no===null?(n.baseState=e,[e,n.queue.dispatch]):Ro(n,no,e,t)},useMemoCache:Eo,useCacheRefresh:xs};Ns.useEffectEvent=is;function Ps(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:p({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Fs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=uu(),i=ja(r);i.payload=t,n!=null&&(i.callback=n),t=Ma(e,i,r),t!==null&&(fu(t,e,r),Na(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=uu(),i=ja(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ma(e,i,r),t!==null&&(fu(t,e,r),Na(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=uu(),r=ja(n);r.tag=2,t!=null&&(r.callback=t),t=Ma(e,r,n),t!==null&&(fu(t,e,n),Na(t,e,n))}};function Is(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!lr(n,r)||!lr(i,a):!0}function Ls(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Fs.enqueueReplaceState(t,t.state,null)}function Rs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=p({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function zs(e){Ir(e)}function Bs(e){console.error(e)}function Vs(e){Ir(e)}function Hs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Us(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ws(e,t,n){return n=ja(n),n.tag=3,n.payload={element:null},n.callback=function(){Hs(e,t)},n}function Gs(e){return e=ja(e),e.tag=3,e}function Ks(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Us(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Us(t,n,r),typeof i!=`function`&&(eu===null?eu=new Set([this]):eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function qs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Bi(t,n,i,!0),n=Ga.current,n!==null){switch(n.tag){case 31:case 13:return Ka===null?wu():n.alternate===null&&Vl===0&&(Vl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===pa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,i)),!1;case 22:return n.flags|=65536,r===pa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Uu(e,r,i)),!1}throw Error(a(435,n.tag))}return Uu(e,r,i),wu(),!1}if(Si)return t=Ga.current,t===null?(r!==Ti&&(t=Error(a(423),{cause:r}),Mi(ii(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ii(r,n),i=Ws(e.stateNode,r,i),Pa(e,i),Vl!==4&&(Vl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ti&&(e=Error(a(422),{cause:r}),Mi(ii(e,n)))),!1;var o=Error(a(520),{cause:r});if(o=ii(o,n),ql===null?ql=[o]:ql.push(o),Vl!==4&&(Vl=2),t===null)return!0;r=ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Ws(n.stateNode,r,e),Pa(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(eu===null||!eu.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Gs(i),Ks(i,e,n,r),Pa(n,i),!1}n=n.return}while(n!==null);return!1}var Js=Error(a(461)),Ys=!1;function Xs(e,t,n,r){t.child=e===null?Da(t,null,n,r):Ea(t,e.child,n,r)}function Zs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Hi(t),r=mo(e,t,n,o,a,i),s=vo(),e!==null&&!Ys?(yo(e,t,i),xc(e,t,i)):(Si&&s&&_i(t),t.flags|=1,Xs(e,t,r,i),t.child)}function Qs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Yr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,$s(e,t,a,r,i)):(e=Qr(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Sc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?lr:n,n(o,r)&&e.ref===t.ref)return xc(e,t,i)}return t.flags|=1,e=Xr(a,r),e.ref=t.ref,e.return=t,t.child=e}function $s(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(lr(a,r)&&e.ref===t.ref)if(Ys=!1,t.pendingProps=r=a,Sc(e,i))e.flags&131072&&(Ys=!0);else return t.lanes=e.lanes,xc(e,t,i)}return sc(e,t,n,r,i)}function ec(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return nc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ca(t,a===null?null:a.cachePool),a===null?Ua():Ha(t,a),Ya(t);else return r=t.lanes=536870912,nc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ca(t,null),Ua(),Xa(t)):(ca(t,a.cachePool),Ha(t,a),Xa(t),t.memoizedState=null);return Xs(e,t,i,n),t.child}function tc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function nc(e,t,n,r,i){var a=sa();return a=a===null?null:{parent:Yi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ca(t,null),Ua(),Ya(t),e!==null&&Bi(e,t,r,!0),t.childLanes=i,null}function rc(e,t){return t=gc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ic(e,t,n){return Ea(t,e.child,null,n),e=rc(t,t.pendingProps),e.flags|=2,Za(t),t.memoizedState=null,e}function ac(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Si){if(r.mode===`hidden`)return e=rc(t,r),t.lanes=536870912,tc(null,e);if(Ja(t),(e=xi)?(e=rf(e,wi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fi===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ti(e),n.return=t,t.child=n,bi=t,xi=null)):e=null,e===null)throw Ei(t);return t.lanes=536870912,null}return rc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Ja(t),i)if(t.flags&256)t.flags&=-257,t=ic(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(a(558));else if(Ys||Bi(e,t,n,!1),i=(n&e.childLanes)!==0,Ys||i){if(r=Ml,r!==null&&(s=Be(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ur(e,s),fu(r,e,s),Js;wu(),t=ic(e,t,n)}else e=o.treeContext,xi=cf(s.nextSibling),bi=t,Si=!0,Ci=null,wi=!1,e!==null&&yi(t,e),t=rc(t,r),t.flags|=4096;return t}return e=Xr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function oc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(a(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function sc(e,t,n,r,i){return Hi(t),n=mo(e,t,n,r,void 0,i),r=vo(),e!==null&&!Ys?(yo(e,t,i),xc(e,t,i)):(Si&&r&&_i(t),t.flags|=1,Xs(e,t,n,i),t.child)}function cc(e,t,n,r,i,a){return Hi(t),t.updateQueue=null,n=go(t,r,n,i),ho(e),r=vo(),e!==null&&!Ys?(yo(e,t,a),xc(e,t,a)):(Si&&r&&_i(t),t.flags|=1,Xs(e,t,n,a),t.child)}function lc(e,t,n,r,i){if(Hi(t),t.stateNode===null){var a=Kr,o=n.contextType;typeof o==`object`&&o&&(a=Ui(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Fs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ka(t),o=n.contextType,a.context=typeof o==`object`&&o?Ui(o):Kr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ps(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Fs.enqueueReplaceState(a,a.state,null),La(t,r,a,i),Ia(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Rs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Kr,typeof u==`object`&&u&&(o=Ui(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ls(t,a,r,o),Oa=!1;var f=t.memoizedState;a.state=f,La(t,r,a,i),Ia(),l=t.memoizedState,s||f!==l||Oa?(typeof d==`function`&&(Ps(t,n,d,r),l=t.memoizedState),(c=Oa||Is(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Aa(e,t),o=t.memoizedProps,u=Rs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Kr,typeof l==`object`&&l&&(c=Ui(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ls(t,a,r,c),Oa=!1,f=t.memoizedState,a.state=f,La(t,r,a,i),Ia();var p=t.memoizedState;o!==d||f!==p||Oa||e!==null&&e.dependencies!==null&&Vi(e.dependencies)?(typeof s==`function`&&(Ps(t,n,s,r),p=t.memoizedState),(u=Oa||Is(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Vi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,oc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ea(t,e.child,null,i),t.child=Ea(t,null,n,i)):Xs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=xc(e,t,i),e}function uc(e,t,n,r){return Ai(),t.flags|=256,Xs(e,t,n,r),t.child}var dc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function fc(e){return{baseLanes:e,cachePool:la()}}function pc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Gl),e}function mc(e,t,n){var r=t.pendingProps,i=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Qa.current&2)!=0),s&&(i=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Si){if(i?qa(t):Xa(t),(e=xi)?(e=rf(e,wi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fi===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ti(e),n.return=t,t.child=n,bi=t,xi=null)):e=null,e===null)throw Ei(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(Xa(t),i=t.mode,c=gc({mode:`hidden`,children:c},i),r=$r(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=fc(n),r.childLanes=pc(e,s,n),t.memoizedState=dc,tc(null,r)):(qa(t),hc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(qa(t),t.flags&=-257,t=_c(e,t,n)):t.memoizedState===null?(Xa(t),c=r.fallback,i=t.mode,r=gc({mode:`visible`,children:r.children},i),c=$r(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ea(t,e.child,null,n),r=t.child,r.memoizedState=fc(n),r.childLanes=pc(e,s,n),t.memoizedState=dc,t=tc(null,r)):(Xa(t),t.child=e.child,t.flags|=128,t=null);else if(qa(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(a(419)),r.stack=``,r.digest=s,Mi({value:r,source:null,stack:null}),t=_c(e,t,n)}else if(Ys||Bi(e,t,n,!1),s=(n&e.childLanes)!==0,Ys||s){if(s=Ml,s!==null&&(r=Be(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Ur(e,r),fu(s,e,r),Js;af(c)||wu(),t=_c(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,xi=cf(c.nextSibling),bi=t,Si=!0,Ci=null,wi=!1,e!==null&&yi(t,e),t=hc(t,r.children),t.flags|=4096);return t}return i?(Xa(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=Xr(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=$r(c,i,n,null),c.flags|=2):c=Xr(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,tc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=fc(n):(i=c.cachePool,i===null?i=la():(l=Yi._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=pc(e,s,n),t.memoizedState=dc,tc(e.child,r)):(qa(t),n=e.child,e=n.sibling,n=Xr(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function hc(e,t){return t=gc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function gc(e,t){return e=Jr(22,e,null,t),e.lanes=0,e}function _c(e,t,n){return Ea(t,e.child,null,n),e=hc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function vc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ri(e.return,t,n)}function yc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function bc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Qa.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,V(Qa,o),Xs(e,t,r,n),r=Si?li:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vc(e,n,t);else if(e.tag===19)vc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&$a(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),yc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&$a(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}yc(t,!0,n,null,a,r);break;case`together`:yc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function xc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Hl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Bi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(a(153));if(t.child!==null){for(e=t.child,n=Xr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Sc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Vi(e))):!0}function Cc(e,t,n){switch(t.tag){case 3:K(t,t.stateNode.containerInfo),Ii(t,Yi,e.memoizedState.cache),Ai();break;case 27:case 5:J(t);break;case 4:K(t,t.stateNode.containerInfo);break;case 10:Ii(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ja(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(qa(t),e=xc(e,t,n),e===null?null:e.sibling):mc(e,t,n):(qa(t),t.flags|=128,null);qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Bi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return bc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),V(Qa,Qa.current),r)break;return null;case 22:return t.lanes=0,ec(e,t,n,t.pendingProps);case 24:Ii(t,Yi,e.memoizedState.cache)}return xc(e,t,n)}function wc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ys=!0;else{if(!Sc(e,n)&&!(t.flags&128))return Ys=!1,Cc(e,t,n);Ys=!!(e.flags&131072)}else Ys=!1,Si&&t.flags&1048576&&gi(t,li,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ga(t.elementType),t.type=e,typeof e==`function`)Yr(e)?(r=Rs(e,r),t.tag=1,t=lc(null,t,e,r,n)):(t.tag=0,t=sc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===S){t.tag=11,t=Zs(null,t,e,r,n);break a}else if(i===T){t.tag=14,t=Qs(null,t,e,r,n);break a}}throw t=M(e)||e,Error(a(306,t,``))}}return t;case 0:return sc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Rs(r,t.pendingProps),lc(e,t,r,i,n);case 3:a:{if(K(t,t.stateNode.containerInfo),e===null)throw Error(a(387));r=t.pendingProps;var o=t.memoizedState;i=o.element,Aa(e,t),La(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ii(t,Yi,r),r!==o.cache&&zi(t,[Yi],n,!0),Ia(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=uc(e,t,r,n);break a}else if(r!==i){i=ii(Error(a(424)),t),Mi(i),t=uc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(xi=cf(e.firstChild),bi=t,Si=!0,Ci=null,wi=!0,n=Da(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ai(),r===i){t=xc(e,t,n);break a}Xs(e,t,r,n)}t=t.child}return t;case 26:return oc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Si||(n=t.type,e=t.pendingProps,r=Bd(W.current).createElement(n),r[Ke]=t,r[qe]=e,Pd(r,n,e),at(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return J(t),e===null&&Si&&(r=t.stateNode=ff(t.type,t.pendingProps,W.current),bi=t,wi=!0,i=xi,Zd(t.type)?(lf=i,xi=cf(r.firstChild)):xi=i),Xs(e,t,t.pendingProps.children,n),oc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Si&&((i=r=xi)&&(r=tf(r,t.type,t.pendingProps,wi),r===null?i=!1:(t.stateNode=r,bi=t,xi=cf(r.firstChild),wi=!1,i=!0)),i||Ei(t)),J(t),i=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(i,o)?r=null:s!==null&&Ud(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=mo(e,t,_o,null,null,n),Qf._currentValue=i),oc(e,t),Xs(e,t,r,n),t.child;case 6:return e===null&&Si&&((e=n=xi)&&(n=nf(n,t.pendingProps,wi),n===null?e=!1:(t.stateNode=n,bi=t,xi=null,e=!0)),e||Ei(t)),null;case 13:return mc(e,t,n);case 4:return K(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ea(t,null,r,n):Xs(e,t,r,n),t.child;case 11:return Zs(e,t,t.type,t.pendingProps,n);case 7:return Xs(e,t,t.pendingProps,n),t.child;case 8:return Xs(e,t,t.pendingProps.children,n),t.child;case 12:return Xs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ii(t,t.type,r.value),Xs(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Hi(t),i=Ui(i),r=r(i),t.flags|=1,Xs(e,t,r,n),t.child;case 14:return Qs(e,t,t.type,t.pendingProps,n);case 15:return $s(e,t,t.type,t.pendingProps,n);case 19:return bc(e,t,n);case 31:return ac(e,t,n);case 22:return ec(e,t,n,t.pendingProps);case 24:return Hi(t),r=Ui(Yi),e===null?(i=sa(),i===null&&(i=Ml,o=Xi(),i.pooledCache=o,o.refCount++,o!==null&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:r,cache:i},ka(t),Ii(t,Yi,i)):((e.lanes&n)!==0&&(Aa(e,t),La(t,null,null,n),Ia()),i=e.memoizedState,o=t.memoizedState,i.parent===r?(r=o.cache,Ii(t,Yi,r),r!==i.cache&&zi(t,[Yi],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Ii(t,Yi,r))),Xs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(a(156,t.tag))}function Tc(e){e.flags|=4}function Ec(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(xu())e.flags|=8192;else throw _a=pa,da}else e.flags&=-16777217}function Dc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(xu())e.flags|=8192;else throw _a=pa,da}function Oc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Pe(),e.lanes|=t,Kl|=t)}function kc(e,t){if(!Si)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ac(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function jc(e,t,n){var r=t.pendingProps;switch(vi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ac(t),null;case 1:return Ac(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Li(Yi),q(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ki(t)?Tc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ji())),Ac(t),null;case 26:var i=t.type,o=t.memoizedState;return e===null?(Tc(t),o===null?(Ac(t),Ec(t,i,null,r,n)):(Ac(t),Dc(t,o))):o?o===e.memoizedState?(Ac(t),t.flags&=-16777217):(Tc(t),Ac(t),Dc(t,o)):(e=e.memoizedProps,e!==r&&Tc(t),Ac(t),Ec(t,i,e,r,n)),null;case 27:if(ee(t),n=W.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Tc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Ac(t),null}e=H.current,ki(t)?Di(t,e):(e=ff(i,r,n),t.stateNode=e,Tc(t))}return Ac(t),null;case 5:if(ee(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Tc(t);else{if(!r){if(t.stateNode===null)throw Error(a(166));return Ac(t),null}if(o=H.current,ki(t))Di(t,o);else{var s=Bd(W.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[Ke]=t,o[qe]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Tc(t)}}return Ac(t),Ec(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Tc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=W.current,ki(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=bi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ke]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ei(t,!0)}else e=Bd(e).createTextNode(r),e[Ke]=t,t.stateNode=e}return Ac(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ki(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[Ke]=t}else Ai(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ac(t),e=!1}else n=ji(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Za(t),t):(Za(t),null);if(t.flags&128)throw Error(a(558))}return Ac(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=ki(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[Ke]=t}else Ai(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ac(t),i=!1}else i=ji(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Za(t),t):(Za(t),null)}return Za(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Oc(t,t.updateQueue),Ac(t),null);case 4:return q(),e===null&&xd(t.stateNode.containerInfo),Ac(t),null;case 10:return Li(t.type),Ac(t),null;case 19:if(B(Qa),r=t.memoizedState,r===null)return Ac(t),null;if(i=(t.flags&128)!=0,o=r.rendering,o===null)if(i)kc(r,!1);else{if(Vl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=$a(e),o!==null){for(t.flags|=128,kc(r,!1),e=o.updateQueue,t.updateQueue=e,Oc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Zr(n,e),n=n.sibling;return V(Qa,Qa.current&1|2),Si&&hi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&de()>Ql&&(t.flags|=128,i=!0,kc(r,!1),t.lanes=4194304)}else{if(!i)if(e=$a(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Oc(t,e),kc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Si)return Ac(t),null}else 2*de()-r.renderingStartTime>Ql&&n!==536870912&&(t.flags|=128,i=!0,kc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Ac(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=de(),e.sibling=null,n=Qa.current,V(Qa,i?n&1|2:n&1),Si&&hi(t,r.treeForkCount),e);case 22:case 23:return Za(t),Wa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ac(t),t.subtreeFlags&6&&(t.flags|=8192)):Ac(t),n=t.updateQueue,n!==null&&Oc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&B(oa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Li(Yi),Ac(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Mc(e,t){switch(vi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Li(Yi),q(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ee(t),null;case 31:if(t.memoizedState!==null){if(Za(t),t.alternate===null)throw Error(a(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Za(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(Qa),null;case 4:return q(),null;case 10:return Li(t.type),null;case 22:case 23:return Za(t),Wa(),e!==null&&B(oa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Li(Yi),null;case 25:return null;default:return null}}function Nc(e,t){switch(vi(t),t.tag){case 3:Li(Yi),q();break;case 26:case 27:case 5:ee(t);break;case 4:q();break;case 31:t.memoizedState!==null&&Za(t);break;case 13:Za(t);break;case 19:B(Qa);break;case 10:Li(t.type);break;case 22:case 23:Za(t),Wa(),e!==null&&B(oa);break;case 24:Li(Yi)}}function Pc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Hu(t,t.return,e)}}function Fc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Hu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Hu(t,t.return,e)}}function Ic(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{za(t,n)}catch(t){Hu(e,e.return,t)}}}function Lc(e,t,n){n.props=Rs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Hu(e,t,n)}}function Rc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Hu(e,t,n)}}function zc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Hu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Hu(e,t,n)}else n.current=null}function Bc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Hu(e,e.return,t)}}function Vc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[qe]=t}catch(t){Hu(e,e.return,t)}}function Hc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Uc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Hc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=zt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[Ke]=e,t[qe]=n}catch(t){Hu(e,e.return,t)}}var qc=!1,Jc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=pr(e),mr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,i=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Rs(n.type,i);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Hu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(a(163))}if(e=t.sibling,e!==null){e.return=t.return,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:fl(e,n),r&4&&Pc(5,n);break;case 1:if(fl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Hu(n,n.return,e)}else{var i=Rs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Hu(n,n.return,e)}}r&64&&Ic(n),r&512&&Rc(n,n.return);break;case 3:if(fl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{za(e,t)}catch(e){Hu(n,n.return,e)}}break;case 27:t===null&&r&4&&Kc(n);case 26:case 5:fl(e,n),t===null&&r&4&&Bc(n),r&512&&Rc(n,n.return);break;case 12:fl(e,n);break;case 31:fl(e,n),r&4&&il(e,n);break;case 13:fl(e,n),r&4&&$(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||qc,!r){t=t!==null&&t.memoizedState!==null||Jc,i=qc;var a=Jc;qc=r,(Jc=t)&&!a?ml(e,n,(n.subtreeFlags&8772)!=0):fl(e,n),qc=i,Jc=a}break;case 30:break;default:fl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&et(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nl=null,Z=!1;function Q(e,t,n){for(n=n.child;n!==null;)rl(e,t,n),n=n.sibling}function rl(e,t,n){if(xe&&typeof xe.onCommitFiberUnmount==`function`)try{xe.onCommitFiberUnmount(be,n)}catch{}switch(n.tag){case 26:Jc||zc(n,t),Q(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Jc||zc(n,t);var r=nl,i=Z;Zd(n.type)&&(nl=n.stateNode,Z=!1),Q(e,t,n),pf(n.stateNode),nl=r,Z=i;break;case 5:Jc||zc(n,t);case 6:if(r=nl,i=Z,nl=null,Q(e,t,n),nl=r,Z=i,nl!==null)if(Z)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Hu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Hu(n,t,e)}break;case 18:nl!==null&&(Z?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=Z,nl=n.stateNode.containerInfo,Z=!0,Q(e,t,n),nl=r,Z=i;break;case 0:case 11:case 14:case 15:Fc(2,n,t),Jc||Fc(4,n,t),Q(e,t,n);break;case 1:Jc||(zc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Lc(n,t,r)),Q(e,t,n);break;case 21:Q(e,t,n);break;case 22:Jc=(r=Jc)||n.memoizedState!==null,Q(e,t,n),Jc=r;break;default:Q(e,t,n)}}function il(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Hu(t,t.return,e)}}}function $(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Hu(t,t.return,e)}}function al(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(a(435,e.tag))}}function ol(e,t){var n=al(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function sl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){nl=c.stateNode,Z=!1;break a}break;case 5:nl=c.stateNode,Z=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,Z=!0;break a}c=c.return}if(nl===null)throw Error(a(160));rl(o,s,i),nl=null,Z=!1,o=i.alternate,o!==null&&(o.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ll(t,e),t=t.sibling}var cl=null;function ll(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sl(t,e),ul(e),r&4&&(Fc(3,e,e.return),Pc(3,e),Fc(5,e,e.return));break;case 1:sl(t,e),ul(e),r&512&&(Jc||n===null||zc(n,n.return)),r&64&&qc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=cl;if(sl(t,e),ul(e),r&512&&(Jc||n===null||zc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:o=i.getElementsByTagName(`title`)[0],(!o||o[$e]||o[Ke]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=i.createElement(r),i.head.insertBefore(o,i.querySelector(`head > title`))),Pd(o,r,n),o[Ke]=e,at(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=i.createElement(r),Pd(o,r,n),i.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=i.createElement(r),Pd(o,r,n),i.head.appendChild(o);break;default:throw Error(a(468,r))}o[Ke]=e,at(o),r=o}e.stateNode=r}else Hf(i,e.type,e.stateNode);else e.stateNode=If(i,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Vc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:sl(t,e),ul(e),r&512&&(Jc||n===null||zc(n,n.return)),n!==null&&r&4&&Vc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(sl(t,e),ul(e),r&512&&(Jc||n===null||zc(n,n.return)),e.flags&32){i=e.stateNode;try{jt(i,``)}catch(t){Hu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Vc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(sl(t,e),ul(e),r&4){if(e.stateNode===null)throw Error(a(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Hu(e,e.return,t)}}break;case 3:if(Bf=null,i=cl,cl=gf(t.containerInfo),sl(t,e),cl=i,ul(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Hu(e,e.return,t)}Xc&&(Xc=!1,dl(e));break;case 4:r=cl,cl=gf(e.stateNode.containerInfo),sl(t,e),ul(e),cl=r;break;case 12:sl(t,e),ul(e);break;case 31:sl(t,e),ul(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ol(e,r)));break;case 13:sl(t,e),ul(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xl=de()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ol(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=qc,d=Jc;if(qc=u||i,Jc=d||l,sl(t,e),Jc=d,qc=u,ul(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||qc||Jc||pl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,i)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Hu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Hu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Hu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ol(e,n))));break;case 19:sl(t,e),ul(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ol(e,r)));break;case 30:break;case 21:break;default:sl(t,e),ul(e)}}function ul(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Hc(r)){n=r;break}r=r.return}if(n==null)throw Error(a(160));switch(n.tag){case 27:var i=n.stateNode;Gc(e,Uc(e),i);break;case 5:var o=n.stateNode;n.flags&32&&(jt(o,``),n.flags&=-33),Gc(e,Uc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Wc(e,Uc(e),s);break;default:throw Error(a(161))}}catch(t){Hu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function dl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;dl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function pl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Fc(4,t,t.return),pl(t);break;case 1:zc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Lc(t,t.return,n),pl(t);break;case 27:pf(t.stateNode);case 26:case 5:zc(t,t.return),pl(t);break;case 22:t.memoizedState===null&&pl(t);break;case 30:pl(t);break;default:pl(t)}e=e.sibling}}function ml(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:ml(i,a,n),Pc(4,a);break;case 1:if(ml(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Hu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ra(c[i],s)}catch(e){Hu(r,r.return,e)}}n&&o&64&&Ic(a),Rc(a,a.return);break;case 27:Kc(a);case 26:case 5:ml(i,a,n),n&&r===null&&o&4&&Bc(a),Rc(a,a.return);break;case 12:ml(i,a,n);break;case 31:ml(i,a,n),n&&o&4&&il(i,a);break;case 13:ml(i,a,n),n&&o&4&&$(i,a);break;case 22:a.memoizedState===null&&ml(i,a,n),Rc(a,a.return);break;case 30:break;default:ml(i,a,n)}t=t.sibling}}function hl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Zi(n))}function gl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zi(e))}function _l(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vl(e,t,n,r),t=t.sibling}function vl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:_l(e,t,n,r),i&2048&&Pc(9,t);break;case 1:_l(e,t,n,r);break;case 3:_l(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zi(e)));break;case 12:if(i&2048){_l(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Hu(t,t.return,e)}}else _l(e,t,n,r);break;case 31:_l(e,t,n,r);break;case 13:_l(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?_l(e,t,n,r):(a._visibility|=2,yl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?_l(e,t,n,r):bl(e,t),i&2048&&hl(o,t);break;case 24:_l(e,t,n,r),i&2048&&gl(t.alternate,t);break;default:_l(e,t,n,r)}}function yl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:yl(a,o,s,c,i),Pc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,yl(a,o,s,c,i)):u._visibility&2?yl(a,o,s,c,i):bl(a,o),i&&l&2048&&hl(o.alternate,o);break;case 24:yl(a,o,s,c,i),i&&l&2048&&gl(o.alternate,o);break;default:yl(a,o,s,c,i)}t=t.sibling}}function bl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:bl(n,r),i&2048&&hl(r.alternate,r);break;case 24:bl(n,r),i&2048&&gl(r.alternate,r);break;default:bl(n,r)}t=t.sibling}}var xl=8192;function Sl(e,t,n){if(e.subtreeFlags&xl)for(e=e.child;e!==null;)Cl(e,t,n),e=e.sibling}function Cl(e,t,n){switch(e.tag){case 26:Sl(e,t,n),e.flags&xl&&e.memoizedState!==null&&Gf(n,cl,e.memoizedState,e.memoizedProps);break;case 5:Sl(e,t,n);break;case 3:case 4:var r=cl;cl=gf(e.stateNode.containerInfo),Sl(e,t,n),cl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=xl,xl=16777216,Sl(e,t,n),xl=r):Sl(e,t,n));break;default:Sl(e,t,n)}}function wl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Tl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,Ol(r,e)}wl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)El(e),e=e.sibling}function El(e){switch(e.tag){case 0:case 11:case 15:Tl(e),e.flags&2048&&Fc(9,e,e.return);break;case 3:Tl(e);break;case 12:Tl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Dl(e)):Tl(e);break;default:Tl(e)}}function Dl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,Ol(r,e)}wl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Fc(8,t,t.return),Dl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Dl(t));break;default:Dl(t)}e=e.sibling}}function Ol(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Fc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Zi(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var kl={getCacheForType:function(e){var t=Ui(Yi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ui(Yi).controller.signal}},Al=typeof WeakMap==`function`?WeakMap:Map,jl=0,Ml=null,Nl=null,Pl=0,Fl=0,Il=null,Ll=!1,Rl=!1,zl=!1,Bl=0,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=null,Jl=null,Yl=!1,Xl=0,Zl=0,Ql=1/0,$l=null,eu=null,tu=0,nu=null,ru=null,iu=0,au=0,ou=null,su=null,cu=0,lu=null;function uu(){return jl&2&&Pl!==0?Pl&-Pl:P.T===null?Ue():ld()}function du(){if(Gl===0)if(!(Pl&536870912)||Si){var e=Oe;Oe<<=1,!(Oe&3932160)&&(Oe=262144),Gl=e}else Gl=536870912;return e=Ga.current,e!==null&&(e.flags|=32),Gl}function fu(e,t,n){(e===Ml&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)&&(yu(e,0),gu(e,Pl,Gl,!1)),Ie(e,n),(!(jl&2)||e!==Ml)&&(e===Ml&&(!(jl&2)&&(Ul|=n),Vl===4&&gu(e,Pl,Gl,!1)),td(e))}function pu(e,t,n){if(jl&6)throw Error(a(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Me(e,t),i=r?Du(e,t):Tu(e,t,!0),o=r;do{if(i===0){Rl&&!r&&gu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!hu(n)){i=Tu(e,t,!1),o=!1;continue}if(i===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=ql;var l=c.current.memoizedState.isDehydrated;if(l&&(yu(c,s).flags|=256),s=Tu(c,s,!1),s!==2){if(zl&&!l){c.errorRecoveryDisabledLanes|=o,Ul|=o,i=4;break a}o=Jl,Jl=i,o!==null&&(Jl===null?Jl=o:Jl.push.apply(Jl,o))}i=s}if(o=!1,i!==2)continue}}if(i===1){yu(e,0),gu(e,t,0,!0);break}a:{switch(r=e,o=i,o){case 0:case 1:throw Error(a(345));case 4:if((t&4194048)!==t)break;case 6:gu(r,t,Gl,!Ll);break a;case 2:Jl=null;break;case 3:case 5:break;default:throw Error(a(329))}if((t&62914560)===t&&(i=Xl+300-de(),10<i)){if(gu(r,t,Gl,!Ll),je(r,0,!0)!==0)break a;iu=t,r.timeoutHandle=Kd(mu.bind(null,r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,o,`Throttled`,-0,0),i);break a}mu(r,n,Jl,$l,Yl,t,Gl,Ul,Kl,Ll,o,null,-0,0)}}break}while(1);td(e)}function mu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:zt},Cl(t,a,d);var m=(a&62914560)===a?Xl-de():(a&4194048)===a?Zl-de():0;if(m=qf(d,m),m!==null){iu=a,e.cancelPendingCommit=m(Pu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),gu(e,a,o,!l);return}}Pu(e,t,a,n,r,i,o,s,c)}function hu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!cr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gu(e,t,n,r){t&=~Wl,t&=~Ul,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ce(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Re(e,n,t)}function _u(){return jl&6?!0:(nd(0,!1),!1)}function vu(){if(Nl!==null){if(Fl===0)var e=Nl.return;else e=Nl,Fi=Pi=null,bo(e),ba=null,xa=0,e=Nl;for(;e!==null;)Nc(e.alternate,e),e=e.return;Nl=null}}function yu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),iu=0,vu(),Ml=e,Nl=n=Xr(e.current,null),Pl=t,Fl=0,Il=null,Ll=!1,Rl=Me(e,t),zl=!1,Kl=Gl=Wl=Ul=Hl=Vl=0,Jl=ql=null,Yl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ce(r),a=1<<i;t|=e[i],r&=~a}return Bl=t,Br(),n}function bu(e,t){to=null,P.H=As,t===ua||t===fa?(t=va(),Fl=3):t===da?(t=va(),Fl=4):Fl=t===Js?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Il=t,Nl===null&&(Vl=1,Hs(e,ii(t,e.current)))}function xu(){var e=Ga.current;return e===null?!0:(Pl&4194048)===Pl?Ka===null:(Pl&62914560)===Pl||Pl&536870912?e===Ka:!1}function Su(){var e=P.H;return P.H=As,e===null?As:e}function Cu(){var e=P.A;return P.A=kl,e}function wu(){Vl=4,Ll||(Pl&4194048)!==Pl&&Ga.current!==null||(Rl=!0),!(Hl&134217727)&&!(Ul&134217727)||Ml===null||gu(Ml,Pl,Gl,!1)}function Tu(e,t,n){var r=jl;jl|=2;var i=Su(),a=Cu();(Ml!==e||Pl!==t)&&($l=null,yu(e,t)),t=!1;var o=Vl;a:do try{if(Fl!==0&&Nl!==null){var s=Nl,c=Il;switch(Fl){case 8:vu(),o=6;break a;case 3:case 2:case 9:case 6:Ga.current===null&&(t=!0);var l=Fl;if(Fl=0,Il=null,ju(e,s,c,l),n&&Rl){o=0;break a}break;default:l=Fl,Fl=0,Il=null,ju(e,s,c,l)}}Eu(),o=Vl;break}catch(t){bu(e,t)}while(1);return t&&e.shellSuspendCounter++,Fi=Pi=null,jl=r,P.H=i,P.A=a,Nl===null&&(Ml=null,Pl=0,Br()),o}function Eu(){for(;Nl!==null;)ku(Nl)}function Du(e,t){var n=jl;jl|=2;var r=Su(),i=Cu();Ml!==e||Pl!==t?($l=null,Ql=de()+500,yu(e,t)):Rl=Me(e,t);a:do try{if(Fl!==0&&Nl!==null){t=Nl;var o=Il;b:switch(Fl){case 1:Fl=0,Il=null,ju(e,t,o,1);break;case 2:case 9:if(ma(o)){Fl=0,Il=null,Au(t);break}t=function(){Fl!==2&&Fl!==9||Ml!==e||(Fl=7),td(e)},o.then(t,t);break a;case 3:Fl=7;break a;case 4:Fl=5;break a;case 7:ma(o)?(Fl=0,Il=null,Au(t)):(Fl=0,Il=null,ju(e,t,o,7));break;case 5:var s=null;switch(Nl.tag){case 26:s=Nl.memoizedState;case 5:case 27:var c=Nl;if(s?Wf(s):c.stateNode.complete){Fl=0,Il=null;var l=c.sibling;if(l!==null)Nl=l;else{var u=c.return;u===null?Nl=null:(Nl=u,Mu(u))}break b}}Fl=0,Il=null,ju(e,t,o,5);break;case 6:Fl=0,Il=null,ju(e,t,o,6);break;case 8:vu(),Vl=6;break a;default:throw Error(a(462))}}Ou();break}catch(t){bu(e,t)}while(1);return Fi=Pi=null,P.H=r,P.A=i,jl=n,Nl===null?(Ml=null,Pl=0,Br(),Vl):0}function Ou(){for(;Nl!==null&&!le();)ku(Nl)}function ku(e){var t=wc(e.alternate,e,Bl);e.memoizedProps=e.pendingProps,t===null?Mu(e):Nl=t}function Au(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=cc(n,t,t.pendingProps,t.type,void 0,Pl);break;case 11:t=cc(n,t,t.pendingProps,t.type.render,t.ref,Pl);break;case 5:bo(t);default:Nc(n,t),t=Nl=Zr(t,Bl),t=wc(n,t,Bl)}e.memoizedProps=e.pendingProps,t===null?Mu(e):Nl=t}function ju(e,t,n,r){Fi=Pi=null,bo(t),ba=null,xa=0;var i=t.return;try{if(qs(e,i,t,n,Pl)){Vl=1,Hs(e,ii(n,e.current)),Nl=null;return}}catch(t){if(i!==null)throw Nl=i,t;Vl=1,Hs(e,ii(n,e.current)),Nl=null;return}t.flags&32768?(Si||r===1?e=!0:Rl||Pl&536870912?e=!1:(Ll=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ga.current,r!==null&&r.tag===13&&(r.flags|=16384))),Nu(t,e)):Mu(t)}function Mu(e){var t=e;do{if(t.flags&32768){Nu(t,Ll);return}e=t.return;var n=jc(t.alternate,t,Bl);if(n!==null){Nl=n;return}if(t=t.sibling,t!==null){Nl=t;return}Nl=t=e}while(t!==null);Vl===0&&(Vl=5)}function Nu(e,t){do{var n=Mc(e.alternate,e);if(n!==null){n.flags&=32767,Nl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Nl=e;return}Nl=e=n}while(e!==null);Vl=6,Nl=null}function Pu(e,t,n,r,i,o,s,c,l){e.cancelPendingCommit=null;do zu();while(tu!==0);if(jl&6)throw Error(a(327));if(t!==null){if(t===e.current)throw Error(a(177));if(o=t.lanes|t.childLanes,o|=zr,Le(e,n,o,s,c,l),e===Ml&&(Nl=Ml=null,Pl=0),ru=t,nu=e,iu=n,au=o,ou=i,su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(he,function(){return Bu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=P.T,P.T=null,i=F.p,F.p=2,s=jl,jl|=4;try{$c(e,t,n)}finally{jl=s,F.p=i,P.T=r}}tu=1,Fu(),Iu(),Lu()}}function Fu(){if(tu===1){tu=0;var e=nu,t=ru,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=jl;jl|=4;try{ll(t,e);var a=zd,o=pr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&fr(s.ownerDocument.documentElement,s)){if(c!==null&&mr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=dr(s,h),v=dr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{jl=i,F.p=r,P.T=n}}e.current=t,tu=2}}function Iu(){if(tu===2){tu=0;var e=nu,t=ru,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=jl;jl|=4;try{el(e,t.alternate,t)}finally{jl=i,F.p=r,P.T=n}}tu=3}}function Lu(){if(tu===4||tu===3){tu=0,ue();var e=nu,t=ru,n=iu,r=su;t.subtreeFlags&10256||t.flags&10256?tu=5:(tu=0,ru=nu=null,Ru(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(eu=null),He(n),t=t.stateNode,xe&&typeof xe.onCommitFiberRoot==`function`)try{xe.onCommitFiberRoot(be,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}iu&3&&zu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===lu?cu++:(cu=0,lu=e):cu=0,nd(0,!1)}}function Ru(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zi(t)))}function zu(){return Fu(),Iu(),Lu(),Bu()}function Bu(){if(tu!==5)return!1;var e=nu,t=au;au=0;var n=He(iu),r=P.T,i=F.p;try{F.p=32>n?32:n,P.T=null,n=ou,ou=null;var o=nu,s=iu;if(tu=0,ru=nu=null,iu=0,jl&6)throw Error(a(331));var c=jl;if(jl|=4,El(o.current),vl(o,o.current,s,n),jl=c,nd(0,!1),xe&&typeof xe.onPostCommitFiberRoot==`function`)try{xe.onPostCommitFiberRoot(be,o)}catch{}return!0}finally{F.p=i,P.T=r,Ru(e,t)}}function Vu(e,t,n){t=ii(n,t),t=Ws(e.stateNode,t,2),e=Ma(e,t,2),e!==null&&(Ie(e,2),td(e))}function Hu(e,t,n){if(e.tag===3)Vu(e,e,n);else for(;t!==null;){if(t.tag===3){Vu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(eu===null||!eu.has(r))){e=ii(n,e),n=Gs(2),r=Ma(t,n,2),r!==null&&(Ks(n,r,t,e),Ie(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Al;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(zl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ml===e&&(Pl&n)===n&&(Vl===4||Vl===3&&(Pl&62914560)===Pl&&300>de()-Xl?!(jl&2)&&yu(e,0):Wl|=n,Kl===Pl&&(Kl=0)),td(e)}function Gu(e,t){t===0&&(t=Pe()),e=Ur(e,t),e!==null&&(Ie(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Gu(e,n)}function Ju(e,t){return se(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ce(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Pl,a=je(r,r===Ml?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Me(r,a)||(n=!0,sd(r,a));r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=de(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}tu!==0&&tu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ce(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ne(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ml,n=Pl,n=je(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Fl===2||Fl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ce(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Me(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ce(r),He(n)){case 2:case 8:n=me;break;case 32:n=he;break;case 268435456:n=_e;break;default:n=he}return r=od.bind(null,e),n=se(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ce(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(tu!==0&&tu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zu()&&e.callbackNode!==n)return null;var r=Pl;return r=je(e,e===Ml?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(pu(e,r,t),ad(e,de()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(zu())return null;pu(e,t,!0)}function cd(){Yd(function(){jl&6?se(pe,rd):id()})}function ld(){if(ed===0){var e=ea;e===0&&(e=De,De<<=1,!(De&261888)&&(De=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Rt(``+e)}function dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[qe]||null).action),o=r.submitter;o&&(t=(t=o[qe]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new sn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);gs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),gs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<Pr.length;pd++){var md=Pr[pd];Fr(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}Fr(Er,`onAnimationEnd`),Fr(Dr,`onAnimationIteration`),Fr(Or,`onAnimationStart`),Fr(`dblclick`,`onDoubleClick`),Fr(`focusin`,`onFocus`),Fr(`focusout`,`onBlur`),Fr(kr,`onTransitionRun`),Fr(Ar,`onTransitionStart`),Fr(jr,`onTransitionCancel`),Fr(Mr,`onTransitionEnd`),lt(`onMouseEnter`,[`mouseout`,`mouseover`]),lt(`onMouseLeave`,[`mouseout`,`mouseover`]),lt(`onPointerEnter`,[`pointerout`,`pointerover`]),lt(`onPointerLeave`,[`pointerout`,`pointerover`]),ct(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),ct(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),ct(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),ct(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),ct(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),ct(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ir(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ir(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[Ye];n===void 0&&(n=t[Ye]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,ot.forEach(function(t){t!==`selectionchange`&&(gd.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!Yt||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var c=r.stateNode.containerInfo;if(c===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;c!==null;){if(o=tt(c),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}c=c.parentNode}}r=r.return}Kt(function(){var r=a,i=Vt(n),o=[];a:{var c=Nr.get(e);if(c!==void 0){var l=sn,u=e;switch(e){case`keypress`:if(tn(n)===0)break a;case`keydown`:case`keyup`:l=Tn;break;case`focusin`:u=`focus`,l=gn;break;case`focusout`:u=`blur`,l=gn;break;case`beforeblur`:case`afterblur`:l=gn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=mn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=hn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Dn;break;case Er:case Dr:case Or:l=_n;break;case Mr:l=On;break;case`scroll`:case`scrollend`:l=ln;break;case`wheel`:l=kn;break;case`copy`:case`cut`:case`paste`:l=vn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=En;break;case`toggle`:case`beforetoggle`:l=An}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=qt(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),o.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Bt&&(u=n.relatedTarget||n.fromElement)&&(tt(u)||u[Je]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?tt(u):null,u!==null&&(f=s(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=mn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=En,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:rt(l),h=u==null?c:rt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,tt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(o,c,l,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(c=r?rt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=Xn;else if(Wn(c))if(Zn)v=or;else{v=ir;var y=rr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Ft(r.elementType)&&(v=Xn):v=ar;if(v&&=v(e,r)){Gn(o,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Dt(c,`number`,c.value)}switch(y=r?rt(r):window,e){case`focusin`:(Wn(y)||y.contentEditable===`true`)&&(gr=y,_r=r,vr=null);break;case`focusout`:vr=_r=gr=null;break;case`mousedown`:yr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:yr=!1,br(o,n,i);break;case`selectionchange`:if(hr)break;case`keydown`:case`keyup`:br(o,n,i)}var b;if(Mn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Bn?Rn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Fn&&n.locale!==`ko`&&(Bn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Bn&&(b=en()):(Zt=i,Qt=`value`in Zt?Zt.value:Zt.textContent,Bn=!0)),y=Td(r,x),0<y.length&&(x=new yn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=zn(n),b!==null&&(x.data=b)))),(b=Pn?Vn(e,n):Hn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new yn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),fd(o,e,r,n,i)}_d(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=qt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=qt(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=qt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=qt(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
10
10
  `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&jt(e,``+r);break;case`className`:ht(e,`class`,r);break;case`tabIndex`:ht(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:ht(e,n,r);break;case`style`:Pt(e,r,o);break;case`data`:if(t!==`object`){ht(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Rt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Rt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=zt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Rt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),mt(e,`popover`,r);break;case`xlinkActuate`:gt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:gt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:gt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:gt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:gt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:gt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:gt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:mt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=It.get(n)||n,mt(e,n,r))}}function Nd(e,t,n,r,i,o){switch(n){case`style`:Pt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&jt(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=zt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!st.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),o=e[qe]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,i),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):mt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,i=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,o,s,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=o=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(a(137,t));break;default:Md(e,t,r,d,n,null)}}Et(e,o,c,l,u,s,i,!1);return;case`select`:for(i in vd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ot(e,!!r,n,!0):Ot(e,!!r,t,!1);return;case`textarea`:for(s in vd(`invalid`,e),o=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(a(91));break;default:Md(e,t,s,c,n,null)}At(e,r,i,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(a(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Ft(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(a(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Tt(e,s,c,l,u,d,o,i);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(i in r)if(o=r[i],l=n[i],r.hasOwnProperty(i)&&(o!=null||l!=null))switch(i){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,i,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ot(e,!!n,n?[]:``,!1):Ot(e,!!n,t,!0)):Ot(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(s in r)if(i=r[s],o=n[s],r.hasOwnProperty(s)&&(i!=null||o!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(a(91));break;default:i!==o&&Md(e,t,s,i,r,o)}kt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(a(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Ft(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[$e]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),et(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[$e])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(a(452));return e;case`head`:if(e=t.head,!e)throw Error(a(453));return e;case`body`:if(e=t.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);et(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=F.d;F.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=nt(e);t!==null&&t.tag===5&&t.type===`form`?vs(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=wt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),at(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+wt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+wt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+wt(n.imageSizes)+`"]`)):i+=`[href="`+wt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),at(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+wt(r)+`"][href="`+wt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),at(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=it(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);at(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=it(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),at(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=it(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),at(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=W.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=it(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=it(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=it(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+wt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),at(t),e.head.appendChild(t))}function Pf(e){return`[src="`+wt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+wt(n.href)+`"]`);if(r)return t.instance=r,at(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),at(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,at(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),at(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,at(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),at(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[$e]||a[Ke]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,at(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),at(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:x,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Fe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fe(0),this.hiddenUpdates=Fe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Jr(3,null,null,t),e.current=a,a.stateNode=e,t=Xi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ka(a),e}function tp(e){return e?(e=Kr,e):Kr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ma(e,r,t),n!==null&&(fu(n,e,t),Na(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Ur(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=Ve(t);var n=Ur(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,up(e,t,n,r)}finally{F.p=a,P.T=i}}function lp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,up(e,t,n,r)}finally{F.p=a,P.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=nt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ae(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ce(o);s.entanglements[1]|=c,o&=~c}td(a),!(jl&6)&&(Ql=de()+500,nd(0,!1))}}break;case 31:case 13:s=Ur(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Vt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=tt(e),e!==null){var t=s(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(fe()){case pe:return 2;case me:return 8;case he:case ge:return 32;case _e:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=nt(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=tt(e.target);if(t!==null){var n=s(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,We(e.priority,function(){op(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,We(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Bt=r,n.target.dispatchEvent(r),Bt=null}else return t=nt(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=nt(n);a!==null&&(e.splice(t,3),t-=3,gs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[qe]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[qe]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(a(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[Je]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ue();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(a(527,Lp,`19.2.5`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(a(188)):(e=Object.keys(e).join(`,`),Error(a(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{be=zp.inject(Rp),xe=zp}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=zs,s=Bs,c=Vs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,s,c,Pp),e[Je]=t.current,xd(e),new Fp(t)}})),Zc=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Xc()})),Qc=li(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),$c=li(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),el=li(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),tl=li(`bird`,[[`path`,{d:`M16 7h.01`,key:`1kdx03`}],[`path`,{d:`M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20`,key:`oj1oa8`}],[`path`,{d:`m20 7 2 .5-2 .5`,key:`12nv4d`}],[`path`,{d:`M10 18v3`,key:`1yea0a`}],[`path`,{d:`M14 17.75V21`,key:`1pymcb`}],[`path`,{d:`M7 18a6 6 0 0 0 3.84-10.61`,key:`1npnn0`}]]),nl=li(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),Z=o(),Q=e(r(),1),rl=e(ai(),1),il=Zc(),$=c(),al=[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]];li(`bot`,al);var ol=li(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),sl=li(`cat`,[[`path`,{d:`M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z`,key:`x6xyqk`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M11.25 16.25h1.5L12 17l-.75-.75Z`,key:`12kq1m`}]]),cl=li(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ll=li(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ul=li(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),dl=li(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),fl=li(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),pl=li(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),ml=li(`dog`,[[`path`,{d:`M11.25 16.25h1.5L12 17z`,key:`w7jh35`}],[`path`,{d:`M16 14v.5`,key:`1lajdz`}],[`path`,{d:`M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309`,key:`u7s9ue`}],[`path`,{d:`M8 14v.5`,key:`1nzgdb`}],[`path`,{d:`M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5`,key:`v8hric`}]]),hl=li(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),gl=li(`file-check`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m9 15 2 2 4-4`,key:`1grp1n`}]]),_l=li(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),vl=li(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),yl=li(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),bl=li(`fish`,[[`path`,{d:`M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z`,key:`15baut`}],[`path`,{d:`M18 12v.5`,key:`18hhni`}],[`path`,{d:`M16 17.93a9.77 9.77 0 0 1 0-11.86`,key:`16dt7o`}],[`path`,{d:`M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33`,key:`l9di03`}],[`path`,{d:`M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4`,key:`1kjonw`}],[`path`,{d:`m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98`,key:`1zlm23`}]]),xl=li(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),Sl=li(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),Cl=li(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),wl=li(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Tl=li(`grid-2x2-x`,[[`path`,{d:`M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3`,key:`11za1p`}],[`path`,{d:`m16 16 5 5`,key:`8tpb07`}],[`path`,{d:`m16 21 5-5`,key:`193jll`}]]),El=li(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Dl=li(`highlighter`,[[`path`,{d:`m9 11-6 6v3h9l3-3`,key:`1a3l36`}],[`path`,{d:`m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4`,key:`14a9rk`}]]),Ol=li(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),kl=li(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),Al=li(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),jl=li(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Ml=li(`list-collapse`,[[`path`,{d:`M10 5h11`,key:`1hkqpe`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 19h11`,key:`14g2nv`}],[`path`,{d:`m3 10 3-3-3-3`,key:`i7pm08`}],[`path`,{d:`m3 20 3-3-3-3`,key:`20gx1n`}]]),Nl=li(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),Pl=li(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Fl=li(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Il=li(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Ll=li(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Rl=li(`octagon-x`,[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),zl=li(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Bl=li(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Vl=li(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Hl=li(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Ul=li(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),Wl=li(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),Gl=li(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Kl=li(`rabbit`,[[`path`,{d:`M13 16a3 3 0 0 1 2.24 5`,key:`1epib5`}],[`path`,{d:`M18 12h.01`,key:`yjnet6`}],[`path`,{d:`M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3`,key:`ue9ozu`}],[`path`,{d:`M20 8.54V4a2 2 0 1 0-4 0v3`,key:`49iql8`}],[`path`,{d:`M7.612 12.524a3 3 0 1 0-1.6 4.3`,key:`1e33i0`}]]),ql=li(`rat`,[[`path`,{d:`M13 22H4a2 2 0 0 1 0-4h12`,key:`bt3f23`}],[`path`,{d:`M13.236 18a3 3 0 0 0-2.2-5`,key:`1tbvmo`}],[`path`,{d:`M16 9h.01`,key:`1bdo4e`}],[`path`,{d:`M16.82 3.94a3 3 0 1 1 3.237 4.868l1.815 2.587a1.5 1.5 0 0 1-1.5 2.1l-2.872-.453a3 3 0 0 0-3.5 3`,key:`9ch7kn`}],[`path`,{d:`M17 4.988a3 3 0 1 0-5.2 2.052A7 7 0 0 0 4 14.015 4 4 0 0 0 8 18`,key:`3s7e9i`}]]),Jl=li(`replace-all`,[[`path`,{d:`M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`zg1ipl`}],[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`,key:`txt6k4`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Yl=li(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Xl=li(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),Zl=li(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ql=li(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),$l=li(`shrimp`,[[`path`,{d:`M11 12h.01`,key:`1lr4k6`}],[`path`,{d:`M13 22c.5-.5 1.12-1 2.5-1-1.38 0-2-.5-2.5-1`,key:`fatpdi`}],[`path`,{d:`M14 2a3.28 3.28 0 0 1-3.227 1.798l-6.17-.561A2.387 2.387 0 1 0 4.387 8H15.5a1 1 0 0 1 0 13 1 1 0 0 0 0-5H12a7 7 0 0 1-7-7V8`,key:`kehrqe`}],[`path`,{d:`M14 8a8.5 8.5 0 0 1 0 8`,key:`1imjx2`}],[`path`,{d:`M16 16c2 0 4.5-4 4-6`,key:`z0nejz`}]]),eu=li(`snail`,[[`path`,{d:`M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0`,key:`hneq2s`}],[`circle`,{cx:`10`,cy:`13`,r:`8`,key:`194lz3`}],[`path`,{d:`M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6`,key:`ixqyt7`}],[`path`,{d:`M18 3 19.1 5.2`,key:`9tjm43`}],[`path`,{d:`M22 3 20.9 5.2`,key:`j3odrs`}]]),tu=li(`square-code`,[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),nu=li(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),ru=li(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),iu=li(`squirrel`,[[`path`,{d:`M15.236 22a3 3 0 0 0-2.2-5`,key:`21bitc`}],[`path`,{d:`M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4`,key:`oh0fg0`}],[`path`,{d:`M18 13h.01`,key:`9veqaj`}],[`path`,{d:`M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10`,key:`980v8a`}]]),au=li(`sticky-note`,[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]),ou=li(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),su=li(`table-properties`,[[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),cu=li(`telescope`,[[`path`,{d:`m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44`,key:`k4qptu`}],[`path`,{d:`m13.56 11.747 4.332-.924`,key:`19l80z`}],[`path`,{d:`m16 21-3.105-6.21`,key:`7oh9d`}],[`path`,{d:`M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z`,key:`m7xp4m`}],[`path`,{d:`m6.158 8.633 1.114 4.456`,key:`74o979`}],[`path`,{d:`m8 21 3.105-6.21`,key:`1fvxut`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}]]),lu=li(`text-align-center`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M17 12H7`,key:`16if0g`}],[`path`,{d:`M19 19H5`,key:`vjpgq2`}]]),uu=li(`text-align-end`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M21 19H7`,key:`4cu937`}]]),du=li(`text-align-start`,[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]]),fu=li(`turtle`,[[`path`,{d:`m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z`,key:`1lbbv7`}],[`path`,{d:`M4.82 7.9 8 10`,key:`m9wose`}],[`path`,{d:`M15.18 7.9 12 10`,key:`p8dp2u`}],[`path`,{d:`M16.93 10H20a2 2 0 0 1 0 4H2`,key:`12nsm7`}]]),pu=li(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),mu=li(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),hu=li(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),gu=li(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]);function _u(e,t){return e instanceof Error&&e.message?e.message:t}async function vu(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(_u(e,t))}}async function yu(e,t,n=hs,r=`action`){await vu(e,t,e=>{e!==null&&n.error(e)},r)}function bu(e){return Gn(e)}function xu(e,t){switch(e.kind){case`ok`:return null;case`not-git`:return`This folder doesn't contain a git repository. Pick a different folder?`;case`wrong-repo`:return`This folder is a clone of ${e.actualOwner}/${e.actualRepo}, not ${t.owner}/${t.repo}. Pick a different folder?`;case`no-origin`:case`non-github`:case`symlink-escape`:return`This folder isn't a clone of ${t.owner}/${t.repo}. Pick a different folder?`}}function Su(e){return e.kind===`unsupported-version`?{kind:`unsupported-version`,message:`Update Open Knowledge to open this share.`}:e.kind===`invalid`?{kind:`invalid`,message:`Invalid share URL.`}:null}function Cu(e){let t=e.split(`
11
- `).map(e=>e.trim()).filter(e=>e.length>0&&!/^Cloning into /i.test(e)),n=t.filter(e=>/^remote:/i.test(e)),r=n[n.length-1];if(r)return r.replace(/^remote:\s*/i,``).trim();let i=t.find(e=>/^fatal:/i.test(e));return i?i.replace(/^fatal:\s*/i,``).trim():t[0]??``}function wu(e){let t=[`[receive]`];return e.q2_path!==void 0&&t.push(`q2_path=${e.q2_path}`),e.folder_validate!==void 0&&t.push(`folder_validate=${e.folder_validate}`),e.branch_action!==void 0&&t.push(`branch_action=${e.branch_action}`),e.branch!==void 0&&t.push(`branch=${e.branch}`),e.doc_check!==void 0&&t.push(`doc_check=${e.doc_check}`),e.branch_dialog_action!==void 0&&t.push(`branch_dialog_action=${e.branch_dialog_action}`),t.join(` `)}function Tu(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function Eu(e){return{async getAuthStatus(){return e.authQueryTransport.status()},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=Tu(t),a=`${r.replace(/\/$/,``)}/${i}`,o=hs.loading(ms._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);hs.loading(ms._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:ms._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(wu({branch_action:`fallback`,branch:e.branch})),hs.info(ms._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return hs.success(ms._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return hs.dismiss(o),{kind:`error`,detail:e.message}}return hs.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return hs.dismiss(o),{kind:`error`,detail:t}}}}}function Du(){return{start(e){return Ti((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=mr.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
12
- `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function Ou(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}var ku=`ContextMenu`,[Au,ju]=ys(ku,[ya]),Mu=ya(),[Nu,Pu]=Au(ku),Fu=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Mu(t),l=xs(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Nu,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(zi,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Fu.displayName=ku;var Iu=`ContextMenuTrigger`,Lu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Pu(Iu,n),o=Mu(n),s=Q.useRef({x:0,y:0}),c=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=Q.useRef(0),u=Q.useCallback(()=>window.clearTimeout(l.current),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return Q.useEffect(()=>u,[u]),Q.useEffect(()=>void(r&&u()),[r,u]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ra,{...o,virtualRef:c}),(0,Z.jsx)(bs.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:Ss(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:Ss(e.onPointerDown,fd(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:Ss(e.onPointerMove,fd(u)),onPointerCancel:r?e.onPointerCancel:Ss(e.onPointerCancel,fd(u)),onPointerUp:r?e.onPointerUp:Ss(e.onPointerUp,fd(u))})]})});Lu.displayName=Iu;var Ru=`ContextMenuPortal`,zu=e=>{let{__scopeContextMenu:t,...n}=e,r=Mu(t);return(0,Z.jsx)(Vi,{...r,...n})};zu.displayName=Ru;var Bu=`ContextMenuContent`,Vu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Pu(Bu,n),a=Mu(n),o=Q.useRef(!1);return(0,Z.jsx)(Yi,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Vu.displayName=Bu;var Hu=`ContextMenuGroup`,Uu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(sa,{...i,...r,ref:t})});Uu.displayName=Hu;var Wu=`ContextMenuLabel`,Gu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(ha,{...i,...r,ref:t})});Gu.displayName=Wu;var Ku=`ContextMenuItem`,qu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(_o,{...i,...r,ref:t})});qu.displayName=Ku;var Ju=`ContextMenuCheckboxItem`,Yu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Ui,{...i,...r,ref:t})});Yu.displayName=Ju;var Xu=`ContextMenuRadioGroup`,Zu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(pa,{...i,...r,ref:t})});Zu.displayName=Xu;var Qu=`ContextMenuRadioItem`,$u=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(_a,{...i,...r,ref:t})});$u.displayName=Qu;var ed=`ContextMenuItemIndicator`,td=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(ki,{...i,...r,ref:t})});td.displayName=ed;var nd=`ContextMenuSeparator`,rd=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(qi,{...i,...r,ref:t})});rd.displayName=nd;var id=`ContextMenuArrow`,ad=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Li,{...i,...r,ref:t})});ad.displayName=id;var od=`ContextMenuSub`,sd=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Mu(t),[s,c]=ws({prop:i,defaultProp:a??!1,onChange:r,caller:od});return(0,Z.jsx)(Qa,{...o,open:s,onOpenChange:c,children:n})};sd.displayName=od;var cd=`ContextMenuSubTrigger`,ld=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(xa,{...i,...r,ref:t})});ld.displayName=cd;var ud=`ContextMenuSubContent`,dd=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Gi,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});dd.displayName=ud;function fd(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var pd=Fu,md=Lu,hd=zu,gd=Vu,_d=Uu,vd=Gu,yd=qu,bd=Yu,xd=td,Sd=rd,Cd=sd,wd=ld,Td=dd,Ed=`Tabs`,[Dd,Od]=ys(Ed,[Us]),kd=Us(),[Ad,jd]=Dd(Ed),Md=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Es(s),[d,f]=ws({prop:r,onChange:i,defaultProp:a??``,caller:Ed});return(0,Z.jsx)(Ad,{scope:n,baseId:vs(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Z.jsx)(bs.div,{dir:u,"data-orientation":o,...l,ref:t})})});Md.displayName=Ed;var Nd=`TabsList`,Pd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=jd(Nd,n),o=kd(n);return(0,Z.jsx)(Hs,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Z.jsx)(bs.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Pd.displayName=Nd;var Fd=`TabsTrigger`,Id=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=jd(Fd,n),s=kd(n),c=zd(o.baseId,r),l=Bd(o.baseId,r),u=r===o.value;return(0,Z.jsx)(Ws,{asChild:!0,...s,focusable:!i,active:u,children:(0,Z.jsx)(bs.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Ss(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Ss(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Ss(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Id.displayName=Fd;var Ld=`TabsContent`,Rd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=jd(Ld,n),c=zd(s.baseId,r),l=Bd(s.baseId,r),u=r===s.value,d=Q.useRef(u);return Q.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Z.jsx)(Cs,{present:i||u,children:({present:n})=>(0,Z.jsx)(bs.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Rd.displayName=Ld;function zd(e,t){return`${e}-trigger-${t}`}function Bd(e,t){return`${e}-content-${t}`}var Vd=Md,Hd=Pd,Ud=Id,Wd=Rd;function Gd(){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(Kd),()=>{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 Kd(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function qd(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=i(),{channel:a}=Gd();if(a!==`beta`)return null;let o;t[0]===r?o=t[1]:(o=r({id:`9fhQRL`}),t[0]=r,t[1]=o);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`cSCbv3`}),t[2]=c):c=t[2];let l;return t[3]!==n||t[4]!==o?(l=(0,Z.jsx)(st,{variant:`secondary`,"aria-label":o,"data-testid":`beta-badge`,className:n,children:c}),t[3]=n,t[4]=o,t[5]=l):l=t[5],l}function Jd(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function Yd(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function Xd(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:a,onCloneComplete:o,transport:c,authQueryTransport:l,pickParentFolder:u,initialUrl:d}=e,{_:f}=i(),p;t[0]===c?p=t[1]:(p=c??Du(),t[0]=c,t[1]=p);let m=p,h;t[2]===l?h=t[3]:(h=l??ja(),t[2]=l,t[3]=h);let g=h,_=u!==void 0,[v,y]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(O=za(),t[4]=O):O=t[4];let[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(-1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),B=(0,Q.useId)(),V;t[5]!==n||t[6]!==g?(V=()=>{if(!n)return;let e=!1;return g.status().then(t=>{Zi(t.authenticated),e||A(t.authenticated)}).catch(()=>{e||A(!1)}),()=>{e=!0}},t[5]=n,t[6]=g,t[7]=V):V=t[7];let H;t[8]===n?H=t[9]:(H=[n],t[8]=n,t[9]=H),(0,Q.useEffect)(V,H);let U;t[10]!==k||t[11]!==n||t[12]!==g?(U=()=>{if(!k||!n)return;let e=!1;return D(!0),g.repos().then(t=>{e||(T(t.ok?t.repos:[]),D(!1))}).catch(()=>{e||(T([]),D(!1))}),()=>{e=!0}},t[10]=k,t[11]=n,t[12]=g,t[13]=U):U=t[13];let W;t[14]!==k||t[15]!==n?(W=[k,n],t[14]=k,t[15]=n,t[16]=W):W=t[16],(0,Q.useEffect)(U,W);let G,K;t[17]!==d||t[18]!==n||t[19]!==_?(G=()=>{if(!n||!d||(y(d),_))return;let e=Yd(d);e&&C(`~/Documents/${e}`)},K=[n,d,_],t[17]=d,t[18]=n,t[19]=_,t[20]=G,t[21]=K):(G=t[20],K=t[21]),(0,Q.useEffect)(G,K);let q,J;t[22]!==F||t[23]!==B?(q=()=>{F<0||document.getElementById(`${B}-opt-${F}`)?.scrollIntoView({block:`nearest`})},J=[F,B],t[22]=F,t[23]=B,t[24]=q,t[25]=J):(q=t[24],J=t[25]),(0,Q.useEffect)(q,J);let ee;t[26]===_?ee=t[27]:(ee=function(e){if(y(e),P(!0),I(-1),_)return;let t=Yd(e);t&&C(`~/Documents/${t}`)},t[26]=_,t[27]=ee);let Y=ee,te;t[28]===_?te=t[29]:(te=function(e){if(y(e.clone_url),_)return;let t=e.full_name.split(`/`)[1];C(`~/Documents/${t}`)},t[28]=_,t[29]=te);let ne=te,X;t[30]!==f||t[31]!==x||t[32]!==o||t[33]!==r||t[34]!==u||t[35]!==m||t[36]!==v?(X=async function(){let e=v.trim();if(!e){hs.error(f({id:`FTUGgh`}));return}let t=x||``;if(u){M(!0);let n=await u();if(!n){M(!1);return}let r=Yd(e);t=`${n.replace(/\/$/,``)}/${r}`}else M(!0);let n=hs.loading(f({id:`2tgFCe`}),{duration:1/0});R.current=n;let i=m.start({url:e,dir:t});L.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=f(Jd(i.phase));hs.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){hs.success(f({id:`u_lS4C`}),{id:n}),r(!1),M(!1),L.current=null;let e=`port`in i?i.port:void 0;o?o({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;hs.error(f({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),M(!1),L.current=null;return}t=await e.next()}hs.error(f({id:`Tz9pJB`}),{id:n}),M(!1),L.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),hs.error(f({id:`K9J00P`}),{id:n}),M(!1),L.current=null}},t[30]=f,t[31]=x,t[32]=o,t[33]=r,t[34]=u,t[35]=m,t[36]=v,t[37]=X):X=t[37];let re=X,ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){L.current?.(),L.current=null,M(!1),hs.dismiss(R.current??void 0)},t[38]=ie):ie=t[38];let ae=ie,oe;t[39]!==j||t[40]!==r||t[41]!==_?(oe=function(e){j||(r(e),e||(y(``),_||C(``),P(!1),I(-1)))},t[39]=j,t[40]=r,t[41]=_,t[42]=oe):oe=t[42];let se=oe,ce;t[43]===ne?ce=t[44]:(ce=function(e){ne(e),P(!1),I(-1),z.current?.focus()},t[43]=ne,t[44]=ce);let le=ce,ue=k===null||E&&w===null,de;if(t[45]!==w||t[46]!==v){let e=v.trim().toLowerCase(),n;t[48]===w?n=t[49]:(n=w??[],t[48]=w,t[49]=n),de=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=w,t[46]=v,t[47]=de}else de=t[47];let pe=de,me;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(me=/:\/\/|^git@|\.git$/i,t[50]=me):me=t[50];let he;t[51]===v?he=t[52]:(he=me.test(v.trim()),t[51]=v,t[52]=he);let ge=he,_e=k===!0&&w!==null&&pe.length===0&&!ge,ve=N&&k!==!1&&!j&&(ue||pe.length>0||_e),ye=pe.length,be=`${B}-loading`,xe,Se;t[53]===ye?(xe=t[54],Se=t[55]):(xe=()=>{I(e=>e>=ye?ye-1:e)},Se=[ye],t[53]=ye,t[54]=xe,t[55]=Se),(0,Q.useEffect)(xe,Se);let Ce;t[56]!==F||t[57]!==j||t[58]!==ve||t[59]!==le||t[60]!==pe?(Ce=function(e){if(!j)if(e.key===`ArrowDown`){if(e.preventDefault(),!ve){P(!0);return}I(e=>Math.min(e+1,pe.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),I(nf)):e.key===`Enter`?ve&&F>=0&&F<pe.length&&(e.preventDefault(),le(pe[F])):e.key===`Escape`&&ve&&(e.preventDefault(),e.stopPropagation(),P(!1),I(-1))},t[56]=F,t[57]=j,t[58]=ve,t[59]=le,t[60]=pe,t[61]=Ce):Ce=t[61];let we=Ce,Te;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(Do,{children:(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`VdXv4D`})})}),t[62]=Te):Te=t[62];let Ee;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`IreQBq`})}),t[63]=Ee):Ee=t[63];let De;t[64]!==f||t[65]!==F||t[66]!==j||t[67]!==we||t[68]!==Y||t[69]!==k||t[70]!==B||t[71]!==be||t[72]!==a||t[73]!==ve||t[74]!==ue||t[75]!==w||t[76]!==le||t[77]!==pe||t[78]!==v?(De=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ee,k===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(jo,{id:`clone-source`,placeholder:f({id:`Xv_ijG`}),value:v,onChange:e=>Y(e.target.value),disabled:j}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`9oE4C3`})}),(0,Z.jsx)(ci,{variant:`link`,className:`h-auto p-0`,onClick:()=>a?.(),disabled:j,children:(0,Z.jsx)(s,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(fe,{open:ve,onOpenChange:P,children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(jo,{id:`clone-source`,ref:z,role:`combobox`,"aria-expanded":ve,"aria-controls":ve?ue?be:B:void 0,"aria-activedescendant":F>=0?`${B}-opt-${F}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:f({id:`R0jJzV`}),value:v,onChange:e=>Y(e.target.value),onFocus:()=>P(!0),onKeyDown:we,disabled:j})}),(0,Z.jsx)(b,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:tf,onCloseAutoFocus:ef,onInteractOutside:e=>{z.current?.contains(e.target)&&e.preventDefault()},onWheel:$d,onTouchMove:Qd,children:ue?(0,Z.jsxs)(`output`,{id:be,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":f({id:`8XQRON`}),children:[(0,Z.jsx)(Di,{className:`h-4 w-2/3`}),(0,Z.jsx)(Di,{className:`h-4 w-1/2`}),(0,Z.jsx)(Di,{className:`h-4 w-3/4`}),(0,Z.jsx)(Di,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:B,role:`listbox`,"aria-label":f({id:`KX1MZR`}),className:`py-1`,children:pe.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:w&&w.length===0?(0,Z.jsx)(s,{id:`cOSAfL`}):(0,Z.jsx)(s,{id:`8eW0WQ`})}):pe.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${B}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===F,onMouseDown:Zd,onMouseEnter:()=>I(t),onClick:()=>le(e),className:oi(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===F&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=f,t[65]=F,t[66]=j,t[67]=we,t[68]=Y,t[69]=k,t[70]=B,t[71]=be,t[72]=a,t[73]=ve,t[74]=ue,t[75]=w,t[76]=le,t[77]=pe,t[78]=v,t[79]=De):De=t[79];let Oe;t[80]!==j||t[81]!==x||t[82]!==_?(Oe=!_&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`Gp_twO`})}),(0,Z.jsx)(jo,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:x,onChange:e=>C(e.target.value),disabled:j})]}),t[80]=j,t[81]=x,t[82]=_,t[83]=Oe):Oe=t[83];let ke;t[84]!==De||t[85]!==Oe?(ke=(0,Z.jsx)(To,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[De,Oe]})}),t[84]=De,t[85]=Oe,t[86]=ke):ke=t[86];let Ae;t[87]!==j||t[88]!==re||t[89]!==se||t[90]!==v||t[91]!==_?(Ae=(0,Z.jsx)(Eo,{children:j?(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:ae,children:(0,Z.jsx)(s,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>se(!1),children:(0,Z.jsx)(s,{id:`dEgA5A`})}),(0,Z.jsx)(ci,{onClick:()=>void re(),disabled:!v.trim(),"aria-describedby":_?`clone-picker-hint`:void 0,children:(0,Z.jsx)(s,{id:`9UQ730`})}),_&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(s,{id:`EvPX7f`})})]})}),t[87]=j,t[88]=re,t[89]=se,t[90]=v,t[91]=_,t[92]=Ae):Ae=t[92];let je;t[93]!==ke||t[94]!==Ae?(je=(0,Z.jsxs)(wo,{className:`sm:max-w-lg`,children:[Te,ke,Ae]}),t[93]=ke,t[94]=Ae,t[95]=je):je=t[95];let Me;return t[96]!==se||t[97]!==n||t[98]!==je?(Me=(0,Z.jsx)(Oo,{open:n,onOpenChange:se,children:je}),t[96]=se,t[97]=n,t[98]=je,t[99]=Me):Me=t[99],Me}function Zd(e){return e.preventDefault()}function Qd(e){return e.stopPropagation()}function $d(e){return e.stopPropagation()}function ef(e){return e.preventDefault()}function tf(e){return e.preventDefault()}function nf(e){return Math.max(e-1,-1)}var rf=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-DOf6_QiW.js`),__vite__mapDeps([5,1,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url));function af(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Ys.subscribe,sf,of))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(rf,{})}),e[0]=t):t=e[0],t}function of(){return!1}function sf(){return Ys.getSnapshot()!==null}var cf=180,lf=5e3;function uf(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function df(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function ff(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function pf(e){let t=e instanceof Error?e.message:String(e);for(let e of hr)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function mf(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function hf(e){let t=(0,$.c)(180),{open:n,onOpenChange:r,bridge:a}=e,{_:o}=i(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(Sf),[b,x]=(0,Q.useState)(`shared`),[S,C]=(0,Q.useState)(!1),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w={kind:`idle`},t[0]=w):w=t[0];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(`idle`),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(N={kind:`idle`},t[1]=N):N=t[1];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(0),R;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(R=new Set,t[2]=R):R=t[2];let z=(0,Q.useRef)(R),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(0),W,G;t[3]!==a||t[4]!==n?(W=()=>{if(!n)return;z.current.clear(),M(null),E({kind:`idle`}),O(`idle`),A(!1),_(``),y(new Set(Dr)),x(`shared`),C(!1),F({kind:`idle`}),U.current+=1;let e=!1;p(``),h(!0),a.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(xf).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{H.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},G=[n,a],t[3]=a,t[4]=n,t[5]=W,t[6]=G):(W=t[5],G=t[6]),(0,Q.useEffect)(W,G);let K;t[7]!==a||t[8]!==f||t[9]!==g||t[10]!==n?(K=()=>{if(!n)return;V.current!==null&&clearTimeout(V.current),B.current!==null&&B.current.abort();let e=Kr(g);if(f===``||e===``){E({kind:`idle`}),O(`idle`);return}let t=f,r=uf(t,e),i=new AbortController;return B.current=i,V.current=setTimeout(()=>{O(`in-flight`),Promise.all([a.fs.findEnclosingProjectRoot(t),a.fs.findEnclosingGitRoot(t),a.fs.folderState(r)]).then(n=>{let[r,a,o]=n;i.signal.aborted||(O(`idle`),E(ff({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:a,targetState:o})))}).catch(e=>{i.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),O(`idle`),E({kind:`free`}))})},cf),()=>{V.current!==null&&clearTimeout(V.current),i.abort()}},t[7]=a,t[8]=f,t[9]=g,t[10]=n,t[11]=K):K=t[11];let q;t[12]!==a||t[13]!==f||t[14]!==g||t[15]!==n||t[16]!==I?(q=[n,f,g,a,I],t[12]=a,t[13]=f,t[14]=g,t[15]=n,t[16]=I,t[17]=q):q=t[17],(0,Q.useEffect)(K,q);let J,ee;t[18]===n?(J=t[19],ee=t[20]):(J=()=>{if(!n)return;let e=()=>L(bf);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},ee=[n],t[18]=n,t[19]=J,t[20]=ee),(0,Q.useEffect)(J,ee);let Y=(0,Q.useRef)(`idle`),te,ne;t[21]===D?(te=t[22],ne=t[23]):(te=()=>{Y.current=D},ne=[D],t[21]=D,t[22]=te,t[23]=ne),(0,Q.useEffect)(te,ne);let X,re;t[24]!==T.kind||t[25]!==n?(X=()=>{if(!n||T.kind!==`confirm-git`)return;let e=setInterval(()=>{Y.current!==`in-flight`&&L(yf)},lf);return()=>clearInterval(e)},re=[n,T.kind],t[24]=T.kind,t[25]=n,t[26]=X,t[27]=re):(X=t[26],re=t[27]),(0,Q.useEffect)(X,re);let ie;t[28]!==T.gitRoot||t[29]!==T.kind||t[30]!==P.gitRoot||t[31]!==P.kind?(ie=()=>{if(T.kind!==`confirm-git`){P.kind!==`idle`&&(U.current+=1,F({kind:`idle`}));return}P.kind===`confirming`&&P.gitRoot!==T.gitRoot&&F({kind:`idle`}),P.kind===`pending`&&P.gitRoot!==T.gitRoot&&(U.current+=1,F({kind:`idle`}))},t[28]=T.gitRoot,t[29]=T.kind,t[30]=P.gitRoot,t[31]=P.kind,t[32]=ie):ie=t[32];let ae;t[33]!==T||t[34]!==P?(ae=[T,P],t[33]=T,t[34]=P,t[35]=ae):ae=t[35],(0,Q.useEffect)(ie,ae);let oe;t[36]!==a||t[37]!==T.kind||t[38]!==n?(oe=()=>{if(!n)return;let e=null;T.kind===`block-nested`?e=`nested`:T.kind===`block-nonempty`?e=`nonempty`:T.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(z.current.has(e)||(z.current.add(e),a.project.recordCreateNewBannerShown(e).catch(vf)))},t[36]=a,t[37]=T.kind,t[38]=n,t[39]=oe):oe=t[39];let se;t[40]!==a||t[41]!==T||t[42]!==n?(se=[n,T,a],t[40]=a,t[41]=T,t[42]=n,t[43]=se):se=t[43],(0,Q.useEffect)(oe,se);let ce=g,le,ue,de,fe,pe;t[44]!==T.kind||t[45]!==f||t[46]!==ce?(fe=ce===``?``:Kr(ce),ue=ce!==``&&fe!==ce&&fe!==``,de=ce!==``&&fe===``,le=T.kind===`block-nonempty`,pe=f!==``&&fe!==``?uf(f,fe):``,t[44]=T.kind,t[45]=f,t[46]=ce,t[47]=le,t[48]=ue,t[49]=de,t[50]=fe,t[51]=pe):(le=t[47],ue=t[48],de=t[49],fe=t[50],pe=t[51]);let me=pe,he=!k&&f!==``&&ce!==``&&fe!==``&&D===`idle`&&(T.kind===`free`||T.kind===`confirm-git`),ge=k||ce!==``&&!he,_e;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[52]=_e):_e=t[52];let ve=_e,ye;t[53]!==a||t[54]!==f?(ye=async function(){try{let e=await a.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),L(_f),M(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[53]=a,t[54]=f,t[55]=ye):ye=t[55];let be=ye,xe;t[56]!==o||t[57]!==a||t[58]!==k||t[59]!==he||t[60]!==v||t[61]!==f||t[62]!==r||t[63]!==ce||t[64]!==fe||t[65]!==b?(xe=async function(e){if(e.preventDefault(),!k){if(ce.trim()===``){hs.error(o({id:`5OqaJi`})),H.current?.focus();return}if(he){A(!0),M(null);try{await a.project.createNew({parent:f,name:fe,editors:Array.from(v),sharing:b}),r(!1)}catch(e){M(pf(e)),A(!1)}}}},t[56]=o,t[57]=a,t[58]=k,t[59]=he,t[60]=v,t[61]=f,t[62]=r,t[63]=ce,t[64]=fe,t[65]=b,t[66]=xe):xe=t[66];let Se=xe,Ce;t[67]!==k||t[68]!==r?(Ce=function(e){k||r(e)},t[67]=k,t[68]=r,t[69]=Ce):Ce=t[69];let we=Ce,Te;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Te=async function(e){F({kind:`confirming`,gitRoot:e})},t[70]=Te):Te=t[70];let Ee=Te,De;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(De=async function(){F({kind:`idle`})},t[71]=De):De=t[71];let Oe=De,ke;t[72]===a?ke=t[73]:(ke=async function(e){let t=U.current+1;U.current=t,F({kind:`pending`,gitRoot:e});try{if(await a.fs.removeGitFolder(e),U.current!==t)return;L(gf),F({kind:`idle`})}catch(e){let n=e;if(U.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),F({kind:`error`,message:r})}},t[72]=a,t[73]=ke);let Ae=ke,je;t[74]!==a||t[75]!==r?(je=async function(e){r(!1);try{await a.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[74]=a,t[75]=r,t[76]=je):je=t[76];let Me=je,Ne=de||le||ue?`${u} ${d}`:u,Pe;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`wbv9xO`})}),t[77]=Pe):Pe=t[77];let Fe;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,Z.jsxs)(Do,{children:[Pe,(0,Z.jsx)(So,{children:(0,Z.jsx)(s,{id:`WEzuMq`})})]}),t[78]=Fe):Fe=t[78];let Ie;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(s,{id:`OyIC0Q`}),t[79]=Ie):Ie=t[79];let Le;t[80]===l?Le=t[81]:(Le=(0,Z.jsx)(Bs,{htmlFor:l,children:Ie}),t[80]=l,t[81]=Le);let Re;t[82]===o?Re=t[83]:(Re=o({id:`cV7LOw`}),t[82]=o,t[83]=Re);let ze;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(ze=e=>_(e.target.value),t[84]=ze):ze=t[84];let Be=de||le,Ve;t[85]!==k||t[86]!==g||t[87]!==Ne||t[88]!==l||t[89]!==Re||t[90]!==Be?(Ve=(0,Z.jsx)(jo,{id:l,ref:H,value:g,placeholder:Re,onChange:ze,disabled:k,autoComplete:`off`,"aria-invalid":Be,"aria-describedby":Ne,"data-testid":`create-name`}),t[85]=k,t[86]=g,t[87]=Ne,t[88]=l,t[89]=Re,t[90]=Be,t[91]=Ve):Ve=t[91];let He;t[92]!==d||t[93]!==le||t[94]!==ue||t[95]!==de||t[96]!==fe?(He=de?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(s,{id:`_PBJRl`})}):le?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(s,{id:`7apDiJ`,values:{sanitized:fe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):ue?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(s,{id:`KnoB--`,values:{sanitized:fe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[92]=d,t[93]=le,t[94]=ue,t[95]=de,t[96]=fe,t[97]=He):He=t[97];let Ue;t[98]!==Le||t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Le,Ve,He]}),t[98]=Le,t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Bs,{children:(0,Z.jsx)(s,{id:`wJijgU`})}),t[102]=We):We=t[102];let Ge;t[103]!==f||t[104]!==m?(Ge=f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`8m8diM`})}):f,t[103]=f,t[104]=m,t[105]=Ge):Ge=t[105];let Ke;t[106]===Ge?Ke=t[107]:(Ke=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:Ge}),t[106]=Ge,t[107]=Ke);let qe;t[108]===be?qe=t[109]:(qe=()=>void be(),t[108]=be,t[109]=qe);let Je;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(s,{id:`O2UpM1`}),t[110]=Je):Je=t[110];let Ye;t[111]!==k||t[112]!==qe?(Ye=(0,Z.jsx)(ci,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:k,onClick:qe,"data-testid":`create-browse`,children:Je}),t[111]=k,t[112]=qe,t[113]=Ye):Ye=t[113];let Xe;t[114]!==Ke||t[115]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ke,Ye]}),t[114]=Ke,t[115]=Ye,t[116]=Xe):Xe=t[116];let Ze;t[117]===me?Ze=t[118]:(Ze=me===``?null:(0,Z.jsx)(s,{id:`k_yIIc`,values:{targetPreview:me},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}}),t[117]=me,t[118]=Ze);let Qe;t[119]!==u||t[120]!==Ze?(Qe=(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:Ze}),t[119]=u,t[120]=Ze,t[121]=Qe):Qe=t[121];let $e;t[122]!==Xe||t[123]!==Qe?($e=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[We,Xe,Qe]}),t[122]=Xe,t[123]=Qe,t[124]=$e):$e=t[124];let et;t[125]!==T||t[126]!==Ae||t[127]!==Me||t[128]!==P?(et=(0,Z.jsx)(Cf,{cascade:T,onOpenNested:Me,removeGitState:P,onRequestRemoveGit:Ee,onCancelRemoveGit:Oe,onConfirmRemoveGit:Ae}),t[125]=T,t[126]=Ae,t[127]=Me,t[128]=P,t[129]=et):et=t[129];let tt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsxs)(Po,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(s,{id:`VNgKZz`}),(0,Z.jsx)(No,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[130]=tt):tt=t[130];let nt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`0YEbfk`})}),t[131]=nt):nt=t[131];let rt;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`prHfed`})}),t[132]=rt):rt=t[132];let it;t[133]!==k||t[134]!==v?(it=Dr.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(Bs,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Vs,{id:t,checked:v.has(e),onCheckedChange:()=>ve(e),disabled:k,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:qn[e]})]},e)}),t[133]=k,t[134]=v,t[135]=it):it=t[135];let at;t[136]===it?at=t[137]:(at=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[nt,rt,it]}),t[136]=it,t[137]=at);let ot;t[138]!==k||t[139]!==b?(ot=(0,Z.jsx)(Zs,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:b,onValueChange:x,disabled:k}),t[138]=k,t[139]=b,t[140]=ot):ot=t[140];let st;t[141]!==at||t[142]!==ot?(st=(0,Z.jsxs)(Mo,{className:`space-y-6 border-t border-border px-3 py-4`,children:[at,ot]}),t[141]=at,t[142]=ot,t[143]=st):st=t[143];let ct;t[144]!==S||t[145]!==st?(ct=(0,Z.jsxs)(Fo,{open:S,onOpenChange:C,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[tt,st]}),t[144]=S,t[145]=st,t[146]=ct):ct=t[146];let lt;t[147]!==o||t[148]!==j?(lt=j===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:o(mf(j))}),t[147]=o,t[148]=j,t[149]=lt):lt=t[149];let ut;t[150]!==c||t[151]!==Se||t[152]!==Ue||t[153]!==$e||t[154]!==et||t[155]!==ct||t[156]!==lt?(ut=(0,Z.jsx)(To,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:Se,"data-testid":`create-project-form`,className:`space-y-6`,children:[Ue,$e,et,ct,lt]})}),t[150]=c,t[151]=Se,t[152]=Ue,t[153]=$e,t[154]=et,t[155]=ct,t[156]=lt,t[157]=ut):ut=t[157];let dt;t[158]===r?dt=t[159]:(dt=()=>r(!1),t[158]=r,t[159]=dt);let ft;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(s,{id:`dEgA5A`}),t[160]=ft):ft=t[160];let pt;t[161]!==k||t[162]!==dt?(pt=(0,Z.jsx)(ci,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:dt,disabled:k,"data-testid":`create-cancel`,children:ft}),t[161]=k,t[162]=dt,t[163]=pt):pt=t[163];let mt;t[164]===k?mt=t[165]:(mt=k?(0,Z.jsx)(s,{id:`E9bKSA`}):(0,Z.jsx)(s,{id:`hYgDIe`}),t[164]=k,t[165]=mt);let ht;t[166]!==c||t[167]!==ge||t[168]!==mt?(ht=(0,Z.jsx)(ci,{type:`submit`,form:c,disabled:ge,"data-testid":`create-submit`,children:mt}),t[166]=c,t[167]=ge,t[168]=mt,t[169]=ht):ht=t[169];let gt;t[170]!==pt||t[171]!==ht?(gt=(0,Z.jsxs)(Eo,{children:[pt,ht]}),t[170]=pt,t[171]=ht,t[172]=gt):gt=t[172];let _t;t[173]!==ut||t[174]!==gt?(_t=(0,Z.jsxs)(wo,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[Fe,ut,gt]}),t[173]=ut,t[174]=gt,t[175]=_t):_t=t[175];let vt;return t[176]!==we||t[177]!==n||t[178]!==_t?(vt=(0,Z.jsx)(Oo,{open:n,onOpenChange:we,children:_t}),t[176]=we,t[177]=n,t[178]=_t,t[179]=vt):vt=t[179],vt}function gf(e){return e+1}function _f(e){return e+1}function vf(){}function yf(e){return e+1}function bf(e){return e+1}function xf(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Sf(){return new Set(Dr)}function Cf(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:c}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=df(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(s,{id:`aIgBKf`,values:o,components:c})}),t[5]=o,t[6]=l);let u;t[7]!==r||t[8]!==e?(u=()=>r(e),t[7]=r,t[8]=e,t[9]=u):u=t[9];let d;t[10]===a?d=t[11]:(d=(0,Z.jsx)(s,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,Z.jsx)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:u,"data-testid":`create-banner-nested-open`,children:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let l=`${r}/.git`,u=i.kind===`error`?i.message:null,d;t[21]===e?d=t[22]:(d={gitRoot:e},t[21]=e,t[22]=d);let f;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(f={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=f):f=t[23];let p;t[24]===d?p=t[25]:(p=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(s,{id:`5o4lc1`,values:d,components:f})}),t[24]=d,t[25]=p);let m;t[26]!==e||t[27]!==o||t[28]!==c||t[29]!==a||t[30]!==u||t[31]!==i.kind||t[32]!==l?(m=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(s,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(s,{id:`SkMZlS`,values:{targetGitPath:l,removeGitError:u},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(s,{id:`WZ-vBy`,values:{targetGitPath:l},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>c(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(s,{id:`0-31GV`}):(0,Z.jsx)(s,{id:`v-h2hx`,values:{targetGitPath:l}})}),(0,Z.jsx)(ci,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(s,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=c,t[29]=a,t[30]=u,t[31]=i.kind,t[32]=l,t[33]=m):m=t[33];let h;return t[34]!==p||t[35]!==m?(h=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[p,m]}),t[34]=p,t[35]=m,t[36]=h):h=t[36],h}return null}function wf(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),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 Tf(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Open Knowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`Open Knowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var Ef=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-stteh15-.js`),__vite__mapDeps([17,1,6,7,8,9,10,11,18]),import.meta.url));function Df(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Qs.subscribe,kf,Of))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Ef,{})}),e[0]=t):t=e[0],t}function Of(){return!1}function kf(){return Qs.getSnapshot()!==null}var Af=new Set([`main`,`master`]);function jf(e){let t=(0,$.c)(19),{owner:n,repo:r,path:i,branch:a,kind:o,testId:c,branchTestId:l}=e,u=o===void 0?`doc`:o,d;t[0]===a?d=t[1]:(d=a!==``&&!Af.has(a),t[0]=a,t[1]=d);let f=d,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(s,{id:`IreQBq`}),t[2]=p):p=t[2];let m;t[3]!==n||t[4]!==r?(m=(0,Z.jsx)(Mf,{label:p,children:(0,Z.jsxs)(`span`,{children:[n,`/`,r]})}),t[3]=n,t[4]=r,t[5]=m):m=t[5];let h;t[6]!==u||t[7]!==i||t[8]!==c?(h=i?(0,Z.jsx)(Mf,{label:u===`folder`?(0,Z.jsx)(s,{id:`kNqMMd`}):(0,Z.jsx)(s,{id:`J2eKUI`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,"data-testid":`${c}-target`,children:i})}):null,t[6]=u,t[7]=i,t[8]=c,t[9]=h):h=t[9];let g;t[10]!==a||t[11]!==l||t[12]!==f?(g=f?(0,Z.jsx)(Mf,{label:(0,Z.jsx)(s,{id:`ssuwjF`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,"data-testid":l,children:a})}):null,t[10]=a,t[11]=l,t[12]=f,t[13]=g):g=t[13];let _;return t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==c?(_=(0,Z.jsxs)(`dl`,{className:`space-y-2 text-1sm text-muted-foreground`,"data-testid":c,children:[m,h,g]}),t[14]=m,t[15]=h,t[16]=g,t[17]=c,t[18]=_):_=t[18],_}function Mf(e){let t=(0,$.c)(7),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`dt`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-xs`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`dd`,{className:`min-w-0 flex-1 break-all text-foreground`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var Nf=e=>({phase:`ready`,seed:e});function Pf(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function Ff(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function If(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function Lf(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}function Rf(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){if(t)return n?r??void 0:(n=!0,r=t.onShareReceived(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var zf=Rf();function Bf(e){return zf.install(e)}function Vf(e){return e!==null&&e.kind===`launcher-consent`}function Hf(e){return e!==null&&e.kind===`launcher-miss`}function Uf(e){let t=(0,$.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?zf:i,o=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,Gf),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(o);o!==l&&(u(o),c(Wf));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=Su(o);e&&(hs.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,Q.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=Hf(o)?o:null,t[4]=o,t[5]=p);let m=p,h;t[6]===o?h=t[7]:(h=Vf(o)?o:null,t[6]=o,t[7]=h);let g=h??m;if(!g)return null;let _;return t[8]!==g||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(_=(0,Z.jsx)(Kf,{payload:g,bridge:n,cloneController:r,store:a},s),t[8]=g,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=_):_=t[13],_}function Wf(e){return e+1}function Gf(){return null}function Kf(e){let t=(0,$.c)(169),{payload:n,bridge:r,cloneController:a,store:o}=e,{_:c}=i(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T,E;t[0]===y?(T=t[1],E=t[2]):(T=()=>{y&&w.current?.focus()},E=[y],t[0]=y,t[1]=T,t[2]=E),(0,Q.useEffect)(T,E);let D;t[3]!==x||t[4]!==n?(D=()=>{Vf(n)&&x===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),S(Nf({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=x,t[4]=n,t[5]=D):D=t[5];let O;t[6]===n?O=t[7]:(O=[n],t[6]=n,t[7]=O),(0,Q.useEffect)(D,O);let k;t[8]!==d||t[9]!==a||t[10]!==n?(k=()=>{a&&Hf(n)&&d===null&&(C.current||(C.current=!0,g(!0),a.getAuthStatus().then(e=>{f(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),f({authenticated:!1,host:`github.com`})}).finally(()=>{g(!1)})))},t[8]=d,t[9]=a,t[10]=n,t[11]=k):k=t[11];let A;t[12]!==d||t[13]!==n?(A=[n,d],t[12]=d,t[13]=n,t[14]=A):A=t[14],(0,Q.useEffect)(k,A);let j=Hf(n)?n:null,M=Vf(n)?n:null,N=j?.share??M?.share??null,P,F,I,L,R,z,B,V,H,U;if(t[15]!==c||t[16]!==m||t[17]!==r||t[18]!==a||t[19]!==_||t[20]!==x||t[21]!==j||t[22]!==l||t[23]!==N||t[24]!==o){H=Symbol.for(`react.early_return_sentinel`);bb0:{let e=N?{owner:N.owner,repo:N.repo}:null,n;t[35]!==c||t[36]!==N?.target.kind?(n=N?.target.kind===`folder`?c({id:`ugoTXs`}):c({id:`XH30C4`}),t[35]=c,t[36]=N?.target.kind,t[37]=n):n=t[37],U=n,I=async function(){if(!j||!e)return;if(console.log(wu({q2_path:`clone`})),!a){hs.info(c({id:`27XW26`}),{action:{label:c({id:`B3NAZC`}),onClick:()=>{r.navigator.open()}},duration:8e3});return}if(_)return;b(null),v(!0);let t=bu(e),n;try{n=await a.runClone({url:t,branch:j.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),v(!1),b({detail:t instanceof Error?t.message:String(t)});return}if(v(!1),n.kind===`error`){b({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:j.share.target.kind,path:p(j.share.target)}}),o.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),hs.error(c({id:`438Fca`}))}return}};let i;t[38]!==c||t[39]!==m||t[40]!==a?(i=async function(){if(!(!a||m)){g(!0);try{let e=await a.startSignIn();g(!1),e!==null&&f(e)}catch(e){let t=e;g(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),hs.error(c({id:`lzwo7p`}))}}},t[38]=c,t[39]=m,t[40]=a,t[41]=i):i=t[41],R=i,L=async function(){if(!(!j||!e||l)){b(null),u(!0),console.log(wu({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(wu({folder_validate:n.kind})),n.kind===`ok`){let e=j.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=ri(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:j.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:j.share.target.kind,path:p(j.share.target)}}}),o.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),hs.error(c({id:`phM8Kh`}))}break}let i=xu(n,e);i&&hs.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),hs.error(c({id:`rlUzXK`}))}u(!1)}};let d;t[42]!==c||t[43]!==r||t[44]!==x||t[45]!==o?(d=function(){if(x===null||x.phase!==`ready`)return;let e=x.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),S(Zf),r.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){S(e=>e===null?e:Ff(e,{ok:!0,projectPath:t.projectPath}));try{await r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),S(Xf),o.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);S(e=>e===null?e:If(e,{ok:!1,message:r})),hs.error(c({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,i=t.message||`Initialization failed.`;S(e=>e===null?e:Ff(e,{ok:!1,reason:n,message:i})),hs.error(i)}).catch(t=>{let n=t instanceof Error?t.message:String(t);S(e=>e===null?e:Ff(e,{ok:!1,reason:`network-error`,message:n})),hs.error(c({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[42]=c,t[43]=r,t[44]=x,t[45]=o,t[46]=d):d=t[46];let y=d,C;t[47]!==x||t[48]!==o?(C=function(){x!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${x.seed.candidatePath}`),S(Yf),o.dismiss()},t[47]=x,t[48]=o,t[49]=C):C=t[49];let w=C;if(x!==null&&x.phase!==`cancelled`&&x.phase!==`done`&&N!==null){let e=x.seed,n=x.phase===`initializing`||x.phase===`opening`,r;t[50]===w?r=t[51]:(r=e=>{e||w()},t[50]=w,t[51]=r);let i;t[52]===U?i=t[53]:(i=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:U}})}),t[52]=U,t[53]=i);let a;t[54]===N.target?a=t[55]:(a=p(N.target)?`— ${p(N.target)}`:``,t[54]=N.target,t[55]=a);let o;t[56]!==N.owner||t[57]!==N.repo||t[58]!==a?(o=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`pgq_xf`,values:{0:N.owner,1:N.repo,2:a}})}),t[56]=N.owner,t[57]=N.repo,t[58]=a,t[59]=o):o=t[59];let c=N.owner,l=N.repo,u;t[60]===N.target?u=t[61]:(u=p(N.target),t[60]=N.target,t[61]=u);let d;t[62]!==N.branch||t[63]!==N.owner||t[64]!==N.repo||t[65]!==N.target.kind||t[66]!==u?(d=(0,Z.jsx)(jf,{owner:c,repo:l,path:u,kind:N.target.kind,branch:N.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[62]=N.branch,t[63]=N.owner,t[64]=N.repo,t[65]=N.target.kind,t[66]=u,t[67]=d):d=t[67];let f;t[68]!==i||t[69]!==o||t[70]!==d?(f=(0,Z.jsxs)(Do,{children:[i,o,d]}),t[68]=i,t[69]=o,t[70]=d,t[71]=f):f=t[71];let m;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`KsAPaB`})}),t[72]=m):m=t[72];let g;t[73]===e.candidatePath?g=t[74]:(g=(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[73]=e.candidatePath,t[74]=g);let _;t[75]===e.parentProjectName?_=t[76]:(_=e.parentProjectName===null?null:(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,Z.jsx)(s,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[75]=e.parentProjectName,t[76]=_);let v;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-Q7TT9`})}),t[77]=v):v=t[77];let b;t[78]!==x.message||t[79]!==x.phase?(b=x.phase===`error`?(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:x.message}):null,t[78]=x.message,t[79]=x.phase,t[80]=b):b=t[80];let S;t[81]!==g||t[82]!==_||t[83]!==b?(S=(0,Z.jsxs)(To,{children:[m,g,_,v,b]}),t[81]=g,t[82]=_,t[83]=b,t[84]=S):S=t[84];let C;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(s,{id:`dEgA5A`}),t[85]=C):C=t[85];let T;t[86]===w?T=t[87]:(T=(0,Z.jsx)(ci,{variant:`ghost`,onClick:w,"data-testid":`share-receive-consent-cancel`,children:C}),t[86]=w,t[87]=T);let E=n||x.phase===`error`,D=n||x.phase===`error`,O;t[88]===n?O=t[89]:(O=n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`NKkZXl`})]}):(0,Z.jsx)(s,{id:`NKkZXl`}),t[88]=n,t[89]=O);let k;t[90]!==y||t[91]!==E||t[92]!==D||t[93]!==O?(k=(0,Z.jsx)(ci,{onClick:y,disabled:E,"aria-disabled":D,"data-testid":`share-receive-consent-initialize`,children:O}),t[90]=y,t[91]=E,t[92]=D,t[93]=O,t[94]=k):k=t[94];let A;t[95]!==T||t[96]!==k?(A=(0,Z.jsxs)(Eo,{children:[T,k]}),t[95]=T,t[96]=k,t[97]=A):A=t[97];let j;t[98]!==f||t[99]!==S||t[100]!==A?(j=(0,Z.jsxs)(wo,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:Jf,onPointerDownOutside:qf,children:[f,S,A]}),t[98]=f,t[99]=S,t[100]=A,t[101]=j):j=t[101];let M;t[102]!==r||t[103]!==j?(M=(0,Z.jsx)(Oo,{open:!0,onOpenChange:r,children:j}),t[102]=r,t[103]=j,t[104]=M):M=t[104],H=M;break bb0}if(!j||!N||!e){H=null;break bb0}P=a!==void 0&&!_;let T;t[105]!==c||t[106]!==_?(T=c(_?{id:`YjhKI5`}:{id:`LE7t79`}),t[105]=c,t[106]=_,t[107]=T):T=t[107],F=T,z=N.owner,B=N.repo,V=Gn(e)}t[15]=c,t[16]=m,t[17]=r,t[18]=a,t[19]=_,t[20]=x,t[21]=j,t[22]=l,t[23]=N,t[24]=o,t[25]=P,t[26]=F,t[27]=I,t[28]=L,t[29]=R,t[30]=z,t[31]=B,t[32]=V,t[33]=H,t[34]=U}else P=t[25],F=t[26],I=t[27],L=t[28],R=t[29],z=t[30],B=t[31],V=t[32],H=t[33],U=t[34];if(H!==Symbol.for(`react.early_return_sentinel`))return H;let W=V,G=d?.authenticated?d.login:void 0,K;t[108]===y?K=t[109]:(K=y?.detail?Cu(y.detail):``,t[108]=y,t[109]=K);let q=K,J;t[110]===o?J=t[111]:(J=e=>{e||o.dismiss()},t[110]=o,t[111]=J);let ee;t[112]===U?ee=t[113]:(ee=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:U}})}),t[112]=U,t[113]=ee);let Y;t[114]===N.target?Y=t[115]:(Y=p(N.target)?` — ${p(N.target)}`:null,t[114]=N.target,t[115]=Y);let te;t[116]!==N.owner||t[117]!==N.repo||t[118]!==Y?(te=(0,Z.jsxs)(So,{className:`sr-only`,children:[N.owner,`/`,N.repo,Y]}),t[116]=N.owner,t[117]=N.repo,t[118]=Y,t[119]=te):te=t[119];let ne=N.owner,X=N.repo,re;t[120]===N.target?re=t[121]:(re=p(N.target),t[120]=N.target,t[121]=re);let ie;t[122]!==N.branch||t[123]!==N.owner||t[124]!==N.repo||t[125]!==N.target.kind||t[126]!==re?(ie=(0,Z.jsx)(jf,{owner:ne,repo:X,path:re,kind:N.target.kind,branch:N.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[122]=N.branch,t[123]=N.owner,t[124]=N.repo,t[125]=N.target.kind,t[126]=re,t[127]=ie):ie=t[127];let ae;t[128]!==ee||t[129]!==te||t[130]!==ie?(ae=(0,Z.jsxs)(Do,{children:[ee,te,ie]}),t[128]=ee,t[129]=te,t[130]=ie,t[131]=ae):ae=t[131];let oe;t[132]!==a||t[133]!==P||t[134]!==y||t[135]!==q||t[136]!==F||t[137]!==_||t[138]!==I||t[139]!==L||t[140]!==l||t[141]!==z||t[142]!==B?(oe=y?(0,Z.jsxs)(`div`,{ref:w,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,Z.jsx)(s,{id:`aiArms`})}),q?(0,Z.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,Z.jsx)(s,{id:`4BITzH`}),` `,(0,Z.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,q,`"`]})]}):null,(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Llyqvo`})}),(0,Z.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(s,{id:`6LbUG7`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(s,{id:`_pY_Vq`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(s,{id:`J6mxC1`})})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Z.jsx)(ci,{onClick:()=>{I()},"data-testid":`share-receive-clone-retry`,children:(0,Z.jsx)(s,{id:`KDw4GX`})}),(0,Z.jsx)(ci,{variant:`outline`,onClick:()=>{L()},disabled:l||_,"data-testid":`share-receive-error-local`,children:(0,Z.jsx)(s,{id:`xFQRu4`})})]})]}):(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border-2 border-primary/40 bg-card p-4 text-left transition hover:border-primary hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/40 disabled:hover:bg-card`,onClick:()=>{I()},disabled:a!==void 0&&!P,"aria-disabled":a!==void 0&&!P,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:F}),(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`jGJy-9`,values:{shareOwner:z,shareRepo:B}})})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{L()},disabled:l||_,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,Z.jsx)(s,{id:`HfI1dR`})}),(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_qD6mn`})})]})]}),t[132]=a,t[133]=P,t[134]=y,t[135]=q,t[136]=F,t[137]=_,t[138]=I,t[139]=L,t[140]=l,t[141]=z,t[142]=B,t[143]=oe):oe=t[143];let se;t[144]!==m||t[145]!==d||t[146]!==a||t[147]!==R||t[148]!==G?(se=a?(0,Z.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:d===null?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`UDFrWm`})}):d.authenticated?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`VAHWL_`,values:{signedInLogin:G},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`SgKLfA`})}),(0,Z.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{R()},disabled:m,children:m?(0,Z.jsx)(s,{id:`PKLY-1`}):(0,Z.jsx)(s,{id:`3jod3l`})})]})}):null,t[144]=m,t[145]=d,t[146]=a,t[147]=R,t[148]=G,t[149]=se):se=t[149];let ce;t[150]!==y||t[151]!==W?(ce=y?null:(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`RJ3a8Z`,values:{lookingForUrl:W},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[150]=y,t[151]=W,t[152]=ce):ce=t[152];let le;t[153]!==oe||t[154]!==se||t[155]!==ce?(le=(0,Z.jsxs)(To,{children:[oe,se,ce]}),t[153]=oe,t[154]=se,t[155]=ce,t[156]=le):le=t[156];let ue;t[157]===o?ue=t[158]:(ue=()=>o.dismiss(),t[157]=o,t[158]=ue);let de;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(s,{id:`dEgA5A`}),t[159]=de):de=t[159];let fe;t[160]===ue?fe=t[161]:(fe=(0,Z.jsx)(Eo,{children:(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:ue,children:de})}),t[160]=ue,t[161]=fe);let pe;t[162]!==ae||t[163]!==le||t[164]!==fe?(pe=(0,Z.jsxs)(wo,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[ae,le,fe]}),t[162]=ae,t[163]=le,t[164]=fe,t[165]=pe):pe=t[165];let me;return t[166]!==J||t[167]!==pe?(me=(0,Z.jsx)(Oo,{open:!0,onOpenChange:J,children:pe}),t[166]=J,t[167]=pe,t[168]=me):me=t[168],me}function qf(e){return e.preventDefault()}function Jf(e){return e.preventDefault()}function Yf(e){return e===null?e:Lf(e)}function Xf(e){return e===null?e:If(e,{ok:!0})}function Zf(e){return e===null?e:Pf(e)}var Qf=(e,t,n)=>vu(e,t,n,`NavigatorApp`);function $f(e,t){return e.filter(e=>e.path!==t)}function ep(e){let t=(0,$.c)(116),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=new Map,t[1]=c):c=t[1];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),E=typeof window<`u`&&window.okDesktop!=null,[D,O]=(0,Q.useState)(`auth`),{theme:k}=Nr(),{_:A}=i();it(n,k??`system`);let j;t[2]!==A||t[3]!==n.project?(j=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;o(t);let r=t.filter(tp),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||u(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||m(t instanceof Error?t.message:A({id:`fYKgzG`}))}).finally(()=>{e||f(!1)}),()=>{e=!0}},t[2]=A,t[3]=n.project,t[4]=j):j=t[4];let M;t[5]!==A||t[6]!==n?(M=[n,A],t[5]=A,t[6]=n,t[7]=M):M=t[7],(0,Q.useEffect)(j,M);let N,P;t[8]===n?(N=t[9],P=t[10]):(N=()=>n.onMenuAction(e=>{e===`new-project`&&y(!0),e===`close-active-tab-or-window`&&window.close()}),P=[n],t[8]=n,t[9]=N,t[10]=P),(0,Q.useEffect)(N,P);let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=(e,t)=>Qf(e,t,m),t[11]=F):F=t[11];let I=F,L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>_(!0),t[12]=L):L=t[12];let R=L,z;t[13]!==A||t[14]!==n?(z=()=>I(async()=>{let e=await n.dialog.openFolder();e&&await ip(n,e,`pick-existing`)},A({id:`gmJ0An`})),t[13]=A,t[14]=n,t[15]=z):z=t[15];let B=z,H;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>y(!0),t[16]=H):H=t[16];let U=H,W;t[17]!==A||t[18]!==n?(W=e=>I(async()=>{await ip(n,e,`recents`)},A({id:`SUOoXn`})),t[17]=A,t[18]=n,t[19]=W):W=t[19];let G=W,K;t[20]!==A||t[21]!==n.project?(K=e=>I(async()=>{await n.project.removeRecent(e),o(t=>$f(t,e)),u(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},A({id:`viwC-K`})),t[20]=A,t[21]=n.project,t[22]=K):K=t[22];let q=K,J;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${E?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":E?``:void 0,"data-testid":`nav-chrome-row`}),t[23]=J):J=t[23];let ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Tf,{className:`size-12 shrink-0`}),t[24]=ee):ee=t[24];let Y;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),(0,Z.jsx)(qd,{})]}),t[25]=Y):Y=t[25];let te;t[26]===n.appVersion?te=t[27]:(te=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[ee,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[Y,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[26]=n.appVersion,t[27]=te);let ne;t[28]===A?ne=t[29]:(ne=A({id:`wbv9xO`}),t[28]=A,t[29]=ne);let X;t[30]===A?X=t[31]:(X=A({id:`fRv-ei`}),t[30]=A,t[31]=X);let ie;t[32]!==ne||t[33]!==X?(ie=(0,Z.jsx)(np,{title:ne,description:X,onClick:U,dataTestId:`nav-create-new`,Icon:V}),t[32]=ne,t[33]=X,t[34]=ie):ie=t[34];let ae;t[35]===A?ae=t[36]:(ae=A({id:`WPwDin`}),t[35]=A,t[36]=ae);let oe;t[37]===A?oe=t[38]:(oe=A({id:`tUvUfp`}),t[37]=A,t[38]=oe);let se;t[39]!==B||t[40]!==ae||t[41]!==oe?(se=(0,Z.jsx)(np,{title:ae,description:oe,onClick:B,dataTestId:`nav-open`,Icon:re}),t[39]=B,t[40]=ae,t[41]=oe,t[42]=se):se=t[42];let ce;t[43]===A?ce=t[44]:(ce=A({id:`VdXv4D`}),t[43]=A,t[44]=ce);let le;t[45]===A?le=t[46]:(le=A({id:`JOcPqH`}),t[45]=A,t[46]=le);let ue;t[47]!==ce||t[48]!==le?(ue=(0,Z.jsx)(np,{title:ce,description:le,onClick:R,dataTestId:`nav-clone`,Icon:wf}),t[47]=ce,t[48]=le,t[49]=ue):ue=t[49];let de;t[50]!==ie||t[51]!==se||t[52]!==ue?(de=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[ie,se,ue]}),t[50]=ie,t[51]=se,t[52]=ue,t[53]=de):de=t[53];let fe;t[54]===p?fe=t[55]:(fe=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(ci,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(s,{id:`1QfxQT`})})]}),t[54]=p,t[55]=fe);let pe;t[56]!==d||t[57]!==G||t[58]!==q||t[59]!==l||t[60]!==a?(pe=d?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(h,{className:`size-4 animate-spin text-muted-foreground/60`})}):a.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(s,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:a.map(e=>(0,Z.jsx)(rp,{project:e,branch:l.get(e.path)??null,onOpen:()=>G(e.path),onRemove:()=>q(e.path)},e.path))})]}):null,t[56]=d,t[57]=G,t[58]=q,t[59]=l,t[60]=a,t[61]=pe):pe=t[61];let me;t[62]!==te||t[63]!==de||t[64]!==fe||t[65]!==pe?(me=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[te,de,fe,pe]})}),t[62]=te,t[63]=de,t[64]=fe,t[65]=pe,t[66]=me):me=t[66];let he,ge;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Df,{}),ge=(0,Z.jsx)(af,{}),t[67]=he,t[68]=ge):(he=t[67],ge=t[68]);let _e;t[69]!==n||t[70]!==v?(_e=(0,Z.jsx)(hf,{open:v,onOpenChange:y,bridge:n}),t[69]=n,t[70]=v,t[71]=_e):_e=t[71];let ve;t[72]===w?ve=t[73]:(ve=e=>{x(e),e||(C(!1),w&&(w(null),T(null)))},t[72]=w,t[73]=ve);let ye;t[74]===n?ye=t[75]:(ye=aa(n),t[74]=n,t[75]=ye);let be;t[76]===n?be=t[77]:(be=io(n),t[76]=n,t[77]=be);let xe=D===`identity`,Se;t[78]!==S||t[79]!==w?(Se=e=>{x(!1),S&&(C(!1),_(!0)),w&&(w({authenticated:!0,host:`github.com`,login:e.login}),T(null))},t[78]=S,t[79]=w,t[80]=Se):Se=t[80];let Ce;t[81]!==b||t[82]!==ve||t[83]!==ye||t[84]!==be||t[85]!==xe||t[86]!==Se?(Ce=(0,Z.jsx)($i,{open:b,onOpenChange:ve,transport:ye,queryTransport:be,identityPrompt:xe,onSuccess:Se}),t[81]=b,t[82]=ve,t[83]=ye,t[84]=be,t[85]=xe,t[86]=Se,t[87]=Ce):Ce=t[87];let we;t[88]===n?we=t[89]:(we=Ou(n),t[88]=n,t[89]=we);let Te;t[90]===n?Te=t[91]:(Te=io(n),t[90]=n,t[91]=Te);let Ee;t[92]===n.dialog?Ee=t[93]:(Ee=()=>n.dialog.openFolder(),t[92]=n.dialog,t[93]=Ee);let De;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{_(!1),O(`auth`),C(!0),x(!0)},t[94]=De):De=t[94];let Oe;t[95]!==A||t[96]!==n?(Oe=e=>{let{dir:t}=e;I(()=>ip(n,t,`pick-existing`),A({id:`iSnkwB`}))},t[95]=A,t[96]=n,t[97]=Oe):Oe=t[97];let ke;t[98]!==g||t[99]!==we||t[100]!==Te||t[101]!==Ee||t[102]!==Oe?(ke=(0,Z.jsx)(Xd,{open:g,onOpenChange:_,transport:we,authQueryTransport:Te,pickParentFolder:Ee,onSignIn:De,onCloneComplete:Oe}),t[98]=g,t[99]=we,t[100]=Te,t[101]=Ee,t[102]=Oe,t[103]=ke):ke=t[103];let Ae;if(t[104]!==n){let e;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{T(()=>e),x(!0)}),t[106]=e):e=t[106],Ae=Eu({bridge:n,authQueryTransport:io(n),cloneTransport:Ou(n),openSignIn:e}),t[104]=n,t[105]=Ae}else Ae=t[105];let je;t[107]!==n||t[108]!==Ae?(je=(0,Z.jsx)(Uf,{bridge:n,cloneController:Ae}),t[107]=n,t[108]=Ae,t[109]=je):je=t[109];let Me;return t[110]!==me||t[111]!==_e||t[112]!==Ce||t[113]!==ke||t[114]!==je?(Me=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[J,me,he,ge,_e,Ce,ke,je]}),t[110]=me,t[111]=_e,t[112]=Ce,t[113]=ke,t[114]=je,t[115]=Me):Me=t[115],Me}function tp(e){return!e.missing}function np(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function rp(e){let t=(0,$.c)(33),{project:n,branch:r,onOpen:a,onRemove:o}=e,{_:c}=i(),{name:l}=n,u=n.missing,d=n.missing&&`opacity-50`,f;t[0]===d?f=t[1]:(f=oi(`h-auto min-w-0 flex-1 justify-between gap-2 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,d),t[0]=d,t[1]=f);let p;t[2]===n.name?p=t[3]:(p=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[2]=n.name,t[3]=p);let m;t[4]===n.path?m=t[5]:(m=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[4]=n.path,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]!==r||t[10]!==n.missing||t[11]!==n.path?(g=n.missing?(0,Z.jsx)(st,{className:`text-2xs rounded-sm`,variant:`warning`,children:(0,Z.jsx)(s,{id:`VU3Nrn`})}):r===null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:r})]}),t[9]=r,t[10]=n.missing,t[11]=n.path,t[12]=g):g=t[12];let _;t[13]!==a||t[14]!==n.missing||t[15]!==f||t[16]!==h||t[17]!==g?(_=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,onClick:a,disabled:u,className:f,children:[h,g]}),t[13]=a,t[14]=n.missing,t[15]=f,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==c||t[20]!==l?(v=c({id:`hDoLrm`,values:{projectName:l}}),t[19]=c,t[20]=l,t[21]=v):v=t[21];let y;t[22]===c?y=t[23]:(y=c({id:`Es-eZU`}),t[22]=c,t[23]=y);let b=`nav-recent-remove-${n.path}`,x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[24]=x):x=t[24];let S;t[25]!==o||t[26]!==y||t[27]!==b||t[28]!==v?(S=(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:o,"aria-label":v,title:y,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":b,children:x}),t[25]=o,t[26]=y,t[27]=b,t[28]=v,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==_?(C=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[_,S]}),t[30]=S,t[31]=_,t[32]=C):C=t[32],C}async function ip(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var ap=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Nr(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Ho,{className:`size-4`}),info:(0,Z.jsx)(Ao,{className:`size-4`}),warning:(0,Z.jsx)(Lo,{className:`size-4`}),error:(0,Z.jsx)(Rl,{className:`size-4`}),loading:(0,Z.jsx)(h,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(_s,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},op=Symbol.for(`ok.client.fetchWrapper`);function sp(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[op])return;let n=window.fetch.bind(window),r=Ht(),i=((e,i)=>{let a=lp(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=cp(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=cp(i?.headers,r);return n(a.url,{...i,headers:o})});i[op]=!0,window.fetch=i}function cp(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function lp(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=up(e);return n&&dp(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:up(e.url,window.location.origin);if(n&&dp(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function up(e,t){try{return new URL(e,t)}catch{return null}}function dp(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=up(t);if(n&&e.origin===n.origin)return!0}return!1}var fp={messages:JSON.parse(`{"-3Qbv7":[["count","plural",{"one":["matches ","#"," file"],"other":["matches ","#"," files"]}]],"-3ois8":["Hard break"],"-8PP0T":["Match case"],"-K0AvT":["Disconnect"],"-KCZ6n":["Mark a block as the source of truth. Mirror references elsewhere render this content read-only and update live as you edit here."],"-LHLx7":["edited template"],"-Q7TT9":["That folder isn't an Open Knowledge project yet. Initialize it and open?"],"-QCLWk":["Templates available"],"-Qw-1t":["GitHub authentication failed. Try signing in again."],"-RXIMO":["Couldn't read the selection — please try again."],"-YV1Uo":["Pattern ",["patternNumber"]],"-g6KIS":["Unrecognized link"],"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"-i7ik4":["Collapse burst ",["burstNumber"]," diff"],"-lCAuQ":["Loading graph"],"-q4abP":["Results capped — this workspace has more files than search can index. A missing file may be a cap artifact, not a typo."],"-slrNR":["Toggle a task list."],"-wePNM":["Search matches file names, paths, and folders. Open a file to search its body (⌘F)."],"0-31GV":["Removing"],"02P3hL":["Upload failed: ",["message"]],"04RA0-":["Failed to enable sync — ",["detail"]],"06SZfb":["Template \\"",["trimmedTitle"],"\\" created"],"07gHun":["You don't have access to this private repo. Sign in with an account that does."],"07q4Qk":["File sidebar"],"092Wah":["Enter a name for this template."],"09Tv5j":["Reconnecting…"],"0BB9ID":["No headings yet."],"0Gd0NU":["Shared"],"0NA4b3":["Keep my version"],"0YEbfk":["Connect to AI tools"],"0_J12R":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in ",["targetLabel"]],"0eHrMb":["Could not complete delete"],"0jD-Gn":["A team knowledge base, a personal wiki, project docs..."],"0kTAXe":["Open source: ",["mirrorSrc"]],"0njBIq":["Setup files include: <0>.ok/</0>, AI-tool MCP configs (<1>.mcp.json</1> and per-tool files), project skills, and <2>.claude/launch.json</2>.<3/><4>Shared</4> commits them to git, so anyone who clones the repo gets the same setup. <5/><6>Local only</6> keeps them out of git (via <7>.git/info/exclude</7>)."],"0rwwOn":["By tag"],"0s8-e8":["Select, enter, or leave block components and fallback source blocks from keyboard boundaries."],"0t0bbC":["Could not save sync preference: ",["detail"]],"0wswKc":["Horizontal rule that divides sections."],"0xnmlQ":["Repository name"],"0yL--g":["Review conflicts"],"12F9WL":["(no id)"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1AumWo":["Push failed — check the server logs for details."],"1EcCom":[["keyName"]," value"],"1GhYxC":["of ",["totalPages"]],"1HBhDS":["Checking out files"],"1MGRQl":["Terminal sessions"],"1QfxQT":["Dismiss"],"1RluQD":["Show replace"],"1TNIig":["Open"],"1Ta7Fd":["Open ",["basename"]],"1WgmEM":["Failed to load template: ",["errorMessage"]],"1XSMhZ":["Switching to <0>local-only</0> will refuse until they're untracked via<1> git rm --cached</1>."],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"1d1F11":["Select all files and folders"],"1di5fu":["Document not found"],"1nke1r":["Open ",["0"]," on GitHub (opens in a new tab)"],"1t_NnN":["Reject"],"2277Tu":["Collapse graph"],"237hSL":["Ended"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"29VNqC":["Unknown error"],"29XZXN":["Set git identity"],"2BBAbc":["List"],"2FYpfJ":["More"],"2GT3Hf":["Global"],"2QM24L":["All tags"],"2RBzMG":["Network error — check your connection and try again"],"2XQ8Ww":["Open preview when agent edits"],"2YOwme":["Restarted — now running v",["appRuntime"],"."],"2YZwPB":["Forward-links response did not match expected shape."],"2Znqb1":[" (missing)"],"2fkdnR":["Nothing to undo on this file"],"2hpdRq":["Hide panel (",["panelShortcutLabel"],")"],"2n3oDU":["Project-level pages ordered by inbound link count, up to ",["FULLSCREEN_HUB_LIMIT"]," results."],"2q_Q7x":["Visibility"],"2ryd91":["Failed to rename property"],"2tgFCe":["Starting clone"],"2vIPtm":["Open link in new tab"],"2wxgft":["Rename"],"322lyb":["Highlight tips, warnings, and notes."],"34qyH5":["Could not reach server"],"36WXSC":["Couldn't delete template: ",["error"]],"379t2h":["Unified diff"],"38foVZ":["Loading diff"],"3DTatP":["Copy a prompt for your agent, start a blank file, or scaffold from a template."],"3Fcb0I":["Open graph"],"3HNlwb":["Hello, world!"],"3Ib6FN":["Move down"],"3IseAk":["Install an AI agent to create with AI"],"3J7d2N":["Big section heading."],"3JYy1p":["Branch ",["0"]," no longer exists. Cloned to default branch."],"3MnvrL":["Showing top ",["0"]," matches — keep typing to narrow"],"3Mwaly":["Could not initialize ",["0"],"."],"3SDfZl":["<0>Mirror — pick a source.</0> Set <1>src</1> + <2>anchor</2> via the property panel to point at a <3><MirrorSource></3> elsewhere."],"3TCafD":["Stored on this machine."],"3VbwPp":["Open ",["keyName"]," in browser"],"3VsNTI":["Loading document"],"3YvS-c":["New tab"],"3_6U6f":["Connect to GitHub"],"3__SjS":["breadcrumb"],"3a_Bd7":["Open source doc: ",["mirrorSrc"]],"3aeN7X":["All files"],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3jod3l":["Connect GitHub"],"3mFsc3":["Restore with remote changes"],"3o3tur":["Starter content"],"3oh0nQ":["Nested .okignore error in ",["path"]],"3pU8e-":["Pin tab"],"3wiBAs":["Where should it live?"],"3y6XTb":["Semantic search"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"44DSl0":["Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."],"45MZFs":["Commands"],"484LKL":["Remove link"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4A3Yzu":["Code block"],"4BITzH":["Error:"],"4CfgPM":["Project folder created, but git init failed. Try again."],"4Gz2wC":["Failed to upload file"],"4KmEoC":["Hotkeys"],"4NC2Ym":["Move to the next or previous table cell."],"4PYsOz":["Hide Files (",["sidebarShortcutLabel"],")"],"4Sxexw":["Source undo or redo"],"4TzU0n":["Initialize"],"4buZWd":["Inherited from ",["path"]],"4c_a6S":["Nothing set yet."],"4g19V6":["Failed to update property"],"4hJhzz":["Table"],"4jDd0j":["Anyone can see"],"4niEzY":["Sandboxed HTML embed — write HTML, see the rendered preview live."],"4nj6n8":["/api/config returned HTTP ",["code"]],"4sKwf6":["File already exists"],"4uNLmk":["Pulling"],"4v2Yyz":["Select every visible file-tree row when focus is in the Files sidebar."],"4xtLTl":["Hidden folder “",["basename"],"”"],"4zGlN_":["Paste image URL or click upload"],"5-FeN2":["Share URL"],"54Y6Fg":["Could not load templates. Try again later."],"56WWtu":["Couldn't load starter packs: ",["error"]],"56xUL1":["Property name"],"57fiu8":["(read-only — edit in source mode for now)"],"5ALjdr":["Move through visual-editor find results from the find field."],"5Ajb15":["The formula <0>c = √(a² + b²)</0> renders inline."],"5ClEAu":["Inline hashtag for cross-doc grouping."],"5D3Ior":["Hide folder"],"5F5HYj":[["ahead"]," ahead, ",["behind"]," behind"],"5GKMSz":["Indent or outdent the current list item."],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5LXwX8":["This permanently removes ",["path"],". Agents that reference this template by name will fail until it's recreated or replaced by one in a parent folder."],"5OqaJi":["Enter a project name"],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5Tk8Fb":["Loading files"],"5WDhAk":["Link to a page or external URL."],"5ZB7XC":["File drop zone"],"5gr_ev":["Becomes the document's content when someone creates a doc from this template. Type <0>",["dateToken"],"</0> or <1>",["userToken"],"</1> to fill in today's date or the author's name automatically."],"5kWklo":["(some may already be hidden by other rules)"],"5lWFkC":["Sign in"],"5mksg0":["Failed to disable semantic search — ",["detail"]],"5o4lc1":["Open Knowledge will be initialized at <0>",["gitRoot"],"</0> — the parent of your new folder, because it contains a <1>.git</1> folder (one project per git repo)."],"5qNxOe":[["count","plural",{"one":["#"," item could not be moved to the Trash. Do you want to permanently delete instead?"],"other":["#"," items could not be moved to the Trash. Do you want to permanently delete instead?"]}]],"5rJ0w2":["Open Knowledge is using this GitHub account."],"5wV2qQ":["and more"],"5y_9lO":["Waiting for authorization"],"5z2tUG":["This project is running an older version of Open Knowledge (v",["0"],") than this app (v",["1"],")."],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"636K3K":["Delete adjacent chip"],"67f-3g":["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],"6Aih4U":["Offline"],"6LbUG7":["The repository is private and your GitHub account doesn't have access to it."],"6MnZEC":["Terminal failed to load"],"6O626z":["No headings match \\"",["trimmedAnchorQuery"],"\\""],"6Pxqwv":["No project templates yet. Create one to make it available everywhere in this project. Folder-scoped templates live on each folder's overview page."],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6VqW-1":["Remove ",["keyName"]],"6WdDG7":["Page"],"6YtxFj":["Name"],"6_ZOw4":["Copied full path"],"6bTTAN":["Invalid input — pick a different folder."],"6cR-PU":["Already open"],"6caB2T":["Connect an existing repository"],"6cuT_1":["Open date picker for ",["keyName"]],"6cyguR":["Connect GitHub to continue."],"6eniID":["Map the architecture"],"6fGjTz":["Show fewer"],"6gRgw8":["Retry"],"6h4zVU":["What would you like to create?"],"6hfDJr":["Server error: ",["status"]],"6ibbCg":["Create your first file"],"6ki7F2":[["0","plural",{"one":["#"," item"],"other":["#"," items"]}]],"6m_7We":["Open this settings dialog."],"6q0rnH":["writing"],"6qMe0o":["Draft a technical spec for my project. Start with an overview, then add cross-linked pages for the architecture, the key modules, and the open questions, all linked from a specs index."],"6s7LXO":["Heads up"],"6u9LvN":[["days","plural",{"one":["#"," day ago"],"other":["#"," days ago"]}]],"6vEr3W":["Link target"],"74-bX-":["A pull quote stands out from the surrounding text."],"74eHt-":["No file or folder selected"],"75Y1dk":["Horizontal pill strip + active panel below; click a pill to switch panels."],"77SdEP":["Delete ",["itemName"]],"7FamGZ":["Go to line"],"7Fkcej":["+ Add ",["addChildName"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7JtSLi":["Failed to delete path"],"7KeV5F":["Undo all failed: ",["message"]],"7OhaRy":["Source search"],"7OwvEL":["Show HTML preview"],"7PNNNs":["This sends content off your machine"],"7PzzBU":["User"],"7_bFEL":["Drag ",["patternText"]," to reorder"],"7apDiJ":["A folder named <0>",["sanitized"],"</0> already has files here. Pick a different name."],"7d1a0d":["Public"],"7hctf2":["Describe the project you want to create"],"7kdoVR":["Open the Open with AI menu for the current editor selection."],"7nrKys":["Open Knowledge is using a GitHub account provided by the gh CLI. There's no separate Open Knowledge credential to disconnect."],"7qRHf0":["Install for Claude Chat & Cowork"],"80c4-P":["Code copied to clipboard"],"81H_23":["Add properties"],"881Uwh":["Delete selected table"],"89TtiD":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in the project root"],"8BsGpU":["A key is set, but the embeddings provider rejected it or was unreachable — search fell back to keyword matching. Check the key in <0>Settings → Account</0> and your provider settings."],"8F1i42":["Page not found"],"8FqTCr":[["chunksRemaining","plural",{"one":["#"," unresolved hunk"],"other":["#"," unresolved hunks"]}]],"8Jm2EP":["Toggle heading levels 1 through 6."],"8OGgNM":["Open or close visual-editor find."],"8OxKZy":["Move succeeded but the sidebar may be out of date — refresh to resync"],"8PmoQF":["Open the insert menu in an empty or active text position."],"8RtNI0":["Failed to load documents"],"8S1E33":["Search recent projects..."],"8TLE9g":["Read-only copy of a MirrorSource block from another doc. Edit at the source — every Mirror reflects the change live."],"8XQRON":["Loading repositories"],"8_brI5":["Name is required"],"8cS0nH":["Config sharing unavailable: ",["0"],"."],"8cpOa8":["Couldn't disconnect — please try again."],"8cpeU3":["Shared repositories"],"8eW0WQ":["No matching repositories."],"8fRyLo":["Invalid patch payload"],"8fc_3j":["Protected branch — cannot push"],"8m8diM":["No location selected. Use Browse to choose a folder."],"8tjQCz":["Explore"],"8uAWix":["This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."],"92rbk2":["Mirror loading <0>",["mirrorRef"],"</0>"],"96G6Re":["New folder"],"96w9hU":["Something went wrong opening this file (HTTP ",["status"],")."],"99eR72":["Visual editor table selection"],"9Bd18D":["Failed to load hub pages"],"9NJWgv":["Backlinks"],"9PQysm":["Hide advanced"],"9R7pRC":["No tags match \\"",["trimmed"],"\\". Continue typing to create one."],"9UQ730":["Clone"],"9bCiQ8":["No pages are missing incoming graph links."],"9clcD5":["Open documents tagged #",["chip"]],"9dw5bW":["Create with ",["0"]],"9euN0m":[["count","plural",{"one":["#"," more cross-doc participant"],"other":["#"," more cross-doc participants"]}]],"9fhQRL":["Beta channel"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9i21pa":["Commits happen automatically"],"9jnjV0":["Embed an audio file with native player controls."],"9npOH9":["Open file"],"9o1bIV":[["behind"]," behind"],"9oE4C3":["Browse your repos:"],"9tJX8r":["By meaning"],"9zb2WA":["Connecting"],"A1taO8":["Search"],"A5CYnd":["Broken link"],"A5hiCy":["Create template"],"A67Uwj":["Still loading"],"A6h5b-":["File duplicated"],"AAlr5Y":["No collab server for this worktree — run <0>ok start</0> here, or reopen the project."],"AB4qw9":["New terminal"],"AE7BY3":["The terminal session ended."],"ALhMYW":["Terminal"],"AMyJts":["This path is on an external volume (/Volumes/...). Open Knowledge will lose track of files when the drive ejects."],"AQ-Lfg":["Couldn't load templates"],"AQGtjK":["Commands run with the full access of your macOS user account on this machine. Turn this off to disable the shell."],"AThCb_":["Open Knowledge manages the <0>open-knowledge</0> MCP server name, the <1>open-knowledge-ui</1> launch config, and <2>ok</2> / <3>open-knowledge</3> on PATH (including OK-owned symlinks). Using a custom wrapper? Register it under a different name."],"AVW-K9":["Failed to load orphan pages"],"AWOSPo":["Zoom in"],"AcK_r0":["Claude CLI"],"AdcGcG":["Applying your change"],"AddR83":["Could not create project. Try again or pick a different location."],"AeHuzT":["# One pattern per line.\\n# Examples:\\n# drafts/\\n# *.draft.md\\n# !keep.md"],"AeXO77":["Account"],"AiNMQ7":["This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."],"Aif3E7":["Enable semantic search"],"Am78jY":["Drag ",["keyName"]," to reorder"],"AqnqMJ":["API key set"],"ArBWJf":["Undo last edit"],"B11p-O":["Edit markdown link"],"B2DrPb":["Auto-save"],"B3NAZC":["Open Navigator"],"B4_ipX":[["conflictCount","plural",{"one":["#"," file conflicted"],"other":["#"," files conflicted"]}]],"BAH4qX":["Selected graph item"],"BBqGS9":["Desktop"],"BD0XSC":["Failed to load project templates"],"BEkF-P":[["userName"],", ",["tabCount","plural",{"one":["#"," concurrent tab"],"other":["#"," concurrent tabs"]}]],"BGHHtQ":["Single page"],"BH56dn":["Custom display text"],"BQKHuL":["Restart terminal"],"BQu9Pg":["Symlink"],"BY-g4_":["Add pattern"],"Bdha5y":["Publishing..."],"BeWTQy":["Loading starter packs"],"BgV29F":["Visual editor find input focused"],"Bv5a9_":["Selection statistics"],"Bx4EXG":["Actions for ",["label"]],"By-7Pn":["Toggle a bullet list."],"BymzO4":["Document outline"],"C0NPNd":["Add Open Knowledge to your AI tools"],"C37Zkt":["Send to"],"C62P6b":["Editor selection"],"C9TBvF":["No Outgoing"],"CCTop_":["Recent"],"CKyk7Q":["Go back"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CSL0l1":["Couldn't clear the key — please try again."],"CTJLpz":["\\"",["trimmed"],"\\" already exists here"],"CU3AiE":["Switching branches"],"CXj9C-":["New property name"],"C_WGy8":["This file is too large to open in the built-in text editor (1 MB limit). Use Open file below to open it in another app."],"C_cPoW":["Your GitHub session expired — sign in again to verify push access."],"ChAtFg":["You don't have permission to push to this repo"],"Ck9XRt":["Couldn't save the key — please try again."],"CmeH9S":["Add property to ",["keyName"]],"CvsD6Y":["via ",["viaTags"]],"D4H2N6":["Remove ",["tag"]],"D8OV7J":["Only collaborators"],"DDTdLl":["Code block settings"],"DELNQk":["Collaborators see your in-progress edits as soon as they sync."],"DF1MtZ":["Loading conflict for ",["filePath"]],"DFfRbX":["Sync status: ",["syncStateLabel"]," — git identity unset"],"DId6MT":["Project-level pages with no outgoing graph edges."],"DPfwMq":["Done"],"DVh_Tb":["Failed to clean up after trash"],"D_WKe_":["Click an agent's avatar in the presence bar to view their session."],"DbILZA":["No matches. Some files are excluded from search (hidden or ignored files)."],"DeDYLr":["Unrecognized wiki link"],"DhLHEb":["Failed to load activity"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DrYM2Z":["Sync disabled"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"Dub54T":["Preview browsers can't auto-copy. Use Cmd/Ctrl+C on the URL above, or open OK in the desktop app."],"Dw1T_W":["Rename ",["label"]],"E1_c72":["Task list"],"E1tG2u":["Get Claude Code"],"E2Mv-X":["Copy source"],"E4XYYH":["Enable terminal for this project"],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"EBVbtP":["Could not duplicate item"],"EDm3wJ":["Loading diff renderer"],"EEYbdt":["Publish"],"EJuO7B":["Connect a GitHub account to browse and sync your repositories."],"EL_YRd":["Mirror of <0>api-spec</0>"],"EOjU5V":["Inline Math Properties"],"ETyvvg":["No language match."],"EVnzPs":["Edit with AI"],"EZVxVz":["Replace the active match from the replace field."],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"E_tNGD":["Connected as @",["login"]],"EarrCe":["Search emoji"],"EbZT7P":["Toggle the left file sidebar."],"EcM3k7":["Failed to clean up pending ",["kind"]],"EcR0fl":["Checking for installed agents"],"EeRZnZ":["Expand burst ",["burstNumber"]," diff"],"Ef7StM":["Unknown"],"EhDLBx":["You modified <0>",["filePath"],"</0> locally, but it was deleted upstream."],"Ehkru0":["Open, navigate, accept, or dismiss CodeMirror completion suggestions."],"EiVgl5":["You don't have permission to push to this repo."],"Eji13z":["Toggle highlight formatting."],"El7NbA":["Heading 2"],"Emz5BG":["Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."],"EqrC_R":["Undo failed: ",["message"]],"EqtBXb":["Visual editor find open"],"ErRi6L":["Template \\"",["label"],"\\" deleted"],"Es-eZU":["Remove from recent projects"],"Ev2r9A":["No results"],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"Evq3lu":["Orphan mode"],"ExPiRQ":["Move to the next CodeMirror lint diagnostic."],"F-NRCj":["Add property"],"F4IYWe":["Share doc"],"F4vEsL":["Sync status: ",["syncStateLabel"]],"F6pfE9":["Active"],"FBknns":["HTML"],"FCxvG5":["First item"],"FEr96N":["Theme"],"FF5rwn":["Connect Open Knowledge to other tools you use."],"FNTx6u":["Search \\"",["semanticSubmitQuery"],"\\" by meaning"],"FOGD7m":["Create something great."],"FOyCTr":["Your OpenAI API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search."],"FRYB1Q":["/api/config returned a malformed body"],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"FjkaiT":["Zoom out"],"FnMkli":["Sync disabled — you don't have permission to push"],"FqTpiN":["Bird wiki"],"Fqr8BP":["Multi-page PDF viewer with toolbar controls (thumbnails, page nav, zoom)."],"FvMSms":["Renaming changes the file on disk and the id agents use to pick this template."],"FvpFSZ":["Reveal in Finder, ",["hint"]],"Fxf4jq":["Description (optional)"],"FyW0WO":["Authorize in browser"],"G-JBA1":["Source mode requires a live connection — your edits are saved and will appear when you reconnect."],"G0YZ-I":["Indent or outdent list item"],"G1Gw0v":["New template"],"G1XxbZ":["Checkbox"],"G7-rf8":["Pattern syntax error: ",["message"]],"G7cMuO":["HTML preview"],"G8t9NN":["Add a property"],"GA-UkN":[["keyName"]," type: ",["typeLabel"],". Click to change."],"GDvlUT":["Role"],"GGsM4y":["Selected in graph"],"GK-IRZ":["Undo buttons are disabled — per-session state has been garbage-collected."],"GN6L5F":["Filename"],"GQDSBN":["Layout options"],"GUYwCr":["Dismiss notice"],"GUpclA":["Created if missing; reused if it exists."],"GUqTzn":["Competitor research"],"GXf9hG":["Cloning ",["repoName"],"..."],"G_686w":["Task List"],"G_mWXb":["Filter languages"],"GamjcN":["Template saved"],"GemPfn":["Failed to parse forward-links error response (HTTP ",["status"],")"],"Gfr4fu":["Server can't open documents"],"GgQgML":["You picked your home directory. Open Knowledge will index everything in your home tree — large and may surface personal files."],"GhjUB_":["Reconnected"],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"GubkSu":["Use a starter pack"],"GuqOb1":["Failed to load headings"],"Gx0VS1":["e.g. drafts/ or *.draft.md"],"H-vDm3":["Relaunching to install the update…"],"H0WlWQ":["Grid of rows and columns with a header row."],"H86f9p":["Collapse"],"H8Ng4Z":["Search recent projects"],"HCn0Ay":["Toggle strikethrough formatting."],"HGNCsl":["Connection lost — keep this tab open, your edits will sync when reconnected"],"HIb0vl":["Network error — please try again"],"HM56Bx":["Creating..."],"HNnVG1":["No other recent projects."],"HRU-eL":["You picked ~/Documents. Open Knowledge will index every markdown file under it. If you only want to manage a sub-folder, choose a smaller scope."],"HXFyWD":["Split diff"],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HlmZBk":["Documents response did not match expected shape."],"HpK_8d":["Reload"],"HptUxX":["Number"],"Hrz9NY":["Wiki link"],"I1gRhX":["Failed to rename"],"I1m158":["Couldn't auto-copy"],"I5AfhE":["Sync status unavailable — server unreachable."],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"ICoNYz":["You can also manage this in Settings."],"IInnZo":["Conflict"],"IKoTAC":["Keep disabled"],"IN4UX8":["Search (",["searchShortcut"],")"],"INEQsp":["Items to be created"],"IQPyrD":["Missing page — click to create"],"IRv9cH":["Cloned ",["repoName"],"."],"IWGfGF":["Checking your GitHub connection"],"IX7-sq":["Something went wrong opening \\"",["docName"],"\\"."],"IajAbS":["Add a starter pack"],"If0crP":["Open with AI ",["targetDisplayName"],", ",["hint"]],"IgTwLt":["Open this document in the editor and collapse the graph."],"Ik-gP0":["Heading H",["level"],": ",["text"]],"Iq8zdU":["Close terminal"],"IrB5AK":["Server-side cleanup failed for ",["failedCount","plural",{"one":["#"," item"],"other":["#"," items"]}]],"IreQBq":["Repository"],"It9ARY":["Toggle the right document panel."],"Ix0K8o":["Hide external URL nodes"],"J2MgzQ":["Undo all edits on ",["docName"]],"J2Mv98":["Name (e.g. ",["login"],")"],"J2eKUI":["File"],"J3HzPL":["Collapse ",["keyName"]],"J6N5MX":["Couldn't construct the share URL. Try Done and re-share."],"J6mxC1":["A network problem or GitHub outage interrupted the clone."],"JCxGEX":["No disconnected pages. Pages appear here only when they have no incoming and no outgoing graph edges."],"JE21eh":["Symlink to ",["targetPath"]],"JK-Ave":["Hide thumbnails"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JLzQi_":["Close ",["accessibleLabel"]],"JOcPqH":["Bring a remote repository onto this machine."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jejur6":["Couldn't load document"],"Jhj_lh":["Modify the link target, anchor, and display label."],"JkCD2u":["Sync paused — you don't have permission to push to this repo"],"JmfgFc":["(a worktree of ",["0"],")"],"Jqqevv":["System error"],"JtD-Br":["Page link"],"Jw6EC4":["Branch switch failed — try opening the ",["targetNoun"]," manually."],"K-a33w":["Start writing to create this page"],"K-h9cT":["Couldn't save the resolution for ",["filePath"],"."],"K0N7zS":["Config sharing status read failed"],"K1ckLX":["Failed to create folder"],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K6jxcj":["Add a key"],"K8-WWn":["Move between table cells"],"K9J00P":["Clone failed — connection error"],"KDuPiY":["Uploading ",["fileName"]],"KDw4GX":["Try again"],"KFdXwz":["Show panel (",["panelShortcut"],")"],"KOZud0":["Build a competitor research knowledge base. Start with an overview page, then add cross-linked pages for each competitor, their products and pricing, and the sources behind every claim."],"KPW5WC":["moved template"],"KRJ6xh":["No tags yet. Continue typing to create one."],"KWL_Ih":["Blog post"],"KX1MZR":["Your repositories"],"KYcZ6Y":["Above"],"KZLdgR":["See <0>#design-docs</0> for the latest specs."],"K_vT1F":["Upstream sync"],"KaFCD3":["Open this link in a new tab and collapse the graph."],"Kf7GG5":["Restarting the server…"],"Kgdbkt":["Switch to local-only refused"],"Kh1n4a":["<",["componentName"],"> isn't a known component. Copy the source to use it elsewhere, or delete the block."],"Khxcyu":["Terminal access isn't enabled for this project."],"KkEAud":["Create a file from the current document or folder context."],"KmydK6":["Bold"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"KsAPaB":["This branch is checked out in:"],"KujtjC":["Find"],"L-rMC9":["Reset to default"],"L1ZE3M":["Document statistics"],"L3CEC1":["this item"],"L4Cdd9":["or create a new file <0/>"],"L5Xu8C":["This project is running a different, incompatible build of Open Knowledge than this app (v",["0"],")."],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"L9Y9Om":["Top linked pages"],"LBwUR6":["Branch switch timed out — try opening the ",["targetNoun"]," manually."],"LCUy_N":["Session ended"],"LDuM35":["Replace current match from field"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LNum6A":[["minutes"]," min ago"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LXdWeS":["Medium section heading."],"LXfNU-":["Navigation and suggestions"],"LYufDw":["Failed to enable semantic search — ",["detail"]],"Lcehxn":["Save resolution"],"LdABLa":["Could not open ",["target"],". Try opening it manually."],"LdKIHS":["Draft a spec"],"LhWYpm":["Other OK paths are tracked upstream:"],"LlHqdU":["Initializing project"],"Llyqvo":["This usually means one of:"],"LpB85N":["Plain"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"LtVw4J":["Claude CLI, ",["hint"]],"LuoJWu":[["truncatedShownCount","plural",{"one":["Showing the first item in one folder — the rest of that folder is hidden."],"other":["Showing the first ",["formattedCount"]," items in one folder — the rest of that folder is hidden."]}]],"M1OfV9":["Next source diagnostic"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"M5mfAe":["Add tag"],"M9597s":["Preparing share URL..."],"MCjC9A":["Delete ",["deleteDescriptorLabel"]],"MGb89P":["Insert, delete, move, copy, and indent source editor lines through CodeMirror's default keymap."],"MHrjPM":["Title"],"MKOVhz":["Enable git auto-sync"],"MQIM_Y":["Couldn't copy. Select the URL above to copy it manually."],"MTs6g3":["Couldn't reconnect after server restart"],"MUBR8r":["Rename succeeded but the tabstrip may be out of date — refresh to resync"],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MVxpbf":["Find and replace"],"MWrUEd":["Undo all"],"MZSBsh":["No templates yet. Add one to give new docs in this folder a ready-made starting point."],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"Mb_20S":["Visual"],"Md709y":["Loading ",["fileName"]],"MmDDWK":["Recently opened"],"Mnavhe":[["propPanelDescriptorLabel"]," Properties"],"MqQoV-":["Describe what you want to build, start a blank file, or scaffold from a template."],"MrwYIK":["Toggle a source comment through CodeMirror."],"MsuXaI":["Hide panel (",["panelShortcut"],")"],"N1YYa7":["Loading image"],"N1mdmS":["This file can't be opened in the text editor."],"N2FcBE":["Synced"],"N2S1rs":["Empty"],"N2eHWq":["Code Block"],"N3_ozB":["Hubs"],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NJyQi_":["Branch ",["shareBranch"]," no longer exists on the remote."],"NKkZXl":["Initialize and open"],"NOHyEE":["Retry push"],"NORKZU":["Pattern warnings: ",["summary"]],"NQ8llq":["Add item"],"NRSLBe":[["diffMin"],"m ago"],"NSnIUP":["Two-page (even)"],"NUr4kz":["A reusable starting point for new documents in this folder."],"N_7kkF":["Read through this codebase and draft a technical spec for the most complex module: an overview, the architecture, key files, and open questions, all linked from a specs index page."],"NjrIak":["File: <0>",["fixedName"],".md</0>"],"NkXEFS":["Restore failed — document unchanged"],"NlZjSM":["Manage the GitHub account Open Knowledge uses to browse and sync your repositories."],"NmPNJJ":["Copy code"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"NnQapF":["Open with AI ",["targetDisplayName"]],"NpC29w":["Create a new list item from the current list item."],"Nu4DdT":["Sync"],"Nu4oKW":["Description"],"NuH1jp":["Public repository"],"Nv3mUj":["Show advanced"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"NxW-md":["Resize ",["handleKey"]],"NzFvyK":["Session ended — undo unavailable"],"O0Z2Xr":["Outgoing"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"O7_W_a":["Open with AI"],"OD0FCX":["Hidden “",["basename"],"”"],"ODD5Jc":["Edit ",["templateLabel"]],"ODGGlj":["Folder name: ",["detail"]],"OETysD":["No hub pages yet. Hubs appear once pages accumulate inbound graph links."],"OJTOUj":["Requires ",["brand"],"."],"OJeiSH":["Failed to add property"],"OLBz-_":["Mermaid diagram failed to render."],"OLIKgw":["Drag item ",["0"]," to reorder"],"ONPvOb":["Loading agent activity"],"ONgEZF":["Loading headings for ",["pageTarget"]],"OTF92M":["Label <0>(optional display text)</0>"],"OVjNeX":["Terminal ",["0"]],"OX2Neh":["Inline code"],"OYnx7O":["Path cannot start with \\"/\\""],"OdmsFg":["Failed to delete item"],"OgyJSr":["Local only"],"OiHJdA":["Move through slash, wiki-link, tag, and path suggestions; accept or dismiss the active suggestion."],"Okd2Xv":["Toggle underline formatting."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"On0aF2":["Website"],"Oo_WWc":["No pages found"],"Oos8fo":["Copy command"],"OuY8t9":["Open in current branch"],"OvEjsP":["Copying..."],"Oxyd5f":["Pick a name"],"OyIC0Q":["Project name"],"P-ye9o":["Could not open folder picker"],"P3NS4G":["Pattern syntax error (line ",["lineNumber"],"): ",["message"]],"P3hnm0":["File too large to open"],"P47EWZ":["Could not update sidebar settings"],"P6gXB-":["Replace ",["keyName"]],"P6lAT3":["Folder target: ",["linkTitle"],". Click to open the overview."],"P8jws3":["Restarting closes this project's server. Connected agents (Claude Code, Codex, Cursor) will see their Open Knowledge MCP connection close unexpectedly — you may need to restart the agent, or toggle its Open Knowledge MCP server off and on, to reconnect."],"P8yDjG":["Name can’t be empty, \\".\\", \\"..\\", or contain / or \\\\"],"PB4upl":["Find previous match"],"PBwmDJ":["Searching by meaning"],"PBxg_E":["Not now"],"PKLY-1":["Opening..."],"PMyJ9C":["No edit session yet"],"PQCdtv":["\\"",["docName"],"\\" doesn't exist."],"PR9FSv":["Move to the next visual-editor find result."],"PVUn_c":["Open folder"],"PZt1uN":["Search files, commands, projects, and AI handoff actions."],"PdA9NZ":[["ahead"]," ahead"],"Pgu10b":["Saved as <0>",["slug"],".md</0>"],"PgzIpb":["Move to the previous visual-editor find result."],"PkeYXL":["Expanded graph mode"],"Pkw7J9":["This folder is empty."],"PqYWiC":["Couldn't restart the server automatically. Try running \`ok stop all\` in a terminal, then reopen this project — or restart your computer if it persists."],"Pyp1NA":["Restore to this point?"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"Q8A-U_":["Connected to"],"QDZbvN":[["diffDays"],"d ago"],"QOINDn":["empty"],"QQghPu":["Install in Claude Desktop"],"QR5SP1":["created template"],"QWks14":["A short line shown under the name in the template list."],"QcpeeE":["Navigate to ",["docName"]],"QlxHAH":["Showing results for \\"",["semanticResultsLabel"],"\\""],"QqBQu1":["Label <0>(visible link text)</0>"],"Qvls7J":["Eng specs"],"QyioBP":["Move up"],"R0cyYB":[["0","plural",{"one":["#"," request blocked by the preview's security policy"],"other":["#"," requests blocked by the preview's security policy"]}]],"R0jJzV":["Paste URL, owner/repo, or search your repos"],"R3y75Z":["Edit source"],"R65q-K":["A real shell is off for this project. Turning it on runs commands with the full access of your macOS user account."],"RDjuBN":["Setup"],"RDrXh4":["Configure user, project, and integration settings."],"RG4XHV":["Copy ",["0"]," prompt"],"RGCCrg":["Copy share link"],"RGkNeJ":["Initialize a starter pack"],"RJ3a8Z":["Looking for <0>",["lookingForUrl"],"</0>."],"RN62Q8":["We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."],"RSqaSd":["Project root"],"RY6Bq1":["Open shared ",["targetNoun"]],"RaPMZv":["Keyboard shortcuts available in the editor and workspace."],"Rah7yq":["What should the AI do? (optional)"],"RfHNf8":["Open activity panel for ",["tooltipName"]],"RfaEio":["Toggle source comment"],"RgbKEe":["You don't have access to this repository."],"Rj01Fz":["Links"],"RlCInP":["Slash commands"],"RmBY0A":["No git remote"],"RobAKV":["Update the destination and optional section anchor."],"Rq1vFD":["Tree view options"],"RrAIZx":["What config sharing covers"],"Rx5ReQ":["Rename ",["keyName"]],"S33tz3":["Not connected"],"S6l5dv":["Could not start creating a new item"],"S9Vnum":["Remove ",["patternText"]],"SCoBBH":["Tag suggestions"],"SCzAbA":[["phase"]," — ",["pct"],"%"],"SEYWYq":["Undo all edits on this file?"],"SFN6dN":["Heading 3"],"STTOnz":[["keyName"]," type: complex value (nested; read-only)"],"SUOoXn":["Failed to open project."],"SYfHmN":["Unpin tab"],"Sc1bKE":["Local collaboration data for \\"",["docName"],"\\" could not be cleared in time. Reload to retry."],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"Sfh6zL":["The file on disk, and the id agents use. It can't be changed later."],"SgKLfA":["Not connected to GitHub."],"SiUUCS":["Next match"],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"SrOuyg":["Document panels"],"T-4cw2":["Pick a layout that matches what you're building. Each pack ships with folders, templates, and agent-readable descriptions. You can mix and match later."],"T-654M":["Loading PDF"],"T0OVm7":["The default branch is protected — pushes need a pull request."],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TJnkyf":["ok ui responded but server.lock has no port yet"],"TKQ7K-":["Install"],"TLIO3j":["Toggle italic formatting."],"T_wG4n":["We couldn't check your GitHub connection."],"Ta25TG":["No history yet"],"ThmUrC":["Could not finalize project setup. Try again."],"Tjc1pH":["Section <0>(optional heading anchor)</0>"],"TvY_XA":["Documentation"],"TwYboS":["Navigate CodeMirror source search results or dismiss the search panel."],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U2Kx6T":["Close all unpinned"],"U2pMtf":["tag-name"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UA171M":["Run a real terminal docked inside Open Knowledge, starting in this project's folder."],"UBv8UK":["Delete Permanently"],"UDFrWm":["Checking GitHub connection..."],"UL8A9w":["Tag"],"UQAp48":["Search templates"],"URmyfc":["Details"],"UTNVyS":["Select the full source document."],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"UW93oq":["Replace key"],"UYcGIW":["Connecting — waiting for collab server"],"Ua78MH":["no response"],"UaXXIF":["Available in the Open Knowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."],"Uci-Ph":["Ordered List"],"Ud0Pj9":["<0>Mirror source removed.</0> The doc <1>",["src"],"</1> is no longer available."],"UfW9Kr":["Your search queries and the full text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"UkQGhd":["Hide replace"],"Up2_7p":["Copy full path"],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"UyROxs":[["mins","plural",{"one":["#"," min ago"],"other":["#"," min ago"]}]],"V48OUT":["You deleted <0>",["filePath"],"</0> locally, but it was modified upstream."],"V7QxyT":["Connection dropped"],"VAHWL_":["Connected as <0>@",["signedInLogin"],"</0>"],"VNgKZz":["Advanced settings"],"VU3Nrn":["Missing"],"VUijjF":["Embed an image with optional alt text."],"VYd_YA":["Open an existing project folder from disk."],"VZGh8G":["Fold, unfold, fold all, or unfold all source ranges."],"VZSBXL":["Semantic ranking activates the first time an agent runs a search."],"V_6bJ4":["Terminal settings not loaded yet — try again in a moment."],"VbqhBI":["Already at ",["assetContentPath"]," — reusing."],"VcqWBy":["Upload may have succeeded but the sidebar is out of date — refresh to resync"],"VdXv4D":["Clone from GitHub"],"Vlc75q":["Keep file deleted"],"VsBxkh":["Started a fresh Open Knowledge server (v",["appRuntime"],") for this dev session — the server already running for this project was terminated. Connected agents (Claude Code, Codex, Cursor) just lost their Open Knowledge MCP connection; restart the agent, or toggle its Open Knowledge MCP server off and on, to reconnect."],"VuxVSP":["Start source completion"],"VvS_k_":["Config sharing is now local-only."],"W-ntoW":["heading-slug"],"W0i24j":["Object"],"W1qRuM":["This document is already active in the editor. Use Open to collapse the graph."],"W5A0Ly":["An unexpected error occurred."],"W8vpBM":["starter pack"],"W9_Bub":["Local changes overlap with incoming sync"],"WEzuMq":["Create a new Open Knowledge project in the folder of your choice."],"WL6puM":["Path resolves outside project"],"WMIKXK":["Are you sure you want to delete ",["targetCount"]," selected items? Folders and all files inside them will be deleted. This action cannot be undone."],"WPwDin":["Open folder on disk"],"WR0y2O":["Share folder"],"WRNXKp":["Searching"],"WZ-vBy":["Permanently deletes <0>",["targetGitPath"],"</0> and all its git history. Working files stay in place. If the parent git repo is intentional (e.g. you cloned it), cancel and pick a location outside it."],"WamGNs":["Failed to load PDF: ",["error"]],"WcWS__":["Download file"],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"We7h2I":["📝 or assets/icon.png"],"Weq9zb":["General"],"Wgmlsw":["Fetching"],"Wh0im4":["editing [[",["realCurrentDoc"],"]]"],"WhOsNE":["Strikethrough"],"WqLq6M":["Open with AI ",["displayName"]],"Wt5W56":["Sync is off — your edits will not sync to the remote repository."],"Wtw22s":["Installing"],"WyXG7w":["Close all"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X7u0xR":[["0"]," templates available"],"X8kjQX":["Re-authenticate with GitHub"],"X9VpsP":["Loading folder contents"],"XDzAnp":["Opens in a new tab"],"XH30C4":["document"],"XJOV1Y":["Activity"],"XPJ0sN":[["settingsDescriptorLabel"]," properties"],"XPqe3B":["Create new tag #",["tagValue"]],"XRuL0i":["Create page"],"XU0OXn":["Enable auto-sync"],"XW18jo":["Page headings response did not match success schema"],"XYlJJT":["Setting up"],"XcGbim":["Show hidden files"],"Xet9MX":["Failed to load backlinks"],"XfzqjK":["template \\"",["name"],"\\""],"Xl-UUg":["guides/install or https://example.com"],"XnlF3W":["Add the next matching source selection."],"XnoA1k":["This ",["targetNoun"]," only exists on branch <0>",["shareBranch"],"</0>. You have uncommitted changes that prevent switching. Commit or stash your changes, then open the share link again."],"XopE_I":["Failed to parse backlinks error response (HTTP ",["status"],")"],"XpIZmv":["Fenced code block with monospace text."],"XtRoxT":["Page ",["pageNumber"]],"XvPJaT":["Diff layout"],"Xv_ijG":["https://github.com/owner/repo or owner/repo"],"Xw_maT":["Type a query, then press ↵ to search your pages by meaning."],"XyOUTJ":["Exit merge"],"Y-Urt2":["Block math equation rendered with KaTeX from a LaTeX source string."],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YC6_wP":["Edit ",["keyName"]],"YEP3X2":["Delete a table when the active table cell selection covers the full table."],"YGIi_c":["Reinstall"],"YKLP_-":["Template renamed"],"YPFBfr":[["detail"]," - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"YSFv5w":["No git repository — config sharing does not apply here."],"YTLmTM":["Remove the parent <0>.git</0> folder"],"YW7Q86":["Search settings not yet loaded — try again in a moment"],"Y_kL7X":["Customize how the editor looks and behaves."],"YaeyFh":["Pulls may overwrite uncommitted edits in your local files."],"Yea-K5":["Restore to this point"],"Yi0VMG":["Upload ",["keyName"]],"YjhKI5":["Cloning..."],"YlDuro":["Fit height"],"YsEYYS":[["behind","plural",{"one":["#"," commit behind"],"other":["#"," commits behind"]}]],"YwPUUP":["This pack is already set up here."],"YyXtnN":["Underline"],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z5h97D":["Hide files and folders from your knowledge base. Hidden items don’t appear in the file tree, search, or AI tools. <0>Learn more about patterns</0>."],"Z8KDox":["Enter a folder name (e.g. brain)."],"Z8lGw6":["Share"],"ZBYKxv":["Reverts every change this agent made to <0>",["docName"],"</0> this session (",["burstCount","plural",{"one":["#"," burst"],"other":["#"," bursts"]}],"). Other files and writers are unaffected."],"ZBt4rI":["Instruction for the AI"],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"ZQLDTl":["created folder"],"ZU8VV_":["Remove failed: ",["error"]],"ZWgr0b":["In a subfolder"],"ZWolSV":["You picked the filesystem root (/). Scaffolding here will scan every file on this machine — make sure that's what you want."],"ZWxfrc":["cleared folder properties"],"ZWyHmq":["This project"],"ZhhOwV":["Quote"],"ZjtgI-":["Command palette"],"Zon_qG":["Mirror source <0>",["label"],"</0>"],"ZptNUh":["Show ",["hidden"]," more"],"ZsGpr_":["Paste link"],"Zue_jx":["Your GitHub token is missing required scopes. Try signing in again."],"Zul8Ry":["never"],"ZxXhLY":["Hide Files (",["sidebarShortcut"],")"],"Zz25kq":["Show Files (",["sidebarShortcut"],")"],"_7UQ7y":["Whole word"],"_8quCH":["From template"],"_902BE":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. You're currently on <1>",["currentLabel"],"</1>."],"_BthEY":["Open in ",["shareBranch"]],"_GBioJ":[["docName"]," is ",["0"],". Open Knowledge currently opens files up to ",["1"],"."],"_K2CvV":["Template"],"_PACVa":["Release notes"],"_PBJRl":["Add at least one letter or number."],"_QwkMu":["No matching paths"],"_TDESN":["Network error - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"_TF8ep":["Failed to render PDF"],"_VRtd7":["Couldn't send the selection — please try again."],"_W-elG":["(inline)"],"_XWY2J":["Terminal disabled"],"_eguJc":["Uploading"],"_gkGSK":["deleted template"],"_pY_Vq":["The repository was moved, renamed, or deleted."],"_qD6mn":["Pick the folder where you've cloned it."],"_rP3HI":[["minutes"],"m ago"],"_tekeB":["updated folder properties"],"a-cKXz":["Select all source"],"a5Gha5":["Local changes blocked the merge"],"a5W0q0":["Are you sure you want to delete ",["folderName"],"/ and all files inside? This action cannot be undone."],"a9OzSn":["No pages found for \\"",["trimmedQuery"],"\\""],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"aENGMB":["Semantic search adds meaning-based ranking to the search tool so conceptually-related pages surface even without shared keywords."],"aIgBKf":["Can't nest projects. An Open Knowledge project already exists at <0>",["rootPath"],"</0>. Choose a location outside it, or open that project instead."],"aM23Wr":["page-name"],"aOp3hw":["Couldn't move to Trash"],"aWlJai":["Starting sign-in flow"],"a_u4ck":["Loading tags"],"aaE55D":["Clear ",["keyName"]],"aalx4E":["Editing broken MDX source: ",["reason"]],"abiHje":["Delete selected items"],"adsMWO":["Resolving deltas"],"aiArms":["We couldn't clone this repository."],"ajz9F8":["Couldn't load conflict content for ",["filePath"],". Try reloading the page."],"aoa6xA":["network error (is \`ok ui\` running?)"],"b3Thhd":["Upload failed"],"b4AQFK":["Open activity panel for ",["tooltipName"],", editing ",["realCurrentDoc"]],"b4itZn":["Working"],"b5aNbi":["The ",["targetNoun"]," could not be opened — try navigating to it manually."],"bBE5tC":["Detected on this machine"],"bBcFK_":["Open emoji picker for ",["keyName"]],"bD8I7O":["Complete"],"bGa3Fk":["Uploading file"],"bH382I":["Edit this HTML — the preview updates live."],"bHboUQ":["Edit template"],"bS_boY":["Replace current match"],"bUUVED":["Asset"],"bWLmRK":["Could not fetch branch. Check your connection."],"bcDHUM":[["descriptorLabel"]," — render error, source editable below"],"bcjYUA":["Fold or unfold source"],"bkQRMh":["Paragraph"],"bmC18N":["Clearing local collaboration data for \\"",["docName"],"\\" before reconnecting."],"brCtGB":["History unavailable"],"bultyE":["When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c1LZZH":["Link copied."],"c5f7sm":["Code block language: ",["currentLabel"],". Click to change."],"c5rF4v":["What is this knowledge base for?"],"c863eW":["Could not switch to ",["shareBranch"],". Try switching manually."],"c8iK2Y":["No templates found."],"cEoyWz":["Add item to ",["keyName"]],"cEx1UT":["Setup Open Knowledge in this folder?"],"cF9DyA":["Reconnecting after server restart"],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cOSAfL":["No repositories found on your GitHub account."],"cOrTMo":["Your share link is ready below."],"cSCbv3":["BETA"],"cUK8lW":[["conflictCount","plural",{"one":["#"," conflict"],"other":["#"," conflicts"]}]],"cUk6TF":["Sync failed — check the server logs for details."],"cV7LOw":["Team Wiki"],"cZGNlb":["Add another pattern"],"cZI5AL":["OK Desktop"],"cZ_8zB":["Stays on this computer."],"cdm00A":["No Incoming"],"cdmk8A":["Uncommitted changes"],"cklVjM":["Timeline"],"cnGeoo":["Delete"],"coIbL2":["Choose whether this project's Open Knowledge setup, including its AI-tool connections, is saved with the project so teammates get it too, or kept only on your computer."],"cqQyPB":["Folder name"],"cs4mps":["Config sharing"],"csDS2L":["Available"],"ct2kv5":["No headings in ",["pageTarget"]],"cuA8QW":["Organize specs"],"d2uTPx":["Server error (HTTP ",["status"],")"],"d5rK4X":[["chars","plural",{"one":["char"],"other":["chars"]}]],"dD7NPy":["Outline"],"dDpCOp":["Rename succeeded but the sidebar may be out of date — refresh to resync"],"dEgA5A":["Cancel"],"dJw2_7":["Saved with the project for your team."],"dN20LW":["Semantic search is on, but no API key is set — search falls back to keyword matching. Add one in <0>Settings → Account</0> (it's stored once for your whole machine)."],"dNM58w":["Claude Code (claude) isn't installed or on your PATH."],"dOHMA0":["Failed to move"],"dOxPd4":["Footnote"],"dPOFid":["Show or hide terminal"],"dTaauv":["Reason: ",["reason"]],"dUQ7_J":["Add meaning-based ranking to search so conceptually-related pages surface even when they share no keywords. This setting applies only to this computer."],"dURmlQ":["\\"frontmatter\\" is a reserved property name"],"dbhUX1":["Hide this file"],"dbtjJh":["(opens in new tab)"],"djc1l9":["More than ",["0"]," requests were blocked by the preview's security policy"],"djjdjr":[["deleteCount","plural",{"one":["Delete"],"other":["Delete ","#"," items"]}]],"dprWmL":["Anchor in this page"],"dr1vFs":["Replace all matches"],"dw_dUJ":["Failed to duplicate path"],"e0NrBM":["Project"],"e1Rn_k":["Open containing folder"],"e1hptq":["Embed a video with native player controls."],"e4GHWP":["Pull"],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"e8zRrb":["Show Files"],"eBIT9h":["Paste failed.",["restoreSuffix"]],"eFJkVt":["Clone failed: ",["cloneError"]],"eG8Jsg":["Toggle source tab focus mode"],"eJitUk":["Upload from computer"],"eKThTQ":["Failed to reorder"],"eNQGRb":["Inline LaTeX math rendered with KaTeX."],"ePK91l":["Edit"],"eSu2Xn":["Writes a project-MCP config for each selected tool; Claude also gets <0>.claude/launch.json</0>."],"eVPynQ":["Open <0><1>",["verificationUri"],"</1><2/></0> and enter this code:"],"emgiet":["Authoritative content; mirrored verbatim everywhere it's referenced."],"euc6Ns":["Duplicate"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f1XQyZ":["Move block"],"f65AOQ":["Start from"],"f8jU-L":[["0"],"/",["1"]," — ",["2"]],"fBHvBn":["There's no project folder for this window, so a terminal can't start here."],"fBaTkM":["Toggle the bottom terminal panel."],"fG0X0e":["Install ",["brand"]," →"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fNr-MX":["Disable semantic search"],"fRv-ei":["Start a new Open Knowledge project."],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fYKgzG":["Failed to load recent projects."],"fYjgXu":["Unordered list of items."],"fbdLmk":["Toggle bold formatting."],"fbsiBw":["Something went wrong starting the terminal."],"fcgvCA":["Claude"],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"fqSfXY":["Replace"],"fwhX-N":["Indent or outdent source"],"g3UF2V":["Accept"],"g4XBm0":["Small section heading."],"g58Kwy":["<",["descriptorLabel"],"> failed to render (likely a bad prop). Copy the source to see what went wrong, or delete the block."],"gBbxn_":["Checking sign-in status"],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gITz7o":["Move the cursor or extend selection through CodeMirror's standard source-editor navigation keymap."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gKi-a_":["New project"],"gQV-9w":["Branch switched but the ",["targetNoun"]," could not be opened — try navigating to it manually."],"gUlRQj":["Orphans"],"gYz2ep":["Expires in ",["timeLabel"]],"gbHcbI":["Failed to delete property"],"gcV0dI":["The folders and templates are in place; there's nothing left to scaffold."],"gfohmY":["Connect tools"],"ggm6JX":["This page doesn't exist yet. Open it to create the page in the editor and collapse the graph."],"ggs9f8":["Search files, folders, or commands"],"gijbne":["Failed to rename path"],"gljvbT":[["words","plural",{"one":["word"],"other":["words"]}]],"gmJ0An":["Failed to open folder."],"goO4Ll":["Editor status bar"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtEbeW":["Highlight"],"h06R3C":["No pages are missing outgoing graph links."],"h6EvY-":["This will replace the current document content with the version from <0>",["relative"]," (",["absoluteTime"],", ",["entrySha"],")</0> by <1>",["authorName"],"</1>. Your current content is already saved in the timeline — you can restore it anytime."],"h7FzJC":["Link-graph response did not match expected shape."],"hA8GQ6":["Will replace existing Open Knowledge entry"],"hBMK4W":["Project templates"],"hDKtoF":[["diffHrs"],"h ago"],"hDoLrm":["Remove ",["projectName"]," from recent projects"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hHMv6l":["Delete block"],"hSBIG-":["A title, description, tags — anything that describes this folder."],"hSySVc":["Install handoff failed: ",["msg"]],"hXUWyd":["Value is required"],"hXbSxc":["Asset: ",["title"]],"hY8pka":["Select next occurrence"],"hYDc6B":["Name cannot be empty"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"he3ygx":["Copy"],"hjO0Mq":["Add tab"],"hozzkE":["Create with Claude CLI"],"hpDtUm":["External wiki link"],"hwFOFD":["Settings failed to load"],"hxBHxQ":["A line with a footnote<0><1>[1]</1></0> and a definition shown below."],"hxEUVJ":["Initialize ",["selectedPackName"]],"hyCxJY":["Open that worktree instead"],"hynz2K":["Download started"],"i1flq_":["Wiki link suggestions"],"i3f2kh":["No matching commands."],"i92eAT":["We'll create a repository and start syncing — no terminal needed."],"i9OyGp":["Undo or redo"],"i9toLO":["Agent configuration file"],"iDZtvM":["Failed to load templates: ",["message"]],"iEQQyu":["Agent"],"iEYxO4":["Show thumbnails"],"iGCs04":["No templates available"],"iH8pgl":["Back"],"iHAJDj":["Resolving default location"],"iKSP5j":["Word wrap"],"iMkWoF":["Turn on"],"iNFKkm":["No diff."],"iOHg1t":["Open embedded URL in new tab"],"iSQTsg":["Ordered list"],"iSnkwB":["Failed to open cloned project."],"iTlqm3":[["ahead","plural",{"one":["#"," commit ahead"],"other":["#"," commits ahead"]}]],"iTylMl":["Templates"],"iXTp5j":["Scope: "],"idD8Ev":["Saved"],"ig5vUe":["Failed to load file"],"iilQXA":["Folder duplicated"],"ijLc3m":["Bullet list"],"iqIDv4":["Sync status unavailable"],"iqugog":["Initialize failed: ",["errorDetail"]],"irFGwu":["Template list"],"isRobC":["New"],"iuTKci":["No edits yet."],"iycx_A":["Pushing"],"j6LB7S":["This project's running server doesn't support live editing. Restart Open Knowledge to fix."],"j9Vqvc":["inherited"],"jEdF24":["Missing page: ",["linkTitle"],". Click to create."],"jGJy-9":["Downloads ",["shareOwner"],"/",["shareRepo"]," from GitHub."],"jKd3AP":["Could not enable the terminal: ",["0"]],"jPUPvG":["Couldn't resolve the conflict for ",["filePath"],"."],"jRHdCz":["Failed to load PDF"],"jSO1X5":["Inherited templates can't be renamed here — rename it in the folder that owns it."],"jSY41h":["\\"",["docName"],"\\" took too long. Check your connection."],"jTLWxh":["Embed an external page in an inline iframe (docs, demos, Figma, CodeSandbox)."],"jZ_E5M":["Fetch failed — check the server logs for details."],"jbSG8V":["Show Files (",["sidebarShortcutLabel"],")"],"jdGUeI":["Couldn't create template: ",["error"]],"jerqF0":["Loading branch state"],"jhtG3I":[" Your selection has been restored."],"jjtmV_":["First file name"],"jol95m":["Failed to open Project Navigator."],"jtg_8-":["Build a knowledge wiki about the different types of flightless birds. Start with an overview page, then add cross-linked pages for each major group (ratites like ostriches, emus, and kiwis; penguins; and flightless rails), the regions they live in, and a timeline of how flightlessness evolved."],"ju38ms":["This project has no git repository — sharing mode does not apply. Initialize a repo to enable the toggle."],"jwnpdM":["A template named <0>",["trimmedSlug"],"</0> already exists here. Saving creates a local copy that overrides it for this folder."],"kCNU4q":["Indexing your pages — ",["semanticIndexedCount"]," of ",["semanticTotalCount"]," ready. Results may be incomplete."],"kCqCyf":["Open CodeMirror's lint diagnostics panel."],"kFLlsI":["Insert a footnote reference + matching definition stub."],"kNqMMd":["Folder"],"kUn-CN":["Sync off"],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kYL1lH":["Agent activity"],"k_pade":["Config sharing is now shared. Commit the OK files to share with your team."],"k_yIIc":["Will be created at: <0>",["targetPreview"],"</0>"],"kdzzOK":["Off — search ranks by keyword only. No content leaves this computer."],"keNFEd":["Set identity"],"kj9pAE":["Creating page"],"kknhfj":["No changes"],"kmKqZg":["Clusters"],"knjOzA":["Tag value"],"kolRU1":["Do you want to permanently delete instead?"],"ku0yLQ":["Pages are embedded the first time a search needs them."],"ky9Tuc":["Edit ",["0"]," source"],"l17ab4":["Could not write project files. Try a different location."],"l1aQKz":["Visual editor table"],"l1l8sj":[["0"],"d ago"],"l3mSlL":["Append-only timeline"],"l6OXqI":["No installed agents found"],"l8G3S9":["Auto-sync is off — you don't have permission to push to this repo"],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lGs_bQ":["Page <0>*</0>"],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lIn9L9":["Disable sync"],"lLGJG6":["Couldn't connect Open Knowledge tools to Claude Code. Please try again."],"lPzyrU":["All hunks resolved"],"lVWEIL":["Indexed ",["embedded"]," of ",["total"]," pages."],"lWNpNB":["Add cursors or select matching occurrences through CodeMirror."],"lXKZGw":["Heading 1"],"lZAiSP":["Backlinks response did not match expected shape."],"l_FAT6":["Use letters, digits, <0>-</0> or <1>_</1> only."],"l_UFPv":["Properties"],"lb_UU4":["Sync now"],"lbkOif":["Undo or redo visual-editor changes through TipTap collaboration history."],"lhjq3G":["Reset ",["labelText"]," to default"],"lkYioO":["Show or hide document panel"],"ll2yNl":["Content directory"],"lond3p":["Shows above the code body. Round-trips as \`title=\\"...\\"\` in markdown."],"lrhetp":["+ ",["overflow"]," more"],"ls1N1w":["(missing)"],"lyWa43":["Project-level disconnected pages"],"lzmtKp":["Failed to load folder properties: ",["message"]],"lzwo7p":["Could not open GitHub sign-in. Please try again."],"m16xKo":["Add"],"m2T1Xj":["Tag #",["tagValue"],", ",["uses"]],"m4v3XT":["Undo last edit on ",["docName"]],"m6YGpY":["Active panel content for the selected tab shows here."],"mBltnd":["Path suggestions"],"mGaZwZ":["See the full install guide"],"mHVPm5":["Reconnect required"],"mKZODc":["Adds the Open Knowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"mNY1G6":["Undo all edits"],"mPy9lS":["Organize my existing specs into a linked index grouped by area, and flag any that have drifted out of sync with the current code."],"mSJ3Rn":["Computing scaffold plan"],"mU3j1b":["Remove item ",["0"]],"mWVJRX":["Collapsible section with a clickable summary."],"mYGY3B":["Date"],"mYLRjR":["You picked ~/Desktop. Open Knowledge will index everything on your desktop."],"mZ1r4i":["Create a document from ",["label"]],"maDWIB":["Mirror source <0>api-spec</0>"],"makN88":["No patterns yet. Type a folder or file name below to start hiding files."],"mdKFEy":["You cancelled loading \\"",["docName"],"\\"."],"mdzKSV":[["nodeCount","plural",{"one":["#"," node"],"other":["#"," nodes"]}]],"mf37rL":["Retrying"],"mg0YGL":["Source multi-cursor and multi-select"],"mk2poV":["e.g. server.ts"],"mmpzAq":["Wrap long lines in the markdown source editor."],"mo22UP":["Toggle inline code formatting."],"mqSwZH":["<0>Mirror anchor not found.</0> No <1>",["mirrorSourceTag"],"</1> exists in <2>",["src"],"</2>."],"msOK6I":["Repositories you've already cloned may keep syncing through git's own saved credentials, even after you disconnect."],"mwMF9u":["Open CodeMirror search in source editor mode."],"mxY24F":["Duplicate the focused file-tree item when focus is in the Files sidebar."],"n2lRue":["Commit or stash changes to switch:"],"n5n_vi":["Private repository"],"n6hXUm":["Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."],"n7aopT":["Editor mode"],"nCzR-G":["Copy code ",["userCode"]],"nDT8qt":["Initialized ",["0"]," but could not open it."],"nNYV3Y":["and ",["remaining"]," more"],"nPhvQ_":["Claude Code is installed, but Open Knowledge tools aren't connected to it yet."],"nTwL53":["Open a doc to share its URL."],"nWv1ja":["Manage hidden files in Settings → Ignore patterns."],"nYKerc":["(user-level only)"],"nYeBmY":[["hours"],"h ago"],"nbfdhU":["Integrations"],"ndeI89":["Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."],"neRy3o":["Split list item"],"nft48x":["Stored at <0>.ok/templates/</0> in this project. Available in every folder (folder-scoped templates can override by filename)."],"nh3wwx":["Embeddings provider key"],"njBeMm":["Both"],"njU86j":["Property \\"",["trimmed"],"\\" already exists"],"noH1JX":["Couldn't reach collab server — ",["errorDetail"],". Try <0>ok status</0> or check <1>.ok/local/last-spawn-error.log</1>."],"nrGWJ7":["Git identity isn't set — commits use a default author. Set yours so teammates see your name."],"nskygk":["Choose agent"],"nzHlj8":["Close ",["0"]],"nzaV6Q":["Page thumbnails"],"o2yoFu":["Reveal in Finder, No workspace"],"o49mDZ":["Loading timeline history"],"o4dcAf":["Reveal in File Explorer, ",["hint"]],"o5gfs1":["This setting is per-machine and isn't shared with collaborators. It needs an API key set with <0>ok embeddings set-key</0>."],"oBXkm2":["Delete code block"],"oCZkaG":["Copy path"],"oJl7eO":["Unknown component: ",["componentName"]," — source editable below"],"oKBnk5":["More requests were blocked."],"oQA-cA":["Full path"],"oS1YpJ":["Open the Project Navigator."],"oXKEsy":["Delete an adjacent wiki-link or tag chip."],"oYepHb":["The terminal is turned off for this project. Turn it back on to run commands here."],"ogAuyr":["Back to document view"],"omXJcU":["Close others"],"optX0N":[["0"],"h ago"],"oqB2ez":["Previous match"],"ot5BRK":["Duplicate selected file or folder"],"otE4aj":["Show external URL nodes"],"ou1hFW":["Toggle an ordered list."],"outYNy":["Duplicate name \\"",["keyName"],"\\""],"ovIGrT":["Local collaboration data for \\"",["docName"],"\\" could not be cleared. Reload to retry."],"p0Iq25":["Insert link"],"p9sdCy":["New ignore pattern"],"pAgkuZ":["Reopening \\"",["docName"],"\\" with a fresh local collaboration cache."],"pEQFsW":["No matching projects."],"pFagOn":["Source editing"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pRc-Im":["Undone all edits on ",["docName"]],"pTPqMK":["Toggle a fenced code block."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pZAs1T":["Failed to load outgoing links"],"pajIrl":["Could not turn off the terminal: ",["0"]],"pbwTg6":[["seconds"],"s ago"],"pckX1A":[["0","plural",{"one":["#"," use"],"other":["#"," uses"]}]],"pgq_xf":[["0"],"/",["1"]," ",["2"]],"phM8Kh":["Found the repo but could not open the project. Please try again."],"pha01Y":["Project-level pages with no incoming graph edges."],"pkAft1":["Search failed."],"pmKdif":["Failed: ",["loadError"]],"pmUArF":["Workspace"],"ppDgFi":["Restart with this app's version"],"prHfed":["Each selected tool gets an Open Knowledge MCP entry."],"pzutoc":["Italic"],"q2kXMG":["Inline Math"],"q4YJl_":["The terminal session ended (exit code ",["0"],")."],"q6-JVU":["Loading pages"],"qAQVSD":["Page headings response was not JSON"],"qAhFeg":[["userName"]," · ",["tabCount","plural",{"one":["#"," tab"],"other":["#"," tabs"]}]],"qEIFZu":["Key ending in ",["keyHint"]],"qEue6Q":[" or "],"qFWMl-":["View as text"],"qNOgUu":["Edits at the source land here — no copy-paste drift."],"qRZh7J":["Let Tab leave the source editor instead of indenting."],"qSKu2v":["Source navigation and selection"],"qSxaOz":["Accept their deletion"],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qZv5ZR":["Config sharing toggle failed"],"q_9EcE":["Enable git auto-sync?"],"q_z77Z":["Heading levels"],"qaHyRJ":[["linkCount","plural",{"one":["#"," link"],"other":["#"," links"]}]],"qbfj1f":["Receiving objects"],"qdBUHP":["Couldn't load ",["fileName"]],"qi1F96":["Reveal in File Explorer"],"qioCwA":["Jump to page ",["pageNumber"]],"qjHMHf":["Failed to disable sync — ",["detail"]],"qo4zCg":["Path cannot contain backslashes"],"qpQwGC":["Describe what you're working on and the agent sets it up for you."],"qvWGzP":["Collapse all"],"qvcK7S":["Open Knowledge will create commits and push them to your remote automatically. If you do not want automatic commits in your git history, you should not enable auto-sync."],"qyLmWw":["Source editor search panel"],"r2huLx":["Undo, redo, or undo selection changes through CodeMirror history."],"r4R7AZ":["Network error during cleanup"],"r51jLC":["File saved & Claude Desktop App opened"],"r871ed":["Your knowledge base is now on GitHub at <0>",["ownerLogin"],"/",["repoName"],"</0>."],"rBc32v":["Couldn't reach the embeddings provider — press ↵ to retry"],"rFw02Q":["Uploading ",["keyName"]],"rJVoVX":["Source find results"],"rQAQus":["Couldn't save template: ",["error"]],"rQRrkB":["yesterday"],"rVgSRB":["Collapse ",["docName"]],"rVxu1k":["No pages link here yet."],"rXz97P":["Numbered list of items."],"rZ9HZq":["To do"],"rZVMkf":["Visual editor replace input focused"],"rageVb":["Custom HTML with a live preview pane (sandboxed iframe)."],"rdU729":["Layout"],"rfFpcF":["Remove ",["chip"]],"rgPqOw":["Convert the current block to a paragraph."],"riqekz":["Suggestion menu navigation"],"rlUzXK":["Could not validate folder. Please try again."],"roAe2K":["Link URL"],"roiUQQ":["This page doesn't link to anything yet."],"rppgXF":["Disconnecting"],"rssK8c":["Ignore patterns (raw text)"],"rtdR4v":["Show or hide Files"],"rwrPbS":["Component boundary navigation"],"s-MGs7":["Resources"],"s-XOaI":["File name"],"s061i4":["Relative path"],"s0IDhW":["This file could not be found."],"s0J_k9":[["0","plural",{"one":["#"," key"],"other":["#"," keys"]}]],"s1c0ja":["Bullet List"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sIGbBZ":["Convert selection to footnote"],"sIxSSP":["Resolve conflict in your terminal"],"sJK6pq":["Permission denied"],"sJWhgo":["Unknown component: ",["unregisteredComponentName"]],"sOxZaS":["Failed to load graph"],"sZ2IOu":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. It doesn't exist on your current branch (<1>",["currentLabel"],"</1>)."],"saIASg":["Second item"],"saYiIO":["Path cannot contain null bytes"],"shNd9t":["Slash command menu"],"skf5Ix":["Indent or outdent source editor lines."],"snrVQ7":["probe failed"],"ssuwjF":["Branch"],"stlgky":["On — your search queries and the text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"sxTdZI":["Loading paths…"],"sxkWRg":["Advanced"],"t-JXbf":["Notion-style inline row for a downloadable file. Drag-drop also works."],"t18QYR":["Unpin ",["accessibleLabel"]],"t2TkQ3":["Sync paused — resolve conflicts to resume."],"tAPZEx":["Below"],"tP5DDk":["Apply link"],"tUvUfp":["Use a folder you already have."],"tW_yvQ":["Expand ",["docName"]],"t_YqKh":["Remove"],"tfDRzk":["Save"],"tfi40B":["Failed to create page"],"tgWuMB":["Modified"],"tiWX6q":["Source editor"],"tjXez2":["blog-post"],"tsiTqO":["Paste your API key"],"u-9fWA":["See <0>Architecture</0> for the system overview."],"u3BOHd":[["fileCount","plural",{"one":["#"," file"],"other":["#"," files"]}]],"u3YnKw":["Could not construct share URL."],"u3wRF-":["Published"],"u6Hp4N":["Markdown"],"u7H-Wn":["Show panel (",["panelShortcutLabel"],")"],"uCaIdy":["GitHub sign-in is missing or expired. Reconnect to resume syncing."],"uDlyqd":["Document the architecture of this repo: create an overview page that links to a page per major module describing its responsibilities and entry points."],"uF9ruK":["Saving"],"uH_S-u":[["loadErrorTitle"],": ",["message"]],"uKRYiW":["Sync status unavailable — server error."],"uL_Wx8":["The terminal stopped unexpectedly."],"uM6jnS":["Restore failed"],"uO9WLl":["Push"],"uQNW00":["Detached HEAD — checkout a branch to resume"],"uQewpR":["Couldn't restart the server — it's running under a different account. Restart your computer to clear it, then reopen this project."],"uWtdQR":["No templates yet. Add one in this folder's Templates section, or in Settings → Templates."],"uWx2ZP":["Last sync"],"u_lS4C":["Clone complete — opening project"],"ubMwcO":["The terminal session ended (signal ",["0"],")."],"ugoTXs":["folder"],"uhJEA2":[["count","plural",{"one":["#"," more participant"],"other":["#"," more participants"]}]],"uksqrP":["Repository not found. It may have been renamed, deleted, or moved."],"un8kBM":["Creating page: ",["linkTitle"],"."],"ur2XSb":["Visual editor"],"uuoHOU":["Command failed."],"uynXup":[["tokens","plural",{"one":["token"],"other":["tokens"]}]],"v-h2hx":["Delete ",["targetGitPath"]],"v2ZW0K":["Enable terminal"],"v41fCm":["File not found"],"v75Em9":[["uploadedCount","plural",{"one":["Uploaded one file"],"other":["Uploaded ",["uploadedCount"]," files"]}]],"v7lbnC":["Find next match"],"vDXqVv":["Insert a markdown hard break."],"vEJDlt":["The file is in your Trash; the file-watcher will reconcile."],"vGeNNQ":["Copy a prompt and paste it into your agent to set up your project."],"vIxrEk":["Fit width"],"vLyv1R":["Hide"],"vPYaz3":["Scaffold directly under this project."],"vQIVHc":["Folder properties"],"vWc9a0":["Type to edit; <0>⌘ Enter</0> saves, <1>Esc</1> cancels."],"vZVeFG":["Upload failed — please try again"],"vbK_ZG":["Files sidebar"],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"vhAnzJ":["Turn on semantic search?"],"viwC-K":["Failed to remove project."],"vv7kpg":["Cancelled"],"vvWZnu":["Diff unavailable"],"w3tVpc":["No links yet. Add wiki links or markdown links to build a graph."],"w3vFfL":["Hide Files"],"w4hMYl":["Could not read branch state for this project. Close this dialog and open the share link again."],"w7nm4K":["Indented blockquote for citations."],"wJijgU":["Location"],"wJo9oS":["Close find"],"wQp1V3":["Mirror of <0>",["src"],"</0>"],"wT4iQr":["Open visual-editor find with replace controls expanded."],"wTcjov":["No workspace"],"wXO4Tg":[["hrs"],"h ago"],"wbv9xO":["Create new project"],"wbwHYD":["Enable sync"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"wndeIl":["Project-level pages with neither incoming nor outgoing graph edges."],"wtcxiD":["Share this setup with your team?"],"wvbc1r":["Couldn't open document"],"x2fr_j":["Graph"],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"x57cJf":["Open link"],"xCJdfg":["Clear"],"xCdTnb":["Close new tab"],"xDBki3":["Heading suggestions"],"xFQRu4":["I already have it locally"],"xG4tb6":["Lost connection to \\"",["docName"],"\\"."],"xHGM4U":["Hide HTML preview"],"xK291b":["Two-page (odd)"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"xOTzt5":["just now"],"xSVO3J":["What gets created"],"xXo8FT":["Save failed: ",["error"]],"xYMPyY":["Paste was incomplete — ",["chunksCompleted"]," of ",["totalChunks"]," chunks landed.",["restoreSuffix"]],"xaDWAI":["Switch project"],"xbdtfY":["Markdown source"],"xc4g25":["Parse failed"],"xeXS4P":["Or use a starter pack"],"xeiujy":["Text"],"xhlFsx":["Inherited — set a value here to replace it."],"xiv-dW":["No files yet."],"xsZhu-":["Page number"],"xzktOa":["Edit wiki link"],"y1t8bQ":["Settings sections"],"y3aU20":["Save changes"],"y46m5r":["The desktop app isn't responding. Refresh and try again."],"y5FUYi":["Suggestion menu open"],"yCX4jp":[" Your selection could not be restored."],"yEJ-sl":["The preview blocks resources that don't meet its security rules (for example plain http:// URLs, or code that uses eval). The content above may render incompletely."],"yFyZMJ":["No pages matched \\"",["semanticQueryText"],"\\" by meaning."],"yH7T4q":[["failedCount","plural",{"one":["1 file failed to upload"],"other":[["failedCount"]," files failed to upload"]}]],"yHikCO":["Open CodeMirror's go-to-line prompt."],"yIPXut":["Preparing search"],"yKu_3Y":["Restore"],"yLq4w4":["Separator"],"yMgL_E":["Find field navigation"],"yQE2r9":["Loading"],"yUxR-Q":["Expand ",["keyName"]],"yWWThY":["Asset reference"],"yYR6za":["Display text"],"yZmvQ4":["This project's server (v",["0"],") is newer than this app (v",["1"],")."],"y_5CE8":["Item ",["0"]],"yf5r22":[["keyName"]," type: ",["typeLabel"]," (inherited from folder properties; not editable here)"],"ygbd_U":["Open Knowledge stores its configuration and internal files inside a newly created <0>.ok</0> directory in your project root folder."],"yjExfe":["Branch <0>",["shareBranch"],"</0> is checked out in:"],"ylXj1N":["Selected"],"ynIa4S":["Visual editor list item"],"ypw6My":["Showing top ",["0"]," headings — keep typing to narrow"],"ysxgu8":["project"],"yu8Pzy":["Not detected"],"yutJKi":["Checklist with checkboxes."],"yvG-l1":["Open source lint panel"],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"yzF66j":["Link"],"yzGPkm":["Expand graph"],"z0a2EA":["Diagram from Mermaid source — flowchart, sequence, class, state, ER, gantt, pie."],"z1uNN0":["No emoji found."],"z2JdQ-":["Config sharing unchanged — see details below."],"z5pqI8":["Cannot upload: no document is open"],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"zAsDLY":["Graph visualization of document links"],"zEfRFN":["Using the <0>OK_EMBEDDINGS_API_KEY</0> environment variable (managed outside Open Knowledge)."],"zL0LPh":["Global outside text fields"],"zLGXna":["No starter packs available."],"zLak8b":["Activate new tab"],"zQBg2C":["Move the current block up or down one position."],"zUhPuR":["Open containing folder, ",["hint"]],"zXZ0sB":["Open Knowledge initializes at <0>",["projectDir"],"</0> — the parent of <1>",["pickedRelative"],"</1> because it contains a <2>.git</2> folder (one .ok/ per git repo). <3>Content directory</3> defaults to <4>.</4> (the whole repo); type a sub-folder to narrow it."],"zXj1rA":["Search by meaning"],"zZ_I5K":["Open project menu"],"zaXlhf":["The properties block at the top of this doc has a formatting error. Switch to source mode to fix it."],"zbymaY":[["0"],"m ago"],"zgSFyG":["External link"],"zkz0Fg":["Set up syncing"],"zlErBl":["Page headings error response did not match RFC 9457"],"zo3Dl7":["Toggle thumbnails"],"ztKII6":["Failed to add item"],"zwBp5t":["Private"]}`)},pp=`en`;ms.load(pp,fp.messages),ms.activate(pp);var mp=Symbol.for(`ok.client.logForwarder`),hp=2e3,gp=[`log`,`info`,`warn`,`error`],_p={log:`info`,info:`info`,warn:`warn`,error:`error`};function vp(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function yp(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function bp(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[mp])return;n[mp]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??hp,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function p(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0,d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify({entries:e})}).catch(()=>{})}catch{}finally{d=!1}}function m(e){if(c.push(e),l+=yp(e),c.length>100){let e=c.shift();e&&(l-=yp(e))}if(c.length>=100||l>=32768){p();return}u===null&&(u=setTimeout(p,a))}function h(e,t){if(!d)try{let n=Fr(t.map(vp).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?cr(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}m({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of gp)r[e]=(...t)=>{f[e](...t),h(_p[e],t)};let g=e=>{if(d)return;let t=e;h(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},_=e=>{d||h(`error`,[`unhandledrejection: ${vp(e.reason)}`])},v=()=>p(),y=()=>{i&&i.visibilityState===`hidden`&&p()};n.addEventListener(`error`,g),n.addEventListener(`unhandledrejection`,_),n.addEventListener(`pagehide`,v),i&&i.addEventListener(`visibilitychange`,y);function b(){for(let e of gp)r[e]=f[e];n.removeEventListener(`error`,g),n.removeEventListener(`unhandledrejection`,_),n.removeEventListener(`pagehide`,v),i&&i.removeEventListener(`visibilitychange`,y),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[mp]}return{flushNow:p,uninstall:b}}function xp(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function Sp(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{hs(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`;if(e.targetMissing===!0){r(`This ${i===`folder`?`folder`:`file`} isn't in your local checkout${e.branch===void 0||e.branch===null||e.branch===``?``:` on branch ${e.branch}`} yet`,{description:`Pull the latest changes, then open the share link again.`,duration:5e3});return}n(Go(i,e.doc,i===`doc`?e.branch:void 0));let a=xp(e,t.config.projectPath);a!==null&&r(a.message,{description:a.description,duration:3e3})})}var Cp=4e3,wp=1440*60*1e3;function Tp(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){hs.success(`Opened existing Open Knowledge project at ${e.ancestorPath}`,{duration:Cp});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>qn[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`Open Knowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;hs[r?`error`:`success`](n,{duration:r||i?wp:Cp});return}if(e.kind===`sharing-refused-tracked`){hs.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:wp,description:e.remediation});return}if(e.kind===`sharing-no-git`){hs.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:Cp});return}let t=Xs(e.gitRoot,e.pickedPath)??e.pickedPath;hs.success(`Initialized Open Knowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Cp})})}function Ep(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Lo,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(ci,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(ci,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function Dp(){return ms._({id:`P8jws3`})}function Op(e){return e.serverRuntime===e.appRuntime?ms._({id:`L5Xu8C`,values:{0:e.appRuntime}}):e.relation===`older`?ms._({id:`5z2tUG`,values:{0:e.serverRuntime,1:e.appRuntime}}):ms._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function kp(e){return ms._({id:`2YOwme`,values:{appRuntime:e}})}function Ap(e){return ms._({id:`VsBxkh`,values:{appRuntime:e}})}function jp(e){return e===`eperm`?ms._({id:`uQewpR`}):ms._({id:`PqYWiC`})}async function Mp(e){let t=hs.loading(ms._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}hs.dismiss(t),n.ok===!1&&hs.error(jp(n.reason),{duration:1/0})}function Np(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{hs.custom(n=>(0,Q.createElement)(Ep,{body:Op(e),warning:Dp(),restartLabel:ms._({id:`ppDgFi`}),cancelLabel:ms._({id:`PBxg_E`}),onRestart:()=>{hs.dismiss(n),Mp(t)},onDismiss:()=>hs.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{hs.success(kp(e.appRuntime))}),i=t.onServerReclaimed(e=>{hs.warning(Ap(e.appRuntime),{duration:15e3})});return()=>{n(),r(),i()}}var Pp=!1;function Fp(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{le(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Ip(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 Lp=0,Rp=0,zp=0,Bp=0,Vp=null,Hp=[`linkResolutionDecoration$`],Up=new WeakSet,Wp=new WeakSet;function Gp(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Kp(){return!1}function qp(){return!Kp()}function Jp(e,t){if(qp())return t;let n=`ok/cold/nodeview-factory-${Gp(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;le(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Yp(e){if(qp())return;let t=e.state.plugins;for(let e of t){if(Wp.has(e))continue;let t=e.spec?.key?.key;if(!t||!Hp.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Wp.add(e);continue}let i=`ok/cold/decoration-${Gp(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;le(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Wp.add(e)}}function Xp(e){if(qp())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=Jp(e,n);r.__okWrapped=!0,t[e]=r}}function Zp(e){return qp()?e:e.map(e=>{let t=e.name??`unknown`,n=Gp(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;le(`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;le(`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;le(`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;le(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function Qp(){if(!Pp){Pp=!0,Fp(gr.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return qp()||(Vp=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Ip(i.editorState),durationMs:r}}),Fp(gr.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!qp()&&!Up.has(e)&&t.view&&(Yp(t.view),Xp(t.view),Up.add(e)),{docSize:Ip(t.editorState)}}),Fp(gr.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Bp+=1;let i=e;return!qp()&&i.view&&Xp(i.view),{docSize:Ip(i.view),seq:Bp,durationMs:r}}),Fp(ir.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Rp+=1,{seq:Rp,docSize:Ip(e.state),durationMs:r})),Fp(ir.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(zp+=1,{seq:zp,docSize:Ip(e.state),durationMs:r})),Fp(Ue.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Lp+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Lp,topLevelYElements:a,durationMs:r}}),Fp(zt.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`)&&(le(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}),!qp()&&e===`first-paint`&&Vp!==null)){let e=Vp,n=Math.max(0,t.startTime-e);le(`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}),Vp=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var $p=!1,em=new Set,tm=!1;function nm(){for(let e of em)e()}function rm(e){$p!==e&&($p=e,nm())}function im(){return $p}function am(e){return em.add(e),()=>{em.delete(e)}}function om(e){let t=[e.onUpdateRelaunching(()=>rm(!0)),e.onUpdateRelaunchFailed(()=>rm(!1))];return()=>{for(let e of t)e()}}function sm(){if(tm||typeof window>`u`)return;let e=window.okDesktop;e&&(tm=!0,om(e))}function cm(){return(0,Q.useSyncExternalStore)(am,im,lm)}function lm(){return!1}function um(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(Vo(t))}function dm(){typeof window>`u`||!window.okDesktop||um({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}var fm=`Relaunch`,pm=`Release notes`,mm=`Updates paused`,hm=`Download`,gm=`Reset to defaults`,_m=`Relaunching to install the update…`,vm=`Relaunch failed — please restart manually`;function ym(e){return`Update to ${e} didn't install.`}var bm=`Retry`,xm=`Download manually`,Sm=`Recovery action failed — please try again`;function Cm(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function wm(e){return`Version ${e} ready to install`}function Tm(e){return`Updated to Version ${e}`}function Em(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var Dm=0,Om=0,km=1,Am=2,jm=3,Mm=6e4;function Nm(e,t,n=()=>{},r=Mm){let i=[],a=new Set,o=`update-downloaded`;return i.push(e.onUpdateDownloaded(({version:r})=>{let i=o,a=()=>{t({id:i,body:wm(r),priority:Am,action:{label:fm,onClick:()=>{t({id:i,body:_m,priority:Am,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:Cm(vm,e),variant:`error`,priority:km})})}}})};a()})),i.push(e.onUpdateRelaunching(()=>{t({id:o,body:_m,priority:Am,dismissible:!1})})),i.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:ym(r),variant:`error`,priority:km,action:{label:bm,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:xm,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${vm}: ${i}`:vm,variant:`error`,priority:km})})),i.push(e.onWhatsNew(({version:i,releaseUrl:o})=>{let s=`whats-new-${i}`;t({id:s,body:Tm(i),variant:`success`,priority:jm,action:{label:pm,onClick:()=>{e.shell.openExternal(o)}},onDismiss:()=>{e.update.dismissWhatsNew(i)}});let c=setTimeout(()=>{a.delete(c),n(s),e.update.dismissWhatsNew(i)},r);a.add(c)})),i.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),i.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:mm,priority:Om,action:{label:hm,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of i)e();for(let e of a)clearTimeout(e);a.clear()}}function Pm(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:Cm(Sm,e),variant:`error`,priority:Dm})};n({id:i,body:Em(t.currentBuild),priority:Dm,action:{label:gm,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var Fm=[],Im=new Set,Lm=!1;function Rm(){for(let e of Im)e()}function zm(e){let t=Fm.findIndex(t=>t.id===e.id);if(t===-1)Fm=[...Fm,e];else{let n=Fm.slice();n[t]=e,Fm=n}Rm()}function Bm(e){let t=Fm.filter(t=>t.id!==e);t.length!==Fm.length&&(Fm=t,Rm())}function Vm(){return Fm}function Hm(e){return Im.add(e),()=>{Im.delete(e)}}function Um(){if(Lm||typeof window>`u`)return;let e=window.okDesktop;e&&(Lm=!0,Nm(e,zm,Bm),e.state.query().then(t=>{t.schemaIncompatibility&&Pm(e,t.schemaIncompatibility,zm,Bm)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Wm=`ok-omnibar-recents-v1`,Gm=10;function Km(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function qm(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Jm(e,t){return`${e}:${t}`}function Ym(e){let t=qm(e);if(!t)return[];try{let e=t.getItem(Wm);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Km).slice(0,Gm):[]}catch{return[]}}function Xm(e,t){let n=qm(t);if(n)try{n.setItem(Wm,JSON.stringify(e.slice(0,Gm)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Zm(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Gm)}function Qm(e,t){return e.filter(e=>t.has(Jm(e.kind,e.path)))}var $m=50,eh=50,th=``,nh=null;function rh(e){return e.trim().toLowerCase()}function ih(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ah(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function oh(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t)?.modified,i=n.get(t);a.push({kind:`file`,path:t,name:wr(t),...i?{title:i}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:wr(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:wr(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function sh(e){return Vr({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function ch(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Yr(e.map(sh))}}function lh(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function uh(e){let t=lh(e);return nh&&th===t?nh:(th=t,nh=ch(e),nh)}function dh(e,t,n=$m){return fh(uh(e),t,n)}function fh(e,t,n=$m){let r=rh(t);return r?kr(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function ph(e,t){let n=ah(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(ih).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function mh(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=wr(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function hh(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??eh,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(qo(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(mh).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function gh(e,t,n=[]){let r=rh(t);return r?rh([e,...n].join(` `)).includes(r):!0}function _h(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function vh(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var yh=`tag:`;function bh(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function xh(e,t){return ie(e,t)}var Sh=ke;async function Ch(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var wh=`open-knowledge:doc-panel-tab`,Th=null;function Eh(){let e=Th;return Th=null,e}function Dh(e,t=typeof window>`u`?new EventTarget:window){Th=e,t.dispatchEvent(new CustomEvent(wh,{detail:{tab:e}}))}function Oh(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(wh,n),()=>t.removeEventListener(wh,n)}var kh=[`.md`,`.mdx`];function Ah(e){let t=e.toLowerCase();for(let e of kh)if(t.endsWith(e))return e;return null}var jh={local:0,inherited:1};function Mh(e){return[...e].sort((e,t)=>{let n=jh[e.scope]-jh[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var Nh=`__blank__`;function Ph(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function Fh(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function Ih(e){let t=e.fileName.trim(),n=Ah(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function Lh(e,t){return ec(e.target)?!1:nc(e,`new-item`,t)}function Rh(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function zh(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:a,initialDir:o,suggestedName:c,initialTemplate:l,defaultToTemplate:u,description:d,onCreated:f,folderConfig:p}=e,{_:m}=i(),{addPage:h}=rs(),g=Va(p?null:o),_=p??g,[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(Nh),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(null),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),F=(0,Q.useId)(),I=(0,Q.useId)(),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(null),V,H;t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==c?(V=()=>{n&&(D(null),j(null),k(!1),x(``),C(a===`file`&&l?l:Nh),T(!1),R(!1),y(a===`file`?c??`untitled`:`index`))},H=[n,a,c,l],t[0]=l,t[1]=a,t[2]=n,t[3]=c,t[4]=V,t[5]=H):(V=t[4],H=t[5]),(0,Q.useEffect)(V,H);let U;t[6]!==_.state.data||t[7]!==_.state.status?(U=_.state.status===`ready`?Mh(_.state.data.folder.templates_available??[]):[],t[6]=_.state.data,t[7]=_.state.status,t[8]=U):U=t[8];let W=U,G;t[9]!==_.state.data||t[10]!==_.state.status||t[11]!==n||t[12]!==S?(G=()=>{n&&S!==Nh&&_.state.status===`ready`&&((_.state.data.folder.templates_available??[]).some(e=>e.name===S)||C(Nh))},t[9]=_.state.data,t[10]=_.state.status,t[11]=n,t[12]=S,t[13]=G):G=t[13];let K;t[14]!==_.state||t[15]!==n||t[16]!==S?(K=[n,S,_.state],t[14]=_.state,t[15]=n,t[16]=S,t[17]=K):K=t[17],(0,Q.useEffect)(G,K);let q;t[18]!==u||t[19]!==_.state.data||t[20]!==_.state.status||t[21]!==l||t[22]!==n||t[23]!==w?(q=()=>{if(!n||!u||l||w||_.state.status!==`ready`)return;let e=Mh(_.state.data.folder.templates_available??[]);e.length>0&&C(e[0].name)},t[18]=u,t[19]=_.state.data,t[20]=_.state.status,t[21]=l,t[22]=n,t[23]=w,t[24]=q):q=t[24];let J;t[25]!==u||t[26]!==_.state||t[27]!==l||t[28]!==n||t[29]!==w?(J=[n,u,l,w,_.state],t[25]=u,t[26]=_.state,t[27]=l,t[28]=n,t[29]=w,t[30]=J):J=t[30],(0,Q.useEffect)(q,J);let ee=a===`file`,Y=_.state.status===`loading`||_.state.status===`idle`,te=_.state.status===`error`?_.state.message:null,ne;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){y(e),D(null)},t[31]=ne):ne=t[31];let X=ne,re;t[32]!==v||t[33]!==b||t[34]!==o||t[35]!==a?(re=function(){return Ih({kind:a,initialDir:o,fileName:v,folderName:b})},t[32]=v,t[33]=b,t[34]=o,t[35]=a,t[36]=re):re=t[36];let ie=re,ae;t[37]!==m||t[38]!==v||t[39]!==b||t[40]!==a?(ae=function(){if(a===`folder`){let e=Ph(b.trim());if(e)return{message:m({id:`ODGGlj`,values:{detail:m(Fh(e))}}),field:`folder`}}let e=Ph(v.trim());return e?{message:m(Fh(e)),field:`file`}:null},t[37]=m,t[38]=v,t[39]=b,t[40]=a,t[41]=ae):ae=t[41];let oe=ae,se;t[42]!==O||t[43]!==v||t[44]!==b||t[45]!==a?(se=O||!v.trim()||a===`folder`&&!b.trim(),t[42]=O,t[43]=v,t[44]=b,t[45]=a,t[46]=se):se=t[46];let ce=se,le;t[47]!==m||t[48]!==h||t[49]!==ie||t[50]!==oe||t[51]!==a||t[52]!==f||t[53]!==r||t[54]!==S?(le=async function(){let e=oe();if(e){D(e.message),j(e.field);return}k(!0),D(null),j(null);let t=ie(),n=a===`file`&&S!==Nh?S:void 0,i={path:t};n!==void 0&&(i.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),t=e.status,n=await _e(e,m({id:`d2uTPx`,values:{status:t}}));if(!n.ok){k(!1),D(n.title),j(`form`);return}let o=$r.safeParse(n.body);if(k(!1),!o.success){D(m(a===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),j(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,h(s),ss([`files`,`backlinks`,`graph`]),f?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),k(!1),D(m({id:`HIb0vl`})),j(`form`)}},t[47]=m,t[48]=h,t[49]=ie,t[50]=oe,t[51]=a,t[52]=f,t[53]=r,t[54]=S,t[55]=le):le=t[55];let ue=le,de;t[56]!==m||t[57]!==o?(de=o||m({id:`L6Hhh6`}),t[56]=m,t[57]=o,t[58]=de):de=t[58];let fe=de,pe;t[59]===a?pe=t[60]:(pe=(0,Z.jsx)(Co,{children:a===`file`?(0,Z.jsx)(s,{id:`HdkSiO`}):(0,Z.jsx)(s,{id:`96G6Re`})}),t[59]=a,t[60]=pe);let me;t[61]!==d||t[62]!==fe?(me=d??(0,Z.jsx)(s,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=d,t[62]=fe,t[63]=me):me=t[63];let he;t[64]===me?he=t[65]:(he=(0,Z.jsx)(So,{children:me}),t[64]=me,t[65]=he);let ge;t[66]!==pe||t[67]!==he?(ge=(0,Z.jsxs)(Do,{children:[pe,he]}),t[66]=pe,t[67]=he,t[68]=ge):ge=t[68];let ve;t[69]!==S||t[70]!==ee||t[71]!==F||t[72]!==L||t[73]!==I||t[74]!==W||t[75]!==te||t[76]!==Y?(ve=ee&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:F,className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`f65AOQ`})}),te?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`sE7R19`,values:{templatesError:te}})}):null,(0,Z.jsx)(Vh,{triggerId:I,labelledById:F,open:L,onOpenChange:R,value:S,onValueChange:e=>{C(e),T(!0)},templates:W,loading:Y}),!Y&&!te&&W.length===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`uWtdQR`})}):null]}),t[69]=S,t[70]=ee,t[71]=F,t[72]=L,t[73]=I,t[74]=W,t[75]=te,t[76]=Y,t[77]=ve):ve=t[77];let ye;t[78]!==m||t[79]!==E||t[80]!==A||t[81]!==M||t[82]!==N||t[83]!==b||t[84]!==a?(ye=a===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:N,children:(0,Z.jsx)(s,{id:`cqQyPB`})}),(0,Z.jsx)(jo,{ref:B,id:N,value:b,onChange:e=>{x(e.target.value),D(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":E&&(A===`folder`||A===`form`)?M:void 0,"aria-invalid":E&&(A===`folder`||A===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Ph(b.trim());if(t){D(m({id:`ODGGlj`,values:{detail:m(Fh(t))}})),j(`folder`);return}z.current?.focus()}}})]}),t[78]=m,t[79]=E,t[80]=A,t[81]=M,t[82]=N,t[83]=b,t[84]=a,t[85]=ye):ye=t[85];let be;t[86]===a?be=t[87]:(be=a===`folder`?(0,Z.jsx)(s,{id:`jjtmV_`}):(0,Z.jsx)(s,{id:`s-XOaI`}),t[86]=a,t[87]=be);let xe;t[88]!==P||t[89]!==be?(xe=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:P,children:be}),t[88]=P,t[89]=be,t[90]=xe):xe=t[90];let Se;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>X(e.target.value),t[91]=Se):Se=t[91];let Ce=a===`file`,we=E&&(A===`file`||A===`form`)?M:void 0,Te=E&&(A===`file`||A===`form`)?!0:void 0,Ee;t[92]!==ue||t[93]!==ce?(Ee=e=>{e.key===`Enter`&&!ce&&ue()},t[92]=ue,t[93]=ce,t[94]=Ee):Ee=t[94];let De;t[95]!==P||t[96]!==v||t[97]!==Ce||t[98]!==we||t[99]!==Te||t[100]!==Ee?(De=(0,Z.jsx)(jo,{ref:z,id:P,value:v,onChange:Se,placeholder:`my-note`,autoFocus:Ce,"aria-describedby":we,"aria-invalid":Te,onFocus:Bh,onKeyDown:Ee}),t[95]=P,t[96]=v,t[97]=Ce,t[98]=we,t[99]=Te,t[100]=Ee,t[101]=De):De=t[101];let Oe;t[102]!==E||t[103]!==M?(Oe=E&&(0,Z.jsx)(`p`,{id:M,role:`alert`,className:`text-1sm text-destructive`,children:E}),t[102]=E,t[103]=M,t[104]=Oe):Oe=t[104];let ke;t[105]!==xe||t[106]!==De||t[107]!==Oe?(ke=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[xe,De,Oe]}),t[105]=xe,t[106]=De,t[107]=Oe,t[108]=ke):ke=t[108];let Ae;t[109]!==ve||t[110]!==ye||t[111]!==ke?(Ae=(0,Z.jsxs)(To,{className:`space-y-6 pb-1`,children:[ve,ye,ke]}),t[109]=ve,t[110]=ye,t[111]=ke,t[112]=Ae):Ae=t[112];let je;t[113]===r?je=t[114]:(je=()=>r(!1),t[113]=r,t[114]=je);let Me;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(s,{id:`dEgA5A`}),t[115]=Me):Me=t[115];let Ne;t[116]!==O||t[117]!==je?(Ne=(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:je,disabled:O,children:Me}),t[116]=O,t[117]=je,t[118]=Ne):Ne=t[118];let Pe;t[119]===O?Pe=t[120]:(Pe=O?(0,Z.jsx)(s,{id:`E9bKSA`}):(0,Z.jsx)(s,{id:`hYgDIe`}),t[119]=O,t[120]=Pe);let Fe;t[121]!==ue||t[122]!==ce||t[123]!==Pe?(Fe=(0,Z.jsx)(ci,{onClick:ue,disabled:ce,children:Pe}),t[121]=ue,t[122]=ce,t[123]=Pe,t[124]=Fe):Fe=t[124];let Ie;t[125]!==Ne||t[126]!==Fe?(Ie=(0,Z.jsxs)(Eo,{children:[Ne,Fe]}),t[125]=Ne,t[126]=Fe,t[127]=Ie):Ie=t[127];let Le;t[128]!==ge||t[129]!==Ae||t[130]!==Ie?(Le=(0,Z.jsxs)(wo,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,Ae,Ie]}),t[128]=ge,t[129]=Ae,t[130]=Ie,t[131]=Le):Le=t[131];let Re;return t[132]!==r||t[133]!==n||t[134]!==Le?(Re=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:Le}),t[132]=r,t[133]=n,t[134]=Le,t[135]=Re):Re=t[135],Re}function Bh(e){return Rh(e.currentTarget)}function Vh(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:a,onOpenChange:o,value:c,onValueChange:l,templates:u,loading:d}=e,{_:f}=i(),p=(0,Q.useId)(),m;if(t[0]!==u||t[1]!==c){let e;t[3]===c?e=t[4]:(e=e=>e.name===c,t[3]=c,t[4]=e),m=u.find(e),t[0]=u,t[1]=c,t[2]=m}else m=t[2];let h=m,g=c===Nh,_=a?p:void 0,v=`${r} ${n}`,y;t[5]!==g||t[6]!==d||t[7]!==h?.name||t[8]!==h?.title||t[9]!==c?(y=d?(0,Z.jsx)(s,{id:`Hl89Qd`}):g?(0,Z.jsx)(s,{id:`E7BhZn`}):h?.title??h?.name??c,t[5]=g,t[6]=d,t[7]=h?.name,t[8]=h?.title,t[9]=c,t[10]=y):y=t[10];let x;t[11]===y?x=t[12]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:y}),t[11]=y,t[12]=x);let S;t[13]!==g||t[14]!==d||t[15]!==h?(S=!d&&!g&&h?(0,Z.jsx)(Gh,{entry:h}):null,t[13]=g,t[14]=d,t[15]=h,t[16]=S):S=t[16];let C;t[17]!==x||t[18]!==S?(C=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(cl,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=w):w=t[20];let T;t[21]!==d||t[22]!==a||t[23]!==_||t[24]!==v||t[25]!==C||t[26]!==n?(T=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":a,"aria-haspopup":`listbox`,"aria-controls":_,"aria-labelledby":v,disabled:d,className:`w-full justify-between font-normal`,children:[C,w]})}),t[21]=d,t[22]=a,t[23]=_,t[24]=v,t[25]=C,t[26]=n,t[27]=T):T=t[27];let E;t[28]===f?E=t[29]:(E=f({id:`UQAp48`}),t[28]=f,t[29]=E);let D;t[30]===E?D=t[31]:(D=(0,Z.jsx)(Et,{placeholder:E}),t[30]=E,t[31]=D);let k;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`c8iK2Y`})}),t[32]=k):k=t[32];let A;if(t[33]!==o||t[34]!==l||t[35]!==u||t[36]!==c){let e;t[38]!==o||t[39]!==l||t[40]!==c?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(I,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{l(e.name),o(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(ko,{className:oi(`mt-1 size-4 shrink-0`,c===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(Gh,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=o,t[39]=l,t[40]=c,t[41]=e):e=t[41],A=u.map(e),t[33]=o,t[34]=l,t[35]=u,t[36]=c,t[37]=A}else A=t[37];let j;t[42]!==o||t[43]!==l?(j=()=>{l(Nh),o(!1)},t[42]=o,t[43]=l,t[44]=j):j=t[44];let M=c===Nh?`opacity-100`:`opacity-0`,N;t[45]===M?N=t[46]:(N=oi(`mt-1 size-4 shrink-0`,M),t[45]=M,t[46]=N);let P;t[47]===N?P=t[48]:(P=(0,Z.jsx)(ko,{className:N,"aria-hidden":`true`}),t[47]=N,t[48]=P);let F;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`E7BhZn`})}),t[49]=F):F=t[49];let L;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[F,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hZoBHK`})})]}),t[50]=L):L=t[50];let R;t[51]!==j||t[52]!==P?(R=(0,Z.jsxs)(I,{value:`Blank note empty`,onSelect:j,className:`items-start gap-3`,children:[P,L]}),t[51]=j,t[52]=P,t[53]=R):R=t[53];let z;t[54]!==p||t[55]!==A||t[56]!==R?(z=(0,Z.jsxs)(Ee,{id:p,className:`subtle-scrollbar`,children:[k,A,R]}),t[54]=p,t[55]=A,t[56]=R,t[57]=z):z=t[57];let B;t[58]!==D||t[59]!==z?(B=(0,Z.jsx)(b,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Wh,onWheel:Uh,onTouchMove:Hh,children:(0,Z.jsxs)(he,{children:[D,z]})}),t[58]=D,t[59]=z,t[60]=B):B=t[60];let V;return t[61]!==o||t[62]!==a||t[63]!==B||t[64]!==T?(V=(0,Z.jsxs)(fe,{open:a,onOpenChange:o,children:[T,B]}),t[61]=o,t[62]=a,t[63]=B,t[64]=T,t[65]=V):V=t[65],V}function Hh(e){e.stopPropagation()}function Uh(e){e.stopPropagation()}function Wh(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function Gh(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=oi(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(s,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(st,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function Kh(e){return e.split(`/`).pop()??e}function qh(e,t){let n=new Map;for(let e of t?.folders??[])n.set(e.path,e.summary);let r=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:n.get(Kh(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:Kh(e.path)===`log.md`?ms._({id:`l3mSlL`}):``}));return[...r,...i]}function Jh(e){let t=(0,$.c)(23),{plan:n,selectedPack:r}=e,{_:a}=i(),o,c,l,u,d,f;if(t[0]!==a||t[1]!==n||t[2]!==r){let e=[...qh(n,r)].sort(Zh),i=new Set(e.map(Xh));d=`space-y-2`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-primary`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center`,children:`◇`}),(0,Z.jsx)(s,{id:`xSVO3J`})]}),t[9]=f):f=t[9],u=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,t[10]===a?o=t[11]:(o=a({id:`INEQsp`}),t[10]=a,t[11]=o),c=`py-1.5`,l=e.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let a=t.slice(0,e).join(`/`);i.has(a)&&(n++,r=e)}let a=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),o=e.kind===`folder`;return(0,Z.jsxs)(`li`,{className:`relative flex min-w-0 items-center gap-1.5 py-1 pr-3`,style:{paddingLeft:`${12+n*16}px`},children:[Array.from({length:n},Yh),o?(0,Z.jsx)(wl,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0 text-foreground/80`,children:a}),o&&e.description?(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{"aria-label":`Show description`,className:`flex shrink-0 cursor-help rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,Z.jsx)(Ao,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(Ns,{children:e.description})]}):null]},e.name)}),t[0]=a,t[1]=n,t[2]=r,t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f}else o=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8];let p;t[12]!==o||t[13]!==c||t[14]!==l?(p=(0,Z.jsx)(`ul`,{"aria-label":o,className:c,children:l}),t[12]=o,t[13]=c,t[14]=l,t[15]=p):p=t[15];let m;t[16]!==u||t[17]!==p?(m=(0,Z.jsx)(`div`,{className:u,children:p}),t[16]=u,t[17]=p,t[18]=m):m=t[18];let h;return t[19]!==d||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`section`,{className:d,children:[f,m]}),t[19]=d,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Yh(e,t){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0 bottom-0 w-px bg-border/50`,style:{left:`${12+t*16+8}px`}},`guide:${t}`)}function Xh(e){return e.name.replace(/\/$/,``)}function Zh(e,t){return e.name.localeCompare(t.name)}async function Qh(e){let t=await e.json().catch(()=>null),n=mr.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function $h(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:e.seed.plan,apply:e.seed.apply,listPacks:e.seed.listPacks}:{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Qh(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Qh(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result}:{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var eg={"knowledge-base":Al,"software-lifecycle":Oe,"plain-notes":au,worldbuilding:fl,"writing-pipeline":Ul,"entity-vault":Ll,okf:gl};function tg(e){return eg[e]??Al}function ng(e){let t=(0,$.c)(37),{onPackSelect:n,onCreateBlankFile:r,className:a,packs:o}=e,{_:c}=i(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p=o===void 0,m,h;t[0]===p?(m=t[1],h=t[2]):(m=()=>{if(!p)return;let e=!1;return(async()=>{try{let t=await $h().listPacks();if(e)return;t.ok?u(t.packs):f(t.error.message)}catch(t){let n=t;if(e)return;f(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},h=[p],t[0]=p,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=p?l:o;if(d!==null){let e;t[3]===a?e=t[4]:(e=oi(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===d?n=t[6]:(n=(0,Z.jsx)(s,{id:`56WWtu`,values:{error:d}}),t[5]=d,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(g===null){let e;t[10]===a?e=t[11]:(e=oi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,a),t[10]=a,t[11]=e);let n;t[12]===c?n=t[13]:(n=c({id:`BeWTQy`}),t[12]=c,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:Object.keys(eg).length},ig).map(rg),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(g.length===0){let e;t[19]===a?e=t[20]:(e=oi(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(s,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let _;t[24]===a?_=t[25]:(_=oi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,a),t[24]=a,t[25]=_);let v;if(t[26]!==n||t[27]!==g){let e;t[29]===n?e=t[30]:(e=e=>(0,Z.jsx)(og,{pack:e,onSelect:()=>n(e.id)},e.id),t[29]=n,t[30]=e),v=g.map(e),t[26]=n,t[27]=g,t[28]=v}else v=t[28];let y;t[31]===r?y=t[32]:(y=r?(0,Z.jsx)(ag,{onSelect:r}):null,t[31]=r,t[32]=y);let b;return t[33]!==_||t[34]!==v||t[35]!==y?(b=(0,Z.jsxs)(`div`,{className:_,children:[v,y]}),t[33]=_,t[34]=v,t[35]=y,t[36]=b):b=t[36],b}function rg(e){return(0,Z.jsx)(sg,{},`skeleton-${e}`)}function ig(e,t){return t}function ag(e){let t=(0,$.c)(3),{onSelect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(to,{"aria-hidden":`true`,className:`size-3.5`})}})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`group flex h-full min-h-22 flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-border/60 bg-card p-5 text-center text-sm transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px text-muted-foreground`,children:r}),t[1]=n,t[2]=i),i}function og(e){let t=(0,$.c)(17),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=tg(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;return t[14]!==r||t[15]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:u}),t[14]=r,t[15]=u,t[16]=d):d=t[16],d}function sg(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(h,{className:`size-5 animate-spin text-muted-foreground opacity-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 h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var cg=`knowledge-base`;function lg(e){let t=(0,$.c)(68),{open:n,onOpenChange:r,onSeedApplied:a,initialPackId:o}=e,{_:c}=i(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={kind:`loading`},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(o??cg),[_,v]=(0,Q.useState)(`project-root`),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(o===void 0?`pick`:`configure`),C=(0,Q.useRef)(!0),w=f?.find(e=>e.id===m),T,E;t[1]!==n||t[2]!==f?(T=()=>{if(!n||f!==null)return;let e=!1;return(async()=>{try{let t=await $h().listPacks();if(e)return;t.ok?p(t.packs):(p([]),d({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;p([]),d({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},E=[n,f],t[1]=n,t[2]=f,t[3]=T,t[4]=E):(T=t[3],E=t[4]),(0,Q.useEffect)(T,E);let D,O;t[5]!==o||t[6]!==n?(D=()=>{n&&(g(o??cg),v(`project-root`),b(``),S(o===void 0?`pick`:`configure`),d({kind:`loading`}),C.current=!0)},O=[n,o],t[5]=o,t[6]=n,t[7]=D,t[8]=O):(D=t[7],O=t[8]),(0,Q.useEffect)(D,O),(0,Q.useEffect)(()=>{w&&b(w.defaultSubfolder??``)},[w]);let k;t[9]===y?k=t[10]:(k=y.trim(),t[9]=y,t[10]=k);let A=k,j=_===`subfolder`&&A===``,M,N;t[11]!==c||t[12]!==n||t[13]!==f||t[14]!==_||t[15]!==m||t[16]!==x||t[17]!==j||t[18]!==A?(M=()=>{if(!n||x!==`configure`||f===null)return;if(j){d({kind:`error`,message:c({id:`Z8KDox`})});return}let e=_===`project-root`?void 0:A,t=C.current?0:200;C.current=!1;let r=!1,i=setTimeout(()=>{r||(d(ug),$h().plan({rootDir:e,packId:m}).then(e=>{if(!r){if(!e.ok){d({kind:`error`,message:e.error.message});return}d(e.plan.created.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||d({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},N=[n,x,f,m,_,A,j,c],t[11]=c,t[12]=n,t[13]=f,t[14]=_,t[15]=m,t[16]=x,t[17]=j,t[18]=A,t[19]=M,t[20]=N):(M=t[19],N=t[20]),(0,Q.useEffect)(M,N);let P=async function(){if(u.kind!==`plan`)return;let e=u.plan;d({kind:`applying`,plan:e});let t;try{t=await $h().apply(e,{packId:m})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);hs.error(c({id:`iqugog`,values:{errorDetail:r}})),d({kind:`plan`,plan:e});return}if(t.ok){let e=w?.name??c({id:`W8vpBM`}),n=t.result.applied,i=c(n===0?{id:`K6jjWB`,values:{packName:e}}:{id:`x3-2ta`,values:{packName:e,projectEntries:n}});hs.success(i),a?.(),r(!1)}else{let n=t.error.message;hs.error(c({id:`iqugog`,values:{errorDetail:n}})),d({kind:`plan`,plan:e})}},F=o!==void 0,I=w?.name,L=c(x===`configure`&&w?{id:`hxEUVJ`,values:{selectedPackName:I}}:{id:`RGkNeJ`}),R;t[21]!==c||t[22]!==w||t[23]!==x?(R=x===`configure`&&w?w.description:c({id:`T-4cw2`}),t[21]=c,t[22]=w,t[23]=x,t[24]=R):R=t[24];let z=R,B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){g(e),S(`configure`),C.current=!0},t[25]=B):B=t[25];let V=B,H;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){S(`pick`),d({kind:`loading`}),C.current=!0},t[26]=H):H=t[26];let U=H,W;t[27]===L?W=t[28]:(W=(0,Z.jsx)(Co,{children:L}),t[27]=L,t[28]=W);let G;t[29]===z?G=t[30]:(G=(0,Z.jsx)(So,{children:z}),t[29]=z,t[30]=G);let K;t[31]!==W||t[32]!==G?(K=(0,Z.jsxs)(Do,{children:[W,G]}),t[31]=W,t[32]=G,t[33]=K):K=t[33];let q;t[34]!==f||t[35]!==u||t[36]!==_||t[37]!==w||t[38]!==x||t[39]!==y?(q=x===`pick`?(0,Z.jsx)(To,{children:(0,Z.jsx)(ng,{packs:f,onPackSelect:V})}):(0,Z.jsxs)(To,{className:`space-y-6`,children:[(0,Z.jsx)(dg,{choice:_,subfolder:y,placeholder:w?.defaultSubfolder??`subfolder`,onChoiceChange:v,onSubfolderChange:b}),(0,Z.jsx)(fg,{phase:u,selectedPack:w})]}),t[34]=f,t[35]=u,t[36]=_,t[37]=w,t[38]=x,t[39]=y,t[40]=q):q=t[40];let J;t[41]!==F||t[42]!==x?(J=x===`configure`&&!F?(0,Z.jsxs)(ci,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:U,children:[(0,Z.jsx)(gi,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(s,{id:`iH8pgl`})]}):null,t[41]=F,t[42]=x,t[43]=J):J=t[43];let ee;t[44]===r?ee=t[45]:(ee=()=>r(!1),t[44]=r,t[45]=ee);let Y;t[46]===u.kind?Y=t[47]:(Y=u.kind===`already-seeded`||u.kind===`error`?(0,Z.jsx)(s,{id:`yz7wBu`}):(0,Z.jsx)(s,{id:`dEgA5A`}),t[46]=u.kind,t[47]=Y);let te;t[48]!==ee||t[49]!==Y?(te=(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`outline`,onClick:ee,children:Y}),t[48]=ee,t[49]=Y,t[50]=te):te=t[50];let ne;t[51]!==P||t[52]!==u.kind||t[53]!==x||t[54]!==j?(ne=x===`configure`&&u.kind===`plan`?(0,Z.jsx)(ci,{onClick:P,disabled:j,children:(0,Z.jsx)(s,{id:`4TzU0n`})}):x===`configure`&&u.kind===`applying`?(0,Z.jsxs)(ci,{disabled:!0,children:[(0,Z.jsx)(h,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(s,{id:`XYlJJT`})]}):null,t[51]=P,t[52]=u.kind,t[53]=x,t[54]=j,t[55]=ne):ne=t[55];let X;t[56]!==J||t[57]!==te||t[58]!==ne?(X=(0,Z.jsxs)(Eo,{children:[J,te,ne]}),t[56]=J,t[57]=te,t[58]=ne,t[59]=X):X=t[59];let re;t[60]!==K||t[61]!==q||t[62]!==X?(re=(0,Z.jsxs)(wo,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[K,q,X]}),t[60]=K,t[61]=q,t[62]=X,t[63]=re):re=t[63];let ie;return t[64]!==r||t[65]!==n||t[66]!==re?(ie=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:re}),t[64]=r,t[65]=n,t[66]=re,t[67]=ie):ie=t[67],ie}function ug(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function dg(e){let t=(0,$.c)(21),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`3wiBAs`})}),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e),t[1]=a,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Fi,{children:(0,Z.jsx)(s,{id:`RSqaSd`})}),t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(da,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(la,{orientation:`horizontal`,children:[(0,Z.jsxs)(ji,{children:[u,(0,Z.jsx)(uo,{className:`text-1sm`,children:(0,Z.jsx)(s,{id:`vPYaz3`})})]}),(0,Z.jsx)(Ks,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Fi,{children:(0,Z.jsx)(s,{id:`ZWgr0b`})}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(uo,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(s,{id:`GUpclA`})}),t[6]=p):p=t[6];let m;t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==r?(m=n===`subfolder`&&(0,Z.jsx)(jo,{value:r,onChange:e=>o(e.target.value),placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=n,t[8]=o,t[9]=i,t[10]=r,t[11]=m):m=t[11];let h;t[12]===m?h=t[13]:(h=(0,Z.jsxs)(ji,{children:[f,p,m]}),t[12]=m,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Ks,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=g):g=t[14];let _;t[15]===h?_=t[16]:(_=(0,Z.jsx)(da,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(la,{orientation:`horizontal`,children:[h,g]})}),t[15]=h,t[16]=_);let v;return t[17]!==n||t[18]!==_||t[19]!==l?(v=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[c,(0,Z.jsxs)(Gs,{className:`sm:flex`,value:n,onValueChange:l,children:[d,_]})]}),t[17]=n,t[18]=_,t[19]=l,t[20]=v):v=t[20],v}function fg(e){let t=(0,$.c)(13),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(s,{id:`mSJ3Rn`})]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(s,{id:`YwPUUP`})}),t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`gcV0dI`})})]}),t[4]=n):n=t[4],n}let i;t[5]!==n.plan||t[6]!==r?(i=(0,Z.jsx)(Jh,{plan:n.plan,selectedPack:r}),t[5]=n.plan,t[6]=r,t[7]=i):i=t[7];let a;t[8]===n.plan.warnings?a=t[9]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(pg)}):null,t[8]=n.plan.warnings,t[9]=a);let o;return t[10]!==i||t[11]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[10]=i,t[11]=a,t[12]=o):o=t[12],o}function pg(e){return(0,Z.jsx)(`p`,{children:e},e)}function mg(){let[e]=(0,Q.useState)(hg);return e}function hg(){return Or()!=null}var gg=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],_g=gg.filter(e=>e.id!==`claude-cowork`),vg=(0,Q.createContext)(!1);function yg(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(xg),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return se(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(bg),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(vg,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function bg(){}function xg(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function Sg(){return(0,Q.use)(vg)}var Cg=`#settings`;function wg(e){return ec(e.target)?!1:nc(e,`settings`)}function Tg(e){return e.replace(/^#/,``)===`settings`}function Eg(){return typeof window>`u`?``:window.location.hash}function Dg(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(kg),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,Q.startTransition)(()=>{n(Tg(Eg()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a=Og,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Og(){typeof window>`u`||Tg(Eg())&&window.history.back()}function kg(){return Tg(Eg())}function Ag(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function jg(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=qo(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Mg(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Ag(e):jg()}var Ng=`ok:skill:cowork:installed`,Pg=`1`,Fg=250,Ig=`/api/skill/install-state`;function Lg(e){return`${Ng}:v${e}`}var Rg=new Map;async function zg(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Rg.get(n);if(r)return r;let i=Bg(e,t);return Rg.set(n,i),i.finally(()=>{Rg.get(n)===i&&Rg.delete(n)}),i}async function Bg(e,t){let n=e.installer===void 0?Mg():e.installer,r=Vg(e.storage),i=e.fetchSnapshot??Ug,a=e.serverTimeoutMs??Fg,o=null;if(!t.force){try{o=await Wg(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Lg(o?.currentVersion??e.fallbackSkillVersion??Hg());if(!t.force&&r?.getItem(s)===Pg)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Pg)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Vg(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Hg(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Ug(){let e;try{e=await fetch(Ig,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Wg(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Gg(e){return zg({},e)}function Kg(){return zg({},{force:!0})}async function qg(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Jg(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return qg({target:`claude-cowork`,url:Xn({mode:`cowork`},e)},n);case`claude-code`:return qg({target:`claude-code`,url:Xn({mode:`code`},e)},n);case`codex`:return qg({target:`codex`,url:$n(e)},n);case`cursor`:return qg({target:`cursor`,url:Rn(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Yg(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Xg(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Xg(e)}}}function Xg(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function Zg(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function Qg(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function $g(e){return`${e}.md`}function e_(e){if(!e.docName||!e.workspace)return null;let t=$g(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Qg(n,t,r)}}function t_(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function n_(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,projectDir:e.workspace.contentDir,docPath:``}:null}function r_(e){return Yg(e.installUrl).then(()=>void 0)}function i_(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function a_(e){if(!e.docName||!e.workspace||!e.selectionMarkdown)return null;let t=$g(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:null,selection:{relativePath:t,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown},projectDir:n,docPath:Qg(n,t,r)}}function o_(e){return a_(e)??e_(e)}function s_(e){return`Opened in ${e}.`}function c_(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function l_(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function u_(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function d_(e,t,n){return e.selection?dr({...e.selection,target:t}):xr(e.docContext===null?e.folderRelativePath?lr(e.folderRelativePath,n,e.instruction):e.createDescription===void 0?Un(n,e.instruction):Wr(e.createDescription,n,e.createScenario??`new-project`):ur(e.docContext.relativePath,n,e.instruction))}function f_(e){return d_(e,`claude-code`,!1)}async function p_(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:d_(t,e,n.autoOpen)},a=await n.dispatchHandoff(i),o=u_(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString(),t.selection?`selection`:void 0);await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(s_(s));else{let i=l_(r),a=c_(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{p_(e,t,n,r+1)}}})}return a}function m_(e){return gg.find(t=>t.id===e)?.displayName??e}function h_(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function g_(){return{dispatchHandoff:Jg,recordHandoff:Zg,toast:{success:e=>{hs.success(e)},error:(e,t)=>{hs.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>h_(),getDisplayName:m_,ensureCoworkSkillInstalled:Gg,autoOpen:!0}}function __(){let e=(0,$.c)(2),{merged:t}=ae(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>p_(e,t,{...g_(),autoOpen:n}),reinstallCoworkSkill:Kg},e[0]=n,e[1]=r),r}var v_=[...new Set(gg.flatMap(e=>e.schemes))];function y_(e,t){let n=t.now?.()??Date.now(),r={};for(let t of gg){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function b_(e){return y_({},e)}async function x_(e){let t=e.schemes??v_,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var S_=Object.fromEntries(v_.map(e=>[e,{installed:!1}]));async function C_(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return S_}if(!t.ok)return S_;let n;try{n=await t.json()}catch{return S_}if(typeof n!=`object`||!n||Array.isArray(n))return S_;let r=n,i={};for(let e of v_)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function w_(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function T_(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=b_({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=y_(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!w_(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function E_(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function D_(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>x_({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>C_({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function O_(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(k_),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=T_(D_());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function k_(){return b_({isElectronHost:E_(),now:Date.now})}var A_=3e3,j_=600,M_=20,N_=(e,t,n)=>yu(e,t,n,`CommandPalette`);function P_(e){window.location.assign(Vo(e))}function F_(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:ps(t)}function I_(e){let t=(0,$.c)(24),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c=n.kind===`folder`?re:We,l;t[0]===n?l=t[1]:(l=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=l);let u=l,d=`snippet`in n?n.snippet:void 0,f=`${n.kind} ${n.path}`,p=`command-palette-nav-${n.kind}-${n.path}`,m;t[2]===c?m=t[3]:(m=(0,Z.jsx)(c,{className:`mt-0.5`}),t[2]=c,t[3]=m);let h;t[4]!==o||t[5]!==u?(h=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(R_,{query:o,text:u})}),t[4]=o,t[5]=u,t[6]=h):h=t[6];let g;t[7]!==n.path||t[8]!==o?(g=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(R_,{query:o,text:n.path})}),t[7]=n.path,t[8]=o,t[9]=g):g=t[9];let _;t[10]!==o||t[11]!==d?(_=d?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(R_,{query:o,text:d})}):null,t[10]=o,t[11]=d,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==g||t[15]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[h,g,_]}),t[13]=h,t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;return t[17]!==s||t[18]!==i||t[19]!==v||t[20]!==f||t[21]!==p||t[22]!==m?(y=(0,Z.jsxs)(I,{value:f,onSelect:i,disabled:s,"data-testid":p,className:`items-start`,children:[m,v]}),t[17]=s,t[18]=i,t[19]=v,t[20]=f,t[21]=p,t[22]=m,t[23]=y):y=t[23],y}function L_(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(s,{id:`-wePNM`}):n===`truncated`?(0,Z.jsx)(s,{id:`-q4abP`}):(0,Z.jsx)(s,{id:`DbILZA`}),t[0]=n,t[1]=o);let c;return t[2]!==a||t[3]!==o?(c=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=c):c=t[4],c}function R_(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=ph(n,r).map(z_),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function z_(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function B_({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function V_(e){let t=(0,$.c)(181),{bridge:n,open:r,onOpenChange:a}=e,o=n===void 0?null:n,{_:c}=i(),l=Sg(),[u,d]=(0,Q.useState)(``),f=(0,Q.useDeferredValue)(u),p=f.trim(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[0]=m):m=t[0];let[g,_]=(0,Q.useState)(m),[v,y]=(0,Q.useState)(`idle`),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,k]=(0,Q.useState)(E),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(`idle`),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[2]=P):P=t[2];let[F,L]=(0,Q.useState)(P),B;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[3]=B):B=t[3];let[H,U]=(0,Q.useState)(B),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(!1),[J,ee]=(0,Q.useState)(!1),Y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(Y=[],t[4]=Y):Y=t[4];let[te,ne]=(0,Q.useState)(Y),[X,ie]=(0,Q.useState)(`idle`),ae;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[5]=ae):ae=t[5];let[oe,se]=(0,Q.useState)(ae),[ce,le]=(0,Q.useState)(`idle`),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),{activeDocName:he,activeTarget:ge}=mt(),{pages:_e,pageTitles:ve,pageMeta:ye,folderPaths:xe,filePaths:we,loading:Te}=rs(),De=Oa(),{states:Oe,refresh:ke}=O_(),{dispatch:Ae}=__(),je;t[6]===r?je=t[7]:(je={enabled:r},t[6]=r,t[7]=je);let{status:Me,refresh:Ne}=po(je),Pe=(Me?.enabled??!1)&&(Me?.keyPresent??!1),Fe=Me?.embedded??0,Ie=Me?.total??0,Le=Pe&&Ie>0&&Fe<Ie,Re;t[8]!==w||t[9]!==r||t[10]!==Ne||t[11]!==Le?(Re=()=>{if(!r||!w||!Le)return;let e=window.setInterval(()=>Ne(),2500);return()=>window.clearInterval(e)},t[8]=w,t[9]=r,t[10]=Ne,t[11]=Le,t[12]=Re):Re=t[12];let ze;t[13]!==w||t[14]!==r||t[15]!==Le?(ze=[r,w,Le],t[13]=w,t[14]=r,t[15]=Le,t[16]=ze):ze=t[16],(0,Q.useEffect)(Re,ze);let Be=e_({docName:he,workspace:De}),Ve=oh(_e,xe,ve,ye,we),He=Qm(H,new Set(Ve.map(W_))),Ue=o?.config.projectPath??null,Ge=o?F.filter(e=>e.path!==Ue):[],Ke;t[17]!==he||t[18]!==ge?(Ke=F_(ge,he),t[17]=he,t[18]=ge,t[19]=Ke):Ke=t[19];let Je=Ke,Ye=p===``?[]:dh(Ve,p,8),Xe,Ze;t[20]!==a||t[21]!==r?(Xe=()=>{let e=function(e){nc(e,`command-palette`)&&(e.preventDefault(),a(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ze=[a,r],t[20]=a,t[21]=r,t[22]=Xe,t[23]=Ze):(Xe=t[22],Ze=t[23]),(0,Q.useEffect)(Xe,Ze);let Qe,$e;t[24]!==c||t[25]!==o||t[26]!==r||t[27]!==ke?(Qe=()=>{if(r){if(U(Ym()),ke(),o){let e=!1;return N_(async()=>{let t=await o.project.listRecent();e||L(t)},c({id:`fYKgzG`})),()=>{e=!0}}return}d(``),ne([]),ie(`idle`),ue.current=!1,se([]),le(`idle`),T(!1),pe.current?.abort(),pe.current=null,me.current!==null&&(window.clearTimeout(me.current),me.current=null),k([]),j(null),N(`idle`)},$e=[r,o,ke,c],t[24]=c,t[25]=o,t[26]=r,t[27]=ke,t[28]=Qe,t[29]=$e):(Qe=t[28],$e=t[29]),(0,Q.useEffect)(Qe,$e);let et;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>{de.current&&(de.current.scrollTop=0)},t[30]=et):et=t[30];let tt;t[31]===u?tt=t[32]:(tt=[u],t[31]=u,t[32]=tt),(0,Q.useEffect)(et,tt);let nt=new Set(te.map(U_)),rt=w?{kind:`normal`,query:f}:bh(f,nt),it=rt.kind!==`normal`,at=it||w,ot=rt.kind===`tag-list`?rt.query:``,st=rt.kind===`tag-docs`?rt.tagName:``,ct=u.trim(),lt=w?vh({query:ct,firedQuery:A,status:M,resultCount:D.length}):null,ut=lt?.submit?.query??``,dt=lt?.results.forQuery??``,ft,pt;t[33]!==it||t[34]!==r?(ft=()=>{if(!r||!it||ue.current)return;ue.current=!0,ie(`loading`);let e=!1;return Sh().then(t=>{e||(ne(t),ie(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),ne([]),ie(`error`))}),()=>{e=!0}},pt=[r,it],t[33]=it,t[34]=r,t[35]=ft,t[36]=pt):(ft=t[35],pt=t[36]),(0,Q.useEffect)(ft,pt);let ht=rt.kind===`tag-docs`?rt.tagName:null;(0,Q.useEffect)(()=>{if(!r||ht===null){se([]),le(`idle`);return}le(`loading`),se([]);let e=!1;return Ch(ht).then(t=>{e||(se(t),le(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),se([]),le(`error`))}),()=>{e=!0}},[r,ht]),(0,Q.useEffect)(()=>{if(!r||!p||at||Te){_([]),y(`idle`),x(!1),C(!1);return}let e=!1,t=!1,n=0,i=null,a,o;y(`loading`);let s=()=>e||n>=M_?!1:(n+=1,o=window.setTimeout(l,j_),!0),c=()=>{e||t&&s()||(_([]),y(`error`),x(!1),C(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},A_),hh(p,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,_([]),x(!1),C(!0),y(`success`)),s()||C(!1);return}_(r),x(i),C(!1),y(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,p,at,Te]);let gt;t[37]!==c||t[38]!==a?(gt=(e,t)=>{let n=t===void 0?c({id:`uuoHOU`}):t;a(!1),N_(async()=>{await e()},n)},t[37]=c,t[38]=a,t[39]=gt):gt=t[39];let _t=gt,vt;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(vt=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Zm(Ym(),t);Xm(n),U(n)},t[40]=vt):vt=t[40];let yt=vt,bt;t[41]===a?bt=t[42]:(bt=function(e){a(!1),yt(e),P_(e.path)},t[41]=a,t[42]=bt);let xt=bt,St=!at&&p===``&&He.length>0,Ct=B_({searchResults:g,fallbackSearchResults:Ye,searchStatus:v}),wt=!at&&Ct.length>0,Tt=!at&&p!==``&&(Te||S)&&!wt,Dt=!at&&p!==``&&v===`loading`&&!wt&&!Tt,Ot;t[43]!==c||t[44]!==f||t[45]!==at?(Ot=!at&&gh(c({id:`HdkSiO`}),f,[`create file`]),t[43]=c,t[44]=f,t[45]=at,t[46]=Ot):Ot=t[46];let kt=Ot,At;t[47]!==c||t[48]!==f||t[49]!==at?(At=!at&&gh(c({id:`96G6Re`}),f,[`create folder`]),t[47]=c,t[48]=f,t[49]=at,t[50]=At):At=t[50];let jt=At,Mt;t[51]!==c||t[52]!==he||t[53]!==f||t[54]!==at?(Mt=!at&&he!==null&&gh(c({id:`3Fcb0I`}),f,[`graph panel network`]),t[51]=c,t[52]=he,t[53]=f,t[54]=at,t[55]=Mt):Mt=t[55];let Nt=Mt,Pt;t[56]!==c||t[57]!==f||t[58]!==at?(Pt=!at&&gh(c({id:`fWi7pn`}),f,[`scaffold`,`seed`,`pack`,`starter`]),t[56]=c,t[57]=f,t[58]=at,t[59]=Pt):Pt=t[59];let Ft=Pt,It;t[60]!==c||t[61]!==o||t[62]!==f||t[63]!==at?(It=!at&&o!==null&&gh(c({id:`gKi-a_`}),f,[`create new project scaffold`]),t[60]=c,t[61]=o,t[62]=f,t[63]=at,t[64]=It):It=t[64];let Lt=It,Rt;t[65]!==c||t[66]!==o||t[67]!==f||t[68]!==at?(Rt=!at&&o!==null&&gh(c({id:`WPwDin`}),f,[`project`]),t[65]=c,t[66]=o,t[67]=f,t[68]=at,t[69]=Rt):Rt=t[69];let zt=Rt,Bt;t[70]!==c||t[71]!==o||t[72]!==f||t[73]!==at||t[74]!==l?(Bt=!at&&!l&&o!==null&&gh(c({id:`xaDWAI`}),f,[`switch project navigator projects`]),t[70]=c,t[71]=o,t[72]=f,t[73]=at,t[74]=l,t[75]=Bt):Bt=t[75];let Vt=Bt,Ht;t[76]!==c||t[77]!==f||t[78]!==at||t[79]!==l?(Ht=!at&&!l&&gh(c({id:`Tz0i8g`}),f,[`preferences config`]),t[76]=c,t[77]=f,t[78]=at,t[79]=l,t[80]=Ht):Ht=t[80];let Ut=Ht,Wt;t[81]!==c||t[82]!==f||t[83]!==at?(Wt=!1,t[81]=c,t[82]=f,t[83]=at,t[84]=Wt):Wt=t[84];let Gt=Wt,Kt=!at&&o!==null&&Ge.length>0&&(p===``||Ge.some(e=>gh(`${e.name} ${e.path}`,f,[`open recent project`]))),qt=mg(),Jt=!at&&!qt&&Be!==null&&(p===``||_g.some(e=>{let t=e.displayName;return gh(c({id:`WqLq6M`,values:{displayName:t}}),f,[e.id,`agent handoff`,`open in`])})),Yt=rt.kind===`tag-list`?xh(te,rt.query):[],Xt=rt.kind===`tag-list`&&X!==`loading`&&Yt.length===0,Zt=rt.kind===`tag-docs`&&ce===`success`&&oe.length===0,Qt=at||St||wt||Dt||Tt||kt||jt||Nt||Ft||Lt||zt||Vt||Ut||Gt||Kt||Jt,$t;t[85]===Symbol.for(`react.memo_cache_sentinel`)?($t=function(e){d(`${yh}${e}`)},t[85]=$t):$t=t[85];let en=$t,tn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(tn=function(){pe.current?.abort(),pe.current=null,me.current!==null&&(window.clearTimeout(me.current),me.current=null),k([]),j(null),N(`idle`)},t[86]=tn):tn=t[86];let nn=tn,rn;t[87]===u?rn=t[88]:(rn=function(){T(!0),u.startsWith(`tag:`)&&d(u.slice(yh.length)),nn(),fe.current?.focus()},t[87]=u,t[88]=rn);let an=rn,on;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(on=function(){T(!1),d(``),nn(),fe.current?.focus()},t[89]=on):on=t[89];let sn=on,cn=function(e){let t=e.trim();if(!t||Te)return;pe.current?.abort(),me.current!==null&&window.clearTimeout(me.current);let n=new AbortController;pe.current=n,N(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),N(`error`)},A_);me.current=i,hh(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;ln(i,n),k(r),j(t),N(`success`)}).catch(e=>{ln(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),N(`error`))})};function ln(e,t){window.clearTimeout(e),me.current===e&&(me.current=null),pe.current===t&&(pe.current=null)}let un=function(e){!w||e.key!==`Enter`||(lt?.submit?(e.preventDefault(),e.stopPropagation(),cn(lt.submit.query)):M===`loading`&&(e.preventDefault(),e.stopPropagation()))},dn;t[90]===w?dn=t[91]:(dn=function(e){w&&(e.preventDefault(),sn())},t[90]=w,t[91]=dn);let fn=dn,pn;t[92]===c?pn=t[93]:(pn=c({id:`1bDVu5`}),t[92]=c,t[93]=pn);let mn;t[94]===c?mn=t[95]:(mn=c({id:`5GRxoA`}),t[94]=c,t[95]=mn);let hn;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(hn={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[96]=hn):hn=t[96];let gn;t[97]!==c||t[98]!==w?(gn=c(w?{id:`zXj1rA`}:{id:`ggs9f8`}),t[97]=c,t[98]=w,t[99]=gn):gn=t[99];let _n;t[100]!==w||t[101]!==it?(_n=()=>{w&&(T(!1),nn()),d(it?``:yh),fe.current?.focus()},t[100]=w,t[101]=it,t[102]=_n):_n=t[102];let vn=it?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,yn;t[103]===vn?yn=t[104]:(yn=oi(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,vn),t[103]=vn,t[104]=yn);let bn,xn;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(bn=(0,Z.jsx)(Se,{className:`size-3.5`}),xn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`0rwwOn`})}),t[105]=bn,t[106]=xn):(bn=t[105],xn=t[106]);let Sn;t[107]!==it||t[108]!==_n||t[109]!==yn?(Sn=(0,Z.jsxs)(`button`,{type:`button`,onClick:_n,"data-testid":`command-palette-filter-tag`,"data-active":it,"aria-pressed":it,className:yn,children:[bn,xn]}),t[107]=it,t[108]=_n,t[109]=yn,t[110]=Sn):Sn=t[110];let Cn;t[111]!==an||t[112]!==w||t[113]!==Pe?(Cn=Pe?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>w?sn():an(),"data-testid":`command-palette-filter-semantic`,"data-active":w,"aria-pressed":w,className:oi(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,w?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(yi,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`9tJX8r`})})]}):null,t[111]=an,t[112]=w,t[113]=Pe,t[114]=Cn):Cn=t[114];let wn;t[115]!==Sn||t[116]!==Cn?(wn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Sn,Cn]}),t[115]=Sn,t[116]=Cn,t[117]=wn):wn=t[117];let Tn=w&&lt?(0,Z.jsxs)(Z.Fragment,{children:[Le?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(h,{className:`size-3.5 animate-spin`}),(0,Z.jsx)(s,{id:`kCNU4q`,values:{semanticIndexedCount:Fe,semanticTotalCount:Ie}})]}):null,lt.submit?(0,Z.jsx)(z,{children:(0,Z.jsx)(I,{value:`semantic-submit`,onSelect:()=>cn(ut),"data-testid":`command-palette-semantic-submit`,children:lt.submit.kind===`retry`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(yi,{}),(0,Z.jsx)(s,{id:`rBc32v`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(yi,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(s,{id:`FNTx6u`,values:{semanticSubmitQuery:ut}})}),(0,Z.jsx)(Ce,{children:`↵`})]})})}):null,lt.notice===`empty`?(0,Z.jsx)(O,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(s,{id:`Xw_maT`})}):null,lt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),(0,Z.jsx)(s,{id:`PBwmDJ`})]}):null,lt.notice===`no-results`?(0,Z.jsx)(O,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(s,{id:`yFyZMJ`,values:{semanticQueryText:ct}})}):null,lt.results.show?(0,Z.jsx)(z,{heading:lt.results.dimmed?c({id:`QlxHAH`,values:{semanticResultsLabel:dt}}):c({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":lt.results.dimmed,children:D.map(e=>(0,Z.jsx)(I_,{entry:e,disabled:lt.results.dimmed,onSelect:()=>xt(e)},Jm(e.kind,e.path)))})}):null]}):null,En;t[118]===Tt?En=t[119]:(En=Tt?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),(0,Z.jsx)(s,{id:`yIPXut`})]}):null,t[118]=Tt,t[119]=En);let Dn;t[120]!==wt||t[121]!==Dt?(Dn=Dt&&!wt?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`WRNXKp`})}):null,t[120]=wt,t[121]=Dt,t[122]=Dn):Dn=t[122];let On=Qt?null:(0,Z.jsx)(O,{children:v===`error`?(0,Z.jsx)(s,{id:`pkAft1`}):(0,Z.jsx)(s,{id:`i3f2kh`})}),kn=rt.kind===`tag-list`?(0,Z.jsxs)(z,{heading:rt.query?c({id:`evs0iw`,values:{tagListQuery:ot}}):c({id:`2QM24L`}),children:[X===`loading`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`a_u4ck`})}):null,X===`error`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`MZoxVx`})}):null,Xt?(0,Z.jsx)(O,{children:rt.query?c({id:`X0ttSN`,values:{tagListQuery:ot}}):c({id:`JLUTgi`})}):null,Yt.map(e=>(0,Z.jsxs)(I,{value:`tag ${e.name}`,onSelect:()=>en(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(Se,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(s,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,An=rt.kind===`tag-docs`?(0,Z.jsxs)(z,{heading:c({id:`hGmuTc`,values:{tagDocsName:st}}),children:[ce===`loading`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`pWbsW6`})}):null,ce===`error`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`48uGTI`})}):null,Zt?(0,Z.jsx)(O,{children:c({id:`NIWAux`,values:{tagDocsName:st}})}):null,oe.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==rt.tagName).map(H_).join(`, `);return(0,Z.jsxs)(I,{value:`tag-doc ${e.docName}`,onSelect:()=>{a(!1),P_(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(We,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==rt.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(s,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,jn=St?(0,Z.jsx)(z,{heading:c({id:`MmDDWK`}),children:He.map(e=>(0,Z.jsx)(I_,{entry:e,onSelect:()=>xt(e)},Jm(e.kind,e.path)))}):null,Mn;t[123]!==c||t[124]!==he||t[125]!==a||t[126]!==G||t[127]!==q||t[128]!==kt||t[129]!==jt||t[130]!==Nt||t[131]!==Ft?(Mn=kt||jt||Nt||Ft?(0,Z.jsxs)(z,{heading:c({id:`45MZFs`}),children:[kt?(0,Z.jsxs)(I,{value:`new file create file`,onSelect:()=>{a(!1),G(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(yl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`HdkSiO`})})]}):null,jt?(0,Z.jsxs)(I,{value:`new folder create folder`,onSelect:()=>{a(!1),G(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(Cl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`96G6Re`})})]}):null,Nt?(0,Z.jsxs)(I,{value:`open graph graph panel network`,onSelect:()=>{he&&(a(!1),Dh(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Ll,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`3Fcb0I`})})]}):null,Ft?(0,Z.jsxs)(I,{value:`initialize starter pack scaffold seed`,onSelect:()=>{a(!1),q(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(zl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fWi7pn`})})]}):null]}):null,t[123]=c,t[124]=he,t[125]=a,t[126]=G,t[127]=q,t[128]=kt,t[129]=jt,t[130]=Nt,t[131]=Ft,t[132]=Mn):Mn=t[132];let Nn=Jt?(0,Z.jsx)(z,{heading:c({id:`O7_W_a`}),children:_g.filter(e=>{let t=e.displayName;return gh(c({id:`WqLq6M`,values:{displayName:t}}),f,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Oe[e.id],n=t.installed===!0&&Be!==null,r=e.displayName,i=t.installed===null?c({id:`IA6JW2`}):t.installed===!1?c({id:`5SwVv1`}):null,o=c(i?{id:`1ZpfyB`,values:{displayName:r,hint:i}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(I,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!Be||(a(!1),Ae(e.id,Be))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":o,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`WqLq6M`,values:{displayName:r}})}),i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:i}):null]},e.id)})}):null,Pn;t[133]!==c||t[134]!==o||t[135]!==a||t[136]!==_t||t[137]!==ee||t[138]!==Lt||t[139]!==Gt||t[140]!==zt||t[141]!==Vt||t[142]!==Ut?(Pn=Lt||zt||Vt||Ut||Gt?(0,Z.jsxs)(z,{heading:c({id:`e0NrBM`}),children:[Lt&&o?(0,Z.jsxs)(I,{value:`new project create scaffold`,onSelect:()=>{a(!1),ee(!0)},"data-testid":`command-palette-new-project`,children:[(0,Z.jsx)(V,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`gKi-a_`})})]}):null,zt&&o?(0,Z.jsxs)(I,{value:`open folder on disk project`,onSelect:()=>_t(async()=>{let e=await o.dialog.openFolder();e&&await o.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(re,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`WPwDin`})}),(0,Z.jsx)(Ce,{children:tc(`open-folder`)})]}):null,Vt&&o?(0,Z.jsxs)(I,{value:`switch-project navigator projects`,onSelect:()=>_t(()=>o.navigator.open(),c({id:`jol95m`})),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(R,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`xaDWAI`})}),(0,Z.jsx)(Ce,{children:tc(`switch-project`)})]}):null,Ut?(0,Z.jsxs)(I,{value:`settings preferences config`,onSelect:()=>{a(!1),window.location.hash!==`#settings`&&(window.location.hash=Cg)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Zl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),(0,Z.jsx)(Ce,{children:tc(`settings`)})]}):null,Gt?(0,Z.jsxs)(I,{value:`install claude desktop cowork app`,onSelect:()=>{a(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(Ja,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`62Pc08`})})]}):null]}):null,t[133]=c,t[134]=o,t[135]=a,t[136]=_t,t[137]=ee,t[138]=Lt,t[139]=Gt,t[140]=zt,t[141]=Vt,t[142]=Ut,t[143]=Pn):Pn=t[143];let Fn=Kt&&o?(0,Z.jsx)(z,{heading:c({id:`3iyGWF`}),children:Ge.filter(e=>gh(`${e.name} ${e.path}`,f,[`open recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(I,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>_t(()=>o.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),c({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(qe,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(s,{id:`ls1N1w`})]}):null]})]})]},e.path))}):null,In=wt?(0,Z.jsx)(z,{heading:c({id:`A1taO8`}),children:Ct.map(e=>(0,Z.jsx)(I_,{entry:e,query:p,onSelect:()=>xt(e)},Jm(e.kind,e.path)))}):null,Ln;t[144]!==Tn||t[145]!==En||t[146]!==Dn||t[147]!==On||t[148]!==kn||t[149]!==An||t[150]!==jn||t[151]!==Mn||t[152]!==Nn||t[153]!==Pn||t[154]!==Fn||t[155]!==In?(Ln=(0,Z.jsxs)(Ee,{ref:de,className:`subtle-scrollbar`,children:[Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In]}),t[144]=Tn,t[145]=En,t[146]=Dn,t[147]=On,t[148]=kn,t[149]=An,t[150]=jn,t[151]=Mn,t[152]=Nn,t[153]=Pn,t[154]=Fn,t[155]=In,t[156]=Ln):Ln=t[156];let Rn=L_,zn=_h(p,Ct,{truncated:b}),Bn;t[157]!==Rn||t[158]!==at||t[159]!==rt.kind||t[160]!==zn?(Bn=(0,Z.jsx)(Rn,{mode:zn,inExclusiveMode:at,paletteModeKind:rt.kind}),t[157]=Rn,t[158]=at,t[159]=rt.kind,t[160]=zn,t[161]=Bn):Bn=t[161];let Vn=W===`file`,Hn;t[162]===G?Hn=t[163]:(Hn=e=>{e||G(null)},t[162]=G,t[163]=Hn);let Un;t[164]!==Je||t[165]!==Vn||t[166]!==Hn?(Un=(0,Z.jsx)(zh,{open:Vn,onOpenChange:Hn,kind:`file`,initialDir:Je}),t[164]=Je,t[165]=Vn,t[166]=Hn,t[167]=Un):Un=t[167];let Wn=W===`folder`,Gn;t[168]===G?Gn=t[169]:(Gn=e=>{e||G(null)},t[168]=G,t[169]=Gn);let Kn;t[170]!==Je||t[171]!==Wn||t[172]!==Gn?(Kn=(0,Z.jsx)(zh,{open:Wn,onOpenChange:Gn,kind:`folder`,initialDir:Je}),t[170]=Je,t[171]=Wn,t[172]=Gn,t[173]=Kn):Kn=t[173];let qn;t[174]!==K||t[175]!==q?(qn=(0,Z.jsx)(lg,{open:K,onOpenChange:q}),t[174]=K,t[175]=q,t[176]=qn):qn=t[176];let Jn;return t[177]!==o||t[178]!==J||t[179]!==ee?(Jn=o?(0,Z.jsx)(hf,{open:J,onOpenChange:ee,bridge:o}):null,t[177]=o,t[178]=J,t[179]=ee,t[180]=Jn):Jn=t[180],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(be,{open:r,onOpenChange:a,title:pn,description:mn,className:`sm:max-w-2xl`,commandProps:hn,onEscapeKeyDown:fn,children:[(0,Z.jsx)(Et,{ref:fe,value:u,onValueChange:d,onKeyDown:un,placeholder:gn}),wn,Ln,Bn]}),Un,Kn,qn,Jn]})}function H_(e){return`#${e}`}function U_(e){return e.name}function W_(e){return Jm(e.kind,e.path)}var G_=500;function K_(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function q_(e){return e?.kind===`null-collab`}function J_(e){if(e===null)return ms._({id:`Ua78MH`});if(e.kind===`null-collab`)return ms._({id:`TJnkyf`});if(e.code===`network`)return ms._({id:`aoa6xA`});if(e.code===`invalid-body`)return ms._({id:`FRYB1Q`});let t=e.code;return ms._({id:`4nj6n8`,values:{code:t}})}function Y_(){let e=(0,$.c)(18),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=mt(),[a,o]=(0,Q.useState)(!1),c,l;e[0]!==n||e[1]!==t?(c=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),G_);return()=>clearTimeout(e)},l=[t,n],e[0]=n,e[1]=t,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u=K_(t,n,a);if(u===`hidden`)return null;if(u===`terminal`){let t;e[4]===r?t=e[5]:(t=q_(r),e[4]=r,e[5]=t);let n=t,a;e[6]===r?a=e[7]:(a=J_(r),e[6]=r,e[7]=a);let o=a,c;e[8]!==o||e[9]!==n?(c=(0,Z.jsx)(`span`,{children:n?(0,Z.jsx)(s,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(s,{id:`noH1JX`,values:{errorDetail:o},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[8]=o,e[9]=n,e[10]=c):c=e[10];let l;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(s,{id:`6gRgw8`}),e[11]=l):l=e[11];let u;e[12]===i?u=e[13]:(u=(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:l}),e[12]=i,e[13]=u);let d;return e[14]!==c||e[15]!==u?(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[c,u]}),e[14]=c,e[15]=u,e[16]=d):d=e[16],d}let d;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(s,{id:`UYcGIW`})}),e[17]=d):d=e[17],d}function X_(e){let t=(0,$.c)(6),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>n.onMenuAction(e=>{e===`new-project`&&i(!0)}),o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;return t[3]!==n||t[4]!==r?(s=(0,Z.jsx)(hf,{open:r,onOpenChange:i,bridge:n}),t[3]=n,t[4]=r,t[5]=s):s=t[5],s}async function Z_(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(qo(e)??ms._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function Q_(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,c]=(0,Q.useState)(a),l=(0,Q.useRef)(0),u,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=l.current+=1;i(t.value),n(!0),c({kind:`loading`}),Z_(t.value).then(e=>{l.current===r&&c({kind:`ready`,docs:e})}).catch(e=>{l.current===r&&c({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(Ye,e),()=>document.removeEventListener(Ye,e)},d=[],e[1]=u,e[2]=d):(u=e[1],d=e[2]),(0,Q.useEffect)(u,d);let f;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(e){n(!1),window.location.assign(Vo(e))},e[3]=f):f=e[3];let p=f,m=r??``,h;e[4]===m?h=e[5]:(h={tagName:m},e[4]=m,e[5]=h);let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={0:(0,Z.jsx)(`span`,{className:`font-mono`})},e[6]=g):g=e[6];let _;e[7]===h?_=e[8]:(_=(0,Z.jsx)(Do,{children:(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`7H4UHD`,values:h,components:g})})}),e[7]=h,e[8]=_);let v=r??``,y;e[9]!==o||e[10]!==v?(y=(0,Z.jsx)(To,{children:(0,Z.jsx)($_,{fetchState:o,tag:v,onSelectDoc:p})}),e[9]=o,e[10]=v,e[11]=y):y=e[11];let b;e[12]!==_||e[13]!==y?(b=(0,Z.jsxs)(wo,{children:[_,y]}),e[12]=_,e[13]=y,e[14]=b):b=e[14];let x;return e[15]!==t||e[16]!==b?(x=(0,Z.jsx)(Oo,{open:t,onOpenChange:n,children:b}),e[15]=t,e[16]=b,e[17]=x):x=e[17],x}function $_(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(s,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(s,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(ev)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function ev(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var tv=`raw-mdx-nav`,nv=`ok-editor-mode-v1`,rv=[`wysiwyg`,`source`],iv=`wysiwyg`;function av(e){return rv.includes(e)}function ov(e=localStorage){try{let t=e.getItem(nv);if(t===null)return iv;if(av(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return iv}function sv(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return av(n)?n:ov(t)}function cv(e,t=localStorage){try{return t.setItem(nv,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function lv(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(sv),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),cv(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function uv(e){let t=(0,$.c)(4),{_:n}=i(),r=(0,Q.useRef)(!1),a,o;t[0]!==n||t[1]!==e?(a=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,hs.info(n({id:`JkCD2u`})))},o=[e,n],t[0]=n,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Q.useEffect)(a,o)}function dv(e){let t=(0,$.c)(25),{open:n,onResolved:r}=e,{_:a}=i(),o=Wa(),c;t[0]!==a||t[1]!==r||t[2]!==o?(c=function(e){if(o===null){hs.error(a({id:`fiMNLl`}));return}let t=o(e);if(!t.ok){let n=t.error;hs.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}r()},t[0]=a,t[1]=r,t[2]=o,t[3]=c):c=t[3];let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Do,{children:(0,Z.jsx)(Fa,{})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Pa,{}),t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(To,{children:[d,(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ZLQol-`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})})]}),t[6]=f):f=t[6];let p;t[7]===l?p=t[8]:(p=()=>l(!1),t[7]=l,t[8]=p);let m=o===null,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(s,{id:`IKoTAC`}),t[9]=h):h=t[9];let g;t[10]!==p||t[11]!==m?(g=(0,Z.jsx)(ci,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[10]=p,t[11]=m,t[12]=g):g=t[12];let _;t[13]===l?_=t[14]:(_=()=>l(!0),t[13]=l,t[14]=_);let v=o===null,y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`XU0OXn`}),t[15]=y):y=t[15];let b;t[16]!==v||t[17]!==_?(b=(0,Z.jsx)(ci,{onClick:_,disabled:v,children:y}),t[16]=v,t[17]=_,t[18]=b):b=t[18];let x;t[19]!==b||t[20]!==g?(x=(0,Z.jsxs)(wo,{className:`sm:max-w-lg`,showCloseButton:!1,children:[u,f,(0,Z.jsxs)(Eo,{children:[g,b]})]}),t[19]=b,t[20]=g,t[21]=x):x=t[21];let S;return t[22]!==n||t[23]!==x?(S=(0,Z.jsx)(Oo,{open:n,onOpenChange:fv,children:x}),t[22]=n,t[23]=x,t[24]=S):S=t[24],S}function fv(){}function pv(e){return!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectLocalConfig!==null&&e.projectLocalConfig.autoSync?.enabled===null&&(e.pushPermissionCheckStatus===`allowed`||e.pushPermissionCheckStatus===`unknown`)}var mv=5;async function hv(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=mr.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Fe(ms._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=_r.safeParse(n);if(!r.success)throw new Fe(ms._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function gv(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=mr.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Fe(ms._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=ni.safeParse(n);if(!r.success)throw new Fe(ms._({id:`2YZwPB`}),{status:t.status});return r.data.forwardLinks}function _v(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function vv(e){window.location.hash=Vo(e)}function yv(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ve,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(xn,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(bn,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Po,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function bv(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=mv)return null;let a=n-mv,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Ve,{className:`size-3`}):(0,Z.jsx)(No,{className:`size-3`}),t[0]=r,t[1]=o);let c;t[2]!==r||t[3]!==a?(c=r?(0,Z.jsx)(s,{id:`6fGjTz`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=c):c=t[4];let l;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==c?(l=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,c]}),t[5]=r,t[6]=i,t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function xv(e){let t=(0,$.c)(35),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:c,snippet:l,titleHover:u,ariaLabel:d,href:f,external:p,disabled:m,onClick:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=oi(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==d||t[6]!==m||t[7]!==p||t[8]!==f||t[9]!==h||t[10]!==a||t[11]!==u?(x=f?(0,Z.jsxs)(`a`,{href:f,target:p?`_blank`:void 0,rel:p?`noopener noreferrer`:void 0,"aria-label":d,title:u,onClick:h,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,p?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(s,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":d,title:u,disabled:m,onClick:h,className:oi(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=d,t[6]=m,t[7]=p,t[8]=f,t[9]=h,t[10]=a,t[11]=u,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==c||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,c?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,c]}):null]}):null,t[15]=c,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===l?T=t[20]:(T=l?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:l}):null,t[19]=l,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==C||t[26]!==E?(D=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E]}),t[25]=C,t[26]=E,t[27]=D):D=t[27];let O=D;if(i){let e;t[28]===O?e=t[29]:(e=(0,Z.jsx)(js,{asChild:!0,children:O}),t[28]=O,t[29]=e);let n;t[30]===i?n=t[31]:(n=(0,Z.jsx)(Ns,{side:`top`,children:i}),t[30]=i,t[31]=n);let r;return t[32]!==e||t[33]!==n?(r=(0,Z.jsxs)(Is,{children:[e,n]}),t[32]=e,t[33]=n,t[34]=r):r=t[34],r}return O}function Sv(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=i(),{folderPaths:a,pages:o,pagesBySlug:c,pagesByBasename:l,loading:d}=rs(),f,p;t[0]===n?(f=t[1],p=t[2]):(f=[`backlinks`,n],p=()=>hv(n),t[0]=n,t[1]=f,t[2]=p);let m;t[3]!==n||t[4]!==d||t[5]!==o?(m=!d&&o.has(n),t[3]=n,t[4]=d,t[5]=o,t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p||t[9]!==m?(h={queryKey:f,queryFn:p,enabled:m},t[7]=f,t[8]=p,t[9]=m,t[10]=h):h=t[10];let{data:g,isLoading:_,error:v}=cn(h),y;t[11]===g?y=t[12]:(y=g===void 0?[]:g,t[11]=g,t[12]=y);let b=y,[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1));let T;t[13]!==b||t[14]!==x?(T=x?b:b.slice(0,mv),t[13]=b,t[14]=x,t[15]=T):T=t[15];let E=T,D;t[16]===r?D=t[17]:(D=r({id:`9NJWgv`}),t[16]=r,t[17]=D);let O;t[18]!==b.length||t[19]!==_||t[20]!==D?(O=(0,Z.jsx)(yv,{title:D,count:b.length,isLoading:_}),t[18]=b.length,t[19]=_,t[20]=D,t[21]=O):O=t[21];let k;t[22]!==r||t[23]!==b.length||t[24]!==v||t[25]!==x||t[26]!==a||t[27]!==_||t[28]!==o||t[29]!==l||t[30]!==c||t[31]!==E?(k=v?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(on,{children:v instanceof Error?v.message:r({id:`Xet9MX`})})}):b.length===0&&!_?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(pn,{children:(0,Z.jsx)(s,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:E.map((e,t)=>{let n=Ic(e.source,{pages:o,folderPaths:a,pagesBySlug:c,pagesByBasename:l});return(0,Z.jsx)(xv,{icon:(0,Z.jsx)(u,{className:`size-3.5`}),title:e.title,path:_v(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:Vo(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(bv,{total:b.length,expanded:x,onToggle:()=>S(Cv)})]}),t[22]=r,t[23]=b.length,t[24]=v,t[25]=x,t[26]=a,t[27]=_,t[28]=o,t[29]=l,t[30]=c,t[31]=E,t[32]=k):k=t[32];let A;t[33]!==_||t[34]!==k?(A=(0,Z.jsx)(Mo,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":_,children:k})}),t[33]=_,t[34]=k,t[35]=A):A=t[35];let j;return t[36]!==A||t[37]!==O?(j=(0,Z.jsxs)(Fo,{defaultOpen:!0,children:[O,A]}),t[36]=A,t[37]=O,t[38]=j):j=t[38],j}function Cv(e){return!e}function wv(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=i(),{addPage:a,folderPaths:o,pages:c,pagesBySlug:l,pagesByBasename:d,loading:f}=rs(),p,m;t[0]===n?(p=t[1],m=t[2]):(p=[`forward-links`,n],m=()=>gv(n),t[0]=n,t[1]=p,t[2]=m);let h;t[3]!==n||t[4]!==c||t[5]!==f?(h=!f&&c.has(n),t[3]=n,t[4]=c,t[5]=f,t[6]=h):h=t[6];let g;t[7]!==p||t[8]!==m||t[9]!==h?(g={queryKey:p,queryFn:m,enabled:h},t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let{data:_,isLoading:v,error:y}=cn(g),b;t[11]===_?b=t[12]:(b=_===void 0?[]:_,t[11]=_,t[12]=b);let x=b,[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(n);E!==n&&(D(n),T(!1),C(null));let O;t[13]!==w||t[14]!==x?(O=w?x:x.slice(0,mv),t[13]=w,t[14]=x,t[15]=O):O=t[15];let k=O,A;t[16]!==r||t[17]!==a||t[18]!==S?(A=async function(e,t){if(!S){C(t);try{await Vt(e,{addPage:a,onCreated:vv}),C(null)}catch(e){let t=e;hs.error(t instanceof Error?t.message:r({id:`tfi40B`})),C(null)}}},t[16]=r,t[17]=a,t[18]=S,t[19]=A):A=t[19];let j=A,M;t[20]!==r||t[21]!==S||t[22]!==o||t[23]!==j||t[24]!==c||t[25]!==d||t[26]!==l||t[27]!==f?(M=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(xv,{icon:(0,Z.jsx)(vo,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=U(e.docName,{pages:c,folderPaths:o,pagesBySlug:l,pagesByBasename:d}),i=!f&&n.kind===`create`,a=!f&&n.kind===`navigate`&&n.displayState===`folder`,s=_v(e.docName),p=e.title===e.docName?s:e.title,m=`doc:${e.docName}:${e.anchor??``}`,h=Vo(n.kind===`navigate`?n.hashDocName:e.docName,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(xv,{icon:(0,Z.jsx)(Lo,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(S===m?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(S===m?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:p,path:s,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:S!==null,onClick:()=>void j(i,m)},m)}return a&&n.kind===`navigate`?(0,Z.jsx)(xv,{icon:(0,Z.jsx)(wl,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:p,path:s,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},m):(0,Z.jsx)(xv,{icon:(0,Z.jsx)(u,{className:`size-3.5`}),title:p,path:s,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},m)},t[20]=r,t[21]=S,t[22]=o,t[23]=j,t[24]=c,t[25]=d,t[26]=l,t[27]=f,t[28]=M):M=t[28];let N=M,P;t[29]===r?P=t[30]:(P=r({id:`O0Z2Xr`}),t[29]=r,t[30]=P);let F;t[31]!==v||t[32]!==x.length||t[33]!==P?(F=(0,Z.jsx)(yv,{title:P,count:x.length,isLoading:v}),t[31]=v,t[32]=x.length,t[33]=P,t[34]=F):F=t[34];let I;t[35]!==r||t[36]!==y||t[37]!==w||t[38]!==v||t[39]!==x.length||t[40]!==N||t[41]!==k?(I=y?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(on,{children:y instanceof Error?y.message:r({id:`pZAs1T`})})}):x.length===0&&!v?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(pn,{children:(0,Z.jsx)(s,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:k.map(N)}),(0,Z.jsx)(bv,{total:x.length,expanded:w,onToggle:()=>T(Tv)})]}),t[35]=r,t[36]=y,t[37]=w,t[38]=v,t[39]=x.length,t[40]=N,t[41]=k,t[42]=I):I=t[42];let L;t[43]!==v||t[44]!==I?(L=(0,Z.jsx)(Mo,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":v,children:I})}),t[43]=v,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==F||t[47]!==L?(R=(0,Z.jsxs)(Fo,{defaultOpen:!0,children:[F,L]}),t[46]=F,t[47]=L,t[48]=R):R=t[48],R}function Tv(e){return!e}function Ev(e){let t=(0,$.c)(11),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(wv,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Ni,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Sv,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(_n,{className:`px-0 py-0`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==i||t[9]!==c?(l=(0,Z.jsx)(Sn,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Dv(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var Ov=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Ov{};function kv(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Av(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function jv(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Mv(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Nv(e,t){return jv(e,t,``)}function Pv(e,t){return Mv(e,t,``)}function Fv(e,t){return t.slice(0,Iv(e,t))}function Iv(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Lv(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Rv(e,t){if(t)return Bv(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function zv(e,t){if(t)return Bv(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Bv(e,t){if(!t)return[zv(e),Rv(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Lv(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Vv=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Hv=RegExp(`[${Vv}]+|\\s+|[^${Vv}]`,`ug`);new class extends Ov{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Lv(e,r)}else n=e.match(Hv)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Uv(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Uv(n,i,r,null,t.intlSegmenter),e}};function Uv(e,t,n,r,i){if(t&&n){let[a,o]=Bv(t.value,i),[s,c]=Bv(n.value,i);if(e){let r=kv(a,s);e.value=Mv(e.value,s,r),t.value=Nv(t.value,r),n.value=Nv(n.value,r)}if(r){let e=Av(o,c);r.value=jv(r.value,c,e),t.value=Pv(t.value,e),n.value=Pv(n.value,e)}}else if(n){if(e){let e=zv(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=zv(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=zv(r.value,i),[a,o]=Bv(t.value,i),s=kv(n,a);t.value=Nv(t.value,s);let c=Av(Nv(n,s),o);t.value=Pv(t.value,c),r.value=jv(r.value,n,c),e.value=Mv(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=zv(r.value,i),n=Fv(Rv(t.value,i),e);t.value=Pv(t.value,n)}else if(e){let n=Fv(Rv(e.value,i),zv(t.value,i));t.value=Nv(t.value,n)}}new class extends Ov{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Vv}]+|[^\\S\\n\\r]+|[^${Vv}]`,`ug`);return e.match(t)||[]}};var Wv=new class extends Ov{constructor(){super(...arguments),this.tokenize=Kv}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
11
+ `).map(e=>e.trim()).filter(e=>e.length>0&&!/^Cloning into /i.test(e)),n=t.filter(e=>/^remote:/i.test(e)),r=n[n.length-1];if(r)return r.replace(/^remote:\s*/i,``).trim();let i=t.find(e=>/^fatal:/i.test(e));return i?i.replace(/^fatal:\s*/i,``).trim():t[0]??``}function wu(e){let t=[`[receive]`];return e.q2_path!==void 0&&t.push(`q2_path=${e.q2_path}`),e.folder_validate!==void 0&&t.push(`folder_validate=${e.folder_validate}`),e.branch_action!==void 0&&t.push(`branch_action=${e.branch_action}`),e.branch!==void 0&&t.push(`branch=${e.branch}`),e.doc_check!==void 0&&t.push(`doc_check=${e.doc_check}`),e.branch_dialog_action!==void 0&&t.push(`branch_dialog_action=${e.branch_dialog_action}`),t.join(` `)}function Tu(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function Eu(e){return{async getAuthStatus(){return e.authQueryTransport.status()},async startSignIn(){return e.openSignIn()},async runClone({url:t,branch:n}){let r=await e.bridge.dialog.openFolder();if(!r)return{kind:`cancelled`};let i=Tu(t),a=`${r.replace(/\/$/,``)}/${i}`,o=hs.loading(ms._({id:`GXf9hG`,values:{repoName:i}}),{duration:1/0}),s=typeof n==`string`&&n.length>0?n:null;try{let n=e.cloneTransport.start({url:t,dir:a,branch:s});for await(let e of n.events){if(e.type===`progress`){let t=e.phase,n=Math.round(e.pct);hs.loading(ms._({id:`GXf9hG`,values:{repoName:i}}),{id:o,description:ms._({id:`SCzAbA`,values:{phase:t,pct:n}}),duration:1/0});continue}if(e.type===`branch-fallback`){console.log(wu({branch_action:`fallback`,branch:e.branch})),hs.info(ms._({id:`3JYy1p`,values:{0:e.branch}}),{duration:8e3});continue}if(e.type===`complete`)return hs.success(ms._({id:`IRv9cH`,values:{repoName:i}}),{id:o,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return hs.dismiss(o),{kind:`error`,detail:e.message}}return hs.dismiss(o),{kind:`error`,detail:`Clone ended unexpectedly.`}}catch(e){console.warn(`[clone-controller] clone transport threw`,e);let t=e instanceof Error?e.message:`Unknown error`;return hs.dismiss(o),{kind:`error`,detail:t}}}}}function Du(){return{start(e){return Ma((t,n)=>{(async()=>{try{let r=await fetch(`/api/local-op/clone`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e.url,dir:e.dir||void 0,branch:typeof e.branch==`string`&&e.branch.length>0?e.branch:void 0}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=mr.safeParse(t);n.success&&(e=`Clone failed: ${n.data.title}`)}catch{}t({type:`error`,message:e});return}if(!r.body){t({type:`error`,message:`Clone failed — empty response body`});return}let i=r.body.getReader(),a=new TextDecoder,o=``;for(;;){let{done:e,value:r}=await i.read();if(e)break;o+=a.decode(r,{stream:!0});let s=o.split(`
12
+ `);o=s.pop()??``;for(let e of s){if(!e.trim())continue;let n;try{n=JSON.parse(e)}catch{console.warn(`[clone-transport] Dropped unparseable NDJSON line:`,e.slice(0,100));continue}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let e=n.problem;t({type:`error`,message:e?.detail||e?.title||`Unknown error`});break}t(n)}if(n.aborted)break}n.aborted||t({type:`error`,message:`Clone stream ended unexpectedly — check if the clone completed`})}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;t({type:`error`,message:`Clone failed — connection error`})}})()})}}}function Ou(e){return{start(t){let n=typeof t.branch==`string`&&t.branch.length>0?t.branch:null;return e.localOp.clone.start({url:t.url,dir:t.dir,branch:n})}}}var ku=`ContextMenu`,[Au,ju]=ys(ku,[Ca]),Mu=Ca(),[Nu,Pu]=Au(ku),Fu=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Mu(t),l=xs(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Nu,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(qi,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Fu.displayName=ku;var Iu=`ContextMenuTrigger`,Lu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Pu(Iu,n),o=Mu(n),s=Q.useRef({x:0,y:0}),c=Q.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s.current})}),l=Q.useRef(0),u=Q.useCallback(()=>window.clearTimeout(l.current),[]),d=e=>{s.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return Q.useEffect(()=>u,[u]),Q.useEffect(()=>void(r&&u()),[r,u]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Li,{...o,virtualRef:c}),(0,Z.jsx)(bs.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:Ss(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:Ss(e.onPointerDown,fd(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:Ss(e.onPointerMove,fd(u)),onPointerCancel:r?e.onPointerCancel:Ss(e.onPointerCancel,fd(u)),onPointerUp:r?e.onPointerUp:Ss(e.onPointerUp,fd(u))})]})});Lu.displayName=Iu;var Ru=`ContextMenuPortal`,zu=e=>{let{__scopeContextMenu:t,...n}=e,r=Mu(t);return(0,Z.jsx)(pa,{...r,...n})};zu.displayName=Ru;var Bu=`ContextMenuContent`,Vu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Pu(Bu,n),a=Mu(n),o=Q.useRef(!1);return(0,Z.jsx)(sa,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Vu.displayName=Bu;var Hu=`ContextMenuGroup`,Uu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(_o,{...i,...r,ref:t})});Uu.displayName=Hu;var Wu=`ContextMenuLabel`,Gu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Vi,{...i,...r,ref:t})});Gu.displayName=Wu;var Ku=`ContextMenuItem`,qu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(ki,{...i,...r,ref:t})});qu.displayName=Ku;var Ju=`ContextMenuCheckboxItem`,Yu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Yi,{...i,...r,ref:t})});Yu.displayName=Ju;var Xu=`ContextMenuRadioGroup`,Zu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(_a,{...i,...r,ref:t})});Zu.displayName=Xu;var Qu=`ContextMenuRadioItem`,$u=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(zi,{...i,...r,ref:t})});$u.displayName=Qu;var ed=`ContextMenuItemIndicator`,td=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(ha,{...i,...r,ref:t})});td.displayName=ed;var nd=`ContextMenuSeparator`,rd=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Za,{...i,...r,ref:t})});rd.displayName=nd;var id=`ContextMenuArrow`,ad=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(Ui,{...i,...r,ref:t})});ad.displayName=id;var od=`ContextMenuSub`,sd=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Mu(t),[s,c]=ws({prop:i,defaultProp:a??!1,onChange:r,caller:od});return(0,Z.jsx)(Gi,{...o,open:s,onOpenChange:c,children:n})};sd.displayName=od;var cd=`ContextMenuSubTrigger`,ld=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(ya,{...i,...r,ref:t})});ld.displayName=cd;var ud=`ContextMenuSubContent`,dd=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Mu(n);return(0,Z.jsx)(xa,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});dd.displayName=ud;function fd(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var pd=Fu,md=Lu,hd=zu,gd=Vu,_d=Uu,vd=Gu,yd=qu,bd=Yu,xd=td,Sd=rd,Cd=sd,wd=ld,Td=dd,Ed=`Tabs`,[Dd,Od]=ys(Ed,[Us]),kd=Us(),[Ad,jd]=Dd(Ed),Md=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Es(s),[d,f]=ws({prop:r,onChange:i,defaultProp:a??``,caller:Ed});return(0,Z.jsx)(Ad,{scope:n,baseId:vs(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Z.jsx)(bs.div,{dir:u,"data-orientation":o,...l,ref:t})})});Md.displayName=Ed;var Nd=`TabsList`,Pd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=jd(Nd,n),o=kd(n);return(0,Z.jsx)(Hs,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Z.jsx)(bs.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});Pd.displayName=Nd;var Fd=`TabsTrigger`,Id=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=jd(Fd,n),s=kd(n),c=zd(o.baseId,r),l=Bd(o.baseId,r),u=r===o.value;return(0,Z.jsx)(Ws,{asChild:!0,...s,focusable:!i,active:u,children:(0,Z.jsx)(bs.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Ss(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Ss(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Ss(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});Id.displayName=Fd;var Ld=`TabsContent`,Rd=Q.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=jd(Ld,n),c=zd(s.baseId,r),l=Bd(s.baseId,r),u=r===s.value,d=Q.useRef(u);return Q.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Z.jsx)(Cs,{present:i||u,children:({present:n})=>(0,Z.jsx)(bs.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Rd.displayName=Ld;function zd(e,t){return`${e}-trigger-${t}`}function Bd(e,t){return`${e}-content-${t}`}var Vd=Md,Hd=Pd,Ud=Id,Wd=Rd;function Gd(){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(Kd),()=>{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 Kd(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function qd(e){let t=(0,$.c)(6),{className:n}=e,{_:r}=i(),{channel:a}=Gd();if(a!==`beta`)return null;let o;t[0]===r?o=t[1]:(o=r({id:`9fhQRL`}),t[0]=r,t[1]=o);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`cSCbv3`}),t[2]=c):c=t[2];let l;return t[3]!==n||t[4]!==o?(l=(0,Z.jsx)(st,{variant:`secondary`,"aria-label":o,"data-testid":`beta-badge`,className:n,children:c}),t[3]=n,t[4]=o,t[5]=l):l=t[5],l}function Jd(e){switch(e){case`receiving`:return{id:`qbfj1f`};case`resolving`:return{id:`adsMWO`};case`checking`:return{id:`1HBhDS`};case`init`:return{id:`LlHqdU`};case`done`:return{id:`bD8I7O`};default:return{id:`25Pw6a`}}}function Yd(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function Xd(e){let t=(0,$.c)(100),{open:n,onOpenChange:r,onSignIn:a,onCloneComplete:o,transport:c,authQueryTransport:l,pickParentFolder:u,initialUrl:d}=e,{_:f}=i(),p;t[0]===c?p=t[1]:(p=c??Du(),t[0]=c,t[1]=p);let m=p,h;t[2]===l?h=t[3]:(h=l??io(),t[2]=l,t[3]=h);let g=h,_=u!==void 0,[v,y]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),O;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(O=Zi(),t[4]=O):O=t[4];let[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(!1),[F,I]=(0,Q.useState)(-1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),B=(0,Q.useId)(),V;t[5]!==n||t[6]!==g?(V=()=>{if(!n)return;let e=!1;return g.status().then(t=>{$i(t.authenticated),e||A(t.authenticated)}).catch(()=>{e||A(!1)}),()=>{e=!0}},t[5]=n,t[6]=g,t[7]=V):V=t[7];let H;t[8]===n?H=t[9]:(H=[n],t[8]=n,t[9]=H),(0,Q.useEffect)(V,H);let U;t[10]!==k||t[11]!==n||t[12]!==g?(U=()=>{if(!k||!n)return;let e=!1;return D(!0),g.repos().then(t=>{e||(T(t.ok?t.repos:[]),D(!1))}).catch(()=>{e||(T([]),D(!1))}),()=>{e=!0}},t[10]=k,t[11]=n,t[12]=g,t[13]=U):U=t[13];let W;t[14]!==k||t[15]!==n?(W=[k,n],t[14]=k,t[15]=n,t[16]=W):W=t[16],(0,Q.useEffect)(U,W);let G,K;t[17]!==d||t[18]!==n||t[19]!==_?(G=()=>{if(!n||!d||(y(d),_))return;let e=Yd(d);e&&C(`~/Documents/${e}`)},K=[n,d,_],t[17]=d,t[18]=n,t[19]=_,t[20]=G,t[21]=K):(G=t[20],K=t[21]),(0,Q.useEffect)(G,K);let q,J;t[22]!==F||t[23]!==B?(q=()=>{F<0||document.getElementById(`${B}-opt-${F}`)?.scrollIntoView({block:`nearest`})},J=[F,B],t[22]=F,t[23]=B,t[24]=q,t[25]=J):(q=t[24],J=t[25]),(0,Q.useEffect)(q,J);let ee;t[26]===_?ee=t[27]:(ee=function(e){if(y(e),P(!0),I(-1),_)return;let t=Yd(e);t&&C(`~/Documents/${t}`)},t[26]=_,t[27]=ee);let Y=ee,te;t[28]===_?te=t[29]:(te=function(e){if(y(e.clone_url),_)return;let t=e.full_name.split(`/`)[1];C(`~/Documents/${t}`)},t[28]=_,t[29]=te);let ne=te,X;t[30]!==f||t[31]!==x||t[32]!==o||t[33]!==r||t[34]!==u||t[35]!==m||t[36]!==v?(X=async function(){let e=v.trim();if(!e){hs.error(f({id:`FTUGgh`}));return}let t=x||``;if(u){M(!0);let n=await u();if(!n){M(!1);return}let r=Yd(e);t=`${n.replace(/\/$/,``)}/${r}`}else M(!0);let n=hs.loading(f({id:`2tgFCe`}),{duration:1/0});R.current=n;let i=m.start({url:e,dir:t});L.current=i.cancel;try{let e=i.events[Symbol.asyncIterator](),t=await e.next();for(;!t.done;){let i=t.value;if(i.type===`progress`){let e=f(Jd(i.phase));hs.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){hs.success(f({id:`u_lS4C`}),{id:n}),r(!1),M(!1),L.current=null;let e=`port`in i?i.port:void 0;o?o({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;hs.error(f({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),M(!1),L.current=null;return}t=await e.next()}hs.error(f({id:`Tz9pJB`}),{id:n}),M(!1),L.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),hs.error(f({id:`K9J00P`}),{id:n}),M(!1),L.current=null}},t[30]=f,t[31]=x,t[32]=o,t[33]=r,t[34]=u,t[35]=m,t[36]=v,t[37]=X):X=t[37];let re=X,ie;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){L.current?.(),L.current=null,M(!1),hs.dismiss(R.current??void 0)},t[38]=ie):ie=t[38];let ae=ie,oe;t[39]!==j||t[40]!==r||t[41]!==_?(oe=function(e){j||(r(e),e||(y(``),_||C(``),P(!1),I(-1)))},t[39]=j,t[40]=r,t[41]=_,t[42]=oe):oe=t[42];let se=oe,ce;t[43]===ne?ce=t[44]:(ce=function(e){ne(e),P(!1),I(-1),z.current?.focus()},t[43]=ne,t[44]=ce);let le=ce,ue=k===null||E&&w===null,de;if(t[45]!==w||t[46]!==v){let e=v.trim().toLowerCase(),n;t[48]===w?n=t[49]:(n=w??[],t[48]=w,t[49]=n),de=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[45]=w,t[46]=v,t[47]=de}else de=t[47];let pe=de,me;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(me=/:\/\/|^git@|\.git$/i,t[50]=me):me=t[50];let he;t[51]===v?he=t[52]:(he=me.test(v.trim()),t[51]=v,t[52]=he);let ge=he,_e=k===!0&&w!==null&&pe.length===0&&!ge,ve=N&&k!==!1&&!j&&(ue||pe.length>0||_e),ye=pe.length,be=`${B}-loading`,xe,Se;t[53]===ye?(xe=t[54],Se=t[55]):(xe=()=>{I(e=>e>=ye?ye-1:e)},Se=[ye],t[53]=ye,t[54]=xe,t[55]=Se),(0,Q.useEffect)(xe,Se);let Ce;t[56]!==F||t[57]!==j||t[58]!==ve||t[59]!==le||t[60]!==pe?(Ce=function(e){if(!j)if(e.key===`ArrowDown`){if(e.preventDefault(),!ve){P(!0);return}I(e=>Math.min(e+1,pe.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),I(nf)):e.key===`Enter`?ve&&F>=0&&F<pe.length&&(e.preventDefault(),le(pe[F])):e.key===`Escape`&&ve&&(e.preventDefault(),e.stopPropagation(),P(!1),I(-1))},t[56]=F,t[57]=j,t[58]=ve,t[59]=le,t[60]=pe,t[61]=Ce):Ce=t[61];let we=Ce,Te;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsx)(Do,{children:(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`VdXv4D`})})}),t[62]=Te):Te=t[62];let Ee;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`IreQBq`})}),t[63]=Ee):Ee=t[63];let De;t[64]!==f||t[65]!==F||t[66]!==j||t[67]!==we||t[68]!==Y||t[69]!==k||t[70]!==B||t[71]!==be||t[72]!==a||t[73]!==ve||t[74]!==ue||t[75]!==w||t[76]!==le||t[77]!==pe||t[78]!==v?(De=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ee,k===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(jo,{id:`clone-source`,placeholder:f({id:`Xv_ijG`}),value:v,onChange:e=>Y(e.target.value),disabled:j}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-1sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`9oE4C3`})}),(0,Z.jsx)(ci,{variant:`link`,className:`h-auto p-0`,onClick:()=>a?.(),disabled:j,children:(0,Z.jsx)(s,{id:`3jod3l`})})]})]}):(0,Z.jsxs)(fe,{open:ve,onOpenChange:P,children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(jo,{id:`clone-source`,ref:z,role:`combobox`,"aria-expanded":ve,"aria-controls":ve?ue?be:B:void 0,"aria-activedescendant":F>=0?`${B}-opt-${F}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:f({id:`R0jJzV`}),value:v,onChange:e=>Y(e.target.value),onFocus:()=>P(!0),onKeyDown:we,disabled:j})}),(0,Z.jsx)(b,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:tf,onCloseAutoFocus:ef,onInteractOutside:e=>{z.current?.contains(e.target)&&e.preventDefault()},onWheel:$d,onTouchMove:Qd,children:ue?(0,Z.jsxs)(`output`,{id:be,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":f({id:`8XQRON`}),children:[(0,Z.jsx)(za,{className:`h-4 w-2/3`}),(0,Z.jsx)(za,{className:`h-4 w-1/2`}),(0,Z.jsx)(za,{className:`h-4 w-3/4`}),(0,Z.jsx)(za,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:B,role:`listbox`,"aria-label":f({id:`KX1MZR`}),className:`py-1`,children:pe.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:w&&w.length===0?(0,Z.jsx)(s,{id:`cOSAfL`}):(0,Z.jsx)(s,{id:`8eW0WQ`})}):pe.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${B}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===F,onMouseDown:Zd,onMouseEnter:()=>I(t),onClick:()=>le(e),className:oi(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===F&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Fl,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qo,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[64]=f,t[65]=F,t[66]=j,t[67]=we,t[68]=Y,t[69]=k,t[70]=B,t[71]=be,t[72]=a,t[73]=ve,t[74]=ue,t[75]=w,t[76]=le,t[77]=pe,t[78]=v,t[79]=De):De=t[79];let Oe;t[80]!==j||t[81]!==x||t[82]!==_?(Oe=!_&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`Gp_twO`})}),(0,Z.jsx)(jo,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:x,onChange:e=>C(e.target.value),disabled:j})]}),t[80]=j,t[81]=x,t[82]=_,t[83]=Oe):Oe=t[83];let ke;t[84]!==De||t[85]!==Oe?(ke=(0,Z.jsx)(To,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[De,Oe]})}),t[84]=De,t[85]=Oe,t[86]=ke):ke=t[86];let Ae;t[87]!==j||t[88]!==re||t[89]!==se||t[90]!==v||t[91]!==_?(Ae=(0,Z.jsx)(Eo,{children:j?(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:ae,children:(0,Z.jsx)(s,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>se(!1),children:(0,Z.jsx)(s,{id:`dEgA5A`})}),(0,Z.jsx)(ci,{onClick:()=>void re(),disabled:!v.trim(),"aria-describedby":_?`clone-picker-hint`:void 0,children:(0,Z.jsx)(s,{id:`9UQ730`})}),_&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(s,{id:`EvPX7f`})})]})}),t[87]=j,t[88]=re,t[89]=se,t[90]=v,t[91]=_,t[92]=Ae):Ae=t[92];let je;t[93]!==ke||t[94]!==Ae?(je=(0,Z.jsxs)(wo,{className:`sm:max-w-lg`,children:[Te,ke,Ae]}),t[93]=ke,t[94]=Ae,t[95]=je):je=t[95];let Me;return t[96]!==se||t[97]!==n||t[98]!==je?(Me=(0,Z.jsx)(Oo,{open:n,onOpenChange:se,children:je}),t[96]=se,t[97]=n,t[98]=je,t[99]=Me):Me=t[99],Me}function Zd(e){return e.preventDefault()}function Qd(e){return e.stopPropagation()}function $d(e){return e.stopPropagation()}function ef(e){return e.preventDefault()}function tf(e){return e.preventDefault()}function nf(e){return Math.max(e-1,-1)}var rf=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-DOf6_QiW.js`),__vite__mapDeps([5,1,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url));function af(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Ys.subscribe,sf,of))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(rf,{})}),e[0]=t):t=e[0],t}function of(){return!1}function sf(){return Ys.getSnapshot()!==null}var cf=180,lf=5e3;function uf(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function df(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function ff(e){let{parent:t,sanitizedName:n,enclosingProject:r,enclosingGit:i,targetState:a}=e;return t===``||n===``?{kind:`idle`}:r===null?i===null?a===`exists-nonempty`?{kind:`block-nonempty`}:{kind:`free`}:{kind:`confirm-git`,gitRoot:i.gitRoot}:{kind:`block-nested`,rootPath:r.rootPath}}function pf(e){let t=e instanceof Error?e.message:String(e);for(let e of hr)if(t.startsWith(`${e}:`)||t.includes(`${e}: `))return e===`nested-project`||e===`target-not-empty`?{reason:e}:{reason:e,message:t};return{reason:`unknown`,message:t}}function mf(e){switch(e.reason){case`nested-project`:return{id:`ScwcF2`};case`target-not-empty`:return{id:`e8L17t`};case`invalid-args`:return{id:`6bTTAN`};case`mkdir-failed`:return{id:`gJR87V`};case`git-init-failed`:return{id:`4CfgPM`};case`init-failed`:return{id:`l17ab4`};case`discovery-failed`:return{id:`ThmUrC`};case`unknown`:return{id:`AddR83`}}}function hf(e){let t=(0,$.c)(180),{open:n,onOpenChange:r,bridge:a}=e,{_:o}=i(),c=(0,Q.useId)(),l=(0,Q.useId)(),u=(0,Q.useId)(),d=(0,Q.useId)(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(Sf),[b,x]=(0,Q.useState)(`shared`),[S,C]=(0,Q.useState)(!1),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w={kind:`idle`},t[0]=w):w=t[0];let[T,E]=(0,Q.useState)(w),[D,O]=(0,Q.useState)(`idle`),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null),N;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(N={kind:`idle`},t[1]=N):N=t[1];let[P,F]=(0,Q.useState)(N),[I,L]=(0,Q.useState)(0),R;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(R=new Set,t[2]=R):R=t[2];let z=(0,Q.useRef)(R),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),H=(0,Q.useRef)(null),U=(0,Q.useRef)(0),W,G;t[3]!==a||t[4]!==n?(W=()=>{if(!n)return;z.current.clear(),M(null),E({kind:`idle`}),O(`idle`),A(!1),_(``),y(new Set(Dr)),x(`shared`),C(!1),F({kind:`idle`}),U.current+=1;let e=!1;p(``),h(!0),a.fs.defaultProjectsRoot().then(t=>{e||p(t)}).catch(xf).finally(()=>{e||h(!1)});let t=requestAnimationFrame(()=>{H.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},G=[n,a],t[3]=a,t[4]=n,t[5]=W,t[6]=G):(W=t[5],G=t[6]),(0,Q.useEffect)(W,G);let K;t[7]!==a||t[8]!==f||t[9]!==g||t[10]!==n?(K=()=>{if(!n)return;V.current!==null&&clearTimeout(V.current),B.current!==null&&B.current.abort();let e=Kr(g);if(f===``||e===``){E({kind:`idle`}),O(`idle`);return}let t=f,r=uf(t,e),i=new AbortController;return B.current=i,V.current=setTimeout(()=>{O(`in-flight`),Promise.all([a.fs.findEnclosingProjectRoot(t),a.fs.findEnclosingGitRoot(t),a.fs.folderState(r)]).then(n=>{let[r,a,o]=n;i.signal.aborted||(O(`idle`),E(ff({parent:t,sanitizedName:e,enclosingProject:r,enclosingGit:a,targetState:o})))}).catch(e=>{i.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),O(`idle`),E({kind:`free`}))})},cf),()=>{V.current!==null&&clearTimeout(V.current),i.abort()}},t[7]=a,t[8]=f,t[9]=g,t[10]=n,t[11]=K):K=t[11];let q;t[12]!==a||t[13]!==f||t[14]!==g||t[15]!==n||t[16]!==I?(q=[n,f,g,a,I],t[12]=a,t[13]=f,t[14]=g,t[15]=n,t[16]=I,t[17]=q):q=t[17],(0,Q.useEffect)(K,q);let J,ee;t[18]===n?(J=t[19],ee=t[20]):(J=()=>{if(!n)return;let e=()=>L(bf);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},ee=[n],t[18]=n,t[19]=J,t[20]=ee),(0,Q.useEffect)(J,ee);let Y=(0,Q.useRef)(`idle`),te,ne;t[21]===D?(te=t[22],ne=t[23]):(te=()=>{Y.current=D},ne=[D],t[21]=D,t[22]=te,t[23]=ne),(0,Q.useEffect)(te,ne);let X,re;t[24]!==T.kind||t[25]!==n?(X=()=>{if(!n||T.kind!==`confirm-git`)return;let e=setInterval(()=>{Y.current!==`in-flight`&&L(yf)},lf);return()=>clearInterval(e)},re=[n,T.kind],t[24]=T.kind,t[25]=n,t[26]=X,t[27]=re):(X=t[26],re=t[27]),(0,Q.useEffect)(X,re);let ie;t[28]!==T.gitRoot||t[29]!==T.kind||t[30]!==P.gitRoot||t[31]!==P.kind?(ie=()=>{if(T.kind!==`confirm-git`){P.kind!==`idle`&&(U.current+=1,F({kind:`idle`}));return}P.kind===`confirming`&&P.gitRoot!==T.gitRoot&&F({kind:`idle`}),P.kind===`pending`&&P.gitRoot!==T.gitRoot&&(U.current+=1,F({kind:`idle`}))},t[28]=T.gitRoot,t[29]=T.kind,t[30]=P.gitRoot,t[31]=P.kind,t[32]=ie):ie=t[32];let ae;t[33]!==T||t[34]!==P?(ae=[T,P],t[33]=T,t[34]=P,t[35]=ae):ae=t[35],(0,Q.useEffect)(ie,ae);let oe;t[36]!==a||t[37]!==T.kind||t[38]!==n?(oe=()=>{if(!n)return;let e=null;T.kind===`block-nested`?e=`nested`:T.kind===`block-nonempty`?e=`nonempty`:T.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(z.current.has(e)||(z.current.add(e),a.project.recordCreateNewBannerShown(e).catch(vf)))},t[36]=a,t[37]=T.kind,t[38]=n,t[39]=oe):oe=t[39];let se;t[40]!==a||t[41]!==T||t[42]!==n?(se=[n,T,a],t[40]=a,t[41]=T,t[42]=n,t[43]=se):se=t[43],(0,Q.useEffect)(oe,se);let ce=g,le,ue,de,fe,pe;t[44]!==T.kind||t[45]!==f||t[46]!==ce?(fe=ce===``?``:Kr(ce),ue=ce!==``&&fe!==ce&&fe!==``,de=ce!==``&&fe===``,le=T.kind===`block-nonempty`,pe=f!==``&&fe!==``?uf(f,fe):``,t[44]=T.kind,t[45]=f,t[46]=ce,t[47]=le,t[48]=ue,t[49]=de,t[50]=fe,t[51]=pe):(le=t[47],ue=t[48],de=t[49],fe=t[50],pe=t[51]);let me=pe,he=!k&&f!==``&&ce!==``&&fe!==``&&D===`idle`&&(T.kind===`free`||T.kind===`confirm-git`),ge=k||ce!==``&&!he,_e;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[52]=_e):_e=t[52];let ve=_e,ye;t[53]!==a||t[54]!==f?(ye=async function(){try{let e=await a.dialog.openFolder(f===``?void 0:{defaultPath:f});if(e===null)return;p(e),L(_f),M(null)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[53]=a,t[54]=f,t[55]=ye):ye=t[55];let be=ye,xe;t[56]!==o||t[57]!==a||t[58]!==k||t[59]!==he||t[60]!==v||t[61]!==f||t[62]!==r||t[63]!==ce||t[64]!==fe||t[65]!==b?(xe=async function(e){if(e.preventDefault(),!k){if(ce.trim()===``){hs.error(o({id:`5OqaJi`})),H.current?.focus();return}if(he){A(!0),M(null);try{await a.project.createNew({parent:f,name:fe,editors:Array.from(v),sharing:b}),r(!1)}catch(e){M(pf(e)),A(!1)}}}},t[56]=o,t[57]=a,t[58]=k,t[59]=he,t[60]=v,t[61]=f,t[62]=r,t[63]=ce,t[64]=fe,t[65]=b,t[66]=xe):xe=t[66];let Se=xe,Ce;t[67]!==k||t[68]!==r?(Ce=function(e){k||r(e)},t[67]=k,t[68]=r,t[69]=Ce):Ce=t[69];let we=Ce,Te;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Te=async function(e){F({kind:`confirming`,gitRoot:e})},t[70]=Te):Te=t[70];let Ee=Te,De;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(De=async function(){F({kind:`idle`})},t[71]=De):De=t[71];let Oe=De,ke;t[72]===a?ke=t[73]:(ke=async function(e){let t=U.current+1;U.current=t,F({kind:`pending`,gitRoot:e});try{if(await a.fs.removeGitFolder(e),U.current!==t)return;L(gf),F({kind:`idle`})}catch(e){let n=e;if(U.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),F({kind:`error`,message:r})}},t[72]=a,t[73]=ke);let Ae=ke,je;t[74]!==a||t[75]!==r?(je=async function(e){r(!1);try{await a.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[74]=a,t[75]=r,t[76]=je):je=t[76];let Me=je,Ne=de||le||ue?`${u} ${d}`:u,Pe;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`wbv9xO`})}),t[77]=Pe):Pe=t[77];let Fe;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,Z.jsxs)(Do,{children:[Pe,(0,Z.jsx)(So,{children:(0,Z.jsx)(s,{id:`WEzuMq`})})]}),t[78]=Fe):Fe=t[78];let Ie;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(s,{id:`OyIC0Q`}),t[79]=Ie):Ie=t[79];let Le;t[80]===l?Le=t[81]:(Le=(0,Z.jsx)(Bs,{htmlFor:l,children:Ie}),t[80]=l,t[81]=Le);let Re;t[82]===o?Re=t[83]:(Re=o({id:`cV7LOw`}),t[82]=o,t[83]=Re);let ze;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(ze=e=>_(e.target.value),t[84]=ze):ze=t[84];let Be=de||le,Ve;t[85]!==k||t[86]!==g||t[87]!==Ne||t[88]!==l||t[89]!==Re||t[90]!==Be?(Ve=(0,Z.jsx)(jo,{id:l,ref:H,value:g,placeholder:Re,onChange:ze,disabled:k,autoComplete:`off`,"aria-invalid":Be,"aria-describedby":Ne,"data-testid":`create-name`}),t[85]=k,t[86]=g,t[87]=Ne,t[88]=l,t[89]=Re,t[90]=Be,t[91]=Ve):Ve=t[91];let He;t[92]!==d||t[93]!==le||t[94]!==ue||t[95]!==de||t[96]!==fe?(He=de?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-erased`,children:(0,Z.jsx)(s,{id:`_PBJRl`})}):le?(0,Z.jsx)(`p`,{id:d,role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-name-error-taken`,children:(0,Z.jsx)(s,{id:`7apDiJ`,values:{sanitized:fe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):ue?(0,Z.jsx)(`p`,{id:d,role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-name-hint-diverged`,children:(0,Z.jsx)(s,{id:`KnoB--`,values:{sanitized:fe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[92]=d,t[93]=le,t[94]=ue,t[95]=de,t[96]=fe,t[97]=He):He=t[97];let Ue;t[98]!==Le||t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Le,Ve,He]}),t[98]=Le,t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsx)(Bs,{children:(0,Z.jsx)(s,{id:`wJijgU`})}),t[102]=We):We=t[102];let Ge;t[103]!==f||t[104]!==m?(Ge=f===``?m?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`iHAJDj`})}):(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`8m8diM`})}):f,t[103]=f,t[104]=m,t[105]=Ge):Ge=t[105];let Ke;t[106]===Ge?Ke=t[107]:(Ke=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 rounded-md border border-input bg-muted/50 px-2.5 py-1 text-sm text-foreground wrap-break-word`,"data-testid":`create-location-display`,children:Ge}),t[106]=Ge,t[107]=Ke);let qe;t[108]===be?qe=t[109]:(qe=()=>void be(),t[108]=be,t[109]=qe);let Je;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,Z.jsx)(s,{id:`O2UpM1`}),t[110]=Je):Je=t[110];let Ye;t[111]!==k||t[112]!==qe?(Ye=(0,Z.jsx)(ci,{type:`button`,variant:`outline`,className:`shrink-0`,disabled:k,onClick:qe,"data-testid":`create-browse`,children:Je}),t[111]=k,t[112]=qe,t[113]=Ye):Ye=t[113];let Xe;t[114]!==Ke||t[115]!==Ye?(Xe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[Ke,Ye]}),t[114]=Ke,t[115]=Ye,t[116]=Xe):Xe=t[116];let Ze;t[117]===me?Ze=t[118]:(Ze=me===``?null:(0,Z.jsx)(s,{id:`k_yIIc`,values:{targetPreview:me},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}}),t[117]=me,t[118]=Ze);let Qe;t[119]!==u||t[120]!==Ze?(Qe=(0,Z.jsx)(`p`,{id:u,className:`text-1sm text-muted-foreground wrap-break-word`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:Ze}),t[119]=u,t[120]=Ze,t[121]=Qe):Qe=t[121];let $e;t[122]!==Xe||t[123]!==Qe?($e=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[We,Xe,Qe]}),t[122]=Xe,t[123]=Qe,t[124]=$e):$e=t[124];let et;t[125]!==T||t[126]!==Ae||t[127]!==Me||t[128]!==P?(et=(0,Z.jsx)(Cf,{cascade:T,onOpenNested:Me,removeGitState:P,onRequestRemoveGit:Ee,onCancelRemoveGit:Oe,onConfirmRemoveGit:Ae}),t[125]=T,t[126]=Ae,t[127]=Me,t[128]=P,t[129]=et):et=t[129];let tt;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,Z.jsxs)(Po,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`create-advanced-trigger`,children:[(0,Z.jsx)(s,{id:`VNgKZz`}),(0,Z.jsx)(No,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[130]=tt):tt=t[130];let nt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`0YEbfk`})}),t[131]=nt):nt=t[131];let rt;t[132]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`prHfed`})}),t[132]=rt):rt=t[132];let it;t[133]!==k||t[134]!==v?(it=Dr.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(Bs,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Vs,{id:t,checked:v.has(e),onCheckedChange:()=>ve(e),disabled:k,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:qn[e]})]},e)}),t[133]=k,t[134]=v,t[135]=it):it=t[135];let at;t[136]===it?at=t[137]:(at=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[nt,rt,it]}),t[136]=it,t[137]=at);let ot;t[138]!==k||t[139]!==b?(ot=(0,Z.jsx)(Zs,{idPrefix:`create`,testIdPrefix:`create-sharing`,value:b,onValueChange:x,disabled:k}),t[138]=k,t[139]=b,t[140]=ot):ot=t[140];let st;t[141]!==at||t[142]!==ot?(st=(0,Z.jsxs)(Mo,{className:`space-y-6 border-t border-border px-3 py-4`,children:[at,ot]}),t[141]=at,t[142]=ot,t[143]=st):st=t[143];let ct;t[144]!==S||t[145]!==st?(ct=(0,Z.jsxs)(Fo,{open:S,onOpenChange:C,className:`rounded-md border border-border`,"data-testid":`create-advanced`,children:[tt,st]}),t[144]=S,t[145]=st,t[146]=ct):ct=t[146];let lt;t[147]!==o||t[148]!==j?(lt=j===null?null:(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-submit-error`,children:o(mf(j))}),t[147]=o,t[148]=j,t[149]=lt):lt=t[149];let ut;t[150]!==c||t[151]!==Se||t[152]!==Ue||t[153]!==$e||t[154]!==et||t[155]!==ct||t[156]!==lt?(ut=(0,Z.jsx)(To,{className:`space-y-6`,children:(0,Z.jsxs)(`form`,{id:c,onSubmit:Se,"data-testid":`create-project-form`,className:`space-y-6`,children:[Ue,$e,et,ct,lt]})}),t[150]=c,t[151]=Se,t[152]=Ue,t[153]=$e,t[154]=et,t[155]=ct,t[156]=lt,t[157]=ut):ut=t[157];let dt;t[158]===r?dt=t[159]:(dt=()=>r(!1),t[158]=r,t[159]=dt);let ft;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,Z.jsx)(s,{id:`dEgA5A`}),t[160]=ft):ft=t[160];let pt;t[161]!==k||t[162]!==dt?(pt=(0,Z.jsx)(ci,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:dt,disabled:k,"data-testid":`create-cancel`,children:ft}),t[161]=k,t[162]=dt,t[163]=pt):pt=t[163];let mt;t[164]===k?mt=t[165]:(mt=k?(0,Z.jsx)(s,{id:`E9bKSA`}):(0,Z.jsx)(s,{id:`hYgDIe`}),t[164]=k,t[165]=mt);let ht;t[166]!==c||t[167]!==ge||t[168]!==mt?(ht=(0,Z.jsx)(ci,{type:`submit`,form:c,disabled:ge,"data-testid":`create-submit`,children:mt}),t[166]=c,t[167]=ge,t[168]=mt,t[169]=ht):ht=t[169];let gt;t[170]!==pt||t[171]!==ht?(gt=(0,Z.jsxs)(Eo,{children:[pt,ht]}),t[170]=pt,t[171]=ht,t[172]=gt):gt=t[172];let _t;t[173]!==ut||t[174]!==gt?(_t=(0,Z.jsxs)(wo,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[Fe,ut,gt]}),t[173]=ut,t[174]=gt,t[175]=_t):_t=t[175];let vt;return t[176]!==we||t[177]!==n||t[178]!==_t?(vt=(0,Z.jsx)(Oo,{open:n,onOpenChange:we,children:_t}),t[176]=we,t[177]=n,t[178]=_t,t[179]=vt):vt=t[179],vt}function gf(e){return e+1}function _f(e){return e+1}function vf(){}function yf(e){return e+1}function bf(e){return e+1}function xf(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Sf(){return new Set(Dr)}function Cf(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:c}=e;if(n.kind===`idle`||n.kind===`free`||n.kind===`block-nonempty`)return null;if(n.kind===`block-nested`){let{rootPath:e}=n,i;t[0]===e?i=t[1]:(i=df(e),t[0]=e,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o={rootPath:e},t[2]=e,t[3]=o);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(s,{id:`aIgBKf`,values:o,components:c})}),t[5]=o,t[6]=l);let u;t[7]!==r||t[8]!==e?(u=()=>r(e),t[7]=r,t[8]=e,t[9]=u):u=t[9];let d;t[10]===a?d=t[11]:(d=(0,Z.jsx)(s,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,Z.jsx)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:u,"data-testid":`create-banner-nested-open`,children:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Z.jsxs)(`div`,{role:`alert`,className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,"data-testid":`create-banner-nested`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}if(n.kind===`confirm-git`){let{gitRoot:e}=n,r;if(t[18]!==e){let n;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(n=/\/+$/,t[20]=n):n=t[20],r=e.replace(n,``),t[18]=e,t[19]=r}else r=t[19];let l=`${r}/.git`,u=i.kind===`error`?i.message:null,d;t[21]===e?d=t[22]:(d={gitRoot:e},t[21]=e,t[22]=d);let f;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(f={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=f):f=t[23];let p;t[24]===d?p=t[25]:(p=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(s,{id:`5o4lc1`,values:d,components:f})}),t[24]=d,t[25]=p);let m;t[26]!==e||t[27]!==o||t[28]!==c||t[29]!==a||t[30]!==u||t[31]!==i.kind||t[32]!==l?(m=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(s,{id:`YTLmTM`,components:{0:(0,Z.jsx)(`code`,{})}})}),i.kind===`error`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`create-banner-git-remove-error`,children:(0,Z.jsx)(s,{id:`SkMZlS`,values:{targetGitPath:l,removeGitError:u},components:{0:(0,Z.jsx)(`code`,{})}})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2 rounded border border-blue-400/60 bg-white/40 p-2 dark:border-blue-600/60 dark:bg-black/20`,"data-testid":`create-banner-git-remove-confirm`,children:[(0,Z.jsx)(`p`,{className:`text-xs`,children:(0,Z.jsx)(s,{id:`WZ-vBy`,values:{targetGitPath:l},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>c(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(s,{id:`0-31GV`}):(0,Z.jsx)(s,{id:`v-h2hx`,values:{targetGitPath:l}})}),(0,Z.jsx)(ci,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(s,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=c,t[29]=a,t[30]=u,t[31]=i.kind,t[32]=l,t[33]=m):m=t[33];let h;return t[34]!==p||t[35]!==m?(h=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-blue-300 bg-blue-50 px-3 py-2 text-sm text-blue-900 dark:border-blue-700 dark:bg-blue-950 dark:text-blue-200`,"data-testid":`create-banner-git-confirm`,children:[p,m]}),t[34]=p,t[35]=m,t[36]=h):h=t[36],h}return null}function wf(e){let t=(0,$.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`GitHub`}),r=(0,Z.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`}),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 Tf(e){let t=(0,$.c)(5),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`title`,{children:`Open Knowledge icon`}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`g`,{filter:`url(#filter0_d_ok)`,children:[(0,Z.jsx)(`path`,{d:`M66.8902 16.1017C58.2694 3.86669 46.1739 -0.690239 29.9182 2.17749C21.3995 3.67813 13.4602 9.555 8.67934 17.9009C3.93974 26.1701 2.98514 35.6533 6.05714 43.9166C9.31574 52.6868 16.7168 58.4752 24.2299 63.4231C25.7973 64.4562 26.1351 65.7172 26.3551 68.9896C26.5221 71.4625 26.799 75.6011 30.6842 77.7204C31.8176 78.3372 33.0648 78.6515 34.3946 78.6515C37.0796 78.6515 39.4033 77.3649 40.5189 76.7482C47.1049 73.1046 68.8878 59.7147 72.6453 40.4027C74.3444 31.6679 70.9797 21.9019 66.8922 16.1017H66.8902Z`,fill:`white`}),(0,Z.jsx)(`path`,{d:`M37.4214 71.154C28.7888 75.929 36.787 64.0397 27.7458 58.0843C21.6372 54.0616 14.788 49.0568 12.0499 41.6911C6.74463 27.4192 17.5438 10.8473 31.028 8.47262C45.1977 5.97613 54.6946 9.8947 61.6635 19.7844C65.2089 24.8167 67.6013 32.8365 66.3658 39.1828C63.6906 52.9341 49.073 64.7075 37.4214 71.154Z`,fill:`#69A3FF`}),(0,Z.jsx)(`path`,{d:`M52.7244 29.2638C53.4665 28.5217 54.6697 28.5217 55.4119 29.2638V29.2638C56.154 30.0059 56.154 31.2091 55.4119 31.9513L49.2589 38.1042L46.5715 35.4167L52.7244 29.2638Z`,fill:`#D5E5FF`}),(0,Z.jsx)(`path`,{d:`M55.4119 38.8821C56.154 39.6242 56.154 40.8274 55.4119 41.5696V41.5696C54.6698 42.3117 53.4665 42.3117 52.7244 41.5696L46.5715 35.4166L49.259 32.7292L55.4119 38.8821Z`,fill:`#D5E5FF`})]}),t[1]=r):r=t[1];let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`defs`,{children:(0,Z.jsxs)(`filter`,{id:`filter0_d_ok`,x:`-9.53674e-07`,y:`-0.0799994`,width:`77.3817`,height:`85.8743`,filterUnits:`userSpaceOnUse`,colorInterpolationFilters:`sRGB`,children:[(0,Z.jsx)(`feFlood`,{floodOpacity:`0`,result:`BackgroundImageFix`}),(0,Z.jsx)(`feColorMatrix`,{in:`SourceAlpha`,type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0`,result:`hardAlpha`}),(0,Z.jsx)(`feOffset`,{dy:`2.85714`}),(0,Z.jsx)(`feGaussianBlur`,{stdDeviation:`2.14286`}),(0,Z.jsx)(`feComposite`,{in2:`hardAlpha`,operator:`out`}),(0,Z.jsx)(`feColorMatrix`,{type:`matrix`,values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in2:`BackgroundImageFix`,result:`effect1_dropShadow_ok`}),(0,Z.jsx)(`feBlend`,{mode:`normal`,in:`SourceGraphic`,in2:`effect1_dropShadow_ok`,result:`shape`})]})}),t[2]=i):i=t[2];let a;return t[3]===e?a=t[4]:(a=(0,Z.jsxs)(`svg`,{role:`img`,"aria-label":`Open Knowledge icon`,fill:`none`,height:24,width:24,viewBox:`0 0 78 80`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[n,r,i]}),t[3]=e,t[4]=a),a}var Ef=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-stteh15-.js`),__vite__mapDeps([17,1,6,7,8,9,10,11,18]),import.meta.url));function Df(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Qs.subscribe,kf,Of))return null;let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(Ef,{})}),e[0]=t):t=e[0],t}function Of(){return!1}function kf(){return Qs.getSnapshot()!==null}var Af=new Set([`main`,`master`]);function jf(e){let t=(0,$.c)(19),{owner:n,repo:r,path:i,branch:a,kind:o,testId:c,branchTestId:l}=e,u=o===void 0?`doc`:o,d;t[0]===a?d=t[1]:(d=a!==``&&!Af.has(a),t[0]=a,t[1]=d);let f=d,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(s,{id:`IreQBq`}),t[2]=p):p=t[2];let m;t[3]!==n||t[4]!==r?(m=(0,Z.jsx)(Mf,{label:p,children:(0,Z.jsxs)(`span`,{children:[n,`/`,r]})}),t[3]=n,t[4]=r,t[5]=m):m=t[5];let h;t[6]!==u||t[7]!==i||t[8]!==c?(h=i?(0,Z.jsx)(Mf,{label:u===`folder`?(0,Z.jsx)(s,{id:`kNqMMd`}):(0,Z.jsx)(s,{id:`J2eKUI`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,"data-testid":`${c}-target`,children:i})}):null,t[6]=u,t[7]=i,t[8]=c,t[9]=h):h=t[9];let g;t[10]!==a||t[11]!==l||t[12]!==f?(g=f?(0,Z.jsx)(Mf,{label:(0,Z.jsx)(s,{id:`ssuwjF`}),children:(0,Z.jsx)(`span`,{className:`font-mono`,"data-testid":l,children:a})}):null,t[10]=a,t[11]=l,t[12]=f,t[13]=g):g=t[13];let _;return t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==c?(_=(0,Z.jsxs)(`dl`,{className:`space-y-2 text-1sm text-muted-foreground`,"data-testid":c,children:[m,h,g]}),t[14]=m,t[15]=h,t[16]=g,t[17]=c,t[18]=_):_=t[18],_}function Mf(e){let t=(0,$.c)(7),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`dt`,{className:`w-20 shrink-0 font-mono uppercase tracking-wide text-xs`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`dd`,{className:`min-w-0 flex-1 break-all text-foreground`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}var Nf=e=>({phase:`ready`,seed:e});function Pf(e){return e.phase===`ready`?{phase:`initializing`,seed:e.seed}:e}function Ff(e,t){return e.phase===`initializing`?t.ok?{phase:`opening`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:t.reason,message:t.message}:e}function If(e,t){return e.phase===`opening`?t.ok?{phase:`done`,seed:e.seed}:{phase:`error`,seed:e.seed,reason:`network-error`,message:t.message}:e}function Lf(e){return e.phase===`done`||e.phase===`cancelled`||e.phase===`error`?e:{phase:`cancelled`,seed:e.seed}}function Rf(){let e=null,t=new Set,n=!1,r=null;function i(){for(let e of t)e()}function a(){e!==null&&(e=null,i())}return{install({bridge:t}){if(t)return n?r??void 0:(n=!0,r=t.onShareReceived(t=>{e=t,i()}),()=>{r?.(),r=null,n=!1,a()})},getSnapshot(){return e},subscribe(e){return t.add(e),()=>{t.delete(e)}},dismiss(){a()}}}var zf=Rf();function Bf(e){return zf.install(e)}function Vf(e){return e!==null&&e.kind===`launcher-consent`}function Hf(e){return e!==null&&e.kind===`launcher-miss`}function Uf(e){let t=(0,$.c)(14),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?zf:i,o=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,Gf),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(o);o!==l&&(u(o),c(Wf));let d,f;t[0]!==o||t[1]!==a?(d=()=>{if(!o)return;let e=Su(o);e&&(hs.error(e.message),a.dismiss())},f=[o,a],t[0]=o,t[1]=a,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,Q.useEffect)(d,f);let p;t[4]===o?p=t[5]:(p=Hf(o)?o:null,t[4]=o,t[5]=p);let m=p,h;t[6]===o?h=t[7]:(h=Vf(o)?o:null,t[6]=o,t[7]=h);let g=h??m;if(!g)return null;let _;return t[8]!==g||t[9]!==n||t[10]!==r||t[11]!==s||t[12]!==a?(_=(0,Z.jsx)(Kf,{payload:g,bridge:n,cloneController:r,store:a},s),t[8]=g,t[9]=n,t[10]=r,t[11]=s,t[12]=a,t[13]=_):_=t[13],_}function Wf(e){return e+1}function Gf(){return null}function Kf(e){let t=(0,$.c)(169),{payload:n,bridge:r,cloneController:a,store:o}=e,{_:c}=i(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C=(0,Q.useRef)(!1),w=(0,Q.useRef)(null),T,E;t[0]===y?(T=t[1],E=t[2]):(T=()=>{y&&w.current?.focus()},E=[y],t[0]=y,t[1]=T,t[2]=E),(0,Q.useEffect)(T,E);let D;t[3]!==x||t[4]!==n?(D=()=>{Vf(n)&&x===null&&(console.warn(`[receive] q1_hit=true selection=branch_match_non_ok candidate=${n.candidatePath}`),S(Nf({candidatePath:n.candidatePath,branch:n.share.branch,targetPath:p(n.share.target),targetKind:n.share.target.kind,parentProjectName:n.parentProjectName})))},t[3]=x,t[4]=n,t[5]=D):D=t[5];let O;t[6]===n?O=t[7]:(O=[n],t[6]=n,t[7]=O),(0,Q.useEffect)(D,O);let k;t[8]!==d||t[9]!==a||t[10]!==n?(k=()=>{a&&Hf(n)&&d===null&&(C.current||(C.current=!0,g(!0),a.getAuthStatus().then(e=>{f(e)}).catch(e=>{console.warn(`[receive] auth pre-flight probe failed`,e instanceof Error?e.message:e),f({authenticated:!1,host:`github.com`})}).finally(()=>{g(!1)})))},t[8]=d,t[9]=a,t[10]=n,t[11]=k):k=t[11];let A;t[12]!==d||t[13]!==n?(A=[n,d],t[12]=d,t[13]=n,t[14]=A):A=t[14],(0,Q.useEffect)(k,A);let j=Hf(n)?n:null,M=Vf(n)?n:null,N=j?.share??M?.share??null,P,F,I,L,R,z,B,V,H,U;if(t[15]!==c||t[16]!==m||t[17]!==r||t[18]!==a||t[19]!==_||t[20]!==x||t[21]!==j||t[22]!==l||t[23]!==N||t[24]!==o){H=Symbol.for(`react.early_return_sentinel`);bb0:{let e=N?{owner:N.owner,repo:N.repo}:null,n;t[35]!==c||t[36]!==N?.target.kind?(n=N?.target.kind===`folder`?c({id:`ugoTXs`}):c({id:`XH30C4`}),t[35]=c,t[36]=N?.target.kind,t[37]=n):n=t[37],U=n,I=async function(){if(!j||!e)return;if(console.log(wu({q2_path:`clone`})),!a){hs.info(c({id:`27XW26`}),{action:{label:c({id:`B3NAZC`}),onClick:()=>{r.navigator.open()}},duration:8e3});return}if(_)return;b(null),v(!0);let t=bu(e),n;try{n=await a.runClone({url:t,branch:j.share.branch})}catch(e){let t=e;console.warn(`[receive] runClone threw unexpectedly`,t),v(!1),b({detail:t instanceof Error?t.message:String(t)});return}if(v(!1),n.kind===`error`){b({detail:n.detail??null});return}if(n.kind===`ok`){try{await r.project.open({path:n.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:j.share.target.kind,path:p(j.share.target)}}),o.dismiss()}catch(e){let t=e;console.warn(`[receive] project open after clone failed`,t instanceof Error?t.message:t),hs.error(c({id:`438Fca`}))}return}};let i;t[38]!==c||t[39]!==m||t[40]!==a?(i=async function(){if(!(!a||m)){g(!0);try{let e=await a.startSignIn();g(!1),e!==null&&f(e)}catch(e){let t=e;g(!1),console.warn(`[receive] startSignIn failed`,t instanceof Error?t.message:t),hs.error(c({id:`lzwo7p`}))}}},t[38]=c,t[39]=m,t[40]=a,t[41]=i):i=t[41],R=i,L=async function(){if(!(!j||!e||l)){b(null),u(!0),console.log(wu({q2_path:`local`}));try{for(;;){let t=await r.dialog.openFolder();if(!t)break;let n=await r.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(wu({folder_validate:n.kind})),n.kind===`ok`){let e=j.share.branch,n={currentBranch:null,headSha:null,detached:!1};try{n=await r.project.readHeadBranch(t)}catch(e){let t=e;console.warn(`[receive] local-folder readHeadBranch failed`,t instanceof Error?t.message:t)}let i=ri(e,n)!==`true`;try{await r.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,...i?{pendingShareBranchSwitch:{share:j.share,projectPath:t,currentBranch:n.currentBranch}}:{pendingDeepLinkTarget:{kind:j.share.target.kind,path:p(j.share.target)}}}),o.dismiss()}catch(e){let t=e;console.warn(`[receive] local-folder-open failed`,t instanceof Error?t.message:t),hs.error(c({id:`phM8Kh`}))}break}let i=xu(n,e);i&&hs.error(i)}}catch(e){let t=e;console.warn(`[receive] local-folder-validate failed`,t instanceof Error?t.message:t),hs.error(c({id:`rlUzXK`}))}u(!1)}};let d;t[42]!==c||t[43]!==r||t[44]!==x||t[45]!==o?(d=function(){if(x===null||x.phase!==`ready`)return;let e=x.seed;console.warn(`[receive] consent_dialog action=initialize worktree=${e.candidatePath}`),S(Zf),r.project.okInit({projectPath:e.candidatePath}).then(async t=>{if(t.ok===!0){S(e=>e===null?e:Ff(e,{ok:!0,projectPath:t.projectPath}));try{await r.project.open({path:t.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:e.targetKind,path:e.targetPath},pendingBranch:e.branch}),S(Xf),o.dismiss()}catch(t){let n=t,r=n instanceof Error?n.message:String(n);S(e=>e===null?e:If(e,{ok:!1,message:r})),hs.error(c({id:`nDT8qt`,values:{0:e.candidatePath}}))}return}let n=t.reason,i=t.message||`Initialization failed.`;S(e=>e===null?e:Ff(e,{ok:!1,reason:n,message:i})),hs.error(i)}).catch(t=>{let n=t instanceof Error?t.message:String(t);S(e=>e===null?e:Ff(e,{ok:!1,reason:`network-error`,message:n})),hs.error(c({id:`3Mwaly`,values:{0:e.candidatePath}}))})},t[42]=c,t[43]=r,t[44]=x,t[45]=o,t[46]=d):d=t[46];let y=d,C;t[47]!==x||t[48]!==o?(C=function(){x!==null&&console.warn(`[receive] consent_dialog action=cancel worktree=${x.seed.candidatePath}`),S(Yf),o.dismiss()},t[47]=x,t[48]=o,t[49]=C):C=t[49];let w=C;if(x!==null&&x.phase!==`cancelled`&&x.phase!==`done`&&N!==null){let e=x.seed,n=x.phase===`initializing`||x.phase===`opening`,r;t[50]===w?r=t[51]:(r=e=>{e||w()},t[50]=w,t[51]=r);let i;t[52]===U?i=t[53]:(i=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:U}})}),t[52]=U,t[53]=i);let a;t[54]===N.target?a=t[55]:(a=p(N.target)?`— ${p(N.target)}`:``,t[54]=N.target,t[55]=a);let o;t[56]!==N.owner||t[57]!==N.repo||t[58]!==a?(o=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`pgq_xf`,values:{0:N.owner,1:N.repo,2:a}})}),t[56]=N.owner,t[57]=N.repo,t[58]=a,t[59]=o):o=t[59];let c=N.owner,l=N.repo,u;t[60]===N.target?u=t[61]:(u=p(N.target),t[60]=N.target,t[61]=u);let d;t[62]!==N.branch||t[63]!==N.owner||t[64]!==N.repo||t[65]!==N.target.kind||t[66]!==u?(d=(0,Z.jsx)(jf,{owner:c,repo:l,path:u,kind:N.target.kind,branch:N.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[62]=N.branch,t[63]=N.owner,t[64]=N.repo,t[65]=N.target.kind,t[66]=u,t[67]=d):d=t[67];let f;t[68]!==i||t[69]!==o||t[70]!==d?(f=(0,Z.jsxs)(Do,{children:[i,o,d]}),t[68]=i,t[69]=o,t[70]=d,t[71]=f):f=t[71];let m;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`KsAPaB`})}),t[72]=m):m=t[72];let g;t[73]===e.candidatePath?g=t[74]:(g=(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-receive-consent-path`,children:e.candidatePath}),t[73]=e.candidatePath,t[74]=g);let _;t[75]===e.parentProjectName?_=t[76]:(_=e.parentProjectName===null?null:(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,"data-testid":`share-receive-consent-parent`,children:(0,Z.jsx)(s,{id:`JmfgFc`,values:{0:e.parentProjectName}})}),t[75]=e.parentProjectName,t[76]=_);let v;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-Q7TT9`})}),t[77]=v):v=t[77];let b;t[78]!==x.message||t[79]!==x.phase?(b=x.phase===`error`?(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,"data-testid":`share-receive-consent-error`,role:`alert`,children:x.message}):null,t[78]=x.message,t[79]=x.phase,t[80]=b):b=t[80];let S;t[81]!==g||t[82]!==_||t[83]!==b?(S=(0,Z.jsxs)(To,{children:[m,g,_,v,b]}),t[81]=g,t[82]=_,t[83]=b,t[84]=S):S=t[84];let C;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(s,{id:`dEgA5A`}),t[85]=C):C=t[85];let T;t[86]===w?T=t[87]:(T=(0,Z.jsx)(ci,{variant:`ghost`,onClick:w,"data-testid":`share-receive-consent-cancel`,children:C}),t[86]=w,t[87]=T);let E=n||x.phase===`error`,D=n||x.phase===`error`,O;t[88]===n?O=t[89]:(O=n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`mr-2 h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`NKkZXl`})]}):(0,Z.jsx)(s,{id:`NKkZXl`}),t[88]=n,t[89]=O);let k;t[90]!==y||t[91]!==E||t[92]!==D||t[93]!==O?(k=(0,Z.jsx)(ci,{onClick:y,disabled:E,"aria-disabled":D,"data-testid":`share-receive-consent-initialize`,children:O}),t[90]=y,t[91]=E,t[92]=D,t[93]=O,t[94]=k):k=t[94];let A;t[95]!==T||t[96]!==k?(A=(0,Z.jsxs)(Eo,{children:[T,k]}),t[95]=T,t[96]=k,t[97]=A):A=t[97];let j;t[98]!==f||t[99]!==S||t[100]!==A?(j=(0,Z.jsxs)(wo,{className:`sm:max-w-xl`,"data-testid":`share-receive-consent-dialog`,onInteractOutside:Jf,onPointerDownOutside:qf,children:[f,S,A]}),t[98]=f,t[99]=S,t[100]=A,t[101]=j):j=t[101];let M;t[102]!==r||t[103]!==j?(M=(0,Z.jsx)(Oo,{open:!0,onOpenChange:r,children:j}),t[102]=r,t[103]=j,t[104]=M):M=t[104],H=M;break bb0}if(!j||!N||!e){H=null;break bb0}P=a!==void 0&&!_;let T;t[105]!==c||t[106]!==_?(T=c(_?{id:`YjhKI5`}:{id:`LE7t79`}),t[105]=c,t[106]=_,t[107]=T):T=t[107],F=T,z=N.owner,B=N.repo,V=Gn(e)}t[15]=c,t[16]=m,t[17]=r,t[18]=a,t[19]=_,t[20]=x,t[21]=j,t[22]=l,t[23]=N,t[24]=o,t[25]=P,t[26]=F,t[27]=I,t[28]=L,t[29]=R,t[30]=z,t[31]=B,t[32]=V,t[33]=H,t[34]=U}else P=t[25],F=t[26],I=t[27],L=t[28],R=t[29],z=t[30],B=t[31],V=t[32],H=t[33],U=t[34];if(H!==Symbol.for(`react.early_return_sentinel`))return H;let W=V,G=d?.authenticated?d.login:void 0,K;t[108]===y?K=t[109]:(K=y?.detail?Cu(y.detail):``,t[108]=y,t[109]=K);let q=K,J;t[110]===o?J=t[111]:(J=e=>{e||o.dismiss()},t[110]=o,t[111]=J);let ee;t[112]===U?ee=t[113]:(ee=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:U}})}),t[112]=U,t[113]=ee);let Y;t[114]===N.target?Y=t[115]:(Y=p(N.target)?` — ${p(N.target)}`:null,t[114]=N.target,t[115]=Y);let te;t[116]!==N.owner||t[117]!==N.repo||t[118]!==Y?(te=(0,Z.jsxs)(So,{className:`sr-only`,children:[N.owner,`/`,N.repo,Y]}),t[116]=N.owner,t[117]=N.repo,t[118]=Y,t[119]=te):te=t[119];let ne=N.owner,X=N.repo,re;t[120]===N.target?re=t[121]:(re=p(N.target),t[120]=N.target,t[121]=re);let ie;t[122]!==N.branch||t[123]!==N.owner||t[124]!==N.repo||t[125]!==N.target.kind||t[126]!==re?(ie=(0,Z.jsx)(jf,{owner:ne,repo:X,path:re,kind:N.target.kind,branch:N.branch,testId:`share-receive-metadata`,branchTestId:`share-receive-metadata-branch`}),t[122]=N.branch,t[123]=N.owner,t[124]=N.repo,t[125]=N.target.kind,t[126]=re,t[127]=ie):ie=t[127];let ae;t[128]!==ee||t[129]!==te||t[130]!==ie?(ae=(0,Z.jsxs)(Do,{children:[ee,te,ie]}),t[128]=ee,t[129]=te,t[130]=ie,t[131]=ae):ae=t[131];let oe;t[132]!==a||t[133]!==P||t[134]!==y||t[135]!==q||t[136]!==F||t[137]!==_||t[138]!==I||t[139]!==L||t[140]!==l||t[141]!==z||t[142]!==B?(oe=y?(0,Z.jsxs)(`div`,{ref:w,tabIndex:-1,className:`rounded-lg border border-destructive/40 bg-destructive/5 p-4 outline-none`,"data-testid":`share-receive-clone-error`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-semibold text-foreground`,role:`alert`,children:(0,Z.jsx)(s,{id:`aiArms`})}),q?(0,Z.jsxs)(`p`,{className:`mt-2 break-words text-xs text-destructive`,"data-testid":`share-receive-clone-error-message`,children:[(0,Z.jsx)(s,{id:`4BITzH`}),` `,(0,Z.jsxs)(`span`,{className:`font-mono text-foreground/80`,children:[`"`,q,`"`]})]}):null,(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Llyqvo`})}),(0,Z.jsxs)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5 text-sm text-muted-foreground`,"data-testid":`share-receive-clone-error-reasons`,children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(s,{id:`6LbUG7`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(s,{id:`_pY_Vq`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(s,{id:`J6mxC1`})})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,Z.jsx)(ci,{onClick:()=>{I()},"data-testid":`share-receive-clone-retry`,children:(0,Z.jsx)(s,{id:`KDw4GX`})}),(0,Z.jsx)(ci,{variant:`outline`,onClick:()=>{L()},disabled:l||_,"data-testid":`share-receive-error-local`,children:(0,Z.jsx)(s,{id:`xFQRu4`})})]})]}):(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-clone`,className:`flex flex-col items-start gap-2 rounded-lg border-2 border-primary/40 bg-card p-4 text-left transition hover:border-primary hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-primary/40 disabled:hover:bg-card`,onClick:()=>{I()},disabled:a!==void 0&&!P,"aria-disabled":a!==void 0&&!P,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:F}),(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`jGJy-9`,values:{shareOwner:z,shareRepo:B}})})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-testid":`share-receive-local`,className:`flex flex-col items-start gap-2 rounded-lg border border-border bg-card p-4 text-left transition hover:border-foreground/50 hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>{L()},disabled:l||_,children:[(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,Z.jsx)(s,{id:`HfI1dR`})}),(0,Z.jsx)(`span`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_qD6mn`})})]})]}),t[132]=a,t[133]=P,t[134]=y,t[135]=q,t[136]=F,t[137]=_,t[138]=I,t[139]=L,t[140]=l,t[141]=z,t[142]=B,t[143]=oe):oe=t[143];let se;t[144]!==m||t[145]!==d||t[146]!==a||t[147]!==R||t[148]!==G?(se=a?(0,Z.jsx)(`div`,{className:`mt-3 flex items-center justify-between rounded-md border border-border bg-muted/30 px-3 py-2 text-xs`,"data-testid":`share-receive-auth-banner`,role:`status`,"aria-live":`polite`,children:d===null?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`UDFrWm`})}):d.authenticated?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`VAHWL_`,values:{signedInLogin:G},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground/90`})}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`SgKLfA`})}),(0,Z.jsx)(`button`,{type:`button`,"data-testid":`share-receive-signin`,className:`font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded`,onClick:()=>{R()},disabled:m,children:m?(0,Z.jsx)(s,{id:`PKLY-1`}):(0,Z.jsx)(s,{id:`3jod3l`})})]})}):null,t[144]=m,t[145]=d,t[146]=a,t[147]=R,t[148]=G,t[149]=se):se=t[149];let ce;t[150]!==y||t[151]!==W?(ce=y?null:(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`RJ3a8Z`,values:{lookingForUrl:W},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),t[150]=y,t[151]=W,t[152]=ce):ce=t[152];let le;t[153]!==oe||t[154]!==se||t[155]!==ce?(le=(0,Z.jsxs)(To,{children:[oe,se,ce]}),t[153]=oe,t[154]=se,t[155]=ce,t[156]=le):le=t[156];let ue;t[157]===o?ue=t[158]:(ue=()=>o.dismiss(),t[157]=o,t[158]=ue);let de;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(s,{id:`dEgA5A`}),t[159]=de):de=t[159];let fe;t[160]===ue?fe=t[161]:(fe=(0,Z.jsx)(Eo,{children:(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:ue,children:de})}),t[160]=ue,t[161]=fe);let pe;t[162]!==ae||t[163]!==le||t[164]!==fe?(pe=(0,Z.jsxs)(wo,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[ae,le,fe]}),t[162]=ae,t[163]=le,t[164]=fe,t[165]=pe):pe=t[165];let me;return t[166]!==J||t[167]!==pe?(me=(0,Z.jsx)(Oo,{open:!0,onOpenChange:J,children:pe}),t[166]=J,t[167]=pe,t[168]=me):me=t[168],me}function qf(e){return e.preventDefault()}function Jf(e){return e.preventDefault()}function Yf(e){return e===null?e:Lf(e)}function Xf(e){return e===null?e:If(e,{ok:!0})}function Zf(e){return e===null?e:Pf(e)}var Qf=(e,t,n)=>vu(e,t,n,`NavigatorApp`);function $f(e,t){return e.filter(e=>e.path!==t)}function ep(e){let t=(0,$.c)(116),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=new Map,t[1]=c):c=t[1];let[l,u]=(0,Q.useState)(c),[d,f]=(0,Q.useState)(!0),[p,m]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),E=typeof window<`u`&&window.okDesktop!=null,[D,O]=(0,Q.useState)(`auth`),{theme:k}=Nr(),{_:A}=i();it(n,k??`system`);let j;t[2]!==A||t[3]!==n.project?(j=()=>{let e=!1;return n.project.listRecent().then(async t=>{if(e)return;o(t);let r=t.filter(tp),i=await Promise.all(r.map(async e=>{try{let{currentBranch:t}=await n.project.readHeadBranch(e.path);return[e.path,t]}catch{return[e.path,null]}}));e||u(e=>{let t=new Map(e);for(let[e,n]of i)t.set(e,n);return t})}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||m(t instanceof Error?t.message:A({id:`fYKgzG`}))}).finally(()=>{e||f(!1)}),()=>{e=!0}},t[2]=A,t[3]=n.project,t[4]=j):j=t[4];let M;t[5]!==A||t[6]!==n?(M=[n,A],t[5]=A,t[6]=n,t[7]=M):M=t[7],(0,Q.useEffect)(j,M);let N,P;t[8]===n?(N=t[9],P=t[10]):(N=()=>n.onMenuAction(e=>{e===`new-project`&&y(!0),e===`close-active-tab-or-window`&&window.close()}),P=[n],t[8]=n,t[9]=N,t[10]=P),(0,Q.useEffect)(N,P);let F;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(F=(e,t)=>Qf(e,t,m),t[11]=F):F=t[11];let I=F,L;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>_(!0),t[12]=L):L=t[12];let R=L,z;t[13]!==A||t[14]!==n?(z=()=>I(async()=>{let e=await n.dialog.openFolder();e&&await ip(n,e,`pick-existing`)},A({id:`gmJ0An`})),t[13]=A,t[14]=n,t[15]=z):z=t[15];let B=z,H;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>y(!0),t[16]=H):H=t[16];let U=H,W;t[17]!==A||t[18]!==n?(W=e=>I(async()=>{await ip(n,e,`recents`)},A({id:`SUOoXn`})),t[17]=A,t[18]=n,t[19]=W):W=t[19];let G=W,K;t[20]!==A||t[21]!==n.project?(K=e=>I(async()=>{await n.project.removeRecent(e),o(t=>$f(t,e)),u(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},A({id:`viwC-K`})),t[20]=A,t[21]=n.project,t[22]=K):K=t[22];let q=K,J;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${E?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":E?``:void 0,"data-testid":`nav-chrome-row`}),t[23]=J):J=t[23];let ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(Tf,{className:`size-12 shrink-0`}),t[24]=ee):ee=t[24];let Y;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`font-medium text-xl tracking-tight`,children:`Open Knowledge`}),(0,Z.jsx)(qd,{})]}),t[25]=Y):Y=t[25];let te;t[26]===n.appVersion?te=t[27]:(te=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[ee,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[Y,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[26]=n.appVersion,t[27]=te);let ne;t[28]===A?ne=t[29]:(ne=A({id:`wbv9xO`}),t[28]=A,t[29]=ne);let X;t[30]===A?X=t[31]:(X=A({id:`fRv-ei`}),t[30]=A,t[31]=X);let ie;t[32]!==ne||t[33]!==X?(ie=(0,Z.jsx)(np,{title:ne,description:X,onClick:U,dataTestId:`nav-create-new`,Icon:V}),t[32]=ne,t[33]=X,t[34]=ie):ie=t[34];let ae;t[35]===A?ae=t[36]:(ae=A({id:`WPwDin`}),t[35]=A,t[36]=ae);let oe;t[37]===A?oe=t[38]:(oe=A({id:`tUvUfp`}),t[37]=A,t[38]=oe);let se;t[39]!==B||t[40]!==ae||t[41]!==oe?(se=(0,Z.jsx)(np,{title:ae,description:oe,onClick:B,dataTestId:`nav-open`,Icon:re}),t[39]=B,t[40]=ae,t[41]=oe,t[42]=se):se=t[42];let ce;t[43]===A?ce=t[44]:(ce=A({id:`VdXv4D`}),t[43]=A,t[44]=ce);let le;t[45]===A?le=t[46]:(le=A({id:`JOcPqH`}),t[45]=A,t[46]=le);let ue;t[47]!==ce||t[48]!==le?(ue=(0,Z.jsx)(np,{title:ce,description:le,onClick:R,dataTestId:`nav-clone`,Icon:wf}),t[47]=ce,t[48]=le,t[49]=ue):ue=t[49];let de;t[50]!==ie||t[51]!==se||t[52]!==ue?(de=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[ie,se,ue]}),t[50]=ie,t[51]=se,t[52]=ue,t[53]=de):de=t[53];let fe;t[54]===p?fe=t[55]:(fe=p===null?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 rounded-md border border-red-500/30 bg-red-500/10 px-3 py-2`,"data-testid":`nav-error-banner`,role:`alert`,children:[(0,Z.jsx)(`span`,{className:`text-red-700 text-xs dark:text-red-300`,children:p}),(0,Z.jsx)(ci,{type:`button`,variant:`link`,size:`sm`,onClick:()=>m(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:(0,Z.jsx)(s,{id:`1QfxQT`})})]}),t[54]=p,t[55]=fe);let pe;t[56]!==d||t[57]!==G||t[58]!==q||t[59]!==l||t[60]!==a?(pe=d?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(h,{className:`size-4 animate-spin text-muted-foreground/60`})}):a.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-col`,children:[(0,Z.jsx)(`h2`,{className:`mb-2 shrink-0 font-medium text-muted-foreground font-mono text-xs uppercase tracking-wide`,children:(0,Z.jsx)(s,{id:`CCTop_`})}),(0,Z.jsx)(`ul`,{className:`min-h-0 max-h-48 subtle-scrollbar scroll-fade-mask overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:a.map(e=>(0,Z.jsx)(rp,{project:e,branch:l.get(e.path)??null,onOpen:()=>G(e.path),onRemove:()=>q(e.path)},e.path))})]}):null,t[56]=d,t[57]=G,t[58]=q,t[59]=l,t[60]=a,t[61]=pe):pe=t[61];let me;t[62]!==te||t[63]!==de||t[64]!==fe||t[65]!==pe?(me=(0,Z.jsx)(`div`,{className:`mx-auto flex h-full w-full max-w-5xl flex-col overflow-hidden px-12 py-12`,children:(0,Z.jsxs)(`div`,{className:`my-auto flex min-h-0 flex-col space-y-10`,children:[te,de,fe,pe]})}),t[62]=te,t[63]=de,t[64]=fe,t[65]=pe,t[66]=me):me=t[66];let he,ge;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,Z.jsx)(Df,{}),ge=(0,Z.jsx)(af,{}),t[67]=he,t[68]=ge):(he=t[67],ge=t[68]);let _e;t[69]!==n||t[70]!==v?(_e=(0,Z.jsx)(hf,{open:v,onOpenChange:y,bridge:n}),t[69]=n,t[70]=v,t[71]=_e):_e=t[71];let ve;t[72]===w?ve=t[73]:(ve=e=>{x(e),e||(C(!1),w&&(w(null),T(null)))},t[72]=w,t[73]=ve);let ye;t[74]===n?ye=t[75]:(ye=Ti(n),t[74]=n,t[75]=ye);let be;t[76]===n?be=t[77]:(be=Wa(n),t[76]=n,t[77]=be);let xe=D===`identity`,Se;t[78]!==S||t[79]!==w?(Se=e=>{x(!1),S&&(C(!1),_(!0)),w&&(w({authenticated:!0,host:`github.com`,login:e.login}),T(null))},t[78]=S,t[79]=w,t[80]=Se):Se=t[80];let Ce;t[81]!==b||t[82]!==ve||t[83]!==ye||t[84]!==be||t[85]!==xe||t[86]!==Se?(Ce=(0,Z.jsx)(ra,{open:b,onOpenChange:ve,transport:ye,queryTransport:be,identityPrompt:xe,onSuccess:Se}),t[81]=b,t[82]=ve,t[83]=ye,t[84]=be,t[85]=xe,t[86]=Se,t[87]=Ce):Ce=t[87];let we;t[88]===n?we=t[89]:(we=Ou(n),t[88]=n,t[89]=we);let Te;t[90]===n?Te=t[91]:(Te=Wa(n),t[90]=n,t[91]=Te);let Ee;t[92]===n.dialog?Ee=t[93]:(Ee=()=>n.dialog.openFolder(),t[92]=n.dialog,t[93]=Ee);let De;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>{_(!1),O(`auth`),C(!0),x(!0)},t[94]=De):De=t[94];let Oe;t[95]!==A||t[96]!==n?(Oe=e=>{let{dir:t}=e;I(()=>ip(n,t,`pick-existing`),A({id:`iSnkwB`}))},t[95]=A,t[96]=n,t[97]=Oe):Oe=t[97];let ke;t[98]!==g||t[99]!==we||t[100]!==Te||t[101]!==Ee||t[102]!==Oe?(ke=(0,Z.jsx)(Xd,{open:g,onOpenChange:_,transport:we,authQueryTransport:Te,pickParentFolder:Ee,onSignIn:De,onCloneComplete:Oe}),t[98]=g,t[99]=we,t[100]=Te,t[101]=Ee,t[102]=Oe,t[103]=ke):ke=t[103];let Ae;if(t[104]!==n){let e;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{T(()=>e),x(!0)}),t[106]=e):e=t[106],Ae=Eu({bridge:n,authQueryTransport:Wa(n),cloneTransport:Ou(n),openSignIn:e}),t[104]=n,t[105]=Ae}else Ae=t[105];let je;t[107]!==n||t[108]!==Ae?(je=(0,Z.jsx)(Uf,{bridge:n,cloneController:Ae}),t[107]=n,t[108]=Ae,t[109]=je):je=t[109];let Me;return t[110]!==me||t[111]!==_e||t[112]!==Ce||t[113]!==ke||t[114]!==je?(Me=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[J,me,he,ge,_e,Ce,ke,je]}),t[110]=me,t[111]=_e,t[112]=Ce,t[113]=ke,t[114]=je,t[115]=Me):Me=t[115],Me}function tp(e){return!e.missing}function np(e){let t=(0,$.c)(14),{title:n,description:r,onClick:i,dataTestId:a,Icon:o}=e,s;t[0]===o?s=t[1]:(s=o?(0,Z.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground`}):null,t[0]=o,t[1]=s);let c;t[2]===n?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-gray-700 dark:text-foreground text-sm`,children:n}),t[2]=n,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs leading-snug`,children:r}),t[7]=r,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,onClick:i,"data-testid":a,className:`h-auto flex-col items-start justify-start gap-1.5 whitespace-normal bg-card px-4 py-3.5 text-left`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function rp(e){let t=(0,$.c)(33),{project:n,branch:r,onOpen:a,onRemove:o}=e,{_:c}=i(),{name:l}=n,u=n.missing,d=n.missing&&`opacity-50`,f;t[0]===d?f=t[1]:(f=oi(`h-auto min-w-0 flex-1 justify-between gap-2 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,d),t[0]=d,t[1]=f);let p;t[2]===n.name?p=t[3]:(p=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[2]=n.name,t[3]=p);let m;t[4]===n.path?m=t[5]:(m=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[4]=n.path,t[5]=m);let h;t[6]!==p||t[7]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]!==r||t[10]!==n.missing||t[11]!==n.path?(g=n.missing?(0,Z.jsx)(st,{className:`text-2xs rounded-sm`,variant:`warning`,children:(0,Z.jsx)(s,{id:`VU3Nrn`})}):r===null?null:(0,Z.jsxs)(`span`,{className:`flex max-w-[40%] items-center gap-1 text-muted-foreground text-xs`,"data-testid":`nav-recent-branch-${n.path}`,children:[(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:r})]}),t[9]=r,t[10]=n.missing,t[11]=n.path,t[12]=g):g=t[12];let _;t[13]!==a||t[14]!==n.missing||t[15]!==f||t[16]!==h||t[17]!==g?(_=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,onClick:a,disabled:u,className:f,children:[h,g]}),t[13]=a,t[14]=n.missing,t[15]=f,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==c||t[20]!==l?(v=c({id:`hDoLrm`,values:{projectName:l}}),t[19]=c,t[20]=l,t[21]=v):v=t[21];let y;t[22]===c?y=t[23]:(y=c({id:`Es-eZU`}),t[22]=c,t[23]=y);let b=`nav-recent-remove-${n.path}`,x;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[24]=x):x=t[24];let S;t[25]!==o||t[26]!==y||t[27]!==b||t[28]!==v?(S=(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:o,"aria-label":v,title:y,className:`pointer-events-none mr-2 opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,"data-testid":b,children:x}),t[25]=o,t[26]=y,t[27]=b,t[28]=v,t[29]=S):S=t[29];let C;return t[30]!==S||t[31]!==_?(C=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[_,S]}),t[30]=S,t[31]=_,t[32]=C):C=t[32],C}async function ip(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var ap=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=Nr(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(Ho,{className:`size-4`}),info:(0,Z.jsx)(Ao,{className:`size-4`}),warning:(0,Z.jsx)(Lo,{className:`size-4`}),error:(0,Z.jsx)(Rl,{className:`size-4`}),loading:(0,Z.jsx)(h,{className:`size-4 animate-spin`})},o={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={classNames:{toast:`cn-toast`}},t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsx)(_s,{theme:i,className:`toaster group`,icons:a,style:o,toastOptions:s,...n}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c},op=Symbol.for(`ok.client.fetchWrapper`);function sp(e={}){if(typeof window>`u`)return;let t=e.apiOrigin&&e.apiOrigin.length>0?e.apiOrigin:void 0;if(window.fetch[op])return;let n=window.fetch.bind(window),r=Ht(),i=((e,i)=>{let a=lp(e,t);if(!a.isApi)return n(e,i);if(e instanceof Request){let t=cp(e.headers,r);return n(new Request(a.url,e),{headers:t})}let o=cp(i?.headers,r);return n(a.url,{...i,headers:o})});i[op]=!0,window.fetch=i}function cp(e,t){let n=new Headers(e);for(let[e,r]of Object.entries(t))n.set(e,r);return n}function lp(e,t){if(typeof e==`string`){if(e.startsWith(`/api/`))return{isApi:!0,url:t?t+e:e};let n=up(e);return n&&dp(n,t)?{isApi:!0,url:e}:{isApi:!1,url:e}}let n=e instanceof URL?e:up(e.url,window.location.origin);if(n&&dp(n,t)){let r=e instanceof URL?e.href:e.url;return t&&(n.origin===window.location.origin||n.protocol===`file:`)?{isApi:!0,url:t+n.pathname+n.search+n.hash}:{isApi:!0,url:r}}return{isApi:!1,url:e instanceof URL?e.href:e.url}}function up(e,t){try{return new URL(e,t)}catch{return null}}function dp(e,t){if(!e.pathname.startsWith(`/api/`))return!1;if(e.origin===window.location.origin||e.protocol===`file:`)return!0;if(t){let n=up(t);if(n&&e.origin===n.origin)return!0}return!1}var fp={messages:JSON.parse(`{"-3Qbv7":[["count","plural",{"one":["matches ","#"," file"],"other":["matches ","#"," files"]}]],"-3ois8":["Hard break"],"-8PP0T":["Match case"],"-K0AvT":["Disconnect"],"-KCZ6n":["Mark a block as the source of truth. Mirror references elsewhere render this content read-only and update live as you edit here."],"-LHLx7":["edited template"],"-Q7TT9":["That folder isn't an Open Knowledge project yet. Initialize it and open?"],"-QCLWk":["Templates available"],"-Qw-1t":["GitHub authentication failed. Try signing in again."],"-RXIMO":["Couldn't read the selection — please try again."],"-YV1Uo":["Pattern ",["patternNumber"]],"-g6KIS":["Unrecognized link"],"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"-i7ik4":["Collapse burst ",["burstNumber"]," diff"],"-lCAuQ":["Loading graph"],"-q4abP":["Results capped — this workspace has more files than search can index. A missing file may be a cap artifact, not a typo."],"-slrNR":["Toggle a task list."],"-wePNM":["Search matches file names, paths, and folders. Open a file to search its body (⌘F)."],"0-31GV":["Removing"],"02P3hL":["Upload failed: ",["message"]],"04RA0-":["Failed to enable sync — ",["detail"]],"06SZfb":["Template \\"",["trimmedTitle"],"\\" created"],"07gHun":["You don't have access to this private repo. Sign in with an account that does."],"07q4Qk":["File sidebar"],"092Wah":["Enter a name for this template."],"09Tv5j":["Reconnecting…"],"0BB9ID":["No headings yet."],"0Gd0NU":["Shared"],"0NA4b3":["Keep my version"],"0YEbfk":["Connect to AI tools"],"0_J12R":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in ",["targetLabel"]],"0eHrMb":["Could not complete delete"],"0jD-Gn":["A team knowledge base, a personal wiki, project docs..."],"0kTAXe":["Open source: ",["mirrorSrc"]],"0njBIq":["Setup files include: <0>.ok/</0>, AI-tool MCP configs (<1>.mcp.json</1> and per-tool files), project skills, and <2>.claude/launch.json</2>.<3/><4>Shared</4> commits them to git, so anyone who clones the repo gets the same setup. <5/><6>Local only</6> keeps them out of git (via <7>.git/info/exclude</7>)."],"0rwwOn":["By tag"],"0s8-e8":["Select, enter, or leave block components and fallback source blocks from keyboard boundaries."],"0t0bbC":["Could not save sync preference: ",["detail"]],"0wswKc":["Horizontal rule that divides sections."],"0xnmlQ":["Repository name"],"0yL--g":["Review conflicts"],"12F9WL":["(no id)"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1AumWo":["Push failed — check the server logs for details."],"1EcCom":[["keyName"]," value"],"1GhYxC":["of ",["totalPages"]],"1HBhDS":["Checking out files"],"1MGRQl":["Terminal sessions"],"1QfxQT":["Dismiss"],"1RluQD":["Show replace"],"1TNIig":["Open"],"1Ta7Fd":["Open ",["basename"]],"1WgmEM":["Failed to load template: ",["errorMessage"]],"1XSMhZ":["Switching to <0>local-only</0> will refuse until they're untracked via<1> git rm --cached</1>."],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"1d1F11":["Select all files and folders"],"1di5fu":["Document not found"],"1nke1r":["Open ",["0"]," on GitHub (opens in a new tab)"],"1t_NnN":["Reject"],"2277Tu":["Collapse graph"],"237hSL":["Ended"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"29VNqC":["Unknown error"],"29XZXN":["Set git identity"],"2BBAbc":["List"],"2FYpfJ":["More"],"2GT3Hf":["Global"],"2QM24L":["All tags"],"2RBzMG":["Network error — check your connection and try again"],"2XQ8Ww":["Open preview when agent edits"],"2YOwme":["Restarted — now running v",["appRuntime"],"."],"2YZwPB":["Forward-links response did not match expected shape."],"2Znqb1":[" (missing)"],"2fkdnR":["Nothing to undo on this file"],"2hpdRq":["Hide panel (",["panelShortcutLabel"],")"],"2n3oDU":["Project-level pages ordered by inbound link count, up to ",["FULLSCREEN_HUB_LIMIT"]," results."],"2q_Q7x":["Visibility"],"2ryd91":["Failed to rename property"],"2tgFCe":["Starting clone"],"2vIPtm":["Open link in new tab"],"2wxgft":["Rename"],"322lyb":["Highlight tips, warnings, and notes."],"34qyH5":["Could not reach server"],"36WXSC":["Couldn't delete template: ",["error"]],"379t2h":["Unified diff"],"38foVZ":["Loading diff"],"3DTatP":["Copy a prompt for your agent, start a blank file, or scaffold from a template."],"3Fcb0I":["Open graph"],"3HNlwb":["Hello, world!"],"3Ib6FN":["Move down"],"3IseAk":["Install an AI agent to create with AI"],"3J7d2N":["Big section heading."],"3JYy1p":["Branch ",["0"]," no longer exists. Cloned to default branch."],"3MnvrL":["Showing top ",["0"]," matches — keep typing to narrow"],"3Mwaly":["Could not initialize ",["0"],"."],"3SDfZl":["<0>Mirror — pick a source.</0> Set <1>src</1> + <2>anchor</2> via the property panel to point at a <3><MirrorSource></3> elsewhere."],"3TCafD":["Stored on this machine."],"3VbwPp":["Open ",["keyName"]," in browser"],"3VsNTI":["Loading document"],"3YvS-c":["New tab"],"3_6U6f":["Connect to GitHub"],"3__SjS":["breadcrumb"],"3a_Bd7":["Open source doc: ",["mirrorSrc"]],"3aeN7X":["All files"],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3jod3l":["Connect GitHub"],"3mFsc3":["Restore with remote changes"],"3o3tur":["Starter content"],"3oh0nQ":["Nested .okignore error in ",["path"]],"3pU8e-":["Pin tab"],"3wiBAs":["Where should it live?"],"3y6XTb":["Semantic search"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"44DSl0":["Already have a git repository? Add it with <0>git remote add origin <url></0> in this project's folder. This page updates automatically once a remote is detected."],"45MZFs":["Commands"],"484LKL":["Remove link"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4A3Yzu":["Code block"],"4BITzH":["Error:"],"4CfgPM":["Project folder created, but git init failed. Try again."],"4Gz2wC":["Failed to upload file"],"4KmEoC":["Hotkeys"],"4NC2Ym":["Move to the next or previous table cell."],"4PYsOz":["Hide Files (",["sidebarShortcutLabel"],")"],"4Sxexw":["Source undo or redo"],"4TzU0n":["Initialize"],"4buZWd":["Inherited from ",["path"]],"4c_a6S":["Nothing set yet."],"4g19V6":["Failed to update property"],"4hJhzz":["Table"],"4jDd0j":["Anyone can see"],"4niEzY":["Sandboxed HTML embed — write HTML, see the rendered preview live."],"4nj6n8":["/api/config returned HTTP ",["code"]],"4sKwf6":["File already exists"],"4uNLmk":["Pulling"],"4v2Yyz":["Select every visible file-tree row when focus is in the Files sidebar."],"4xtLTl":["Hidden folder “",["basename"],"”"],"4zGlN_":["Paste image URL or click upload"],"5-FeN2":["Share URL"],"54Y6Fg":["Could not load templates. Try again later."],"56WWtu":["Couldn't load starter packs: ",["error"]],"56xUL1":["Property name"],"57fiu8":["(read-only — edit in source mode for now)"],"5ALjdr":["Move through visual-editor find results from the find field."],"5Ajb15":["The formula <0>c = √(a² + b²)</0> renders inline."],"5ClEAu":["Inline hashtag for cross-doc grouping."],"5D3Ior":["Hide folder"],"5F5HYj":[["ahead"]," ahead, ",["behind"]," behind"],"5GKMSz":["Indent or outdent the current list item."],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5LXwX8":["This permanently removes ",["path"],". Agents that reference this template by name will fail until it's recreated or replaced by one in a parent folder."],"5OqaJi":["Enter a project name"],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5Tk8Fb":["Loading files"],"5WDhAk":["Link to a page or external URL."],"5ZB7XC":["File drop zone"],"5gr_ev":["Becomes the document's content when someone creates a doc from this template. Type <0>",["dateToken"],"</0> or <1>",["userToken"],"</1> to fill in today's date or the author's name automatically."],"5kWklo":["(some may already be hidden by other rules)"],"5lWFkC":["Sign in"],"5mksg0":["Failed to disable semantic search — ",["detail"]],"5o4lc1":["Open Knowledge will be initialized at <0>",["gitRoot"],"</0> — the parent of your new folder, because it contains a <1>.git</1> folder (one project per git repo)."],"5qNxOe":[["count","plural",{"one":["#"," item could not be moved to the Trash. Do you want to permanently delete instead?"],"other":["#"," items could not be moved to the Trash. Do you want to permanently delete instead?"]}]],"5rJ0w2":["Open Knowledge is using this GitHub account."],"5wV2qQ":["and more"],"5y_9lO":["Waiting for authorization"],"5z2tUG":["This project is running an older version of Open Knowledge (v",["0"],") than this app (v",["1"],")."],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"636K3K":["Delete adjacent chip"],"67f-3g":["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],"6Aih4U":["Offline"],"6LbUG7":["The repository is private and your GitHub account doesn't have access to it."],"6MnZEC":["Terminal failed to load"],"6O626z":["No headings match \\"",["trimmedAnchorQuery"],"\\""],"6Pxqwv":["No project templates yet. Create one to make it available everywhere in this project. Folder-scoped templates live on each folder's overview page."],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6VqW-1":["Remove ",["keyName"]],"6WdDG7":["Page"],"6YtxFj":["Name"],"6_ZOw4":["Copied full path"],"6bTTAN":["Invalid input — pick a different folder."],"6cR-PU":["Already open"],"6caB2T":["Connect an existing repository"],"6cuT_1":["Open date picker for ",["keyName"]],"6cyguR":["Connect GitHub to continue."],"6eniID":["Map the architecture"],"6fGjTz":["Show fewer"],"6gRgw8":["Retry"],"6h4zVU":["What would you like to create?"],"6hfDJr":["Server error: ",["status"]],"6ibbCg":["Create your first file"],"6ki7F2":[["0","plural",{"one":["#"," item"],"other":["#"," items"]}]],"6m_7We":["Open this settings dialog."],"6q0rnH":["writing"],"6qMe0o":["Draft a technical spec for my project. Start with an overview, then add cross-linked pages for the architecture, the key modules, and the open questions, all linked from a specs index."],"6s7LXO":["Heads up"],"6u9LvN":[["days","plural",{"one":["#"," day ago"],"other":["#"," days ago"]}]],"6vEr3W":["Link target"],"74-bX-":["A pull quote stands out from the surrounding text."],"74eHt-":["No file or folder selected"],"75Y1dk":["Horizontal pill strip + active panel below; click a pill to switch panels."],"77SdEP":["Delete ",["itemName"]],"7FamGZ":["Go to line"],"7Fkcej":["+ Add ",["addChildName"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7JtSLi":["Failed to delete path"],"7KeV5F":["Undo all failed: ",["message"]],"7OhaRy":["Source search"],"7OwvEL":["Show HTML preview"],"7PNNNs":["This sends content off your machine"],"7PzzBU":["User"],"7_bFEL":["Drag ",["patternText"]," to reorder"],"7apDiJ":["A folder named <0>",["sanitized"],"</0> already has files here. Pick a different name."],"7d1a0d":["Public"],"7hctf2":["Describe the project you want to create"],"7kdoVR":["Open the Open with AI menu for the current editor selection."],"7nrKys":["Open Knowledge is using a GitHub account provided by the gh CLI. There's no separate Open Knowledge credential to disconnect."],"7qRHf0":["Install for Claude Chat & Cowork"],"80c4-P":["Code copied to clipboard"],"81H_23":["Add properties"],"881Uwh":["Delete selected table"],"89TtiD":["New file from template \\"",["displayTitle"],"\\" (",["fileName"],") in the project root"],"8BsGpU":["A key is set, but the embeddings provider rejected it or was unreachable — search fell back to keyword matching. Check the key in <0>Settings → Account</0> and your provider settings."],"8F1i42":["Page not found"],"8FqTCr":[["chunksRemaining","plural",{"one":["#"," unresolved hunk"],"other":["#"," unresolved hunks"]}]],"8Jm2EP":["Toggle heading levels 1 through 6."],"8OGgNM":["Open or close visual-editor find."],"8OxKZy":["Move succeeded but the sidebar may be out of date — refresh to resync"],"8PmoQF":["Open the insert menu in an empty or active text position."],"8RtNI0":["Failed to load documents"],"8S1E33":["Search recent projects..."],"8TLE9g":["Read-only copy of a MirrorSource block from another doc. Edit at the source — every Mirror reflects the change live."],"8XQRON":["Loading repositories"],"8_brI5":["Name is required"],"8cS0nH":["Config sharing unavailable: ",["0"],"."],"8cpOa8":["Couldn't disconnect — please try again."],"8cpeU3":["Shared repositories"],"8eW0WQ":["No matching repositories."],"8fRyLo":["Invalid patch payload"],"8fc_3j":["Protected branch — cannot push"],"8m8diM":["No location selected. Use Browse to choose a folder."],"8tjQCz":["Explore"],"8uAWix":["This template lives in a parent folder — deleting it affects every folder beneath it that doesn't define its own version."],"92rbk2":["Mirror loading <0>",["mirrorRef"],"</0>"],"96G6Re":["New folder"],"96w9hU":["Something went wrong opening this file (HTTP ",["status"],")."],"99eR72":["Visual editor table selection"],"9Bd18D":["Failed to load hub pages"],"9NJWgv":["Backlinks"],"9PQysm":["Hide advanced"],"9R7pRC":["No tags match \\"",["trimmed"],"\\". Continue typing to create one."],"9UQ730":["Clone"],"9bCiQ8":["No pages are missing incoming graph links."],"9clcD5":["Open documents tagged #",["chip"]],"9dw5bW":["Create with ",["0"]],"9euN0m":[["count","plural",{"one":["#"," more cross-doc participant"],"other":["#"," more cross-doc participants"]}]],"9fhQRL":["Beta channel"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9i21pa":["Commits happen automatically"],"9jnjV0":["Embed an audio file with native player controls."],"9npOH9":["Open file"],"9o1bIV":[["behind"]," behind"],"9oE4C3":["Browse your repos:"],"9tJX8r":["By meaning"],"9zb2WA":["Connecting"],"A1taO8":["Search"],"A5CYnd":["Broken link"],"A5hiCy":["Create template"],"A67Uwj":["Still loading"],"A6h5b-":["File duplicated"],"AAlr5Y":["No collab server for this worktree — run <0>ok start</0> here, or reopen the project."],"AB4qw9":["New terminal"],"AE7BY3":["The terminal session ended."],"ALhMYW":["Terminal"],"AMyJts":["This path is on an external volume (/Volumes/...). Open Knowledge will lose track of files when the drive ejects."],"AQ-Lfg":["Couldn't load templates"],"AQGtjK":["Commands run with the full access of your macOS user account on this machine. Turn this off to disable the shell."],"AThCb_":["Open Knowledge manages the <0>open-knowledge</0> MCP server name, the <1>open-knowledge-ui</1> launch config, and <2>ok</2> / <3>open-knowledge</3> on PATH (including OK-owned symlinks). Using a custom wrapper? Register it under a different name."],"AVW-K9":["Failed to load orphan pages"],"AWOSPo":["Zoom in"],"AcK_r0":["Claude CLI"],"AdcGcG":["Applying your change"],"AddR83":["Could not create project. Try again or pick a different location."],"AeHuzT":["# One pattern per line.\\n# Examples:\\n# drafts/\\n# *.draft.md\\n# !keep.md"],"AeXO77":["Account"],"AiNMQ7":["This project lives only on this computer. Connect it to GitHub to back it up and share it with other people."],"Aif3E7":["Enable semantic search"],"Am78jY":["Drag ",["keyName"]," to reorder"],"AqnqMJ":["API key set"],"ArBWJf":["Undo last edit"],"B11p-O":["Edit markdown link"],"B2DrPb":["Auto-save"],"B3NAZC":["Open Navigator"],"B4_ipX":[["conflictCount","plural",{"one":["#"," file conflicted"],"other":["#"," files conflicted"]}]],"BAH4qX":["Selected graph item"],"BBqGS9":["Desktop"],"BD0XSC":["Failed to load project templates"],"BEkF-P":[["userName"],", ",["tabCount","plural",{"one":["#"," concurrent tab"],"other":["#"," concurrent tabs"]}]],"BGHHtQ":["Single page"],"BH56dn":["Custom display text"],"BQKHuL":["Restart terminal"],"BQu9Pg":["Symlink"],"BY-g4_":["Add pattern"],"Bdha5y":["Publishing..."],"BeWTQy":["Loading starter packs"],"BgV29F":["Visual editor find input focused"],"Bv5a9_":["Selection statistics"],"Bx4EXG":["Actions for ",["label"]],"By-7Pn":["Toggle a bullet list."],"BymzO4":["Document outline"],"C0NPNd":["Add Open Knowledge to your AI tools"],"C37Zkt":["Send to"],"C62P6b":["Editor selection"],"C9TBvF":["No Outgoing"],"CCTop_":["Recent"],"CKyk7Q":["Go back"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CSL0l1":["Couldn't clear the key — please try again."],"CTJLpz":["\\"",["trimmed"],"\\" already exists here"],"CU3AiE":["Switching branches"],"CXj9C-":["New property name"],"C_WGy8":["This file is too large to open in the built-in text editor (1 MB limit). Use Open file below to open it in another app."],"C_cPoW":["Your GitHub session expired — sign in again to verify push access."],"ChAtFg":["You don't have permission to push to this repo"],"Ck9XRt":["Couldn't save the key — please try again."],"CmeH9S":["Add property to ",["keyName"]],"CvsD6Y":["via ",["viaTags"]],"D4H2N6":["Remove ",["tag"]],"D8OV7J":["Only collaborators"],"DDTdLl":["Code block settings"],"DELNQk":["Collaborators see your in-progress edits as soon as they sync."],"DF1MtZ":["Loading conflict for ",["filePath"]],"DFfRbX":["Sync status: ",["syncStateLabel"]," — git identity unset"],"DId6MT":["Project-level pages with no outgoing graph edges."],"DPfwMq":["Done"],"DVh_Tb":["Failed to clean up after trash"],"D_WKe_":["Click an agent's avatar in the presence bar to view their session."],"DbILZA":["No matches. Some files are excluded from search (hidden or ignored files)."],"DeDYLr":["Unrecognized wiki link"],"DhLHEb":["Failed to load activity"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DrYM2Z":["Sync disabled"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"Dub54T":["Preview browsers can't auto-copy. Use Cmd/Ctrl+C on the URL above, or open OK in the desktop app."],"Dw1T_W":["Rename ",["label"]],"E1_c72":["Task list"],"E1tG2u":["Get Claude Code"],"E2Mv-X":["Copy source"],"E4XYYH":["Enable terminal for this project"],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"EBVbtP":["Could not duplicate item"],"EDm3wJ":["Loading diff renderer"],"EEYbdt":["Publish"],"EJuO7B":["Connect a GitHub account to browse and sync your repositories."],"EL_YRd":["Mirror of <0>api-spec</0>"],"EOjU5V":["Inline Math Properties"],"ETyvvg":["No language match."],"EVnzPs":["Edit with AI"],"EZVxVz":["Replace the active match from the replace field."],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"E_tNGD":["Connected as @",["login"]],"EarrCe":["Search emoji"],"EbZT7P":["Toggle the left file sidebar."],"EcM3k7":["Failed to clean up pending ",["kind"]],"EcR0fl":["Checking for installed agents"],"EdQY6l":["None"],"EeRZnZ":["Expand burst ",["burstNumber"]," diff"],"Ef7StM":["Unknown"],"EhDLBx":["You modified <0>",["filePath"],"</0> locally, but it was deleted upstream."],"Ehkru0":["Open, navigate, accept, or dismiss CodeMirror completion suggestions."],"EiVgl5":["You don't have permission to push to this repo."],"Eji13z":["Toggle highlight formatting."],"El7NbA":["Heading 2"],"Emz5BG":["Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."],"EqrC_R":["Undo failed: ",["message"]],"EqtBXb":["Visual editor find open"],"ErRi6L":["Template \\"",["label"],"\\" deleted"],"Es-eZU":["Remove from recent projects"],"Ev2r9A":["No results"],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"Evq3lu":["Orphan mode"],"ExPiRQ":["Move to the next CodeMirror lint diagnostic."],"F-NRCj":["Add property"],"F4IYWe":["Share doc"],"F4vEsL":["Sync status: ",["syncStateLabel"]],"F6pfE9":["Active"],"FBknns":["HTML"],"FCxvG5":["First item"],"FEr96N":["Theme"],"FF5rwn":["Connect Open Knowledge to other tools you use."],"FNTx6u":["Search \\"",["semanticSubmitQuery"],"\\" by meaning"],"FOGD7m":["Create something great."],"FOyCTr":["Your OpenAI API key, used only to create embeddings of your content for semantic search. Stored once for this machine in <0>~/.ok/secrets.yml</0> (readable only by your user account) and shared across all projects. Turn the feature on per project in This project → Search."],"FRYB1Q":["/api/config returned a malformed body"],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"FjkaiT":["Zoom out"],"FnMkli":["Sync disabled — you don't have permission to push"],"FqTpiN":["Bird wiki"],"Fqr8BP":["Multi-page PDF viewer with toolbar controls (thumbnails, page nav, zoom)."],"FvMSms":["Renaming changes the file on disk and the id agents use to pick this template."],"FvpFSZ":["Reveal in Finder, ",["hint"]],"Fxf4jq":["Description (optional)"],"FyW0WO":["Authorize in browser"],"G-JBA1":["Source mode requires a live connection — your edits are saved and will appear when you reconnect."],"G0YZ-I":["Indent or outdent list item"],"G1Gw0v":["New template"],"G1XxbZ":["Checkbox"],"G7-rf8":["Pattern syntax error: ",["message"]],"G7cMuO":["HTML preview"],"G8t9NN":["Add a property"],"GA-UkN":[["keyName"]," type: ",["typeLabel"],". Click to change."],"GDvlUT":["Role"],"GGsM4y":["Selected in graph"],"GK-IRZ":["Undo buttons are disabled — per-session state has been garbage-collected."],"GN6L5F":["Filename"],"GQDSBN":["Layout options"],"GUYwCr":["Dismiss notice"],"GUpclA":["Created if missing; reused if it exists."],"GUqTzn":["Competitor research"],"GXf9hG":["Cloning ",["repoName"],"..."],"G_686w":["Task List"],"G_mWXb":["Filter languages"],"GamjcN":["Template saved"],"GemPfn":["Failed to parse forward-links error response (HTTP ",["status"],")"],"Gfr4fu":["Server can't open documents"],"GgQgML":["You picked your home directory. Open Knowledge will index everything in your home tree — large and may surface personal files."],"GhjUB_":["Reconnected"],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"GubkSu":["Use a starter pack"],"GuqOb1":["Failed to load headings"],"Gx0VS1":["e.g. drafts/ or *.draft.md"],"H-vDm3":["Relaunching to install the update…"],"H0WlWQ":["Grid of rows and columns with a header row."],"H86f9p":["Collapse"],"H8Ng4Z":["Search recent projects"],"HCn0Ay":["Toggle strikethrough formatting."],"HGNCsl":["Connection lost — keep this tab open, your edits will sync when reconnected"],"HIb0vl":["Network error — please try again"],"HM56Bx":["Creating..."],"HNnVG1":["No other recent projects."],"HRU-eL":["You picked ~/Documents. Open Knowledge will index every markdown file under it. If you only want to manage a sub-folder, choose a smaller scope."],"HXFyWD":["Split diff"],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HlmZBk":["Documents response did not match expected shape."],"HpK_8d":["Reload"],"HptUxX":["Number"],"Hrz9NY":["Wiki link"],"I1gRhX":["Failed to rename"],"I1m158":["Couldn't auto-copy"],"I5AfhE":["Sync status unavailable — server unreachable."],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"ICoNYz":["You can also manage this in Settings."],"IInnZo":["Conflict"],"IKoTAC":["Keep disabled"],"IN4UX8":["Search (",["searchShortcut"],")"],"INEQsp":["Items to be created"],"IQPyrD":["Missing page — click to create"],"IRv9cH":["Cloned ",["repoName"],"."],"IWGfGF":["Checking your GitHub connection"],"IX7-sq":["Something went wrong opening \\"",["docName"],"\\"."],"IajAbS":["Add a starter pack"],"If0crP":["Open with AI ",["targetDisplayName"],", ",["hint"]],"IgTwLt":["Open this document in the editor and collapse the graph."],"Ik-gP0":["Heading H",["level"],": ",["text"]],"Iq8zdU":["Close terminal"],"IrB5AK":["Server-side cleanup failed for ",["failedCount","plural",{"one":["#"," item"],"other":["#"," items"]}]],"IreQBq":["Repository"],"It9ARY":["Toggle the right document panel."],"Ix0K8o":["Hide external URL nodes"],"J2MgzQ":["Undo all edits on ",["docName"]],"J2Mv98":["Name (e.g. ",["login"],")"],"J2eKUI":["File"],"J3HzPL":["Collapse ",["keyName"]],"J6N5MX":["Couldn't construct the share URL. Try Done and re-share."],"J6mxC1":["A network problem or GitHub outage interrupted the clone."],"JCxGEX":["No disconnected pages. Pages appear here only when they have no incoming and no outgoing graph edges."],"JE21eh":["Symlink to ",["targetPath"]],"JK-Ave":["Hide thumbnails"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JLzQi_":["Close ",["accessibleLabel"]],"JOcPqH":["Bring a remote repository onto this machine."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jejur6":["Couldn't load document"],"Jhj_lh":["Modify the link target, anchor, and display label."],"JkCD2u":["Sync paused — you don't have permission to push to this repo"],"JmfgFc":["(a worktree of ",["0"],")"],"Jqqevv":["System error"],"JtD-Br":["Page link"],"Jw6EC4":["Branch switch failed — try opening the ",["targetNoun"]," manually."],"K-a33w":["Start writing to create this page"],"K-h9cT":["Couldn't save the resolution for ",["filePath"],"."],"K0N7zS":["Config sharing status read failed"],"K1ckLX":["Failed to create folder"],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K6jxcj":["Add a key"],"K8-WWn":["Move between table cells"],"K9J00P":["Clone failed — connection error"],"KDuPiY":["Uploading ",["fileName"]],"KDw4GX":["Try again"],"KFdXwz":["Show panel (",["panelShortcut"],")"],"KOZud0":["Build a competitor research knowledge base. Start with an overview page, then add cross-linked pages for each competitor, their products and pricing, and the sources behind every claim."],"KPW5WC":["moved template"],"KRJ6xh":["No tags yet. Continue typing to create one."],"KWL_Ih":["Blog post"],"KX1MZR":["Your repositories"],"KYcZ6Y":["Above"],"KZLdgR":["See <0>#design-docs</0> for the latest specs."],"K_vT1F":["Upstream sync"],"KaFCD3":["Open this link in a new tab and collapse the graph."],"Kf7GG5":["Restarting the server…"],"Kgdbkt":["Switch to local-only refused"],"Kh1n4a":["<",["componentName"],"> isn't a known component. Copy the source to use it elsewhere, or delete the block."],"Khxcyu":["Terminal access isn't enabled for this project."],"KkEAud":["Create a file from the current document or folder context."],"KmydK6":["Bold"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"KsAPaB":["This branch is checked out in:"],"KujtjC":["Find"],"L-rMC9":["Reset to default"],"L1ZE3M":["Document statistics"],"L3CEC1":["this item"],"L4Cdd9":["or create a new file <0/>"],"L5Xu8C":["This project is running a different, incompatible build of Open Knowledge than this app (v",["0"],")."],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"L9Y9Om":["Top linked pages"],"LBwUR6":["Branch switch timed out — try opening the ",["targetNoun"]," manually."],"LCUy_N":["Session ended"],"LDuM35":["Replace current match from field"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LNum6A":[["minutes"]," min ago"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LXdWeS":["Medium section heading."],"LXfNU-":["Navigation and suggestions"],"LYufDw":["Failed to enable semantic search — ",["detail"]],"Lcehxn":["Save resolution"],"LdABLa":["Could not open ",["target"],". Try opening it manually."],"LdKIHS":["Draft a spec"],"LhWYpm":["Other OK paths are tracked upstream:"],"LlHqdU":["Initializing project"],"Llyqvo":["This usually means one of:"],"LpB85N":["Plain"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"LtVw4J":["Claude CLI, ",["hint"]],"LuoJWu":[["truncatedShownCount","plural",{"one":["Showing the first item in one folder — the rest of that folder is hidden."],"other":["Showing the first ",["formattedCount"]," items in one folder — the rest of that folder is hidden."]}]],"M1OfV9":["Next source diagnostic"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"M5mfAe":["Add tag"],"M9597s":["Preparing share URL..."],"MCjC9A":["Delete ",["deleteDescriptorLabel"]],"MGb89P":["Insert, delete, move, copy, and indent source editor lines through CodeMirror's default keymap."],"MHrjPM":["Title"],"MKOVhz":["Enable git auto-sync"],"MQIM_Y":["Couldn't copy. Select the URL above to copy it manually."],"MTs6g3":["Couldn't reconnect after server restart"],"MUBR8r":["Rename succeeded but the tabstrip may be out of date — refresh to resync"],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MVxpbf":["Find and replace"],"MWrUEd":["Undo all"],"MZSBsh":["No templates yet. Add one to give new docs in this folder a ready-made starting point."],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"Mb_20S":["Visual"],"Md709y":["Loading ",["fileName"]],"MmDDWK":["Recently opened"],"Mnavhe":[["propPanelDescriptorLabel"]," Properties"],"MqQoV-":["Describe what you want to build, start a blank file, or scaffold from a template."],"MrwYIK":["Toggle a source comment through CodeMirror."],"MsuXaI":["Hide panel (",["panelShortcut"],")"],"N1YYa7":["Loading image"],"N1mdmS":["This file can't be opened in the text editor."],"N2FcBE":["Synced"],"N2S1rs":["Empty"],"N2eHWq":["Code Block"],"N3_ozB":["Hubs"],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NJyQi_":["Branch ",["shareBranch"]," no longer exists on the remote."],"NKkZXl":["Initialize and open"],"NOHyEE":["Retry push"],"NORKZU":["Pattern warnings: ",["summary"]],"NQ8llq":["Add item"],"NRSLBe":[["diffMin"],"m ago"],"NSnIUP":["Two-page (even)"],"NUr4kz":["A reusable starting point for new documents in this folder."],"N_7kkF":["Read through this codebase and draft a technical spec for the most complex module: an overview, the architecture, key files, and open questions, all linked from a specs index page."],"NjrIak":["File: <0>",["fixedName"],".md</0>"],"NkXEFS":["Restore failed — document unchanged"],"NlZjSM":["Manage the GitHub account Open Knowledge uses to browse and sync your repositories."],"NmPNJJ":["Copy code"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"NnQapF":["Open with AI ",["targetDisplayName"]],"NpC29w":["Create a new list item from the current list item."],"Nu4DdT":["Sync"],"Nu4oKW":["Description"],"NuH1jp":["Public repository"],"Nv3mUj":["Show advanced"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"NxW-md":["Resize ",["handleKey"]],"NzFvyK":["Session ended — undo unavailable"],"O0Z2Xr":["Outgoing"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"O7_W_a":["Open with AI"],"OD0FCX":["Hidden “",["basename"],"”"],"ODD5Jc":["Edit ",["templateLabel"]],"ODGGlj":["Folder name: ",["detail"]],"OETysD":["No hub pages yet. Hubs appear once pages accumulate inbound graph links."],"OJTOUj":["Requires ",["brand"],"."],"OJeiSH":["Failed to add property"],"OLBz-_":["Mermaid diagram failed to render."],"OLIKgw":["Drag item ",["0"]," to reorder"],"ONPvOb":["Loading agent activity"],"ONgEZF":["Loading headings for ",["pageTarget"]],"OTF92M":["Label <0>(optional display text)</0>"],"OVjNeX":["Terminal ",["0"]],"OX2Neh":["Inline code"],"OYnx7O":["Path cannot start with \\"/\\""],"OdmsFg":["Failed to delete item"],"OgyJSr":["Local only"],"OiHJdA":["Move through slash, wiki-link, tag, and path suggestions; accept or dismiss the active suggestion."],"Okd2Xv":["Toggle underline formatting."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"On0aF2":["Website"],"Oo_WWc":["No pages found"],"Oos8fo":["Copy command"],"OuY8t9":["Open in current branch"],"OvEjsP":["Copying..."],"Oxyd5f":["Pick a name"],"OyIC0Q":["Project name"],"P-ye9o":["Could not open folder picker"],"P3NS4G":["Pattern syntax error (line ",["lineNumber"],"): ",["message"]],"P3hnm0":["File too large to open"],"P47EWZ":["Could not update sidebar settings"],"P6gXB-":["Replace ",["keyName"]],"P6lAT3":["Folder target: ",["linkTitle"],". Click to open the overview."],"P8jws3":["Restarting closes this project's server. Connected agents (Claude Code, Codex, Cursor) will see their Open Knowledge MCP connection close unexpectedly — you may need to restart the agent, or toggle its Open Knowledge MCP server off and on, to reconnect."],"P8yDjG":["Name can’t be empty, \\".\\", \\"..\\", or contain / or \\\\"],"PB4upl":["Find previous match"],"PBwmDJ":["Searching by meaning"],"PBxg_E":["Not now"],"PKLY-1":["Opening..."],"PMyJ9C":["No edit session yet"],"PQCdtv":["\\"",["docName"],"\\" doesn't exist."],"PR9FSv":["Move to the next visual-editor find result."],"PVUn_c":["Open folder"],"PZt1uN":["Search files, commands, projects, and AI handoff actions."],"PdA9NZ":[["ahead"]," ahead"],"Pgu10b":["Saved as <0>",["slug"],".md</0>"],"PgzIpb":["Move to the previous visual-editor find result."],"PkeYXL":["Expanded graph mode"],"Pkw7J9":["This folder is empty."],"PqYWiC":["Couldn't restart the server automatically. Try running \`ok stop all\` in a terminal, then reopen this project — or restart your computer if it persists."],"Pyp1NA":["Restore to this point?"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"Q8A-U_":["Connected to"],"QDZbvN":[["diffDays"],"d ago"],"QOINDn":["empty"],"QQghPu":["Install in Claude Desktop"],"QR5SP1":["created template"],"QWks14":["A short line shown under the name in the template list."],"QcpeeE":["Navigate to ",["docName"]],"QlxHAH":["Showing results for \\"",["semanticResultsLabel"],"\\""],"QqBQu1":["Label <0>(visible link text)</0>"],"Qvls7J":["Eng specs"],"QyioBP":["Move up"],"R0cyYB":[["0","plural",{"one":["#"," request blocked by the preview's security policy"],"other":["#"," requests blocked by the preview's security policy"]}]],"R0jJzV":["Paste URL, owner/repo, or search your repos"],"R3y75Z":["Edit source"],"R65q-K":["A real shell is off for this project. Turning it on runs commands with the full access of your macOS user account."],"RDjuBN":["Setup"],"RDrXh4":["Configure user, project, and integration settings."],"RG4XHV":["Copy ",["0"]," prompt"],"RGCCrg":["Copy share link"],"RGkNeJ":["Initialize a starter pack"],"RJ3a8Z":["Looking for <0>",["lookingForUrl"],"</0>."],"RN62Q8":["We'll build <0>openknowledge.skill</0>, save it to <1>~/Downloads</1>, and open the Claude Desktop App for you."],"RSqaSd":["Project root"],"RY6Bq1":["Open shared ",["targetNoun"]],"RaPMZv":["Keyboard shortcuts available in the editor and workspace."],"Rah7yq":["What should the AI do? (optional)"],"RfHNf8":["Open activity panel for ",["tooltipName"]],"RfaEio":["Toggle source comment"],"RgbKEe":["You don't have access to this repository."],"Rj01Fz":["Links"],"RlCInP":["Slash commands"],"RmBY0A":["No git remote"],"RobAKV":["Update the destination and optional section anchor."],"Rq1vFD":["Tree view options"],"RrAIZx":["What config sharing covers"],"Rx5ReQ":["Rename ",["keyName"]],"S33tz3":["Not connected"],"S6l5dv":["Could not start creating a new item"],"S9Vnum":["Remove ",["patternText"]],"SCoBBH":["Tag suggestions"],"SCzAbA":[["phase"]," — ",["pct"],"%"],"SEYWYq":["Undo all edits on this file?"],"SFN6dN":["Heading 3"],"STTOnz":[["keyName"]," type: complex value (nested; read-only)"],"SUOoXn":["Failed to open project."],"SYfHmN":["Unpin tab"],"Sc1bKE":["Local collaboration data for \\"",["docName"],"\\" could not be cleared in time. Reload to retry."],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"Sfh6zL":["The file on disk, and the id agents use. It can't be changed later."],"SgKLfA":["Not connected to GitHub."],"SiUUCS":["Next match"],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"SrOuyg":["Document panels"],"T-4cw2":["Pick a layout that matches what you're building. Each pack ships with folders, templates, and agent-readable descriptions. You can mix and match later."],"T-654M":["Loading PDF"],"T0OVm7":["The default branch is protected — pushes need a pull request."],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TJnkyf":["ok ui responded but server.lock has no port yet"],"TKQ7K-":["Install"],"TLIO3j":["Toggle italic formatting."],"T_wG4n":["We couldn't check your GitHub connection."],"Ta25TG":["No history yet"],"ThmUrC":["Could not finalize project setup. Try again."],"Tjc1pH":["Section <0>(optional heading anchor)</0>"],"TvY_XA":["Documentation"],"TwYboS":["Navigate CodeMirror source search results or dismiss the search panel."],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U2Kx6T":["Close all unpinned"],"U2pMtf":["tag-name"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UA171M":["Run a real terminal docked inside Open Knowledge, starting in this project's folder."],"UBv8UK":["Delete Permanently"],"UDFrWm":["Checking GitHub connection..."],"UL8A9w":["Tag"],"UQAp48":["Search templates"],"URmyfc":["Details"],"UTNVyS":["Select the full source document."],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"UW93oq":["Replace key"],"UYcGIW":["Connecting — waiting for collab server"],"Ua78MH":["no response"],"UaXXIF":["Available in the Open Knowledge desktop app. From a terminal, use<0> ok config-sharing status</0> / <1>share</1> / <2>unshare</2>."],"Uci-Ph":["Ordered List"],"Ud0Pj9":["<0>Mirror source removed.</0> The doc <1>",["src"],"</1> is no longer available."],"UfW9Kr":["Your search queries and the full text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"UkQGhd":["Hide replace"],"Up2_7p":["Copy full path"],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"UyROxs":[["mins","plural",{"one":["#"," min ago"],"other":["#"," min ago"]}]],"V48OUT":["You deleted <0>",["filePath"],"</0> locally, but it was modified upstream."],"V7QxyT":["Connection dropped"],"VAHWL_":["Connected as <0>@",["signedInLogin"],"</0>"],"VNgKZz":["Advanced settings"],"VU3Nrn":["Missing"],"VUijjF":["Embed an image with optional alt text."],"VYd_YA":["Open an existing project folder from disk."],"VZGh8G":["Fold, unfold, fold all, or unfold all source ranges."],"VZSBXL":["Semantic ranking activates the first time an agent runs a search."],"V_6bJ4":["Terminal settings not loaded yet — try again in a moment."],"VbqhBI":["Already at ",["assetContentPath"]," — reusing."],"VcqWBy":["Upload may have succeeded but the sidebar is out of date — refresh to resync"],"VdXv4D":["Clone from GitHub"],"Vlc75q":["Keep file deleted"],"VsBxkh":["Started a fresh Open Knowledge server (v",["appRuntime"],") for this dev session — the server already running for this project was terminated. Connected agents (Claude Code, Codex, Cursor) just lost their Open Knowledge MCP connection; restart the agent, or toggle its Open Knowledge MCP server off and on, to reconnect."],"VuxVSP":["Start source completion"],"VvS_k_":["Config sharing is now local-only."],"W-ntoW":["heading-slug"],"W0i24j":["Object"],"W1qRuM":["This document is already active in the editor. Use Open to collapse the graph."],"W3Xlpc":["Set the auto-sync default for users opening this project for the first time. This setting is committed to your repository."],"W5A0Ly":["An unexpected error occurred."],"W8vpBM":["starter pack"],"W9_Bub":["Local changes overlap with incoming sync"],"WEzuMq":["Create a new Open Knowledge project in the folder of your choice."],"WL6puM":["Path resolves outside project"],"WMIKXK":["Are you sure you want to delete ",["targetCount"]," selected items? Folders and all files inside them will be deleted. This action cannot be undone."],"WPwDin":["Open folder on disk"],"WR0y2O":["Share folder"],"WRNXKp":["Searching"],"WZ-vBy":["Permanently deletes <0>",["targetGitPath"],"</0> and all its git history. Working files stay in place. If the parent git repo is intentional (e.g. you cloned it), cancel and pick a location outside it."],"WamGNs":["Failed to load PDF: ",["error"]],"WcWS__":["Download file"],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"We7h2I":["📝 or assets/icon.png"],"Weq9zb":["General"],"Wgmlsw":["Fetching"],"Wh0im4":["editing [[",["realCurrentDoc"],"]]"],"WhOsNE":["Strikethrough"],"WqLq6M":["Open with AI ",["displayName"]],"Wt5W56":["Sync is off — your edits will not sync to the remote repository."],"Wtw22s":["Installing"],"WyXG7w":["Close all"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X7u0xR":[["0"]," templates available"],"X8kjQX":["Re-authenticate with GitHub"],"X9VpsP":["Loading folder contents"],"XDzAnp":["Opens in a new tab"],"XH30C4":["document"],"XJOV1Y":["Activity"],"XPJ0sN":[["settingsDescriptorLabel"]," properties"],"XPqe3B":["Create new tag #",["tagValue"]],"XRuL0i":["Create page"],"XU0OXn":["Enable auto-sync"],"XW18jo":["Page headings response did not match success schema"],"XYlJJT":["Setting up"],"XcGbim":["Show hidden files"],"Xet9MX":["Failed to load backlinks"],"XfzqjK":["template \\"",["name"],"\\""],"Xl-UUg":["guides/install or https://example.com"],"XnlF3W":["Add the next matching source selection."],"XnoA1k":["This ",["targetNoun"]," only exists on branch <0>",["shareBranch"],"</0>. You have uncommitted changes that prevent switching. Commit or stash your changes, then open the share link again."],"XopE_I":["Failed to parse backlinks error response (HTTP ",["status"],")"],"XpIZmv":["Fenced code block with monospace text."],"XtRoxT":["Page ",["pageNumber"]],"XvPJaT":["Diff layout"],"Xv_ijG":["https://github.com/owner/repo or owner/repo"],"Xw_maT":["Type a query, then press ↵ to search your pages by meaning."],"XyOUTJ":["Exit merge"],"Y-Urt2":["Block math equation rendered with KaTeX from a LaTeX source string."],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YC6_wP":["Edit ",["keyName"]],"YEP3X2":["Delete a table when the active table cell selection covers the full table."],"YGIi_c":["Reinstall"],"YKLP_-":["Template renamed"],"YPFBfr":[["detail"]," - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"YSFv5w":["No git repository — config sharing does not apply here."],"YTLmTM":["Remove the parent <0>.git</0> folder"],"YW7Q86":["Search settings not yet loaded — try again in a moment"],"Y_kL7X":["Customize how the editor looks and behaves."],"YaeyFh":["Pulls may overwrite uncommitted edits in your local files."],"Yea-K5":["Restore to this point"],"Yi0VMG":["Upload ",["keyName"]],"YjhKI5":["Cloning..."],"YlDuro":["Fit height"],"YsEYYS":[["behind","plural",{"one":["#"," commit behind"],"other":["#"," commits behind"]}]],"YwPUUP":["This pack is already set up here."],"YyXtnN":["Underline"],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z5HWHd":["On"],"Z5h97D":["Hide files and folders from your knowledge base. Hidden items don’t appear in the file tree, search, or AI tools. <0>Learn more about patterns</0>."],"Z8KDox":["Enter a folder name (e.g. brain)."],"Z8lGw6":["Share"],"ZBYKxv":["Reverts every change this agent made to <0>",["docName"],"</0> this session (",["burstCount","plural",{"one":["#"," burst"],"other":["#"," bursts"]}],"). Other files and writers are unaffected."],"ZBt4rI":["Instruction for the AI"],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"ZQLDTl":["created folder"],"ZU8VV_":["Remove failed: ",["error"]],"ZWgr0b":["In a subfolder"],"ZWolSV":["You picked the filesystem root (/). Scaffolding here will scan every file on this machine — make sure that's what you want."],"ZWxfrc":["cleared folder properties"],"ZWyHmq":["This project"],"ZhhOwV":["Quote"],"ZjtgI-":["Command palette"],"Zon_qG":["Mirror source <0>",["label"],"</0>"],"ZptNUh":["Show ",["hidden"]," more"],"ZsGpr_":["Paste link"],"Zue_jx":["Your GitHub token is missing required scopes. Try signing in again."],"Zul8Ry":["never"],"ZxXhLY":["Hide Files (",["sidebarShortcut"],")"],"Zz25kq":["Show Files (",["sidebarShortcut"],")"],"_7UQ7y":["Whole word"],"_8quCH":["From template"],"_902BE":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. You're currently on <1>",["currentLabel"],"</1>."],"_BthEY":["Open in ",["shareBranch"]],"_GBioJ":[["docName"]," is ",["0"],". Open Knowledge currently opens files up to ",["1"],"."],"_K2CvV":["Template"],"_PACVa":["Release notes"],"_PBJRl":["Add at least one letter or number."],"_QwkMu":["No matching paths"],"_TDESN":["Network error - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"_TF8ep":["Failed to render PDF"],"_VRtd7":["Couldn't send the selection — please try again."],"_W-elG":["(inline)"],"_XWY2J":["Terminal disabled"],"_eguJc":["Uploading"],"_gkGSK":["deleted template"],"_pY_Vq":["The repository was moved, renamed, or deleted."],"_qD6mn":["Pick the folder where you've cloned it."],"_rP3HI":[["minutes"],"m ago"],"_tekeB":["updated folder properties"],"a-cKXz":["Select all source"],"a5Gha5":["Local changes blocked the merge"],"a5W0q0":["Are you sure you want to delete ",["folderName"],"/ and all files inside? This action cannot be undone."],"a9OzSn":["No pages found for \\"",["trimmedQuery"],"\\""],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"aENGMB":["Semantic search adds meaning-based ranking to the search tool so conceptually-related pages surface even without shared keywords."],"aIgBKf":["Can't nest projects. An Open Knowledge project already exists at <0>",["rootPath"],"</0>. Choose a location outside it, or open that project instead."],"aM23Wr":["page-name"],"aOp3hw":["Couldn't move to Trash"],"aWlJai":["Starting sign-in flow"],"a_u4ck":["Loading tags"],"aaE55D":["Clear ",["keyName"]],"aalx4E":["Editing broken MDX source: ",["reason"]],"abiHje":["Delete selected items"],"adsMWO":["Resolving deltas"],"aiArms":["We couldn't clone this repository."],"ajz9F8":["Couldn't load conflict content for ",["filePath"],". Try reloading the page."],"aoa6xA":["network error (is \`ok ui\` running?)"],"az8lvo":["Off"],"b3Thhd":["Upload failed"],"b4AQFK":["Open activity panel for ",["tooltipName"],", editing ",["realCurrentDoc"]],"b4itZn":["Working"],"b5aNbi":["The ",["targetNoun"]," could not be opened — try navigating to it manually."],"bBE5tC":["Detected on this machine"],"bBcFK_":["Open emoji picker for ",["keyName"]],"bD8I7O":["Complete"],"bGa3Fk":["Uploading file"],"bH382I":["Edit this HTML — the preview updates live."],"bHboUQ":["Edit template"],"bS_boY":["Replace current match"],"bUUVED":["Asset"],"bWLmRK":["Could not fetch branch. Check your connection."],"bcDHUM":[["descriptorLabel"]," — render error, source editable below"],"bcjYUA":["Fold or unfold source"],"bkQRMh":["Paragraph"],"bmC18N":["Clearing local collaboration data for \\"",["docName"],"\\" before reconnecting."],"brCtGB":["History unavailable"],"bultyE":["When enabled, the agent opens or refreshes the preview after each edit. Disable if you manage your own preview window (OK Desktop, a browser tab on another display, etc.)."],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c1LZZH":["Link copied."],"c5f7sm":["Code block language: ",["currentLabel"],". Click to change."],"c5rF4v":["What is this knowledge base for?"],"c863eW":["Could not switch to ",["shareBranch"],". Try switching manually."],"c8iK2Y":["No templates found."],"cEoyWz":["Add item to ",["keyName"]],"cEx1UT":["Setup Open Knowledge in this folder?"],"cF9DyA":["Reconnecting after server restart"],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cOSAfL":["No repositories found on your GitHub account."],"cOrTMo":["Your share link is ready below."],"cSCbv3":["BETA"],"cUK8lW":[["conflictCount","plural",{"one":["#"," conflict"],"other":["#"," conflicts"]}]],"cUk6TF":["Sync failed — check the server logs for details."],"cV7LOw":["Team Wiki"],"cZGNlb":["Add another pattern"],"cZI5AL":["OK Desktop"],"cZ_8zB":["Stays on this computer."],"cdm00A":["No Incoming"],"cdmk8A":["Uncommitted changes"],"cklVjM":["Timeline"],"cnGeoo":["Delete"],"coIbL2":["Choose whether this project's Open Knowledge setup, including its AI-tool connections, is saved with the project so teammates get it too, or kept only on your computer."],"cqQyPB":["Folder name"],"cs4mps":["Config sharing"],"csDS2L":["Available"],"ct2kv5":["No headings in ",["pageTarget"]],"cuA8QW":["Organize specs"],"d2uTPx":["Server error (HTTP ",["status"],")"],"d5rK4X":[["chars","plural",{"one":["char"],"other":["chars"]}]],"dD7NPy":["Outline"],"dDpCOp":["Rename succeeded but the sidebar may be out of date — refresh to resync"],"dEgA5A":["Cancel"],"dJw2_7":["Saved with the project for your team."],"dN20LW":["Semantic search is on, but no API key is set — search falls back to keyword matching. Add one in <0>Settings → Account</0> (it's stored once for your whole machine)."],"dNM58w":["Claude Code (claude) isn't installed or on your PATH."],"dOHMA0":["Failed to move"],"dOxPd4":["Footnote"],"dPOFid":["Show or hide terminal"],"dTaauv":["Reason: ",["reason"]],"dUQ7_J":["Add meaning-based ranking to search so conceptually-related pages surface even when they share no keywords. This setting applies only to this computer."],"dURmlQ":["\\"frontmatter\\" is a reserved property name"],"dbhUX1":["Hide this file"],"dbtjJh":["(opens in new tab)"],"djc1l9":["More than ",["0"]," requests were blocked by the preview's security policy"],"djjdjr":[["deleteCount","plural",{"one":["Delete"],"other":["Delete ","#"," items"]}]],"dprWmL":["Anchor in this page"],"dr1vFs":["Replace all matches"],"dvGKu2":["Shared auto-sync default"],"dw_dUJ":["Failed to duplicate path"],"e0NrBM":["Project"],"e1Rn_k":["Open containing folder"],"e1hptq":["Embed a video with native player controls."],"e4GHWP":["Pull"],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"e8zRrb":["Show Files"],"eBIT9h":["Paste failed.",["restoreSuffix"]],"eFJkVt":["Clone failed: ",["cloneError"]],"eG8Jsg":["Toggle source tab focus mode"],"eJitUk":["Upload from computer"],"eKThTQ":["Failed to reorder"],"eNQGRb":["Inline LaTeX math rendered with KaTeX."],"ePK91l":["Edit"],"eSu2Xn":["Writes a project-MCP config for each selected tool; Claude also gets <0>.claude/launch.json</0>."],"eVPynQ":["Open <0><1>",["verificationUri"],"</1><2/></0> and enter this code:"],"emgiet":["Authoritative content; mirrored verbatim everywhere it's referenced."],"euc6Ns":["Duplicate"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f1XQyZ":["Move block"],"f65AOQ":["Start from"],"f8jU-L":[["0"],"/",["1"]," — ",["2"]],"fBHvBn":["There's no project folder for this window, so a terminal can't start here."],"fBaTkM":["Toggle the bottom terminal panel."],"fG0X0e":["Install ",["brand"]," →"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fNr-MX":["Disable semantic search"],"fRv-ei":["Start a new Open Knowledge project."],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fYKgzG":["Failed to load recent projects."],"fYjgXu":["Unordered list of items."],"fbdLmk":["Toggle bold formatting."],"fbsiBw":["Something went wrong starting the terminal."],"fcgvCA":["Claude"],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"fqSfXY":["Replace"],"fwhX-N":["Indent or outdent source"],"g3UF2V":["Accept"],"g4XBm0":["Small section heading."],"g58Kwy":["<",["descriptorLabel"],"> failed to render (likely a bad prop). Copy the source to see what went wrong, or delete the block."],"gBbxn_":["Checking sign-in status"],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gITz7o":["Move the cursor or extend selection through CodeMirror's standard source-editor navigation keymap."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gKi-a_":["New project"],"gQV-9w":["Branch switched but the ",["targetNoun"]," could not be opened — try navigating to it manually."],"gUlRQj":["Orphans"],"gYz2ep":["Expires in ",["timeLabel"]],"gbHcbI":["Failed to delete property"],"gcV0dI":["The folders and templates are in place; there's nothing left to scaffold."],"gfohmY":["Connect tools"],"ggm6JX":["This page doesn't exist yet. Open it to create the page in the editor and collapse the graph."],"ggs9f8":["Search files, folders, or commands"],"gijbne":["Failed to rename path"],"gljvbT":[["words","plural",{"one":["word"],"other":["words"]}]],"gmJ0An":["Failed to open folder."],"goO4Ll":["Editor status bar"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtEbeW":["Highlight"],"h06R3C":["No pages are missing outgoing graph links."],"h6EvY-":["This will replace the current document content with the version from <0>",["relative"]," (",["absoluteTime"],", ",["entrySha"],")</0> by <1>",["authorName"],"</1>. Your current content is already saved in the timeline — you can restore it anytime."],"h7FzJC":["Link-graph response did not match expected shape."],"hA8GQ6":["Will replace existing Open Knowledge entry"],"hBMK4W":["Project templates"],"hDKtoF":[["diffHrs"],"h ago"],"hDoLrm":["Remove ",["projectName"]," from recent projects"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hHMv6l":["Delete block"],"hSBIG-":["A title, description, tags — anything that describes this folder."],"hSySVc":["Install handoff failed: ",["msg"]],"hXUWyd":["Value is required"],"hXbSxc":["Asset: ",["title"]],"hY8pka":["Select next occurrence"],"hYDc6B":["Name cannot be empty"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"he3ygx":["Copy"],"hjO0Mq":["Add tab"],"hozzkE":["Create with Claude CLI"],"hpDtUm":["External wiki link"],"hwFOFD":["Settings failed to load"],"hxBHxQ":["A line with a footnote<0><1>[1]</1></0> and a definition shown below."],"hxEUVJ":["Initialize ",["selectedPackName"]],"hyCxJY":["Open that worktree instead"],"hynz2K":["Download started"],"i1flq_":["Wiki link suggestions"],"i3f2kh":["No matching commands."],"i92eAT":["We'll create a repository and start syncing — no terminal needed."],"i9OyGp":["Undo or redo"],"i9toLO":["Agent configuration file"],"iDZtvM":["Failed to load templates: ",["message"]],"iEQQyu":["Agent"],"iEYxO4":["Show thumbnails"],"iGCs04":["No templates available"],"iH8pgl":["Back"],"iHAJDj":["Resolving default location"],"iKSP5j":["Word wrap"],"iMkWoF":["Turn on"],"iNFKkm":["No diff."],"iOHg1t":["Open embedded URL in new tab"],"iSQTsg":["Ordered list"],"iSnkwB":["Failed to open cloned project."],"iTlqm3":[["ahead","plural",{"one":["#"," commit ahead"],"other":["#"," commits ahead"]}]],"iTylMl":["Templates"],"iXTp5j":["Scope: "],"idD8Ev":["Saved"],"ig5vUe":["Failed to load file"],"iilQXA":["Folder duplicated"],"ijLc3m":["Bullet list"],"iqIDv4":["Sync status unavailable"],"iqugog":["Initialize failed: ",["errorDetail"]],"irFGwu":["Template list"],"isRobC":["New"],"iuTKci":["No edits yet."],"iycx_A":["Pushing"],"j6LB7S":["This project's running server doesn't support live editing. Restart Open Knowledge to fix."],"j9Vqvc":["inherited"],"jEdF24":["Missing page: ",["linkTitle"],". Click to create."],"jGJy-9":["Downloads ",["shareOwner"],"/",["shareRepo"]," from GitHub."],"jKd3AP":["Could not enable the terminal: ",["0"]],"jPUPvG":["Couldn't resolve the conflict for ",["filePath"],"."],"jRHdCz":["Failed to load PDF"],"jSO1X5":["Inherited templates can't be renamed here — rename it in the folder that owns it."],"jSY41h":["\\"",["docName"],"\\" took too long. Check your connection."],"jTLWxh":["Embed an external page in an inline iframe (docs, demos, Figma, CodeSandbox)."],"jZ_E5M":["Fetch failed — check the server logs for details."],"j_Z6g7":["Shared default"],"jbSG8V":["Show Files (",["sidebarShortcutLabel"],")"],"jdGUeI":["Couldn't create template: ",["error"]],"jerqF0":["Loading branch state"],"jhtG3I":[" Your selection has been restored."],"jjtmV_":["First file name"],"jol95m":["Failed to open Project Navigator."],"jtg_8-":["Build a knowledge wiki about the different types of flightless birds. Start with an overview page, then add cross-linked pages for each major group (ratites like ostriches, emus, and kiwis; penguins; and flightless rails), the regions they live in, and a timeline of how flightlessness evolved."],"ju38ms":["This project has no git repository — sharing mode does not apply. Initialize a repo to enable the toggle."],"jwnpdM":["A template named <0>",["trimmedSlug"],"</0> already exists here. Saving creates a local copy that overrides it for this folder."],"kCNU4q":["Indexing your pages — ",["semanticIndexedCount"]," of ",["semanticTotalCount"]," ready. Results may be incomplete."],"kCqCyf":["Open CodeMirror's lint diagnostics panel."],"kFLlsI":["Insert a footnote reference + matching definition stub."],"kNqMMd":["Folder"],"kUn-CN":["Sync off"],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kYL1lH":["Agent activity"],"k_pade":["Config sharing is now shared. Commit the OK files to share with your team."],"k_yIIc":["Will be created at: <0>",["targetPreview"],"</0>"],"kdzzOK":["Off — search ranks by keyword only. No content leaves this computer."],"keNFEd":["Set identity"],"kj9pAE":["Creating page"],"kknhfj":["No changes"],"kmKqZg":["Clusters"],"knjOzA":["Tag value"],"kolRU1":["Do you want to permanently delete instead?"],"ku0yLQ":["Pages are embedded the first time a search needs them."],"ky9Tuc":["Edit ",["0"]," source"],"l17ab4":["Could not write project files. Try a different location."],"l1aQKz":["Visual editor table"],"l1l8sj":[["0"],"d ago"],"l3mSlL":["Append-only timeline"],"l6OXqI":["No installed agents found"],"l8G3S9":["Auto-sync is off — you don't have permission to push to this repo"],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lGs_bQ":["Page <0>*</0>"],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lIn9L9":["Disable sync"],"lLGJG6":["Couldn't connect Open Knowledge tools to Claude Code. Please try again."],"lPzyrU":["All hunks resolved"],"lVWEIL":["Indexed ",["embedded"]," of ",["total"]," pages."],"lWNpNB":["Add cursors or select matching occurrences through CodeMirror."],"lXKZGw":["Heading 1"],"lZAiSP":["Backlinks response did not match expected shape."],"l_FAT6":["Use letters, digits, <0>-</0> or <1>_</1> only."],"l_UFPv":["Properties"],"lb_UU4":["Sync now"],"lbkOif":["Undo or redo visual-editor changes through TipTap collaboration history."],"lhjq3G":["Reset ",["labelText"]," to default"],"lkYioO":["Show or hide document panel"],"ll2yNl":["Content directory"],"lond3p":["Shows above the code body. Round-trips as \`title=\\"...\\"\` in markdown."],"lrhetp":["+ ",["overflow"]," more"],"ls1N1w":["(missing)"],"lyWa43":["Project-level disconnected pages"],"lzmtKp":["Failed to load folder properties: ",["message"]],"lzwo7p":["Could not open GitHub sign-in. Please try again."],"m16xKo":["Add"],"m2T1Xj":["Tag #",["tagValue"],", ",["uses"]],"m4v3XT":["Undo last edit on ",["docName"]],"m6YGpY":["Active panel content for the selected tab shows here."],"mBltnd":["Path suggestions"],"mGaZwZ":["See the full install guide"],"mHVPm5":["Reconnect required"],"mKZODc":["Adds the Open Knowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"mNY1G6":["Undo all edits"],"mPy9lS":["Organize my existing specs into a linked index grouped by area, and flag any that have drifted out of sync with the current code."],"mSJ3Rn":["Computing scaffold plan"],"mU3j1b":["Remove item ",["0"]],"mWVJRX":["Collapsible section with a clickable summary."],"mYGY3B":["Date"],"mYLRjR":["You picked ~/Desktop. Open Knowledge will index everything on your desktop."],"mZ1r4i":["Create a document from ",["label"]],"maDWIB":["Mirror source <0>api-spec</0>"],"makN88":["No patterns yet. Type a folder or file name below to start hiding files."],"mdKFEy":["You cancelled loading \\"",["docName"],"\\"."],"mdzKSV":[["nodeCount","plural",{"one":["#"," node"],"other":["#"," nodes"]}]],"mf37rL":["Retrying"],"mg0YGL":["Source multi-cursor and multi-select"],"mk2poV":["e.g. server.ts"],"mmpzAq":["Wrap long lines in the markdown source editor."],"mo22UP":["Toggle inline code formatting."],"mqSwZH":["<0>Mirror anchor not found.</0> No <1>",["mirrorSourceTag"],"</1> exists in <2>",["src"],"</2>."],"msOK6I":["Repositories you've already cloned may keep syncing through git's own saved credentials, even after you disconnect."],"mwMF9u":["Open CodeMirror search in source editor mode."],"mxY24F":["Duplicate the focused file-tree item when focus is in the Files sidebar."],"n2lRue":["Commit or stash changes to switch:"],"n5n_vi":["Private repository"],"n6hXUm":["Auto-sync periodically fetches, pulls, and pushes commits to your remote git repository so your edits stay in sync across machines."],"n7aopT":["Editor mode"],"nCzR-G":["Copy code ",["userCode"]],"nDT8qt":["Initialized ",["0"]," but could not open it."],"nNYV3Y":["and ",["remaining"]," more"],"nPhvQ_":["Claude Code is installed, but Open Knowledge tools aren't connected to it yet."],"nTwL53":["Open a doc to share its URL."],"nWv1ja":["Manage hidden files in Settings → Ignore patterns."],"nYKerc":["(user-level only)"],"nYeBmY":[["hours"],"h ago"],"nbfdhU":["Integrations"],"ndeI89":["Use Cmd/Ctrl+C to copy the link below, or open OK in the desktop app."],"neRy3o":["Split list item"],"nft48x":["Stored at <0>.ok/templates/</0> in this project. Available in every folder (folder-scoped templates can override by filename)."],"nh3wwx":["Embeddings provider key"],"njBeMm":["Both"],"njU86j":["Property \\"",["trimmed"],"\\" already exists"],"noH1JX":["Couldn't reach collab server — ",["errorDetail"],". Try <0>ok status</0> or check <1>.ok/local/last-spawn-error.log</1>."],"nrGWJ7":["Git identity isn't set — commits use a default author. Set yours so teammates see your name."],"nskygk":["Choose agent"],"nzHlj8":["Close ",["0"]],"nzaV6Q":["Page thumbnails"],"o2yoFu":["Reveal in Finder, No workspace"],"o49mDZ":["Loading timeline history"],"o4dcAf":["Reveal in File Explorer, ",["hint"]],"o5gfs1":["This setting is per-machine and isn't shared with collaborators. It needs an API key set with <0>ok embeddings set-key</0>."],"oAFVKX":["Failed to update the project sync default — ",["detail"]],"oBXkm2":["Delete code block"],"oCZkaG":["Copy path"],"oJl7eO":["Unknown component: ",["componentName"]," — source editable below"],"oKBnk5":["More requests were blocked."],"oQA-cA":["Full path"],"oS1YpJ":["Open the Project Navigator."],"oXKEsy":["Delete an adjacent wiki-link or tag chip."],"oYepHb":["The terminal is turned off for this project. Turn it back on to run commands here."],"ogAuyr":["Back to document view"],"omXJcU":["Close others"],"optX0N":[["0"],"h ago"],"oqB2ez":["Previous match"],"ot5BRK":["Duplicate selected file or folder"],"otE4aj":["Show external URL nodes"],"ou1hFW":["Toggle an ordered list."],"outYNy":["Duplicate name \\"",["keyName"],"\\""],"ovIGrT":["Local collaboration data for \\"",["docName"],"\\" could not be cleared. Reload to retry."],"p0Iq25":["Insert link"],"p9sdCy":["New ignore pattern"],"pAgkuZ":["Reopening \\"",["docName"],"\\" with a fresh local collaboration cache."],"pEQFsW":["No matching projects."],"pFagOn":["Source editing"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pRc-Im":["Undone all edits on ",["docName"]],"pTPqMK":["Toggle a fenced code block."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pZAs1T":["Failed to load outgoing links"],"pajIrl":["Could not turn off the terminal: ",["0"]],"pbwTg6":[["seconds"],"s ago"],"pckX1A":[["0","plural",{"one":["#"," use"],"other":["#"," uses"]}]],"pgq_xf":[["0"],"/",["1"]," ",["2"]],"phM8Kh":["Found the repo but could not open the project. Please try again."],"pha01Y":["Project-level pages with no incoming graph edges."],"pkAft1":["Search failed."],"pmKdif":["Failed: ",["loadError"]],"pmUArF":["Workspace"],"ppDgFi":["Restart with this app's version"],"prHfed":["Each selected tool gets an Open Knowledge MCP entry."],"pzutoc":["Italic"],"q2kXMG":["Inline Math"],"q4YJl_":["The terminal session ended (exit code ",["0"],")."],"q6-JVU":["Loading pages"],"qAQVSD":["Page headings response was not JSON"],"qAhFeg":[["userName"]," · ",["tabCount","plural",{"one":["#"," tab"],"other":["#"," tabs"]}]],"qEIFZu":["Key ending in ",["keyHint"]],"qEue6Q":[" or "],"qFWMl-":["View as text"],"qNOgUu":["Edits at the source land here — no copy-paste drift."],"qRZh7J":["Let Tab leave the source editor instead of indenting."],"qSKu2v":["Source navigation and selection"],"qSxaOz":["Accept their deletion"],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qZv5ZR":["Config sharing toggle failed"],"q_9EcE":["Enable git auto-sync?"],"q_z77Z":["Heading levels"],"qaHyRJ":[["linkCount","plural",{"one":["#"," link"],"other":["#"," links"]}]],"qbfj1f":["Receiving objects"],"qdBUHP":["Couldn't load ",["fileName"]],"qi1F96":["Reveal in File Explorer"],"qioCwA":["Jump to page ",["pageNumber"]],"qjHMHf":["Failed to disable sync — ",["detail"]],"qo4zCg":["Path cannot contain backslashes"],"qpQwGC":["Describe what you're working on and the agent sets it up for you."],"qvWGzP":["Collapse all"],"qvcK7S":["Open Knowledge will create commits and push them to your remote automatically. If you do not want automatic commits in your git history, you should not enable auto-sync."],"qyLmWw":["Source editor search panel"],"r2huLx":["Undo, redo, or undo selection changes through CodeMirror history."],"r4R7AZ":["Network error during cleanup"],"r51jLC":["File saved & Claude Desktop App opened"],"r871ed":["Your knowledge base is now on GitHub at <0>",["ownerLogin"],"/",["repoName"],"</0>."],"rBc32v":["Couldn't reach the embeddings provider — press ↵ to retry"],"rFw02Q":["Uploading ",["keyName"]],"rJVoVX":["Source find results"],"rQAQus":["Couldn't save template: ",["error"]],"rQRrkB":["yesterday"],"rVgSRB":["Collapse ",["docName"]],"rVxu1k":["No pages link here yet."],"rXz97P":["Numbered list of items."],"rZ9HZq":["To do"],"rZVMkf":["Visual editor replace input focused"],"rageVb":["Custom HTML with a live preview pane (sandboxed iframe)."],"rdU729":["Layout"],"rfFpcF":["Remove ",["chip"]],"rgPqOw":["Convert the current block to a paragraph."],"riqekz":["Suggestion menu navigation"],"rlUzXK":["Could not validate folder. Please try again."],"roAe2K":["Link URL"],"roiUQQ":["This page doesn't link to anything yet."],"rppgXF":["Disconnecting"],"rssK8c":["Ignore patterns (raw text)"],"rtdR4v":["Show or hide Files"],"rwrPbS":["Component boundary navigation"],"s-MGs7":["Resources"],"s-XOaI":["File name"],"s061i4":["Relative path"],"s0IDhW":["This file could not be found."],"s0J_k9":[["0","plural",{"one":["#"," key"],"other":["#"," keys"]}]],"s1c0ja":["Bullet List"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sIGbBZ":["Convert selection to footnote"],"sIxSSP":["Resolve conflict in your terminal"],"sJK6pq":["Permission denied"],"sJWhgo":["Unknown component: ",["unregisteredComponentName"]],"sOxZaS":["Failed to load graph"],"sZ2IOu":["This ",["targetNoun"]," was shared from branch <0>",["shareBranch"],"</0>. It doesn't exist on your current branch (<1>",["currentLabel"],"</1>)."],"saIASg":["Second item"],"saYiIO":["Path cannot contain null bytes"],"shNd9t":["Slash command menu"],"skf5Ix":["Indent or outdent source editor lines."],"snrVQ7":["probe failed"],"ssuwjF":["Branch"],"stlgky":["On — your search queries and the text of matching pages are sent to your embeddings provider (OpenAI by default) to compute embeddings."],"sxTdZI":["Loading paths…"],"sxkWRg":["Advanced"],"t-JXbf":["Notion-style inline row for a downloadable file. Drag-drop also works."],"t18QYR":["Unpin ",["accessibleLabel"]],"t2TkQ3":["Sync paused — resolve conflicts to resume."],"tAPZEx":["Below"],"tP5DDk":["Apply link"],"tUvUfp":["Use a folder you already have."],"tW_yvQ":["Expand ",["docName"]],"t_YqKh":["Remove"],"tfDRzk":["Save"],"tfi40B":["Failed to create page"],"tgWuMB":["Modified"],"tiWX6q":["Source editor"],"tjXez2":["blog-post"],"tsiTqO":["Paste your API key"],"u-9fWA":["See <0>Architecture</0> for the system overview."],"u3BOHd":[["fileCount","plural",{"one":["#"," file"],"other":["#"," files"]}]],"u3YnKw":["Could not construct share URL."],"u3wRF-":["Published"],"u6Hp4N":["Markdown"],"u7H-Wn":["Show panel (",["panelShortcutLabel"],")"],"uCaIdy":["GitHub sign-in is missing or expired. Reconnect to resume syncing."],"uDlyqd":["Document the architecture of this repo: create an overview page that links to a page per major module describing its responsibilities and entry points."],"uF9ruK":["Saving"],"uH_S-u":[["loadErrorTitle"],": ",["message"]],"uKRYiW":["Sync status unavailable — server error."],"uL_Wx8":["The terminal stopped unexpectedly."],"uM6jnS":["Restore failed"],"uO9WLl":["Push"],"uQNW00":["Detached HEAD — checkout a branch to resume"],"uQewpR":["Couldn't restart the server — it's running under a different account. Restart your computer to clear it, then reopen this project."],"uWtdQR":["No templates yet. Add one in this folder's Templates section, or in Settings → Templates."],"uWx2ZP":["Last sync"],"u_lS4C":["Clone complete — opening project"],"ubMwcO":["The terminal session ended (signal ",["0"],")."],"ugoTXs":["folder"],"uhJEA2":[["count","plural",{"one":["#"," more participant"],"other":["#"," more participants"]}]],"uksqrP":["Repository not found. It may have been renamed, deleted, or moved."],"un8kBM":["Creating page: ",["linkTitle"],"."],"ur2XSb":["Visual editor"],"uuoHOU":["Command failed."],"uynXup":[["tokens","plural",{"one":["token"],"other":["tokens"]}]],"v-h2hx":["Delete ",["targetGitPath"]],"v2ZW0K":["Enable terminal"],"v41fCm":["File not found"],"v75Em9":[["uploadedCount","plural",{"one":["Uploaded one file"],"other":["Uploaded ",["uploadedCount"]," files"]}]],"v7lbnC":["Find next match"],"vDXqVv":["Insert a markdown hard break."],"vEJDlt":["The file is in your Trash; the file-watcher will reconcile."],"vGeNNQ":["Copy a prompt and paste it into your agent to set up your project."],"vIxrEk":["Fit width"],"vLyv1R":["Hide"],"vPYaz3":["Scaffold directly under this project."],"vQIVHc":["Folder properties"],"vWc9a0":["Type to edit; <0>⌘ Enter</0> saves, <1>Esc</1> cancels."],"vZVeFG":["Upload failed — please try again"],"vbK_ZG":["Files sidebar"],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"vhAnzJ":["Turn on semantic search?"],"viwC-K":["Failed to remove project."],"vv7kpg":["Cancelled"],"vvWZnu":["Diff unavailable"],"w3tVpc":["No links yet. Add wiki links or markdown links to build a graph."],"w3vFfL":["Hide Files"],"w4hMYl":["Could not read branch state for this project. Close this dialog and open the share link again."],"w7nm4K":["Indented blockquote for citations."],"wJijgU":["Location"],"wJo9oS":["Close find"],"wQp1V3":["Mirror of <0>",["src"],"</0>"],"wT4iQr":["Open visual-editor find with replace controls expanded."],"wTcjov":["No workspace"],"wXO4Tg":[["hrs"],"h ago"],"wbv9xO":["Create new project"],"wbwHYD":["Enable sync"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"wndeIl":["Project-level pages with neither incoming nor outgoing graph edges."],"wtcxiD":["Share this setup with your team?"],"wvbc1r":["Couldn't open document"],"x2fr_j":["Graph"],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"x57cJf":["Open link"],"xCJdfg":["Clear"],"xCdTnb":["Close new tab"],"xDBki3":["Heading suggestions"],"xFQRu4":["I already have it locally"],"xG4tb6":["Lost connection to \\"",["docName"],"\\"."],"xHGM4U":["Hide HTML preview"],"xK291b":["Two-page (odd)"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"xOTzt5":["just now"],"xSVO3J":["What gets created"],"xXo8FT":["Save failed: ",["error"]],"xYMPyY":["Paste was incomplete — ",["chunksCompleted"]," of ",["totalChunks"]," chunks landed.",["restoreSuffix"]],"xaDWAI":["Switch project"],"xbdtfY":["Markdown source"],"xc4g25":["Parse failed"],"xeXS4P":["Or use a starter pack"],"xeiujy":["Text"],"xhlFsx":["Inherited — set a value here to replace it."],"xiv-dW":["No files yet."],"xsZhu-":["Page number"],"xzktOa":["Edit wiki link"],"y1t8bQ":["Settings sections"],"y3aU20":["Save changes"],"y46m5r":["The desktop app isn't responding. Refresh and try again."],"y5FUYi":["Suggestion menu open"],"yCX4jp":[" Your selection could not be restored."],"yEJ-sl":["The preview blocks resources that don't meet its security rules (for example plain http:// URLs, or code that uses eval). The content above may render incompletely."],"yFyZMJ":["No pages matched \\"",["semanticQueryText"],"\\" by meaning."],"yH7T4q":[["failedCount","plural",{"one":["1 file failed to upload"],"other":[["failedCount"]," files failed to upload"]}]],"yHikCO":["Open CodeMirror's go-to-line prompt."],"yIPXut":["Preparing search"],"yKu_3Y":["Restore"],"yLq4w4":["Separator"],"yMgL_E":["Find field navigation"],"yQE2r9":["Loading"],"yUxR-Q":["Expand ",["keyName"]],"yWWThY":["Asset reference"],"yYR6za":["Display text"],"yZmvQ4":["This project's server (v",["0"],") is newer than this app (v",["1"],")."],"y_5CE8":["Item ",["0"]],"yf5r22":[["keyName"]," type: ",["typeLabel"]," (inherited from folder properties; not editable here)"],"ygbd_U":["Open Knowledge stores its configuration and internal files inside a newly created <0>.ok</0> directory in your project root folder."],"yjExfe":["Branch <0>",["shareBranch"],"</0> is checked out in:"],"ylXj1N":["Selected"],"ynIa4S":["Visual editor list item"],"ypw6My":["Showing top ",["0"]," headings — keep typing to narrow"],"ysxgu8":["project"],"yu8Pzy":["Not detected"],"yutJKi":["Checklist with checkboxes."],"yvG-l1":["Open source lint panel"],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"yzF66j":["Link"],"yzGPkm":["Expand graph"],"z0a2EA":["Diagram from Mermaid source — flowchart, sequence, class, state, ER, gantt, pie."],"z1uNN0":["No emoji found."],"z2JdQ-":["Config sharing unchanged — see details below."],"z5pqI8":["Cannot upload: no document is open"],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"zAsDLY":["Graph visualization of document links"],"zEfRFN":["Using the <0>OK_EMBEDDINGS_API_KEY</0> environment variable (managed outside Open Knowledge)."],"zL0LPh":["Global outside text fields"],"zLGXna":["No starter packs available."],"zLak8b":["Activate new tab"],"zQBg2C":["Move the current block up or down one position."],"zUhPuR":["Open containing folder, ",["hint"]],"zXZ0sB":["Open Knowledge initializes at <0>",["projectDir"],"</0> — the parent of <1>",["pickedRelative"],"</1> because it contains a <2>.git</2> folder (one .ok/ per git repo). <3>Content directory</3> defaults to <4>.</4> (the whole repo); type a sub-folder to narrow it."],"zXj1rA":["Search by meaning"],"zZ_I5K":["Open project menu"],"zaXlhf":["The properties block at the top of this doc has a formatting error. Switch to source mode to fix it."],"zbymaY":[["0"],"m ago"],"zgSFyG":["External link"],"zkz0Fg":["Set up syncing"],"zlErBl":["Page headings error response did not match RFC 9457"],"zo3Dl7":["Toggle thumbnails"],"ztKII6":["Failed to add item"],"zwBp5t":["Private"]}`)},pp=`en`;ms.load(pp,fp.messages),ms.activate(pp);var mp=Symbol.for(`ok.client.logForwarder`),hp=2e3,gp=[`log`,`info`,`warn`,`error`],_p={log:`info`,info:`info`,warn:`warn`,error:`error`};function vp(e){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function yp(e){let t=e.message.length+80;if(e.event&&(t+=e.event.length),e.fields)try{t+=JSON.stringify(e.fields).length}catch{}return t}function bp(e={}){let t=e.windowObj??(typeof window<`u`?window:void 0);if(!t||t.okDesktop)return;let n=t;if(n[mp])return;n[mp]=!0;let r=e.consoleObj??console,i=e.documentObj===void 0?typeof document<`u`?document:null:e.documentObj,a=e.flushIntervalMs??hp,o=e.fetchImpl??n.fetch.bind(n),s=e.now??Date.now,c=[],l=0,u=null,d=!1,f={log:r.log.bind(r),info:r.info.bind(r),warn:r.warn.bind(r),error:r.error.bind(r)};function p(){if(u!==null&&(clearTimeout(u),u=null),c.length===0)return;let e=c.splice(0,100);l=0,d=!0;try{o(`/api/client-logs`,{method:`POST`,headers:{"content-type":`application/json`},keepalive:!0,body:JSON.stringify({entries:e})}).catch(()=>{})}catch{}finally{d=!1}}function m(e){if(c.push(e),l+=yp(e),c.length>100){let e=c.shift();e&&(l-=yp(e))}if(c.length>=100||l>=32768){p();return}u===null&&(u=setTimeout(p,a))}function h(e,t){if(!d)try{let n=Fr(t.map(vp).join(` `)),r=t[0],i=typeof r==`string`&&r.length<=32768?r:void 0,a=i?cr(i):null,o=a?.fields;if(o)try{JSON.stringify(o).length>8192&&(o=void 0)}catch{o=void 0}m({level:e,message:n,ts:s(),...a?.event?{event:a.event}:{},...o?{fields:o}:{}})}catch{}}for(let e of gp)r[e]=(...t)=>{f[e](...t),h(_p[e],t)};let g=e=>{if(d)return;let t=e;h(`error`,[`uncaught error: ${t.message} (${t.filename}:${t.lineno}:${t.colno})`])},_=e=>{d||h(`error`,[`unhandledrejection: ${vp(e.reason)}`])},v=()=>p(),y=()=>{i&&i.visibilityState===`hidden`&&p()};n.addEventListener(`error`,g),n.addEventListener(`unhandledrejection`,_),n.addEventListener(`pagehide`,v),i&&i.addEventListener(`visibilitychange`,y);function b(){for(let e of gp)r[e]=f[e];n.removeEventListener(`error`,g),n.removeEventListener(`unhandledrejection`,_),n.removeEventListener(`pagehide`,v),i&&i.removeEventListener(`visibilitychange`,y),u!==null&&(clearTimeout(u),u=null),c.length=0,delete n[mp]}return{flushNow:p,uninstall:b}}function xp(e,t){return e.branch===void 0||e.branch===null||e.branch===``||t===``||e.multiCandidate!==!0?null:{message:`Opened on branch ${e.branch}`,description:t}}function Sp(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e}),r=e.emitToast??((e,t)=>{hs(e,t)});return t.onDeepLink(e=>{let i=e.kind??`doc`;if(e.targetMissing===!0){r(`This ${i===`folder`?`folder`:`file`} isn't in your local checkout${e.branch===void 0||e.branch===null||e.branch===``?``:` on branch ${e.branch}`} yet`,{description:`Pull the latest changes, then open the share link again.`,duration:5e3});return}n(Go(i,e.doc,i===`doc`?e.branch:void 0));let a=xp(e,t.config.projectPath);a!==null&&r(a.message,{description:a.description,duration:3e3})})}var Cp=4e3,wp=1440*60*1e3;function Tp(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){hs.success(`Opened existing Open Knowledge project at ${e.ancestorPath}`,{duration:Cp});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>qn[e]??e).join(`, `);t.push(`repaired ${n} MCP integration`)}else e.mcp.status===`failed`&&t.push(`MCP auto-repair failed`);e.path.status===`installed`&&t.push(e.path.summary),e.path.status===`failed`&&t.push(`PATH install failed: ${e.path.summary}`);let n=t.length>0?t.join(`; `):`Open Knowledge integrations checked.`,r=e.mcp.status===`failed`||e.path.status===`failed`,i=e.path.status!==`none`;hs[r?`error`:`success`](n,{duration:r||i?wp:Cp});return}if(e.kind===`sharing-refused-tracked`){hs.error(`Config sharing unchanged: ${e.tracked.length} OK file(s) tracked upstream — see message below.`,{duration:wp,description:e.remediation});return}if(e.kind===`sharing-no-git`){hs.warning(`Local-only requested but no git repository was created. Switch later via Settings → Config sharing once the project is in a git repo.`,{duration:Cp});return}let t=Xs(e.gitRoot,e.pickedPath)??e.pickedPath;hs.success(`Initialized Open Knowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Cp})})}function Ep(e){let t=(0,$.c)(18),{body:n,warning:r,restartLabel:i,cancelLabel:a,onRestart:o,onDismiss:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Lo,{className:`mt-0.5 size-4 shrink-0 text-amber-500`}),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=(0,Z.jsx)(`p`,{className:`font-medium text-sm`,children:n}),t[1]=n,t[2]=l);let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[3]=r,t[4]=u);let d;t[5]!==o||t[6]!==i?(d=(0,Z.jsx)(ci,{size:`sm`,onClick:o,children:i}),t[5]=o,t[6]=i,t[7]=d):d=t[7];let f;t[8]!==a||t[9]!==s?(f=(0,Z.jsx)(ci,{size:`sm`,variant:`ghost`,onClick:s,children:a}),t[8]=a,t[9]=s,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==u||t[16]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full gap-3 rounded-lg border bg-popover p-4 text-popover-foreground shadow-lg`,children:[c,(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[l,u,p]})]}),t[14]=l,t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function Dp(){return ms._({id:`P8jws3`})}function Op(e){return e.serverRuntime===e.appRuntime?ms._({id:`L5Xu8C`,values:{0:e.appRuntime}}):e.relation===`older`?ms._({id:`5z2tUG`,values:{0:e.serverRuntime,1:e.appRuntime}}):ms._({id:`yZmvQ4`,values:{0:e.serverRuntime,1:e.appRuntime}})}function kp(e){return ms._({id:`2YOwme`,values:{appRuntime:e}})}function Ap(e){return ms._({id:`VsBxkh`,values:{appRuntime:e}})}function jp(e){return e===`eperm`?ms._({id:`uQewpR`}):ms._({id:`PqYWiC`})}async function Mp(e){let t=hs.loading(ms._({id:`Kf7GG5`}),{duration:1/0}),n;try{n=await e.restartServer(e.config.projectPath)}catch{return}hs.dismiss(t),n.ok===!1&&hs.error(jp(n.reason),{duration:1/0})}function Np(e){let t=e.bridge;if(!t)return;let n=t.onServerVersionDrift(e=>{hs.custom(n=>(0,Q.createElement)(Ep,{body:Op(e),warning:Dp(),restartLabel:ms._({id:`ppDgFi`}),cancelLabel:ms._({id:`PBxg_E`}),onRestart:()=>{hs.dismiss(n),Mp(t)},onDismiss:()=>hs.dismiss(n)}),{duration:1/0})}),r=t.onServerRestarted(e=>{hs.success(kp(e.appRuntime))}),i=t.onServerReclaimed(e=>{hs.warning(Ap(e.appRuntime),{duration:15e3})});return()=>{n(),r(),i()}}var Pp=!1;function Fp(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{le(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Ip(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 Lp=0,Rp=0,zp=0,Bp=0,Vp=null,Hp=[`linkResolutionDecoration$`],Up=new WeakSet,Wp=new WeakSet;function Gp(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Kp(){return!1}function qp(){return!Kp()}function Jp(e,t){if(qp())return t;let n=`ok/cold/nodeview-factory-${Gp(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;le(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Yp(e){if(qp())return;let t=e.state.plugins;for(let e of t){if(Wp.has(e))continue;let t=e.spec?.key?.key;if(!t||!Hp.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Wp.add(e);continue}let i=`ok/cold/decoration-${Gp(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;le(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Wp.add(e)}}function Xp(e){if(qp())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=Jp(e,n);r.__okWrapped=!0,t[e]=r}}function Zp(e){return qp()?e:e.map(e=>{let t=e.name??`unknown`,n=Gp(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;le(`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;le(`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;le(`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;le(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function Qp(){if(!Pp){Pp=!0,Fp(gr.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return qp()||(Vp=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Ip(i.editorState),durationMs:r}}),Fp(gr.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!qp()&&!Up.has(e)&&t.view&&(Yp(t.view),Xp(t.view),Up.add(e)),{docSize:Ip(t.editorState)}}),Fp(gr.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Bp+=1;let i=e;return!qp()&&i.view&&Xp(i.view),{docSize:Ip(i.view),seq:Bp,durationMs:r}}),Fp(ir.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Rp+=1,{seq:Rp,docSize:Ip(e.state),durationMs:r})),Fp(ir.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(zp+=1,{seq:zp,docSize:Ip(e.state),durationMs:r})),Fp(Ue.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Lp+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Lp,topLevelYElements:a,durationMs:r}}),Fp(zt.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`)&&(le(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}),!qp()&&e===`first-paint`&&Vp!==null)){let e=Vp,n=Math.max(0,t.startTime-e);le(`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}),Vp=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var $p=!1,em=new Set,tm=!1;function nm(){for(let e of em)e()}function rm(e){$p!==e&&($p=e,nm())}function im(){return $p}function am(e){return em.add(e),()=>{em.delete(e)}}function om(e){let t=[e.onUpdateRelaunching(()=>rm(!0)),e.onUpdateRelaunchFailed(()=>rm(!1))];return()=>{for(let e of t)e()}}function sm(){if(tm||typeof window>`u`)return;let e=window.okDesktop;e&&(tm=!0,om(e))}function cm(){return(0,Q.useSyncExternalStore)(am,im,lm)}function lm(){return!1}function um(e){let{initialDoc:t}=e;if(!t)return;let n=e.getHash();n!==``&&n!==`#`&&n!==`#/`||e.setHash(Vo(t))}function dm(){typeof window>`u`||!window.okDesktop||um({initialDoc:window.okDesktop.config.initialDoc,getHash:()=>window.location.hash,setHash:e=>{window.location.hash=e}})}var fm=`Relaunch`,pm=`Release notes`,mm=`Updates paused`,hm=`Download`,gm=`Reset to defaults`,_m=`Relaunching to install the update…`,vm=`Relaunch failed — please restart manually`;function ym(e){return`Update to ${e} didn't install.`}var bm=`Retry`,xm=`Download manually`,Sm=`Recovery action failed — please try again`;function Cm(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function wm(e){return`Version ${e} ready to install`}function Tm(e){return`Updated to Version ${e}`}function Em(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var Dm=0,Om=0,km=1,Am=2,jm=3,Mm=6e4;function Nm(e,t,n=()=>{},r=Mm){let i=[],a=new Set,o=`update-downloaded`;return i.push(e.onUpdateDownloaded(({version:r})=>{let i=o,a=()=>{t({id:i,body:wm(r),priority:Am,action:{label:fm,onClick:()=>{t({id:i,body:_m,priority:Am,dismissible:!1}),e.update.relaunchNow().then(()=>{n(i)},e=>{a(),t({id:`relaunch-error-${r}`,body:Cm(vm,e),variant:`error`,priority:km})})}}})};a()})),i.push(e.onUpdateRelaunching(()=>{t({id:o,body:_m,priority:Am,dismissible:!1})})),i.push(e.onUpdateRelaunchFailed(({version:r,message:i,downloadUrl:a})=>{if(a){let i=`install-failed-${r}`,o=()=>{t({id:i,body:ym(r),variant:`error`,priority:km,action:{label:bm,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{console.warn(`[update-notice] install-failed retry rejected`,e),o()})}},secondaryAction:{label:xm,onClick:()=>{e.shell.openExternal(a)}}})};o();return}t({id:`relaunch-error-${r}`,body:i?`${vm}: ${i}`:vm,variant:`error`,priority:km})})),i.push(e.onWhatsNew(({version:i,releaseUrl:o})=>{let s=`whats-new-${i}`;t({id:s,body:Tm(i),variant:`success`,priority:jm,action:{label:pm,onClick:()=>{e.shell.openExternal(o)}},onDismiss:()=>{e.update.dismissWhatsNew(i)}});let c=setTimeout(()=>{a.delete(c),n(s),e.update.dismissWhatsNew(i)},r);a.add(c)})),i.push(e.onWhatsNewDismissed(({version:e})=>{n(`whats-new-${e}`)})),i.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:mm,priority:Om,action:{label:hm,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of i)e();for(let e of a)clearTimeout(e);a.clear()}}function Pm(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:Cm(Sm,e),variant:`error`,priority:Dm})};n({id:i,body:Em(t.currentBuild),priority:Dm,action:{label:gm,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var Fm=[],Im=new Set,Lm=!1;function Rm(){for(let e of Im)e()}function zm(e){let t=Fm.findIndex(t=>t.id===e.id);if(t===-1)Fm=[...Fm,e];else{let n=Fm.slice();n[t]=e,Fm=n}Rm()}function Bm(e){let t=Fm.filter(t=>t.id!==e);t.length!==Fm.length&&(Fm=t,Rm())}function Vm(){return Fm}function Hm(e){return Im.add(e),()=>{Im.delete(e)}}function Um(){if(Lm||typeof window>`u`)return;let e=window.okDesktop;e&&(Lm=!0,Nm(e,zm,Bm),e.state.query().then(t=>{t.schemaIncompatibility&&Pm(e,t.schemaIncompatibility,zm,Bm)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Wm=`ok-omnibar-recents-v1`,Gm=10;function Km(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function qm(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Jm(e,t){return`${e}:${t}`}function Ym(e){let t=qm(e);if(!t)return[];try{let e=t.getItem(Wm);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Km).slice(0,Gm):[]}catch{return[]}}function Xm(e,t){let n=qm(t);if(n)try{n.setItem(Wm,JSON.stringify(e.slice(0,Gm)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Zm(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,Gm)}function Qm(e,t){return e.filter(e=>t.has(Jm(e.kind,e.path)))}var $m=50,eh=50,th=``,nh=null;function rh(e){return e.trim().toLowerCase()}function ih(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ah(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function oh(e,t,n=new Map,r=new Map,i=new Set){let a=[],o=new Set;for(let t of e){o.add(t);let e=r.get(t)?.modified,i=n.get(t);a.push({kind:`file`,path:t,name:wr(t),...i?{title:i}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of i)o.has(e)||(o.add(e),a.push({kind:`file`,path:e,name:wr(e),bodyIndexed:!1}));for(let e of t)a.push({kind:`folder`,path:e,name:wr(e)});return a.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),a}function sh(e){return Vr({kind:e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function ch(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`folder`?`folder`:e.bodyIndexed===!1?`file`:`page`}:${e.path}`,e])),corpus:Yr(e.map(sh))}}function lh(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0} ${e.bodyIndexed===!1?`0`:`1`}`).join(``)}function uh(e){let t=lh(e);return nh&&th===t?nh:(th=t,nh=ch(e),nh)}function dh(e,t,n=$m){return fh(uh(e),t,n)}function fh(e,t,n=$m){let r=rh(t);return r?kr(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`,`file`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function ph(e,t){let n=ah(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(ih).join(`|`)})`,`gi`),i=[],a=0;for(let t of e.matchAll(r)){let n=t.index??0;n>a&&i.push({text:e.slice(a,n),match:!1,start:a}),i.push({text:t[0],match:!0,start:n}),a=n+t[0].length}return a<e.length&&i.push({text:e.slice(a),match:!1,start:a}),i.length>0?i:[{text:e,match:!1,start:0}]}function mh(e){if(e.kind!==`page`&&e.kind!==`folder`&&e.kind!==`file`||typeof e.path!=`string`)return null;let t=wr(e.path);return{kind:e.kind===`folder`?`folder`:`file`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function hh(e,t={}){let n=e.trim();if(!n)return{entries:[],truncated:!1,ready:!0};let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,ranking:t.semantic?`relevance`:`navigation`,scopes:[`page`,`folder`,`content`,`file`],limit:t.limit??eh,source:`omnibar`,...t.semantic?{semantic:!0}:{}}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(qo(e)??`Search failed with status ${r.status}`)}let i=await r.json();return{entries:(i.results??[]).map(mh).filter(e=>!!e),truncated:i.truncated===!0,ready:i.ready!==!1}}function gh(e,t,n=[]){let r=rh(t);return r?rh([e,...n].join(` `)).includes(r):!0}function _h(e,t,n={}){if(e.trim()===``)return`idle`;if(t.length===0)return`empty`;if(n.truncated)return`truncated`;for(let e of t)if(`snippet`in e&&typeof e.snippet==`string`&&e.snippet.length>0)return`content`;return`name-only`}function vh(e){let{query:t,firedQuery:n,status:r,resultCount:i}=e,a=i>0,o=t!==``&&t!==n,s=a&&(r===`loading`||t!==n),c=null;r===`error`&&t!==``?c={kind:`retry`,query:t}:o&&r!==`loading`&&(c={kind:`search`,query:t});let l=null;return r===`loading`?l=`searching`:t===``&&!a?l=`empty`:r===`success`&&!o&&!a&&(l=`no-results`),{submit:c,results:{show:a,dimmed:s,forQuery:a?n:null},notice:l}}var yh=`tag:`;function bh(e,t){if(!e.toLowerCase().startsWith(`tag:`))return{kind:`normal`,query:e};let n=e.slice(4).replace(/^\s+/,``).trim();return n&&t.has(n)?{kind:`tag-docs`,tagName:n}:{kind:`tag-list`,query:n}}function xh(e,t){return ie(e,t)}var Sh=ke;async function Ch(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`/api/tags/${e} responded with ${t.status}`);let n=await t.json();return Array.isArray(n.docs)?n.docs:[]}var wh=`open-knowledge:doc-panel-tab`,Th=null;function Eh(){let e=Th;return Th=null,e}function Dh(e,t=typeof window>`u`?new EventTarget:window){Th=e,t.dispatchEvent(new CustomEvent(wh,{detail:{tab:e}}))}function Oh(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.tab:void 0;n&&e(n)};return t.addEventListener(wh,n),()=>t.removeEventListener(wh,n)}var kh=[`.md`,`.mdx`];function Ah(e){let t=e.toLowerCase();for(let e of kh)if(t.endsWith(e))return e;return null}var jh={local:0,inherited:1};function Mh(e){return[...e].sort((e,t)=>{let n=jh[e.scope]-jh[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}var Nh=`__blank__`;function Ph(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function Fh(e){switch(e){case`empty`:return{id:`hYDc6B`};case`dotdot`:return{id:`Wyxs0x`};case`leading-slash`:return{id:`OYnx7O`};case`backslash`:return{id:`qo4zCg`};case`null-byte`:return{id:`saYiIO`}}}function Ih(e){let t=e.fileName.trim(),n=Ah(t)?t:`${t}${e.fileExtension??`.md`}`;if(e.kind===`folder`){let t=(e.folderName??``).trim();return`${e.initialDir?`${e.initialDir}/${t}`:t}/${n}`}return e.initialDir?`${e.initialDir}/${n}`:n}function Lh(e,t){return ec(e.target)?!1:nc(e,`new-item`,t)}function Rh(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function zh(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:a,initialDir:o,suggestedName:c,initialTemplate:l,defaultToTemplate:u,description:d,onCreated:f,folderConfig:p}=e,{_:m}=i(),{addPage:h}=rs(),g=Di(p?null:o),_=p??g,[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(``),[S,C]=(0,Q.useState)(Nh),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(null),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),F=(0,Q.useId)(),I=(0,Q.useId)(),[L,R]=(0,Q.useState)(!1),z=(0,Q.useRef)(null),B=(0,Q.useRef)(null),V,H;t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==c?(V=()=>{n&&(D(null),j(null),k(!1),x(``),C(a===`file`&&l?l:Nh),T(!1),R(!1),y(a===`file`?c??`untitled`:`index`))},H=[n,a,c,l],t[0]=l,t[1]=a,t[2]=n,t[3]=c,t[4]=V,t[5]=H):(V=t[4],H=t[5]),(0,Q.useEffect)(V,H);let U;t[6]!==_.state.data||t[7]!==_.state.status?(U=_.state.status===`ready`?Mh(_.state.data.folder.templates_available??[]):[],t[6]=_.state.data,t[7]=_.state.status,t[8]=U):U=t[8];let W=U,G;t[9]!==_.state.data||t[10]!==_.state.status||t[11]!==n||t[12]!==S?(G=()=>{n&&S!==Nh&&_.state.status===`ready`&&((_.state.data.folder.templates_available??[]).some(e=>e.name===S)||C(Nh))},t[9]=_.state.data,t[10]=_.state.status,t[11]=n,t[12]=S,t[13]=G):G=t[13];let K;t[14]!==_.state||t[15]!==n||t[16]!==S?(K=[n,S,_.state],t[14]=_.state,t[15]=n,t[16]=S,t[17]=K):K=t[17],(0,Q.useEffect)(G,K);let q;t[18]!==u||t[19]!==_.state.data||t[20]!==_.state.status||t[21]!==l||t[22]!==n||t[23]!==w?(q=()=>{if(!n||!u||l||w||_.state.status!==`ready`)return;let e=Mh(_.state.data.folder.templates_available??[]);e.length>0&&C(e[0].name)},t[18]=u,t[19]=_.state.data,t[20]=_.state.status,t[21]=l,t[22]=n,t[23]=w,t[24]=q):q=t[24];let J;t[25]!==u||t[26]!==_.state||t[27]!==l||t[28]!==n||t[29]!==w?(J=[n,u,l,w,_.state],t[25]=u,t[26]=_.state,t[27]=l,t[28]=n,t[29]=w,t[30]=J):J=t[30],(0,Q.useEffect)(q,J);let ee=a===`file`,Y=_.state.status===`loading`||_.state.status===`idle`,te=_.state.status===`error`?_.state.message:null,ne;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){y(e),D(null)},t[31]=ne):ne=t[31];let X=ne,re;t[32]!==v||t[33]!==b||t[34]!==o||t[35]!==a?(re=function(){return Ih({kind:a,initialDir:o,fileName:v,folderName:b})},t[32]=v,t[33]=b,t[34]=o,t[35]=a,t[36]=re):re=t[36];let ie=re,ae;t[37]!==m||t[38]!==v||t[39]!==b||t[40]!==a?(ae=function(){if(a===`folder`){let e=Ph(b.trim());if(e)return{message:m({id:`ODGGlj`,values:{detail:m(Fh(e))}}),field:`folder`}}let e=Ph(v.trim());return e?{message:m(Fh(e)),field:`file`}:null},t[37]=m,t[38]=v,t[39]=b,t[40]=a,t[41]=ae):ae=t[41];let oe=ae,se;t[42]!==O||t[43]!==v||t[44]!==b||t[45]!==a?(se=O||!v.trim()||a===`folder`&&!b.trim(),t[42]=O,t[43]=v,t[44]=b,t[45]=a,t[46]=se):se=t[46];let ce=se,le;t[47]!==m||t[48]!==h||t[49]!==ie||t[50]!==oe||t[51]!==a||t[52]!==f||t[53]!==r||t[54]!==S?(le=async function(){let e=oe();if(e){D(e.message),j(e.field);return}k(!0),D(null),j(null);let t=ie(),n=a===`file`&&S!==Nh?S:void 0,i={path:t};n!==void 0&&(i.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),t=e.status,n=await _e(e,m({id:`d2uTPx`,values:{status:t}}));if(!n.ok){k(!1),D(n.title),j(`form`);return}let o=$r.safeParse(n.body);if(k(!1),!o.success){D(m(a===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),j(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,h(s),ss([`files`,`backlinks`,`graph`]),f?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),k(!1),D(m({id:`HIb0vl`})),j(`form`)}},t[47]=m,t[48]=h,t[49]=ie,t[50]=oe,t[51]=a,t[52]=f,t[53]=r,t[54]=S,t[55]=le):le=t[55];let ue=le,de;t[56]!==m||t[57]!==o?(de=o||m({id:`L6Hhh6`}),t[56]=m,t[57]=o,t[58]=de):de=t[58];let fe=de,pe;t[59]===a?pe=t[60]:(pe=(0,Z.jsx)(Co,{children:a===`file`?(0,Z.jsx)(s,{id:`HdkSiO`}):(0,Z.jsx)(s,{id:`96G6Re`})}),t[59]=a,t[60]=pe);let me;t[61]!==d||t[62]!==fe?(me=d??(0,Z.jsx)(s,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[61]=d,t[62]=fe,t[63]=me):me=t[63];let he;t[64]===me?he=t[65]:(he=(0,Z.jsx)(So,{children:me}),t[64]=me,t[65]=he);let ge;t[66]!==pe||t[67]!==he?(ge=(0,Z.jsxs)(Do,{children:[pe,he]}),t[66]=pe,t[67]=he,t[68]=ge):ge=t[68];let ve;t[69]!==S||t[70]!==ee||t[71]!==F||t[72]!==L||t[73]!==I||t[74]!==W||t[75]!==te||t[76]!==Y?(ve=ee&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`span`,{id:F,className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`f65AOQ`})}),te?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`sE7R19`,values:{templatesError:te}})}):null,(0,Z.jsx)(Vh,{triggerId:I,labelledById:F,open:L,onOpenChange:R,value:S,onValueChange:e=>{C(e),T(!0)},templates:W,loading:Y}),!Y&&!te&&W.length===0?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`uWtdQR`})}):null]}),t[69]=S,t[70]=ee,t[71]=F,t[72]=L,t[73]=I,t[74]=W,t[75]=te,t[76]=Y,t[77]=ve):ve=t[77];let ye;t[78]!==m||t[79]!==E||t[80]!==A||t[81]!==M||t[82]!==N||t[83]!==b||t[84]!==a?(ye=a===`folder`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:N,children:(0,Z.jsx)(s,{id:`cqQyPB`})}),(0,Z.jsx)(jo,{ref:B,id:N,value:b,onChange:e=>{x(e.target.value),D(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":E&&(A===`folder`||A===`form`)?M:void 0,"aria-invalid":E&&(A===`folder`||A===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Ph(b.trim());if(t){D(m({id:`ODGGlj`,values:{detail:m(Fh(t))}})),j(`folder`);return}z.current?.focus()}}})]}),t[78]=m,t[79]=E,t[80]=A,t[81]=M,t[82]=N,t[83]=b,t[84]=a,t[85]=ye):ye=t[85];let be;t[86]===a?be=t[87]:(be=a===`folder`?(0,Z.jsx)(s,{id:`jjtmV_`}):(0,Z.jsx)(s,{id:`s-XOaI`}),t[86]=a,t[87]=be);let xe;t[88]!==P||t[89]!==be?(xe=(0,Z.jsx)(`label`,{className:`text-sm font-medium`,htmlFor:P,children:be}),t[88]=P,t[89]=be,t[90]=xe):xe=t[90];let Se;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Se=e=>X(e.target.value),t[91]=Se):Se=t[91];let Ce=a===`file`,we=E&&(A===`file`||A===`form`)?M:void 0,Te=E&&(A===`file`||A===`form`)?!0:void 0,Ee;t[92]!==ue||t[93]!==ce?(Ee=e=>{e.key===`Enter`&&!ce&&ue()},t[92]=ue,t[93]=ce,t[94]=Ee):Ee=t[94];let De;t[95]!==P||t[96]!==v||t[97]!==Ce||t[98]!==we||t[99]!==Te||t[100]!==Ee?(De=(0,Z.jsx)(jo,{ref:z,id:P,value:v,onChange:Se,placeholder:`my-note`,autoFocus:Ce,"aria-describedby":we,"aria-invalid":Te,onFocus:Bh,onKeyDown:Ee}),t[95]=P,t[96]=v,t[97]=Ce,t[98]=we,t[99]=Te,t[100]=Ee,t[101]=De):De=t[101];let Oe;t[102]!==E||t[103]!==M?(Oe=E&&(0,Z.jsx)(`p`,{id:M,role:`alert`,className:`text-1sm text-destructive`,children:E}),t[102]=E,t[103]=M,t[104]=Oe):Oe=t[104];let ke;t[105]!==xe||t[106]!==De||t[107]!==Oe?(ke=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[xe,De,Oe]}),t[105]=xe,t[106]=De,t[107]=Oe,t[108]=ke):ke=t[108];let Ae;t[109]!==ve||t[110]!==ye||t[111]!==ke?(Ae=(0,Z.jsxs)(To,{className:`space-y-6 pb-1`,children:[ve,ye,ke]}),t[109]=ve,t[110]=ye,t[111]=ke,t[112]=Ae):Ae=t[112];let je;t[113]===r?je=t[114]:(je=()=>r(!1),t[113]=r,t[114]=je);let Me;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(s,{id:`dEgA5A`}),t[115]=Me):Me=t[115];let Ne;t[116]!==O||t[117]!==je?(Ne=(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:je,disabled:O,children:Me}),t[116]=O,t[117]=je,t[118]=Ne):Ne=t[118];let Pe;t[119]===O?Pe=t[120]:(Pe=O?(0,Z.jsx)(s,{id:`E9bKSA`}):(0,Z.jsx)(s,{id:`hYgDIe`}),t[119]=O,t[120]=Pe);let Fe;t[121]!==ue||t[122]!==ce||t[123]!==Pe?(Fe=(0,Z.jsx)(ci,{onClick:ue,disabled:ce,children:Pe}),t[121]=ue,t[122]=ce,t[123]=Pe,t[124]=Fe):Fe=t[124];let Ie;t[125]!==Ne||t[126]!==Fe?(Ie=(0,Z.jsxs)(Eo,{children:[Ne,Fe]}),t[125]=Ne,t[126]=Fe,t[127]=Ie):Ie=t[127];let Le;t[128]!==ge||t[129]!==Ae||t[130]!==Ie?(Le=(0,Z.jsxs)(wo,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,Ae,Ie]}),t[128]=ge,t[129]=Ae,t[130]=Ie,t[131]=Le):Le=t[131];let Re;return t[132]!==r||t[133]!==n||t[134]!==Le?(Re=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:Le}),t[132]=r,t[133]=n,t[134]=Le,t[135]=Re):Re=t[135],Re}function Bh(e){return Rh(e.currentTarget)}function Vh(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:a,onOpenChange:o,value:c,onValueChange:l,templates:u,loading:d}=e,{_:f}=i(),p=(0,Q.useId)(),m;if(t[0]!==u||t[1]!==c){let e;t[3]===c?e=t[4]:(e=e=>e.name===c,t[3]=c,t[4]=e),m=u.find(e),t[0]=u,t[1]=c,t[2]=m}else m=t[2];let h=m,g=c===Nh,_=a?p:void 0,v=`${r} ${n}`,y;t[5]!==g||t[6]!==d||t[7]!==h?.name||t[8]!==h?.title||t[9]!==c?(y=d?(0,Z.jsx)(s,{id:`Hl89Qd`}):g?(0,Z.jsx)(s,{id:`E7BhZn`}):h?.title??h?.name??c,t[5]=g,t[6]=d,t[7]=h?.name,t[8]=h?.title,t[9]=c,t[10]=y):y=t[10];let x;t[11]===y?x=t[12]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:y}),t[11]=y,t[12]=x);let S;t[13]!==g||t[14]!==d||t[15]!==h?(S=!d&&!g&&h?(0,Z.jsx)(Gh,{entry:h}):null,t[13]=g,t[14]=d,t[15]=h,t[16]=S):S=t[16];let C;t[17]!==x||t[18]!==S?(C=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[x,S]}),t[17]=x,t[18]=S,t[19]=C):C=t[19];let w;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsx)(cl,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=w):w=t[20];let T;t[21]!==d||t[22]!==a||t[23]!==_||t[24]!==v||t[25]!==C||t[26]!==n?(T=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":a,"aria-haspopup":`listbox`,"aria-controls":_,"aria-labelledby":v,disabled:d,className:`w-full justify-between font-normal`,children:[C,w]})}),t[21]=d,t[22]=a,t[23]=_,t[24]=v,t[25]=C,t[26]=n,t[27]=T):T=t[27];let E;t[28]===f?E=t[29]:(E=f({id:`UQAp48`}),t[28]=f,t[29]=E);let D;t[30]===E?D=t[31]:(D=(0,Z.jsx)(Et,{placeholder:E}),t[30]=E,t[31]=D);let k;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`c8iK2Y`})}),t[32]=k):k=t[32];let A;if(t[33]!==o||t[34]!==l||t[35]!==u||t[36]!==c){let e;t[38]!==o||t[39]!==l||t[40]!==c?(e=e=>{let t=e.title??e.name,n=e.title&&e.title!==e.name?e.name:void 0,r=`${e.scope}:${e.source_folder}:${e.name}`;return(0,Z.jsxs)(I,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{l(e.name),o(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(ko,{className:oi(`mt-1 size-4 shrink-0`,c===e.name?`opacity-100`:`opacity-0`),"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:t}),n?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:n}):null,(0,Z.jsx)(Gh,{entry:e,className:`ml-auto`})]}),e.description?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:e.description}):null]})]},r)},t[38]=o,t[39]=l,t[40]=c,t[41]=e):e=t[41],A=u.map(e),t[33]=o,t[34]=l,t[35]=u,t[36]=c,t[37]=A}else A=t[37];let j;t[42]!==o||t[43]!==l?(j=()=>{l(Nh),o(!1)},t[42]=o,t[43]=l,t[44]=j):j=t[44];let M=c===Nh?`opacity-100`:`opacity-0`,N;t[45]===M?N=t[46]:(N=oi(`mt-1 size-4 shrink-0`,M),t[45]=M,t[46]=N);let P;t[47]===N?P=t[48]:(P=(0,Z.jsx)(ko,{className:N,"aria-hidden":`true`}),t[47]=N,t[48]=P);let F;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`E7BhZn`})}),t[49]=F):F=t[49];let L;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[F,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hZoBHK`})})]}),t[50]=L):L=t[50];let R;t[51]!==j||t[52]!==P?(R=(0,Z.jsxs)(I,{value:`Blank note empty`,onSelect:j,className:`items-start gap-3`,children:[P,L]}),t[51]=j,t[52]=P,t[53]=R):R=t[53];let z;t[54]!==p||t[55]!==A||t[56]!==R?(z=(0,Z.jsxs)(Ee,{id:p,className:`subtle-scrollbar`,children:[k,A,R]}),t[54]=p,t[55]=A,t[56]=R,t[57]=z):z=t[57];let B;t[58]!==D||t[59]!==z?(B=(0,Z.jsx)(b,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:Wh,onWheel:Uh,onTouchMove:Hh,children:(0,Z.jsxs)(he,{children:[D,z]})}),t[58]=D,t[59]=z,t[60]=B):B=t[60];let V;return t[61]!==o||t[62]!==a||t[63]!==B||t[64]!==T?(V=(0,Z.jsxs)(fe,{open:a,onOpenChange:o,children:[T,B]}),t[61]=o,t[62]=a,t[63]=B,t[64]=T,t[65]=V):V=t[65],V}function Hh(e){e.stopPropagation()}function Uh(e){e.stopPropagation()}function Wh(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function Gh(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=oi(`shrink-0 text-2xs`,r),t[0]=r,t[1]=e);let i;t[2]===n.source_folder?i=t[3]:(i=n.source_folder||(0,Z.jsx)(s,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(st,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function Kh(e){return e.split(`/`).pop()??e}function qh(e,t){let n=new Map;for(let e of t?.folders??[])n.set(e.path,e.summary);let r=e.created.filter(e=>e.kind===`folder`).map(e=>({kind:`folder`,name:`${e.path}/`,description:n.get(Kh(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:Kh(e.path)===`log.md`?ms._({id:`l3mSlL`}):``}));return[...r,...i]}function Jh(e){let t=(0,$.c)(23),{plan:n,selectedPack:r}=e,{_:a}=i(),o,c,l,u,d,f;if(t[0]!==a||t[1]!==n||t[2]!==r){let e=[...qh(n,r)].sort(Zh),i=new Set(e.map(Xh));d=`space-y-2`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-primary`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex items-center justify-center`,children:`◇`}),(0,Z.jsx)(s,{id:`xSVO3J`})]}),t[9]=f):f=t[9],u=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,t[10]===a?o=t[11]:(o=a({id:`INEQsp`}),t[10]=a,t[11]=o),c=`py-1.5`,l=e.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let a=t.slice(0,e).join(`/`);i.has(a)&&(n++,r=e)}let a=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),o=e.kind===`folder`;return(0,Z.jsxs)(`li`,{className:`relative flex min-w-0 items-center gap-1.5 py-1 pr-3`,style:{paddingLeft:`${12+n*16}px`},children:[Array.from({length:n},Yh),o?(0,Z.jsx)(wl,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`code`,{className:`font-mono text-1sm shrink-0 text-foreground/80`,children:a}),o&&e.description?(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{"aria-label":`Show description`,className:`flex shrink-0 cursor-help rounded outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,Z.jsx)(Ao,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(Ns,{children:e.description})]}):null]},e.name)}),t[0]=a,t[1]=n,t[2]=r,t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f}else o=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8];let p;t[12]!==o||t[13]!==c||t[14]!==l?(p=(0,Z.jsx)(`ul`,{"aria-label":o,className:c,children:l}),t[12]=o,t[13]=c,t[14]=l,t[15]=p):p=t[15];let m;t[16]!==u||t[17]!==p?(m=(0,Z.jsx)(`div`,{className:u,children:p}),t[16]=u,t[17]=p,t[18]=m):m=t[18];let h;return t[19]!==d||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`section`,{className:d,children:[f,m]}),t[19]=d,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Yh(e,t){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-0 bottom-0 w-px bg-border/50`,style:{left:`${12+t*16+8}px`}},`guide:${t}`)}function Xh(e){return e.name.replace(/\/$/,``)}function Zh(e,t){return e.name.localeCompare(t.name)}async function Qh(e){let t=await e.json().catch(()=>null),n=mr.safeParse(t);if(!n.success)return{kind:`internal`,message:`HTTP ${e.status}`};let r=n.data.detail??n.data.title,i=n.data.type;return i===`urn:ok:error:seed-prerequisite-missing`?{kind:`prerequisite-missing`,message:r}:i===`urn:ok:error:seed-invalid-root`?{kind:`invalid-root`,message:r}:i===`urn:ok:error:no-project-dir`?{kind:`no-project`,message:r}:{kind:`internal`,message:r}}function $h(){let e=typeof window<`u`?window.okDesktop:void 0;return e?.seed?{plan:e.seed.plan,apply:e.seed.apply,listPacks:e.seed.listPacks}:{plan:async e=>{let t=new URLSearchParams;e?.rootDir&&t.set(`rootDir`,e.rootDir),e?.packId&&t.set(`packId`,e.packId);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Qh(r)};let i=await r.json().catch(()=>null);return i?.plan?{ok:!0,plan:i.plan}:{ok:!1,error:{kind:`internal`,message:`Malformed plan response`}}},apply:async(e,t)=>{let n=await fetch(`/api/seed/apply`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({plan:e,packId:t?.packId})});if(!n.ok)return{ok:!1,error:await Qh(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result}:{ok:!1,error:{kind:`internal`,message:`Malformed apply response`}}},listPacks:async()=>{let e=await fetch(`/api/seed/packs`);if(!e.ok)return{ok:!1,error:{kind:`internal`,message:`HTTP ${e.status}`}};let t=await e.json().catch(()=>null);return!t||!Array.isArray(t.packs)?{ok:!1,error:{kind:`internal`,message:`Malformed listPacks response`}}:{ok:!0,packs:t.packs}}}}var eg={"knowledge-base":Al,"software-lifecycle":Oe,"plain-notes":au,worldbuilding:fl,"writing-pipeline":Ul,"entity-vault":Ll,okf:gl};function tg(e){return eg[e]??Al}function ng(e){let t=(0,$.c)(37),{onPackSelect:n,onCreateBlankFile:r,className:a,packs:o}=e,{_:c}=i(),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),p=o===void 0,m,h;t[0]===p?(m=t[1],h=t[2]):(m=()=>{if(!p)return;let e=!1;return(async()=>{try{let t=await $h().listPacks();if(e)return;t.ok?u(t.packs):f(t.error.message)}catch(t){let n=t;if(e)return;f(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},h=[p],t[0]=p,t[1]=m,t[2]=h),(0,Q.useEffect)(m,h);let g=p?l:o;if(d!==null){let e;t[3]===a?e=t[4]:(e=oi(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,a),t[3]=a,t[4]=e);let n;t[5]===d?n=t[6]:(n=(0,Z.jsx)(s,{id:`56WWtu`,values:{error:d}}),t[5]=d,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,Z.jsx)(`div`,{role:`alert`,className:e,children:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}if(g===null){let e;t[10]===a?e=t[11]:(e=oi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,a),t[10]=a,t[11]=e);let n;t[12]===c?n=t[13]:(n=c({id:`BeWTQy`}),t[12]=c,t[13]=n);let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=Array.from({length:Object.keys(eg).length},ig).map(rg),t[14]=r):r=t[14];let i;return t[15]!==e||t[16]!==n||t[17]!==r?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":n,children:r}),t[15]=e,t[16]=n,t[17]=r,t[18]=i):i=t[18],i}if(g.length===0){let e;t[19]===a?e=t[20]:(e=oi(`flex w-full max-w-5xl items-center justify-center rounded-2xl border border-dashed border-border/60 bg-muted/20 p-8 text-sm text-muted-foreground`,a),t[19]=a,t[20]=e);let n;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(s,{id:`zLGXna`}),t[21]=n):n=t[21];let r;return t[22]===e?r=t[23]:(r=(0,Z.jsx)(`div`,{role:`status`,className:e,children:n}),t[22]=e,t[23]=r),r}let _;t[24]===a?_=t[25]:(_=oi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,a),t[24]=a,t[25]=_);let v;if(t[26]!==n||t[27]!==g){let e;t[29]===n?e=t[30]:(e=e=>(0,Z.jsx)(og,{pack:e,onSelect:()=>n(e.id)},e.id),t[29]=n,t[30]=e),v=g.map(e),t[26]=n,t[27]=g,t[28]=v}else v=t[28];let y;t[31]===r?y=t[32]:(y=r?(0,Z.jsx)(ag,{onSelect:r}):null,t[31]=r,t[32]=y);let b;return t[33]!==_||t[34]!==v||t[35]!==y?(b=(0,Z.jsxs)(`div`,{className:_,children:[v,y]}),t[33]=_,t[34]=v,t[35]=y,t[36]=b):b=t[36],b}function rg(e){return(0,Z.jsx)(sg,{},`skeleton-${e}`)}function ig(e,t){return t}function ag(e){let t=(0,$.c)(3),{onSelect:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(ka,{"aria-hidden":`true`,className:`size-3.5`})}})}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsx)(`button`,{type:`button`,onClick:n,className:`group flex h-full min-h-22 flex-col items-center justify-center gap-2 rounded-2xl border border-dashed border-border/60 bg-card p-5 text-center text-sm transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px text-muted-foreground`,children:r}),t[1]=n,t[2]=i),i}function og(e){let t=(0,$.c)(17),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=tg(n.id),t[0]=n.id,t[1]=i);let a=i,o;t[2]===a?o=t[3]:(o=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:(0,Z.jsx)(a,{className:`size-3.5`})}),t[2]=a,t[3]=o);let s;t[4]===n.name?s=t[5]:(s=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]===n.description?l=t[10]:(l=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=l);let u;t[11]!==c||t[12]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;return t[14]!==r||t[15]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,onClick:r,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px`,children:u}),t[14]=r,t[15]=u,t[16]=d):d=t[16],d}function sg(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`size-10 animate-pulse rounded-lg bg-muted`,"aria-hidden":`true`,children:(0,Z.jsx)(h,{className:`size-5 animate-spin text-muted-foreground opacity-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 h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var cg=`knowledge-base`;function lg(e){let t=(0,$.c)(68),{open:n,onOpenChange:r,onSeedApplied:a,initialPackId:o}=e,{_:c}=i(),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={kind:`loading`},t[0]=l):l=t[0];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(null),[m,g]=(0,Q.useState)(o??cg),[_,v]=(0,Q.useState)(`project-root`),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(o===void 0?`pick`:`configure`),C=(0,Q.useRef)(!0),w=f?.find(e=>e.id===m),T,E;t[1]!==n||t[2]!==f?(T=()=>{if(!n||f!==null)return;let e=!1;return(async()=>{try{let t=await $h().listPacks();if(e)return;t.ok?p(t.packs):(p([]),d({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;p([]),d({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},E=[n,f],t[1]=n,t[2]=f,t[3]=T,t[4]=E):(T=t[3],E=t[4]),(0,Q.useEffect)(T,E);let D,O;t[5]!==o||t[6]!==n?(D=()=>{n&&(g(o??cg),v(`project-root`),b(``),S(o===void 0?`pick`:`configure`),d({kind:`loading`}),C.current=!0)},O=[n,o],t[5]=o,t[6]=n,t[7]=D,t[8]=O):(D=t[7],O=t[8]),(0,Q.useEffect)(D,O),(0,Q.useEffect)(()=>{w&&b(w.defaultSubfolder??``)},[w]);let k;t[9]===y?k=t[10]:(k=y.trim(),t[9]=y,t[10]=k);let A=k,j=_===`subfolder`&&A===``,M,N;t[11]!==c||t[12]!==n||t[13]!==f||t[14]!==_||t[15]!==m||t[16]!==x||t[17]!==j||t[18]!==A?(M=()=>{if(!n||x!==`configure`||f===null)return;if(j){d({kind:`error`,message:c({id:`Z8KDox`})});return}let e=_===`project-root`?void 0:A,t=C.current?0:200;C.current=!1;let r=!1,i=setTimeout(()=>{r||(d(ug),$h().plan({rootDir:e,packId:m}).then(e=>{if(!r){if(!e.ok){d({kind:`error`,message:e.error.message});return}d(e.plan.created.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||d({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},N=[n,x,f,m,_,A,j,c],t[11]=c,t[12]=n,t[13]=f,t[14]=_,t[15]=m,t[16]=x,t[17]=j,t[18]=A,t[19]=M,t[20]=N):(M=t[19],N=t[20]),(0,Q.useEffect)(M,N);let P=async function(){if(u.kind!==`plan`)return;let e=u.plan;d({kind:`applying`,plan:e});let t;try{t=await $h().apply(e,{packId:m})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);hs.error(c({id:`iqugog`,values:{errorDetail:r}})),d({kind:`plan`,plan:e});return}if(t.ok){let e=w?.name??c({id:`W8vpBM`}),n=t.result.applied,i=c(n===0?{id:`K6jjWB`,values:{packName:e}}:{id:`x3-2ta`,values:{packName:e,projectEntries:n}});hs.success(i),a?.(),r(!1)}else{let n=t.error.message;hs.error(c({id:`iqugog`,values:{errorDetail:n}})),d({kind:`plan`,plan:e})}},F=o!==void 0,I=w?.name,L=c(x===`configure`&&w?{id:`hxEUVJ`,values:{selectedPackName:I}}:{id:`RGkNeJ`}),R;t[21]!==c||t[22]!==w||t[23]!==x?(R=x===`configure`&&w?w.description:c({id:`T-4cw2`}),t[21]=c,t[22]=w,t[23]=x,t[24]=R):R=t[24];let z=R,B;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){g(e),S(`configure`),C.current=!0},t[25]=B):B=t[25];let V=B,H;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){S(`pick`),d({kind:`loading`}),C.current=!0},t[26]=H):H=t[26];let U=H,W;t[27]===L?W=t[28]:(W=(0,Z.jsx)(Co,{children:L}),t[27]=L,t[28]=W);let G;t[29]===z?G=t[30]:(G=(0,Z.jsx)(So,{children:z}),t[29]=z,t[30]=G);let K;t[31]!==W||t[32]!==G?(K=(0,Z.jsxs)(Do,{children:[W,G]}),t[31]=W,t[32]=G,t[33]=K):K=t[33];let q;t[34]!==f||t[35]!==u||t[36]!==_||t[37]!==w||t[38]!==x||t[39]!==y?(q=x===`pick`?(0,Z.jsx)(To,{children:(0,Z.jsx)(ng,{packs:f,onPackSelect:V})}):(0,Z.jsxs)(To,{className:`space-y-6`,children:[(0,Z.jsx)(dg,{choice:_,subfolder:y,placeholder:w?.defaultSubfolder??`subfolder`,onChoiceChange:v,onSubfolderChange:b}),(0,Z.jsx)(fg,{phase:u,selectedPack:w})]}),t[34]=f,t[35]=u,t[36]=_,t[37]=w,t[38]=x,t[39]=y,t[40]=q):q=t[40];let J;t[41]!==F||t[42]!==x?(J=x===`configure`&&!F?(0,Z.jsxs)(ci,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:U,children:[(0,Z.jsx)(gi,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(s,{id:`iH8pgl`})]}):null,t[41]=F,t[42]=x,t[43]=J):J=t[43];let ee;t[44]===r?ee=t[45]:(ee=()=>r(!1),t[44]=r,t[45]=ee);let Y;t[46]===u.kind?Y=t[47]:(Y=u.kind===`already-seeded`||u.kind===`error`?(0,Z.jsx)(s,{id:`yz7wBu`}):(0,Z.jsx)(s,{id:`dEgA5A`}),t[46]=u.kind,t[47]=Y);let te;t[48]!==ee||t[49]!==Y?(te=(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`outline`,onClick:ee,children:Y}),t[48]=ee,t[49]=Y,t[50]=te):te=t[50];let ne;t[51]!==P||t[52]!==u.kind||t[53]!==x||t[54]!==j?(ne=x===`configure`&&u.kind===`plan`?(0,Z.jsx)(ci,{onClick:P,disabled:j,children:(0,Z.jsx)(s,{id:`4TzU0n`})}):x===`configure`&&u.kind===`applying`?(0,Z.jsxs)(ci,{disabled:!0,children:[(0,Z.jsx)(h,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(s,{id:`XYlJJT`})]}):null,t[51]=P,t[52]=u.kind,t[53]=x,t[54]=j,t[55]=ne):ne=t[55];let X;t[56]!==J||t[57]!==te||t[58]!==ne?(X=(0,Z.jsxs)(Eo,{children:[J,te,ne]}),t[56]=J,t[57]=te,t[58]=ne,t[59]=X):X=t[59];let re;t[60]!==K||t[61]!==q||t[62]!==X?(re=(0,Z.jsxs)(wo,{className:`sm:max-w-4xl`,"data-ok-layer-spawned":``,children:[K,q,X]}),t[60]=K,t[61]=q,t[62]=X,t[63]=re):re=t[63];let ie;return t[64]!==r||t[65]!==n||t[66]!==re?(ie=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:re}),t[64]=r,t[65]=n,t[66]=re,t[67]=ie):ie=t[67],ie}function ug(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function dg(e){let t=(0,$.c)(21),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`3wiBAs`})}),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e),t[1]=a,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ni,{children:(0,Z.jsx)(s,{id:`RSqaSd`})}),t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Fi,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(ji,{orientation:`horizontal`,children:[(0,Z.jsxs)(uo,{children:[u,(0,Z.jsx)(da,{className:`text-1sm`,children:(0,Z.jsx)(s,{id:`vPYaz3`})})]}),(0,Z.jsx)(Ks,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(Ni,{children:(0,Z.jsx)(s,{id:`ZWgr0b`})}),t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(da,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(s,{id:`GUpclA`})}),t[6]=p):p=t[6];let m;t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==r?(m=n===`subfolder`&&(0,Z.jsx)(jo,{value:r,onChange:e=>o(e.target.value),placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`}),t[7]=n,t[8]=o,t[9]=i,t[10]=r,t[11]=m):m=t[11];let h;t[12]===m?h=t[13]:(h=(0,Z.jsxs)(uo,{children:[f,p,m]}),t[12]=m,t[13]=h);let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Ks,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=g):g=t[14];let _;t[15]===h?_=t[16]:(_=(0,Z.jsx)(Fi,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(ji,{orientation:`horizontal`,children:[h,g]})}),t[15]=h,t[16]=_);let v;return t[17]!==n||t[18]!==_||t[19]!==l?(v=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[c,(0,Z.jsxs)(Gs,{className:`sm:flex`,value:n,onValueChange:l,children:[d,_]})]}),t[17]=n,t[18]=_,t[19]=l,t[20]=v):v=t[20],v}function fg(e){let t=(0,$.c)(13),{phase:n,selectedPack:r}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,Z.jsx)(h,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(s,{id:`mSJ3Rn`})]}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.kind===`already-seeded`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`font-medium`,children:(0,Z.jsx)(s,{id:`YwPUUP`})}),t[3]=e):e=t[3];let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[e,(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Z.jsx)(s,{id:`gcV0dI`})})]}),t[4]=n):n=t[4],n}let i;t[5]!==n.plan||t[6]!==r?(i=(0,Z.jsx)(Jh,{plan:n.plan,selectedPack:r}),t[5]=n.plan,t[6]=r,t[7]=i):i=t[7];let a;t[8]===n.plan.warnings?a=t[9]:(a=n.plan.warnings.length>0?(0,Z.jsx)(`div`,{className:`rounded-md bg-warning/10 p-3 text-xs text-warning-foreground`,children:n.plan.warnings.map(pg)}):null,t[8]=n.plan.warnings,t[9]=a);let o;return t[10]!==i||t[11]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[10]=i,t[11]=a,t[12]=o):o=t[12],o}function pg(e){return(0,Z.jsx)(`p`,{children:e},e)}function mg(){let[e]=(0,Q.useState)(hg);return e}function hg(){return Or()!=null}var gg=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Agentic coding in Claude Desktop's Code tab.`},{id:`codex`,displayName:`Codex`,appBrandName:`Codex Desktop`,schemes:[`codex:`],installUrl:`https://openai.com/codex`,tagline:`OpenAI's coding agent, terminal-native.`},{id:`cursor`,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`}],_g=gg.filter(e=>e.id!==`claude-cowork`),vg=(0,Q.createContext)(!1);function yg(e){let t=(0,$.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(xg),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{if(window.okDesktop)return;let e=new AbortController;return se(e.signal).then(t=>{e.signal.aborted||t.status!==`ok`||i(t.config.singleFile)}).catch(bg),()=>e.abort()},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o);let s;return t[2]!==n||t[3]!==r?(s=(0,Z.jsx)(vg,{value:r,children:n}),t[2]=n,t[3]=r,t[4]=s):s=t[4],s}function bg(){}function xg(){return typeof window<`u`?window.okDesktop?.config.singleFile??!1:!1}function Sg(){return(0,Q.use)(vg)}var Cg=`#settings`;function wg(e){return ec(e.target)?!1:nc(e,`settings`)}function Tg(e){return e.replace(/^#/,``)===`settings`}function Eg(){return typeof window>`u`?``:window.location.hash}function Dg(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(kg),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,Q.startTransition)(()=>{n(Tg(Eg()))})};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a=Og,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Og(){typeof window>`u`||Tg(Eg())&&window.history.back()}function kg(){return Tg(Eg())}function Ag(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function jg(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=qo(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:`Invalid server response`}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:`Invalid server response shape`}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??`unknown build failure`}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Mg(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Ag(e):jg()}var Ng=`ok:skill:cowork:installed`,Pg=`1`,Fg=250,Ig=`/api/skill/install-state`;function Lg(e){return`${Ng}:v${e}`}var Rg=new Map;async function zg(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Rg.get(n);if(r)return r;let i=Bg(e,t);return Rg.set(n,i),i.finally(()=>{Rg.get(n)===i&&Rg.delete(n)}),i}async function Bg(e,t){let n=e.installer===void 0?Mg():e.installer,r=Vg(e.storage),i=e.fetchSnapshot??Ug,a=e.serverTimeoutMs??Fg,o=null;if(!t.force){try{o=await Wg(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Lg(o?.currentVersion??e.fallbackSkillVersion??Hg());if(!t.force&&r?.getItem(s)===Pg)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Pg)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Vg(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Hg(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Ug(){let e;try{e=await fetch(Ig,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Wg(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Gg(e){return zg({},e)}function Kg(){return zg({},{force:!0})}async function qg(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Jg(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return qg({target:`claude-cowork`,url:Xn({mode:`cowork`},e)},n);case`claude-code`:return qg({target:`claude-code`,url:Xn({mode:`code`},e)},n);case`codex`:return qg({target:`codex`,url:$n(e)},n);case`cursor`:return qg({target:`cursor`,url:Rn(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Yg(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.openExternal)try{return await n.shell.openExternal(e),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Xg(e)}}let r=t.doc??(typeof document<`u`?document:void 0);if(!r)return{ok:!1,reason:`dispatch-error`,detail:`no DOM available`};try{let t=r.createElement(`a`);return t.href=e,t.rel=`noopener noreferrer`,/^https?:/i.test(e)&&(t.target=`_blank`),r.body.appendChild(t),t.click(),t.remove(),{ok:!0}}catch(e){return{ok:!1,reason:`dispatch-error`,detail:Xg(e)}}}function Xg(e){if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}async function Zg(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}function Qg(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function $g(e){return`${e}.md`}function e_(e){if(!e.docName||!e.workspace)return null;let t=$g(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Qg(n,t,r)}}function t_(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function n_(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,projectDir:e.workspace.contentDir,docPath:``}:null}function r_(e){return Yg(e.installUrl).then(()=>void 0)}function i_(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function a_(e){if(!e.docName||!e.workspace||!e.selectionMarkdown)return null;let t=$g(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:null,selection:{relativePath:t,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown},projectDir:n,docPath:Qg(n,t,r)}}function o_(e){return a_(e)??e_(e)}function s_(e){return`Opened in ${e}.`}function c_(e,t=1){return t>=3?`Couldn't reach ${e} — please try again later.`:t===2?`Still couldn't reach ${e} — try one more time?`:`Couldn't reach ${e} — try again?`}function l_(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function u_(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function d_(e,t,n){return e.selection?dr({...e.selection,target:t}):xr(e.docContext===null?e.folderRelativePath?lr(e.folderRelativePath,n,e.instruction):e.createDescription===void 0?Un(n,e.instruction):Wr(e.createDescription,n,e.createScenario??`new-project`):ur(e.docContext.relativePath,n,e.instruction))}function f_(e){return d_(e,`claude-code`,!1)}async function p_(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(`Open Knowledge skill saved. Upload it in Claude Desktop, then click Cowork again.`),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(`Couldn't install Open Knowledge skill — ${t}`),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:d_(t,e,n.autoOpen)},a=await n.dispatchHandoff(i),o=u_(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString(),t.selection?`selection`:void 0);await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(s_(s));else{let i=l_(r),a=c_(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{p_(e,t,n,r+1)}}})}return a}function m_(e){return gg.find(t=>t.id===e)?.displayName??e}function h_(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function g_(){return{dispatchHandoff:Jg,recordHandoff:Zg,toast:{success:e=>{hs.success(e)},error:(e,t)=>{hs.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>h_(),getDisplayName:m_,ensureCoworkSkillInstalled:Gg,autoOpen:!0}}function __(){let e=(0,$.c)(2),{merged:t}=ae(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>p_(e,t,{...g_(),autoOpen:n}),reinstallCoworkSkill:Kg},e[0]=n,e[1]=r),r}var v_=[...new Set(gg.flatMap(e=>e.schemes))];function y_(e,t){let n=t.now?.()??Date.now(),r={};for(let t of gg){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function b_(e){return y_({},e)}async function x_(e){let t=e.schemes??v_,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var S_=Object.fromEntries(v_.map(e=>[e,{installed:!1}]));async function C_(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return S_}if(!t.ok)return S_;let n;try{n=await t.json()}catch{return S_}if(typeof n!=`object`||!n||Array.isArray(n))return S_;let r=n,i={};for(let e of v_)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function w_(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function T_(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=b_({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=y_(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!w_(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function E_(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function D_(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>x_({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>C_({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function O_(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(k_),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=T_(D_());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,Q.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function k_(){return b_({isElectronHost:E_(),now:Date.now})}var A_=3e3,j_=600,M_=20,N_=(e,t,n)=>yu(e,t,n,`CommandPalette`);function P_(e){window.location.assign(Vo(e))}function F_(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:ps(t)}function I_(e){let t=(0,$.c)(24),{entry:n,query:r,onSelect:i,disabled:a}=e,o=r===void 0?``:r,s=a===void 0?!1:a,c=n.kind===`folder`?re:We,l;t[0]===n?l=t[1]:(l=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=l);let u=l,d=`snippet`in n?n.snippet:void 0,f=`${n.kind} ${n.path}`,p=`command-palette-nav-${n.kind}-${n.path}`,m;t[2]===c?m=t[3]:(m=(0,Z.jsx)(c,{className:`mt-0.5`}),t[2]=c,t[3]=m);let h;t[4]!==o||t[5]!==u?(h=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(R_,{query:o,text:u})}),t[4]=o,t[5]=u,t[6]=h):h=t[6];let g;t[7]!==n.path||t[8]!==o?(g=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(R_,{query:o,text:n.path})}),t[7]=n.path,t[8]=o,t[9]=g):g=t[9];let _;t[10]!==o||t[11]!==d?(_=d?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(R_,{query:o,text:d})}):null,t[10]=o,t[11]=d,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==g||t[15]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[h,g,_]}),t[13]=h,t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;return t[17]!==s||t[18]!==i||t[19]!==v||t[20]!==f||t[21]!==p||t[22]!==m?(y=(0,Z.jsxs)(I,{value:f,onSelect:i,disabled:s,"data-testid":p,className:`items-start`,children:[m,v]}),t[17]=s,t[18]=i,t[19]=v,t[20]=f,t[21]=p,t[22]=m,t[23]=y):y=t[23],y}function L_(e){let t=(0,$.c)(5),{mode:n,inExclusiveMode:r,paletteModeKind:i}=e;if(r||i!==`normal`||n===`idle`||n===`content`)return null;let a=`command-palette-search-hint-${n}`,o;t[0]===n?o=t[1]:(o=n===`name-only`?(0,Z.jsx)(s,{id:`-wePNM`}):n===`truncated`?(0,Z.jsx)(s,{id:`-q4abP`}):(0,Z.jsx)(s,{id:`DbILZA`}),t[0]=n,t[1]=o);let c;return t[2]!==a||t[3]!==o?(c=(0,Z.jsx)(`div`,{"aria-live":`polite`,"data-testid":a,className:`border-t px-3 py-2 text-muted-foreground text-xs`,children:o}),t[2]=a,t[3]=o,t[4]=c):c=t[4],c}function R_(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=ph(n,r).map(z_),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[3]=i,t[4]=a),a}function z_(e){let t=`${e.start}:${e.match?`match`:`plain`}`;return e.match?(0,Z.jsx)(`mark`,{className:`rounded-sm bg-primary/10 px-0.5 font-semibold text-primary`,children:e.text},t):(0,Z.jsx)(`span`,{children:e.text},t)}function B_({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function V_(e){let t=(0,$.c)(181),{bridge:n,open:r,onOpenChange:a}=e,o=n===void 0?null:n,{_:c}=i(),l=Sg(),[u,d]=(0,Q.useState)(``),f=(0,Q.useDeferredValue)(u),p=f.trim(),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[0]=m):m=t[0];let[g,_]=(0,Q.useState)(m),[v,y]=(0,Q.useState)(`idle`),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[1]=E):E=t[1];let[D,k]=(0,Q.useState)(E),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(`idle`),P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[2]=P):P=t[2];let[F,L]=(0,Q.useState)(P),B;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(B=[],t[3]=B):B=t[3];let[H,U]=(0,Q.useState)(B),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(!1),[J,ee]=(0,Q.useState)(!1),Y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(Y=[],t[4]=Y):Y=t[4];let[te,ne]=(0,Q.useState)(Y),[X,ie]=(0,Q.useState)(`idle`),ae;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[],t[5]=ae):ae=t[5];let[oe,se]=(0,Q.useState)(ae),[ce,le]=(0,Q.useState)(`idle`),ue=(0,Q.useRef)(!1),de=(0,Q.useRef)(null),fe=(0,Q.useRef)(null),pe=(0,Q.useRef)(null),me=(0,Q.useRef)(null),{activeDocName:he,activeTarget:ge}=mt(),{pages:_e,pageTitles:ve,pageMeta:ye,folderPaths:xe,filePaths:we,loading:Te}=rs(),De=po(),{states:Oe,refresh:ke}=O_(),{dispatch:Ae}=__(),je;t[6]===r?je=t[7]:(je={enabled:r},t[6]=r,t[7]=je);let{status:Me,refresh:Ne}=la(je),Pe=(Me?.enabled??!1)&&(Me?.keyPresent??!1),Fe=Me?.embedded??0,Ie=Me?.total??0,Le=Pe&&Ie>0&&Fe<Ie,Re;t[8]!==w||t[9]!==r||t[10]!==Ne||t[11]!==Le?(Re=()=>{if(!r||!w||!Le)return;let e=window.setInterval(()=>Ne(),2500);return()=>window.clearInterval(e)},t[8]=w,t[9]=r,t[10]=Ne,t[11]=Le,t[12]=Re):Re=t[12];let ze;t[13]!==w||t[14]!==r||t[15]!==Le?(ze=[r,w,Le],t[13]=w,t[14]=r,t[15]=Le,t[16]=ze):ze=t[16],(0,Q.useEffect)(Re,ze);let Be=e_({docName:he,workspace:De}),Ve=oh(_e,xe,ve,ye,we),He=Qm(H,new Set(Ve.map(W_))),Ue=o?.config.projectPath??null,Ge=o?F.filter(e=>e.path!==Ue):[],Ke;t[17]!==he||t[18]!==ge?(Ke=F_(ge,he),t[17]=he,t[18]=ge,t[19]=Ke):Ke=t[19];let Je=Ke,Ye=p===``?[]:dh(Ve,p,8),Xe,Ze;t[20]!==a||t[21]!==r?(Xe=()=>{let e=function(e){nc(e,`command-palette`)&&(e.preventDefault(),a(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ze=[a,r],t[20]=a,t[21]=r,t[22]=Xe,t[23]=Ze):(Xe=t[22],Ze=t[23]),(0,Q.useEffect)(Xe,Ze);let Qe,$e;t[24]!==c||t[25]!==o||t[26]!==r||t[27]!==ke?(Qe=()=>{if(r){if(U(Ym()),ke(),o){let e=!1;return N_(async()=>{let t=await o.project.listRecent();e||L(t)},c({id:`fYKgzG`})),()=>{e=!0}}return}d(``),ne([]),ie(`idle`),ue.current=!1,se([]),le(`idle`),T(!1),pe.current?.abort(),pe.current=null,me.current!==null&&(window.clearTimeout(me.current),me.current=null),k([]),j(null),N(`idle`)},$e=[r,o,ke,c],t[24]=c,t[25]=o,t[26]=r,t[27]=ke,t[28]=Qe,t[29]=$e):(Qe=t[28],$e=t[29]),(0,Q.useEffect)(Qe,$e);let et;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>{de.current&&(de.current.scrollTop=0)},t[30]=et):et=t[30];let tt;t[31]===u?tt=t[32]:(tt=[u],t[31]=u,t[32]=tt),(0,Q.useEffect)(et,tt);let nt=new Set(te.map(U_)),rt=w?{kind:`normal`,query:f}:bh(f,nt),it=rt.kind!==`normal`,at=it||w,ot=rt.kind===`tag-list`?rt.query:``,st=rt.kind===`tag-docs`?rt.tagName:``,ct=u.trim(),lt=w?vh({query:ct,firedQuery:A,status:M,resultCount:D.length}):null,ut=lt?.submit?.query??``,dt=lt?.results.forQuery??``,ft,pt;t[33]!==it||t[34]!==r?(ft=()=>{if(!r||!it||ue.current)return;ue.current=!0,ie(`loading`);let e=!1;return Sh().then(t=>{e||(ne(t),ie(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),ne([]),ie(`error`))}),()=>{e=!0}},pt=[r,it],t[33]=it,t[34]=r,t[35]=ft,t[36]=pt):(ft=t[35],pt=t[36]),(0,Q.useEffect)(ft,pt);let ht=rt.kind===`tag-docs`?rt.tagName:null;(0,Q.useEffect)(()=>{if(!r||ht===null){se([]),le(`idle`);return}le(`loading`),se([]);let e=!1;return Ch(ht).then(t=>{e||(se(t),le(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),se([]),le(`error`))}),()=>{e=!0}},[r,ht]),(0,Q.useEffect)(()=>{if(!r||!p||at||Te){_([]),y(`idle`),x(!1),C(!1);return}let e=!1,t=!1,n=0,i=null,a,o;y(`loading`);let s=()=>e||n>=M_?!1:(n+=1,o=window.setTimeout(l,j_),!0),c=()=>{e||t&&s()||(_([]),y(`error`),x(!1),C(!1))};function l(){let n=new AbortController;i=n,a=window.setTimeout(()=>{n.abort(),c()},A_),hh(p,{signal:n.signal}).then(n=>{let{entries:r,truncated:i,ready:o}=n;if(window.clearTimeout(a),!e){if(!o){t||(t=!0,_([]),x(!1),C(!0),y(`success`)),s()||C(!1);return}_(r),x(i),C(!1),y(`success`)}}).catch(t=>{window.clearTimeout(a),!e&&(t instanceof Error&&t.name===`AbortError`||c())})}return l(),()=>{e=!0,window.clearTimeout(a),window.clearTimeout(o),i?.abort()}},[r,p,at,Te]);let gt;t[37]!==c||t[38]!==a?(gt=(e,t)=>{let n=t===void 0?c({id:`uuoHOU`}):t;a(!1),N_(async()=>{await e()},n)},t[37]=c,t[38]=a,t[39]=gt):gt=t[39];let _t=gt,vt;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(vt=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Zm(Ym(),t);Xm(n),U(n)},t[40]=vt):vt=t[40];let yt=vt,bt;t[41]===a?bt=t[42]:(bt=function(e){a(!1),yt(e),P_(e.path)},t[41]=a,t[42]=bt);let xt=bt,St=!at&&p===``&&He.length>0,Ct=B_({searchResults:g,fallbackSearchResults:Ye,searchStatus:v}),wt=!at&&Ct.length>0,Tt=!at&&p!==``&&(Te||S)&&!wt,Dt=!at&&p!==``&&v===`loading`&&!wt&&!Tt,Ot;t[43]!==c||t[44]!==f||t[45]!==at?(Ot=!at&&gh(c({id:`HdkSiO`}),f,[`create file`]),t[43]=c,t[44]=f,t[45]=at,t[46]=Ot):Ot=t[46];let kt=Ot,At;t[47]!==c||t[48]!==f||t[49]!==at?(At=!at&&gh(c({id:`96G6Re`}),f,[`create folder`]),t[47]=c,t[48]=f,t[49]=at,t[50]=At):At=t[50];let jt=At,Mt;t[51]!==c||t[52]!==he||t[53]!==f||t[54]!==at?(Mt=!at&&he!==null&&gh(c({id:`3Fcb0I`}),f,[`graph panel network`]),t[51]=c,t[52]=he,t[53]=f,t[54]=at,t[55]=Mt):Mt=t[55];let Nt=Mt,Pt;t[56]!==c||t[57]!==f||t[58]!==at?(Pt=!at&&gh(c({id:`fWi7pn`}),f,[`scaffold`,`seed`,`pack`,`starter`]),t[56]=c,t[57]=f,t[58]=at,t[59]=Pt):Pt=t[59];let Ft=Pt,It;t[60]!==c||t[61]!==o||t[62]!==f||t[63]!==at?(It=!at&&o!==null&&gh(c({id:`gKi-a_`}),f,[`create new project scaffold`]),t[60]=c,t[61]=o,t[62]=f,t[63]=at,t[64]=It):It=t[64];let Lt=It,Rt;t[65]!==c||t[66]!==o||t[67]!==f||t[68]!==at?(Rt=!at&&o!==null&&gh(c({id:`WPwDin`}),f,[`project`]),t[65]=c,t[66]=o,t[67]=f,t[68]=at,t[69]=Rt):Rt=t[69];let zt=Rt,Bt;t[70]!==c||t[71]!==o||t[72]!==f||t[73]!==at||t[74]!==l?(Bt=!at&&!l&&o!==null&&gh(c({id:`xaDWAI`}),f,[`switch project navigator projects`]),t[70]=c,t[71]=o,t[72]=f,t[73]=at,t[74]=l,t[75]=Bt):Bt=t[75];let Vt=Bt,Ht;t[76]!==c||t[77]!==f||t[78]!==at||t[79]!==l?(Ht=!at&&!l&&gh(c({id:`Tz0i8g`}),f,[`preferences config`]),t[76]=c,t[77]=f,t[78]=at,t[79]=l,t[80]=Ht):Ht=t[80];let Ut=Ht,Wt;t[81]!==c||t[82]!==f||t[83]!==at?(Wt=!1,t[81]=c,t[82]=f,t[83]=at,t[84]=Wt):Wt=t[84];let Gt=Wt,Kt=!at&&o!==null&&Ge.length>0&&(p===``||Ge.some(e=>gh(`${e.name} ${e.path}`,f,[`open recent project`]))),qt=mg(),Jt=!at&&!qt&&Be!==null&&(p===``||_g.some(e=>{let t=e.displayName;return gh(c({id:`WqLq6M`,values:{displayName:t}}),f,[e.id,`agent handoff`,`open in`])})),Yt=rt.kind===`tag-list`?xh(te,rt.query):[],Xt=rt.kind===`tag-list`&&X!==`loading`&&Yt.length===0,Zt=rt.kind===`tag-docs`&&ce===`success`&&oe.length===0,Qt=at||St||wt||Dt||Tt||kt||jt||Nt||Ft||Lt||zt||Vt||Ut||Gt||Kt||Jt,$t;t[85]===Symbol.for(`react.memo_cache_sentinel`)?($t=function(e){d(`${yh}${e}`)},t[85]=$t):$t=t[85];let en=$t,tn;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(tn=function(){pe.current?.abort(),pe.current=null,me.current!==null&&(window.clearTimeout(me.current),me.current=null),k([]),j(null),N(`idle`)},t[86]=tn):tn=t[86];let nn=tn,rn;t[87]===u?rn=t[88]:(rn=function(){T(!0),u.startsWith(`tag:`)&&d(u.slice(yh.length)),nn(),fe.current?.focus()},t[87]=u,t[88]=rn);let an=rn,on;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(on=function(){T(!1),d(``),nn(),fe.current?.focus()},t[89]=on):on=t[89];let sn=on,cn=function(e){let t=e.trim();if(!t||Te)return;pe.current?.abort(),me.current!==null&&window.clearTimeout(me.current);let n=new AbortController;pe.current=n,N(`loading`);let r=!1,i=window.setTimeout(()=>{r=!0,n.abort(),N(`error`)},A_);me.current=i,hh(t,{signal:n.signal,semantic:!0,limit:30}).then(e=>{let{entries:r}=e;ln(i,n),k(r),j(t),N(`success`)}).catch(e=>{ln(i,n),!(e instanceof Error&&e.name===`AbortError`&&!r)&&(console.debug(`[semantic-search] fire failed`,{timedOut:r,error:e}),N(`error`))})};function ln(e,t){window.clearTimeout(e),me.current===e&&(me.current=null),pe.current===t&&(pe.current=null)}let un=function(e){!w||e.key!==`Enter`||(lt?.submit?(e.preventDefault(),e.stopPropagation(),cn(lt.submit.query)):M===`loading`&&(e.preventDefault(),e.stopPropagation()))},dn;t[90]===w?dn=t[91]:(dn=function(e){w&&(e.preventDefault(),sn())},t[90]=w,t[91]=dn);let fn=dn,pn;t[92]===c?pn=t[93]:(pn=c({id:`1bDVu5`}),t[92]=c,t[93]=pn);let mn;t[94]===c?mn=t[95]:(mn=c({id:`5GRxoA`}),t[94]=c,t[95]=mn);let hn;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(hn={shouldFilter:!1,className:`[&_[cmdk-input-wrapper]_svg]:h-4 [&_[cmdk-input-wrapper]_svg]:w-4 [&_[cmdk-item]_svg]:h-4 [&_[cmdk-item]_svg]:w-4`},t[96]=hn):hn=t[96];let gn;t[97]!==c||t[98]!==w?(gn=c(w?{id:`zXj1rA`}:{id:`ggs9f8`}),t[97]=c,t[98]=w,t[99]=gn):gn=t[99];let _n;t[100]!==w||t[101]!==it?(_n=()=>{w&&(T(!1),nn()),d(it?``:yh),fe.current?.focus()},t[100]=w,t[101]=it,t[102]=_n):_n=t[102];let vn=it?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,yn;t[103]===vn?yn=t[104]:(yn=oi(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,vn),t[103]=vn,t[104]=yn);let bn,xn;t[105]===Symbol.for(`react.memo_cache_sentinel`)?(bn=(0,Z.jsx)(Se,{className:`size-3.5`}),xn=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`0rwwOn`})}),t[105]=bn,t[106]=xn):(bn=t[105],xn=t[106]);let Sn;t[107]!==it||t[108]!==_n||t[109]!==yn?(Sn=(0,Z.jsxs)(`button`,{type:`button`,onClick:_n,"data-testid":`command-palette-filter-tag`,"data-active":it,"aria-pressed":it,className:yn,children:[bn,xn]}),t[107]=it,t[108]=_n,t[109]=yn,t[110]=Sn):Sn=t[110];let Cn;t[111]!==an||t[112]!==w||t[113]!==Pe?(Cn=Pe?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>w?sn():an(),"data-testid":`command-palette-filter-semantic`,"data-active":w,"aria-pressed":w,className:oi(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,w?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`),children:[(0,Z.jsx)(yi,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`9tJX8r`})})]}):null,t[111]=an,t[112]=w,t[113]=Pe,t[114]=Cn):Cn=t[114];let wn;t[115]!==Sn||t[116]!==Cn?(wn=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:[Sn,Cn]}),t[115]=Sn,t[116]=Cn,t[117]=wn):wn=t[117];let Tn=w&&lt?(0,Z.jsxs)(Z.Fragment,{children:[Le?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-indexing`,children:[(0,Z.jsx)(h,{className:`size-3.5 animate-spin`}),(0,Z.jsx)(s,{id:`kCNU4q`,values:{semanticIndexedCount:Fe,semanticTotalCount:Ie}})]}):null,lt.submit?(0,Z.jsx)(z,{children:(0,Z.jsx)(I,{value:`semantic-submit`,onSelect:()=>cn(ut),"data-testid":`command-palette-semantic-submit`,children:lt.submit.kind===`retry`?(0,Z.jsxs)(`span`,{className:`flex items-center gap-2 text-amber-700 dark:text-amber-400`,children:[(0,Z.jsx)(yi,{}),(0,Z.jsx)(s,{id:`rBc32v`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(yi,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,Z.jsx)(s,{id:`FNTx6u`,values:{semanticSubmitQuery:ut}})}),(0,Z.jsx)(Ce,{children:`↵`})]})})}):null,lt.notice===`empty`?(0,Z.jsx)(O,{"data-testid":`command-palette-semantic-empty`,children:(0,Z.jsx)(s,{id:`Xw_maT`})}):null,lt.notice===`searching`?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-semantic-searching`,children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),(0,Z.jsx)(s,{id:`PBwmDJ`})]}):null,lt.notice===`no-results`?(0,Z.jsx)(O,{"data-testid":`command-palette-semantic-no-results`,children:(0,Z.jsx)(s,{id:`yFyZMJ`,values:{semanticQueryText:ct}})}):null,lt.results.show?(0,Z.jsx)(z,{heading:lt.results.dimmed?c({id:`QlxHAH`,values:{semanticResultsLabel:dt}}):c({id:`9tJX8r`}),children:(0,Z.jsx)(`div`,{"data-testid":`command-palette-semantic-results`,"data-dimmed":lt.results.dimmed,children:D.map(e=>(0,Z.jsx)(I_,{entry:e,disabled:lt.results.dimmed,onSelect:()=>xt(e)},Jm(e.kind,e.path)))})}):null]}):null,En;t[118]===Tt?En=t[119]:(En=Tt?(0,Z.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-6 text-muted-foreground text-sm`,role:`status`,"aria-live":`polite`,"data-testid":`command-palette-search-preparing`,children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),(0,Z.jsx)(s,{id:`yIPXut`})]}):null,t[118]=Tt,t[119]=En);let Dn;t[120]!==wt||t[121]!==Dt?(Dn=Dt&&!wt?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`WRNXKp`})}):null,t[120]=wt,t[121]=Dt,t[122]=Dn):Dn=t[122];let On=Qt?null:(0,Z.jsx)(O,{children:v===`error`?(0,Z.jsx)(s,{id:`pkAft1`}):(0,Z.jsx)(s,{id:`i3f2kh`})}),kn=rt.kind===`tag-list`?(0,Z.jsxs)(z,{heading:rt.query?c({id:`evs0iw`,values:{tagListQuery:ot}}):c({id:`2QM24L`}),children:[X===`loading`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`a_u4ck`})}):null,X===`error`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`MZoxVx`})}):null,Xt?(0,Z.jsx)(O,{children:rt.query?c({id:`X0ttSN`,values:{tagListQuery:ot}}):c({id:`JLUTgi`})}):null,Yt.map(e=>(0,Z.jsxs)(I,{value:`tag ${e.name}`,onSelect:()=>en(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(Se,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:(0,Z.jsx)(s,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,An=rt.kind===`tag-docs`?(0,Z.jsxs)(z,{heading:c({id:`hGmuTc`,values:{tagDocsName:st}}),children:[ce===`loading`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`pWbsW6`})}):null,ce===`error`?(0,Z.jsx)(O,{children:(0,Z.jsx)(s,{id:`48uGTI`})}):null,Zt?(0,Z.jsx)(O,{children:c({id:`NIWAux`,values:{tagDocsName:st}})}):null,oe.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==rt.tagName).map(H_).join(`, `);return(0,Z.jsxs)(I,{value:`tag-doc ${e.docName}`,onSelect:()=>{a(!1),P_(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(We,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:t}),(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:e.docName}),e.matchingTags.length>0&&e.matchingTags.some(e=>e!==rt.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(s,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,jn=St?(0,Z.jsx)(z,{heading:c({id:`MmDDWK`}),children:He.map(e=>(0,Z.jsx)(I_,{entry:e,onSelect:()=>xt(e)},Jm(e.kind,e.path)))}):null,Mn;t[123]!==c||t[124]!==he||t[125]!==a||t[126]!==G||t[127]!==q||t[128]!==kt||t[129]!==jt||t[130]!==Nt||t[131]!==Ft?(Mn=kt||jt||Nt||Ft?(0,Z.jsxs)(z,{heading:c({id:`45MZFs`}),children:[kt?(0,Z.jsxs)(I,{value:`new file create file`,onSelect:()=>{a(!1),G(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(yl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`HdkSiO`})})]}):null,jt?(0,Z.jsxs)(I,{value:`new folder create folder`,onSelect:()=>{a(!1),G(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(Cl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`96G6Re`})})]}):null,Nt?(0,Z.jsxs)(I,{value:`open graph graph panel network`,onSelect:()=>{he&&(a(!1),Dh(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Ll,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`3Fcb0I`})})]}):null,Ft?(0,Z.jsxs)(I,{value:`initialize starter pack scaffold seed`,onSelect:()=>{a(!1),q(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(zl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fWi7pn`})})]}):null]}):null,t[123]=c,t[124]=he,t[125]=a,t[126]=G,t[127]=q,t[128]=kt,t[129]=jt,t[130]=Nt,t[131]=Ft,t[132]=Mn):Mn=t[132];let Nn=Jt?(0,Z.jsx)(z,{heading:c({id:`O7_W_a`}),children:_g.filter(e=>{let t=e.displayName;return gh(c({id:`WqLq6M`,values:{displayName:t}}),f,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=Oe[e.id],n=t.installed===!0&&Be!==null,r=e.displayName,i=t.installed===null?c({id:`IA6JW2`}):t.installed===!1?c({id:`5SwVv1`}):null,o=c(i?{id:`1ZpfyB`,values:{displayName:r,hint:i}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(I,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!Be||(a(!1),Ae(e.id,Be))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":o,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`WqLq6M`,values:{displayName:r}})}),i?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:i}):null]},e.id)})}):null,Pn;t[133]!==c||t[134]!==o||t[135]!==a||t[136]!==_t||t[137]!==ee||t[138]!==Lt||t[139]!==Gt||t[140]!==zt||t[141]!==Vt||t[142]!==Ut?(Pn=Lt||zt||Vt||Ut||Gt?(0,Z.jsxs)(z,{heading:c({id:`e0NrBM`}),children:[Lt&&o?(0,Z.jsxs)(I,{value:`new project create scaffold`,onSelect:()=>{a(!1),ee(!0)},"data-testid":`command-palette-new-project`,children:[(0,Z.jsx)(V,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`gKi-a_`})})]}):null,zt&&o?(0,Z.jsxs)(I,{value:`open folder on disk project`,onSelect:()=>_t(async()=>{let e=await o.dialog.openFolder();e&&await o.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(re,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`WPwDin`})}),(0,Z.jsx)(Ce,{children:tc(`open-folder`)})]}):null,Vt&&o?(0,Z.jsxs)(I,{value:`switch-project navigator projects`,onSelect:()=>_t(()=>o.navigator.open(),c({id:`jol95m`})),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(R,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`xaDWAI`})}),(0,Z.jsx)(Ce,{children:tc(`switch-project`)})]}):null,Ut?(0,Z.jsxs)(I,{value:`settings preferences config`,onSelect:()=>{a(!1),window.location.hash!==`#settings`&&(window.location.hash=Cg)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Zl,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),(0,Z.jsx)(Ce,{children:tc(`settings`)})]}):null,Gt?(0,Z.jsxs)(I,{value:`install claude desktop cowork app`,onSelect:()=>{a(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(to,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`62Pc08`})})]}):null]}):null,t[133]=c,t[134]=o,t[135]=a,t[136]=_t,t[137]=ee,t[138]=Lt,t[139]=Gt,t[140]=zt,t[141]=Vt,t[142]=Ut,t[143]=Pn):Pn=t[143];let Fn=Kt&&o?(0,Z.jsx)(z,{heading:c({id:`3iyGWF`}),children:Ge.filter(e=>gh(`${e.name} ${e.path}`,f,[`open recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(I,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>_t(()=>o.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),c({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(qe,{className:`mt-0.5`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-xs`,children:[e.path,e.missing?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(s,{id:`ls1N1w`})]}):null]})]})]},e.path))}):null,In=wt?(0,Z.jsx)(z,{heading:c({id:`A1taO8`}),children:Ct.map(e=>(0,Z.jsx)(I_,{entry:e,query:p,onSelect:()=>xt(e)},Jm(e.kind,e.path)))}):null,Ln;t[144]!==Tn||t[145]!==En||t[146]!==Dn||t[147]!==On||t[148]!==kn||t[149]!==An||t[150]!==jn||t[151]!==Mn||t[152]!==Nn||t[153]!==Pn||t[154]!==Fn||t[155]!==In?(Ln=(0,Z.jsxs)(Ee,{ref:de,className:`subtle-scrollbar`,children:[Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In]}),t[144]=Tn,t[145]=En,t[146]=Dn,t[147]=On,t[148]=kn,t[149]=An,t[150]=jn,t[151]=Mn,t[152]=Nn,t[153]=Pn,t[154]=Fn,t[155]=In,t[156]=Ln):Ln=t[156];let Rn=L_,zn=_h(p,Ct,{truncated:b}),Bn;t[157]!==Rn||t[158]!==at||t[159]!==rt.kind||t[160]!==zn?(Bn=(0,Z.jsx)(Rn,{mode:zn,inExclusiveMode:at,paletteModeKind:rt.kind}),t[157]=Rn,t[158]=at,t[159]=rt.kind,t[160]=zn,t[161]=Bn):Bn=t[161];let Vn=W===`file`,Hn;t[162]===G?Hn=t[163]:(Hn=e=>{e||G(null)},t[162]=G,t[163]=Hn);let Un;t[164]!==Je||t[165]!==Vn||t[166]!==Hn?(Un=(0,Z.jsx)(zh,{open:Vn,onOpenChange:Hn,kind:`file`,initialDir:Je}),t[164]=Je,t[165]=Vn,t[166]=Hn,t[167]=Un):Un=t[167];let Wn=W===`folder`,Gn;t[168]===G?Gn=t[169]:(Gn=e=>{e||G(null)},t[168]=G,t[169]=Gn);let Kn;t[170]!==Je||t[171]!==Wn||t[172]!==Gn?(Kn=(0,Z.jsx)(zh,{open:Wn,onOpenChange:Gn,kind:`folder`,initialDir:Je}),t[170]=Je,t[171]=Wn,t[172]=Gn,t[173]=Kn):Kn=t[173];let qn;t[174]!==K||t[175]!==q?(qn=(0,Z.jsx)(lg,{open:K,onOpenChange:q}),t[174]=K,t[175]=q,t[176]=qn):qn=t[176];let Jn;return t[177]!==o||t[178]!==J||t[179]!==ee?(Jn=o?(0,Z.jsx)(hf,{open:J,onOpenChange:ee,bridge:o}):null,t[177]=o,t[178]=J,t[179]=ee,t[180]=Jn):Jn=t[180],(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(be,{open:r,onOpenChange:a,title:pn,description:mn,className:`sm:max-w-2xl`,commandProps:hn,onEscapeKeyDown:fn,children:[(0,Z.jsx)(Et,{ref:fe,value:u,onValueChange:d,onKeyDown:un,placeholder:gn}),wn,Ln,Bn]}),Un,Kn,qn,Jn]})}function H_(e){return`#${e}`}function U_(e){return e.name}function W_(e){return Jm(e.kind,e.path)}var G_=500;function K_(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function q_(e){return e?.kind===`null-collab`}function J_(e){if(e===null)return ms._({id:`Ua78MH`});if(e.kind===`null-collab`)return ms._({id:`TJnkyf`});if(e.code===`network`)return ms._({id:`aoa6xA`});if(e.code===`invalid-body`)return ms._({id:`FRYB1Q`});let t=e.code;return ms._({id:`4nj6n8`,values:{code:t}})}function Y_(){let e=(0,$.c)(18),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=mt(),[a,o]=(0,Q.useState)(!1),c,l;e[0]!==n||e[1]!==t?(c=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),G_);return()=>clearTimeout(e)},l=[t,n],e[0]=n,e[1]=t,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u=K_(t,n,a);if(u===`hidden`)return null;if(u===`terminal`){let t;e[4]===r?t=e[5]:(t=q_(r),e[4]=r,e[5]=t);let n=t,a;e[6]===r?a=e[7]:(a=J_(r),e[6]=r,e[7]=a);let o=a,c;e[8]!==o||e[9]!==n?(c=(0,Z.jsx)(`span`,{children:n?(0,Z.jsx)(s,{id:`AAlr5Y`,components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}}):(0,Z.jsx)(s,{id:`noH1JX`,values:{errorDetail:o},components:{0:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`}),1:(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`})}})}),e[8]=o,e[9]=n,e[10]=c):c=e[10];let l;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(s,{id:`6gRgw8`}),e[11]=l):l=e[11];let u;e[12]===i?u=e[13]:(u=(0,Z.jsx)(`button`,{type:`button`,onClick:i,className:`bg-red-950 text-red-50 px-2 py-0.5 rounded text-xs font-medium hover:bg-red-900`,children:l}),e[12]=i,e[13]=u);let d;return e[14]!==c||e[15]!==u?(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-live":`assertive`,className:`fixed top-0 inset-x-0 z-50 bg-red-500/95 text-red-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md flex items-center justify-center gap-3 flex-wrap`,children:[c,u]}),e[14]=c,e[15]=u,e[16]=d):d=e[16],d}let d;return e[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`fixed top-0 inset-x-0 z-50 bg-amber-500/95 text-amber-950 text-sm text-center py-2 px-4 pl-[var(--ok-titlebar-reserve-left,1rem)] shadow-md`,children:(0,Z.jsx)(s,{id:`UYcGIW`})}),e[17]=d):d=e[17],d}function X_(e){let t=(0,$.c)(6),{bridge:n}=e,[r,i]=(0,Q.useState)(!1),a,o;t[0]===n?(a=t[1],o=t[2]):(a=()=>n.onMenuAction(e=>{e===`new-project`&&i(!0)}),o=[n],t[0]=n,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o);let s;return t[3]!==n||t[4]!==r?(s=(0,Z.jsx)(hf,{open:r,onOpenChange:i,bridge:n}),t[3]=n,t[4]=r,t[5]=s):s=t[5],s}async function Z_(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null),n=t.status,r=t.statusText;throw Error(qo(e)??ms._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function Q_(){let e=(0,$.c)(18),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={kind:`idle`},e[0]=a):a=e[0];let[o,c]=(0,Q.useState)(a),l=(0,Q.useRef)(0),u,d;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=l.current+=1;i(t.value),n(!0),c({kind:`loading`}),Z_(t.value).then(e=>{l.current===r&&c({kind:`ready`,docs:e})}).catch(e=>{l.current===r&&c({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(Ye,e),()=>document.removeEventListener(Ye,e)},d=[],e[1]=u,e[2]=d):(u=e[1],d=e[2]),(0,Q.useEffect)(u,d);let f;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(e){n(!1),window.location.assign(Vo(e))},e[3]=f):f=e[3];let p=f,m=r??``,h;e[4]===m?h=e[5]:(h={tagName:m},e[4]=m,e[5]=h);let g;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(g={0:(0,Z.jsx)(`span`,{className:`font-mono`})},e[6]=g):g=e[6];let _;e[7]===h?_=e[8]:(_=(0,Z.jsx)(Do,{children:(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`7H4UHD`,values:h,components:g})})}),e[7]=h,e[8]=_);let v=r??``,y;e[9]!==o||e[10]!==v?(y=(0,Z.jsx)(To,{children:(0,Z.jsx)($_,{fetchState:o,tag:v,onSelectDoc:p})}),e[9]=o,e[10]=v,e[11]=y):y=e[11];let b;e[12]!==_||e[13]!==y?(b=(0,Z.jsxs)(wo,{children:[_,y]}),e[12]=_,e[13]=y,e[14]=b):b=e[14];let x;return e[15]!==t||e[16]!==b?(x=(0,Z.jsx)(Oo,{open:t,onOpenChange:n,children:b}),e[15]=t,e[16]=b,e[17]=x):x=e[17],x}function $_(e){let t=(0,$.c)(15),{fetchState:n,tag:r,onSelectDoc:i}=e;if(n.kind===`idle`||n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-loading`,children:(0,Z.jsx)(s,{id:`yQE2r9`})}),t[0]=e):e=t[0],e}if(n.kind===`error`){let e;return t[1]===n.message?e=t[2]:(e=(0,Z.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`tag-dialog-error`,children:n.message}),t[1]=n.message,t[2]=e),e}if(n.docs.length===0){let e;t[3]===r?e=t[4]:(e={tag:r},t[3]=r,t[4]=e);let n;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(n={0:(0,Z.jsx)(`span`,{className:`font-mono`})},t[5]=n):n=t[5];let i;return t[6]===e?i=t[7]:(i=(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:(0,Z.jsx)(s,{id:`lAiyU_`,values:e,components:n})}),t[6]=e,t[7]=i),i}let a;if(t[8]!==n.docs||t[9]!==i){let e;t[11]===i?e=t[12]:(e=e=>{let t=e.matchingTags??[];return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`w-full rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring`,onClick:()=>i(e.docName),"data-testid":`tag-dialog-row`,children:[(0,Z.jsx)(`span`,{className:`block truncate font-medium`,children:e.title}),e.docName===e.title?null:(0,Z.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:e.docName}),t.length>0?(0,Z.jsx)(`span`,{className:`mt-1 flex flex-wrap items-center gap-1`,"data-testid":`tag-dialog-row-matches`,children:t.map(ev)}):null]})},e.docName)},t[11]=i,t[12]=e),a=n.docs.map(e),t[8]=n.docs,t[9]=i,t[10]=a}else a=t[10];let o;return t[13]===a?o=t[14]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[13]=a,t[14]=o),o}function ev(e){return(0,Z.jsxs)(`span`,{"data-testid":`tag-dialog-row-match`,"data-tag":e,className:`tag pointer-events-none text-xs`,children:[`#`,e]},e)}var tv=`raw-mdx-nav`,nv=`ok-editor-mode-v1`,rv=[`wysiwyg`,`source`],iv=`wysiwyg`;function av(e){return rv.includes(e)}function ov(e=localStorage){try{let t=e.getItem(nv);if(t===null)return iv;if(av(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return iv}function sv(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return av(n)?n:ov(t)}function cv(e,t=localStorage){try{return t.setItem(nv,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function lv(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(sv),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),cv(e)},e[0]=r):r=e[0];let i=r,a;return e[1]===t?a=e[2]:(a=[t,i],e[1]=t,e[2]=a),a}function uv(e){let t=(0,$.c)(4),{_:n}=i(),r=(0,Q.useRef)(!1),a,o;t[0]!==n||t[1]!==e?(a=()=>{e===`no-push-permission`&&!r.current&&(r.current=!0,hs.info(n({id:`JkCD2u`})))},o=[e,n],t[0]=n,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Q.useEffect)(a,o)}function dv(e){let t=(0,$.c)(25),{open:n,onResolved:r}=e,{_:a}=i(),o=Ia(),c;t[0]!==a||t[1]!==r||t[2]!==o?(c=function(e){if(o===null){hs.error(a({id:`fiMNLl`}));return}let t=o(e);if(!t.ok){let n=t.error;hs.error(a(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}r()},t[0]=a,t[1]=r,t[2]=o,t[3]=c):c=t[3];let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Do,{children:(0,Z.jsx)(Fa,{})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(wa,{}),t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(To,{children:[d,(0,Z.jsx)(`p`,{className:`mt-3 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ZLQol-`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})})]}),t[6]=f):f=t[6];let p;t[7]===l?p=t[8]:(p=()=>l(!1),t[7]=l,t[8]=p);let m=o===null,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(s,{id:`IKoTAC`}),t[9]=h):h=t[9];let g;t[10]!==p||t[11]!==m?(g=(0,Z.jsx)(ci,{variant:`outline`,className:`uppercase font-mono`,onClick:p,disabled:m,children:h}),t[10]=p,t[11]=m,t[12]=g):g=t[12];let _;t[13]===l?_=t[14]:(_=()=>l(!0),t[13]=l,t[14]=_);let v=o===null,y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`XU0OXn`}),t[15]=y):y=t[15];let b;t[16]!==v||t[17]!==_?(b=(0,Z.jsx)(ci,{onClick:_,disabled:v,children:y}),t[16]=v,t[17]=_,t[18]=b):b=t[18];let x;t[19]!==b||t[20]!==g?(x=(0,Z.jsxs)(wo,{className:`sm:max-w-lg`,showCloseButton:!1,children:[u,f,(0,Z.jsxs)(Eo,{children:[g,b]})]}),t[19]=b,t[20]=g,t[21]=x):x=t[21];let S;return t[22]!==n||t[23]!==x?(S=(0,Z.jsx)(Oo,{open:n,onOpenChange:fv,children:x}),t[22]=n,t[23]=x,t[24]=S):S=t[24],S}function fv(){}function pv(e){return!e.autoSyncOnboardingDismissed&&e.hasRemote===!0&&e.projectLocalSynced===!0&&e.projectSynced===!0&&e.projectLocalConfig!==null&&e.projectLocalConfig.autoSync?.enabled===null&&(e.projectConfig?.autoSync?.default??null)===null&&(e.pushPermissionCheckStatus===`allowed`||e.pushPermissionCheckStatus===`unknown`)}var mv=5;async function hv(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=mr.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Fe(ms._({id:`XopE_I`,values:{status:r}}),{status:r})}let r=_r.safeParse(n);if(!r.success)throw new Fe(ms._({id:`lZAiSP`}),{status:t.status});return r.data.backlinks}async function gv(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=mr.safeParse(n),r=t.status;throw e.success?Error(e.data.title):new Fe(ms._({id:`GemPfn`,values:{status:r}}),{status:r})}let r=ni.safeParse(n);if(!r.success)throw new Fe(ms._({id:`2YZwPB`}),{status:t.status});return r.data.forwardLinks}function _v(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function vv(e){window.location.hash=Vo(e)}function yv(e){let t=(0,$.c)(9),{title:n,count:r,isLoading:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Ve,{className:`size-3.5 text-muted-foreground transition-transform group-data-[state=closed]:-rotate-90`}),t[0]=a):a=t[0];let o;t[1]===n?o=t[2]:(o=(0,Z.jsxs)(`span`,{className:`flex items-center gap-2.5`,children:[a,(0,Z.jsx)(xn,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(bn,{children:r}),t[3]=r,t[4]=i,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(Po,{className:`group flex w-full cursor-pointer items-center justify-between px-5 py-3 text-left transition-colors hover:bg-muted/40`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function bv(e){let t=(0,$.c)(10),{total:n,expanded:r,onToggle:i}=e;if(n<=mv)return null;let a=n-mv,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Ve,{className:`size-3`}):(0,Z.jsx)(No,{className:`size-3`}),t[0]=r,t[1]=o);let c;t[2]!==r||t[3]!==a?(c=r?(0,Z.jsx)(s,{id:`6fGjTz`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:a}}),t[2]=r,t[3]=a,t[4]=c):c=t[4];let l;return t[5]!==r||t[6]!==i||t[7]!==o||t[8]!==c?(l=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,className:`mt-2 inline-flex cursor-pointer items-center gap-1 px-3 text-xs text-muted-foreground transition-colors hover:text-foreground`,onClick:i,children:[o,c]}),t[5]=r,t[6]=i,t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function xv(e){let t=(0,$.c)(35),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:c,snippet:l,titleHover:u,ariaLabel:d,href:f,external:p,disabled:m,onClick:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=oi(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==d||t[6]!==m||t[7]!==p||t[8]!==f||t[9]!==h||t[10]!==a||t[11]!==u?(x=f?(0,Z.jsxs)(`a`,{href:f,target:p?`_blank`:void 0,rel:p?`noopener noreferrer`:void 0,"aria-label":d,title:u,onClick:h,className:`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:[a,p?(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,(0,Z.jsx)(s,{id:`dbtjJh`})]}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":d,title:u,disabled:m,onClick:h,className:oi(`block w-full truncate text-left font-medium text-foreground no-underline outline-none after:absolute after:inset-0 after:rounded-md focus-visible:after:ring-2 focus-visible:after:ring-ring`,`cursor-pointer bg-transparent p-0 disabled:cursor-not-allowed disabled:opacity-60`),children:a}),t[5]=d,t[6]=m,t[7]=p,t[8]=f,t[9]=h,t[10]=a,t[11]=u,t[12]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==c||t[16]!==o||t[17]!==g?(w=g?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,c?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,c]}):null]}):null,t[15]=c,t[16]=o,t[17]=g,t[18]=w):w=t[18];let T;t[19]===l?T=t[20]:(T=l?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:l}):null,t[19]=l,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]!==C||t[26]!==E?(D=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E]}),t[25]=C,t[26]=E,t[27]=D):D=t[27];let O=D;if(i){let e;t[28]===O?e=t[29]:(e=(0,Z.jsx)(js,{asChild:!0,children:O}),t[28]=O,t[29]=e);let n;t[30]===i?n=t[31]:(n=(0,Z.jsx)(Ns,{side:`top`,children:i}),t[30]=i,t[31]=n);let r;return t[32]!==e||t[33]!==n?(r=(0,Z.jsxs)(Is,{children:[e,n]}),t[32]=e,t[33]=n,t[34]=r):r=t[34],r}return O}function Sv(e){let t=(0,$.c)(39),{docName:n}=e,{_:r}=i(),{folderPaths:a,pages:o,pagesBySlug:c,pagesByBasename:l,loading:d}=rs(),f,p;t[0]===n?(f=t[1],p=t[2]):(f=[`backlinks`,n],p=()=>hv(n),t[0]=n,t[1]=f,t[2]=p);let m;t[3]!==n||t[4]!==d||t[5]!==o?(m=!d&&o.has(n),t[3]=n,t[4]=d,t[5]=o,t[6]=m):m=t[6];let h;t[7]!==f||t[8]!==p||t[9]!==m?(h={queryKey:f,queryFn:p,enabled:m},t[7]=f,t[8]=p,t[9]=m,t[10]=h):h=t[10];let{data:g,isLoading:_,error:v}=cn(h),y;t[11]===g?y=t[12]:(y=g===void 0?[]:g,t[11]=g,t[12]=y);let b=y,[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1));let T;t[13]!==b||t[14]!==x?(T=x?b:b.slice(0,mv),t[13]=b,t[14]=x,t[15]=T):T=t[15];let E=T,D;t[16]===r?D=t[17]:(D=r({id:`9NJWgv`}),t[16]=r,t[17]=D);let O;t[18]!==b.length||t[19]!==_||t[20]!==D?(O=(0,Z.jsx)(yv,{title:D,count:b.length,isLoading:_}),t[18]=b.length,t[19]=_,t[20]=D,t[21]=O):O=t[21];let k;t[22]!==r||t[23]!==b.length||t[24]!==v||t[25]!==x||t[26]!==a||t[27]!==_||t[28]!==o||t[29]!==l||t[30]!==c||t[31]!==E?(k=v?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(on,{children:v instanceof Error?v.message:r({id:`Xet9MX`})})}):b.length===0&&!_?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(pn,{children:(0,Z.jsx)(s,{id:`rVxu1k`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:E.map((e,t)=>{let n=Ic(e.source,{pages:o,folderPaths:a,pagesBySlug:c,pagesByBasename:l});return(0,Z.jsx)(xv,{icon:(0,Z.jsx)(u,{className:`size-3.5`}),title:e.title,path:_v(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:Vo(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(bv,{total:b.length,expanded:x,onToggle:()=>S(Cv)})]}),t[22]=r,t[23]=b.length,t[24]=v,t[25]=x,t[26]=a,t[27]=_,t[28]=o,t[29]=l,t[30]=c,t[31]=E,t[32]=k):k=t[32];let A;t[33]!==_||t[34]!==k?(A=(0,Z.jsx)(Mo,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":_,children:k})}),t[33]=_,t[34]=k,t[35]=A):A=t[35];let j;return t[36]!==A||t[37]!==O?(j=(0,Z.jsxs)(Fo,{defaultOpen:!0,children:[O,A]}),t[36]=A,t[37]=O,t[38]=j):j=t[38],j}function Cv(e){return!e}function wv(e){let t=(0,$.c)(49),{docName:n}=e,{_:r}=i(),{addPage:a,folderPaths:o,pages:c,pagesBySlug:l,pagesByBasename:d,loading:f}=rs(),p,m;t[0]===n?(p=t[1],m=t[2]):(p=[`forward-links`,n],m=()=>gv(n),t[0]=n,t[1]=p,t[2]=m);let h;t[3]!==n||t[4]!==c||t[5]!==f?(h=!f&&c.has(n),t[3]=n,t[4]=c,t[5]=f,t[6]=h):h=t[6];let g;t[7]!==p||t[8]!==m||t[9]!==h?(g={queryKey:p,queryFn:m,enabled:h},t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let{data:_,isLoading:v,error:y}=cn(g),b;t[11]===_?b=t[12]:(b=_===void 0?[]:_,t[11]=_,t[12]=b);let x=b,[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(n);E!==n&&(D(n),T(!1),C(null));let O;t[13]!==w||t[14]!==x?(O=w?x:x.slice(0,mv),t[13]=w,t[14]=x,t[15]=O):O=t[15];let k=O,A;t[16]!==r||t[17]!==a||t[18]!==S?(A=async function(e,t){if(!S){C(t);try{await Vt(e,{addPage:a,onCreated:vv}),C(null)}catch(e){let t=e;hs.error(t instanceof Error?t.message:r({id:`tfi40B`})),C(null)}}},t[16]=r,t[17]=a,t[18]=S,t[19]=A):A=t[19];let j=A,M;t[20]!==r||t[21]!==S||t[22]!==o||t[23]!==j||t[24]!==c||t[25]!==d||t[26]!==l||t[27]!==f?(M=function(e){let{title:t}=e;if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(xv,{icon:(0,Z.jsx)(vo,{className:`size-3.5`}),rowTooltip:r({id:`XDzAnp`}),title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let n=U(e.docName,{pages:c,folderPaths:o,pagesBySlug:l,pagesByBasename:d}),i=!f&&n.kind===`create`,a=!f&&n.kind===`navigate`&&n.displayState===`folder`,s=_v(e.docName),p=e.title===e.docName?s:e.title,m=`doc:${e.docName}:${e.anchor??``}`,h=Vo(n.kind===`navigate`?n.hashDocName:e.docName,e.anchor);if(i&&n.kind===`create`){let i={initialDir:n.initialDir,suggestedName:n.suggestedName};return(0,Z.jsx)(xv,{icon:(0,Z.jsx)(Lo,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:r(S===m?{id:`kj9pAE`}:{id:`IQPyrD`}),ariaLabel:r(S===m?{id:`un8kBM`,values:{linkTitle:t}}:{id:`jEdF24`,values:{linkTitle:t}}),title:p,path:s,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:S!==null,onClick:()=>void j(i,m)},m)}return a&&n.kind===`navigate`?(0,Z.jsx)(xv,{icon:(0,Z.jsx)(wl,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:r({id:`P6lAT3`,values:{linkTitle:t}}),title:p,path:s,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},m):(0,Z.jsx)(xv,{icon:(0,Z.jsx)(u,{className:`size-3.5`}),title:p,path:s,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:h},m)},t[20]=r,t[21]=S,t[22]=o,t[23]=j,t[24]=c,t[25]=d,t[26]=l,t[27]=f,t[28]=M):M=t[28];let N=M,P;t[29]===r?P=t[30]:(P=r({id:`O0Z2Xr`}),t[29]=r,t[30]=P);let F;t[31]!==v||t[32]!==x.length||t[33]!==P?(F=(0,Z.jsx)(yv,{title:P,count:x.length,isLoading:v}),t[31]=v,t[32]=x.length,t[33]=P,t[34]=F):F=t[34];let I;t[35]!==r||t[36]!==y||t[37]!==w||t[38]!==v||t[39]!==x.length||t[40]!==N||t[41]!==k?(I=y?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(on,{children:y instanceof Error?y.message:r({id:`pZAs1T`})})}):x.length===0&&!v?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(pn,{children:(0,Z.jsx)(s,{id:`roiUQQ`})})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:k.map(N)}),(0,Z.jsx)(bv,{total:x.length,expanded:w,onToggle:()=>T(Tv)})]}),t[35]=r,t[36]=y,t[37]=w,t[38]=v,t[39]=x.length,t[40]=N,t[41]=k,t[42]=I):I=t[42];let L;t[43]!==v||t[44]!==I?(L=(0,Z.jsx)(Mo,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":v,children:I})}),t[43]=v,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==F||t[47]!==L?(R=(0,Z.jsxs)(Fo,{defaultOpen:!0,children:[F,L]}),t[46]=F,t[47]=L,t[48]=R):R=t[48],R}function Tv(e){return!e}function Ev(e){let t=(0,$.c)(11),{docName:n,className:r}=e,i=r===void 0?``:r,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(wv,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ta,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Sv,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(_n,{className:`px-0 py-0`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==i||t[9]!==c?(l=(0,Z.jsx)(Sn,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}function Dv(e){let t=e.setTimer??((e,t)=>setTimeout(e,t)),n=e.clearTimer??(e=>clearTimeout(e)),r=!1,i=!1,a=null,o=null,s=e.baseMs,c=!1,l=n=>{if(!r){if(e.isPaused()){c=!0;return}a=t(u,n)}};async function u(){if(a=null,c=!1,r)return;if(e.isPaused()){c=!0;return}o=new AbortController;let t=o.signal;try{let n=await e.poll(t);if(r)return;n===`ok`?(s=e.baseMs,l(e.baseMs)):(s=Math.min(s*2,e.maxBackoffMs),l(s))}catch{if(r||t.aborted)return;s=Math.min(s*2,e.maxBackoffMs),l(s)}}return{start(){r||i||(i=!0,u())},resume(){r||!e.isPaused()&&c&&a===null&&(c=!1,u())},stop(){r=!0,a!==null&&(n(a),a=null),o?.abort()}}}var Ov=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends Ov{};function kv(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function Av(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function jv(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function Mv(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Nv(e,t){return jv(e,t,``)}function Pv(e,t){return Mv(e,t,``)}function Fv(e,t){return t.slice(0,Iv(e,t))}function Iv(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Lv(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Rv(e,t){if(t)return Bv(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function zv(e,t){if(t)return Bv(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Bv(e,t){if(!t)return[zv(e),Rv(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Lv(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Vv=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Hv=RegExp(`[${Vv}]+|\\s+|[^${Vv}]`,`ug`);new class extends Ov{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Lv(e,r)}else n=e.match(Hv)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Uv(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Uv(n,i,r,null,t.intlSegmenter),e}};function Uv(e,t,n,r,i){if(t&&n){let[a,o]=Bv(t.value,i),[s,c]=Bv(n.value,i);if(e){let r=kv(a,s);e.value=Mv(e.value,s,r),t.value=Nv(t.value,r),n.value=Nv(n.value,r)}if(r){let e=Av(o,c);r.value=jv(r.value,c,e),t.value=Pv(t.value,e),n.value=Pv(n.value,e)}}else if(n){if(e){let e=zv(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=zv(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=zv(r.value,i),[a,o]=Bv(t.value,i),s=kv(n,a);t.value=Nv(t.value,s);let c=Av(Nv(n,s),o);t.value=Pv(t.value,c),r.value=jv(r.value,n,c),e.value=Mv(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=zv(r.value,i),n=Fv(Rv(t.value,i),e);t.value=Pv(t.value,n)}else if(e){let n=Fv(Rv(e.value,i),zv(t.value,i));t.value=Nv(t.value,n)}}new class extends Ov{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Vv}]+|[^\\S\\n\\r]+|[^${Vv}]`,`ug`);return e.match(t)||[]}};var Wv=new class extends Ov{constructor(){super(...arguments),this.tokenize=Kv}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
13
13
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
14
14
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
15
15
  `)&&(e=e.slice(0,-1)),t.endsWith(`
@@ -21,12 +21,12 @@ Error generating stack: `+e.message+`
21
21
  `}function Qv(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Xv(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Zv(e,o.headerOptions):void 0)}}))}else{let s=Xv(e,t,n,r,i,a,o);return s?Zv(s,o?.headerOptions):void 0}}function $v(e,t,n,r,i,a){return Qv(e,e,t,n,r,i,a)}function ey(e){let t=e.endsWith(`
22
22
  `),n=e.split(`
23
23
  `).map(e=>e+`
24
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function ty(e,t){return`${e}\u0000${t}`}function ny(e,t,n){let r=Hr(e).body,i=Hr(t).body;return r===i?``:$v(n,r,i,``,``,{context:3})}function ry(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=mt(),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=ty(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=ny(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 iy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),ay=1e4,oy=6e4;async function sy(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 cy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return ms._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return ms._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return ms._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return ms._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?ms._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function ly(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function uy(e){return e.slice(0,7)}function dy(e){return e.type===`upstream`?ms._({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`?ms._({id:`B2DrPb`}):e.author}function fy(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)(fi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(vi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ui,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(hi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ci,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(xi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(yi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function py(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)(Oe,{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=Qr(i),t[1]=i,t[2]=a);let o=a,s=r?zr[o]??Jr[o]:Jr[o],c;t[3]!==s||t[4]!==i?(c=s??Wn(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)(fy,{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)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qc,{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)(hu,{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)(yi,{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)(Qc,{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)(hu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function my(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function hy(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(_y),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(gy)},children:[r?(0,Z.jsx)(Ve,{className:`size-3`}):(0,Z.jsx)(No,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function gy(e){return!e}function _y(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 vy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=ry(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(iy,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function yy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:a,cache:o,docName:c,expanded:l,onToggleExpanded:u,onRestoreSuccess:d}=e,{_:f}=i(),p;t[0]===n.timestamp?p=t[1]:(p=cy(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,g;t[2]===n?g=t[3]:(g=dy(n),t[2]=n,t[3]=g);let _=g,v;t[4]===n.timestamp?v=t[5]:(v=ly(n.timestamp),t[4]=n.timestamp,t[5]=v);let y=v,b;t[6]===n.sha?b=t[7]:(b=uy(n.sha),t[6]=n.sha,t[7]=b);let x=b,S=n.contributors.flatMap(by),C;t[8]===n?C=t[9]:(C=my(n),t[8]=n,t[9]=C);let w=C,[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useId)(),j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>k.current?.abort(),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==n.sha||t[13]!==u?(N=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=N):N=t[14];let P=N,F;t[15]===E?F=t[16]:(F=function(){k.current?.abort(),k.current=null,O(!1),E(!1)},t[15]=E,t[16]=F);let I=F,L;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==E?(L=async function(){O(!0);let e=new AbortController;k.current=e;let t=function(){e.signal.aborted||O(!1),k.current===e&&(k.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:c,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:c,sha:n.sha,err:i}),hs.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)E(!1),d();else{let e=`HTTP ${r.status}`;try{let t=mr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:c,sha:n.sha,status:r.status,detail:e}),hs.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=E,t[22]=L):L=t[22];let R=L,z;t[23]!==n||t[24]!==r?(z=(0,Z.jsx)(py,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=z):z=t[25];let B=z,V=l?A:void 0,H=l?`bg-muted`:`hover:bg-muted/80`,U;t[26]===H?U=t[27]:(U=[`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`,H],t[26]=H,t[27]=U);let W=U.join(` `),G;t[28]===P?G=t[29]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[28]=P,t[29]=G);let K;t[30]===B?K=t[31]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[30]=B,t[31]=K);let q;t[32]===_?q=t[33]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:_}),t[32]=_,t[33]=q);let J;t[34]!==n.timestamp||t[35]!==m?(J=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:m}),t[34]=n.timestamp,t[35]=m,t[36]=J):J=t[36];let ee;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=ee):ee=t[37];let Y;t[38]===f?Y=t[39]:(Y=f({id:`Yea-K5`}),t[38]=f,t[39]=Y);let te;t[40]===E?te=t[41]:(te=e=>{e.stopPropagation(),E(!0)},t[40]=E,t[41]=te);let ne;t[42]===D?ne=t[43]:(ne=D?(0,Z.jsx)(h,{className:`size-3 animate-spin`}):(0,Z.jsx)(pi,{className:`size-3`}),t[42]=D,t[43]=ne);let X;t[44]!==D||t[45]!==Y||t[46]!==te||t[47]!==ne?(X=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":Y,disabled:D,onClick:te,children:ne})}),t[44]=D,t[45]=Y,t[46]=te,t[47]=ne,t[48]=X):X=t[48];let re;t[49]===f?re=t[50]:(re=f({id:`Yea-K5`}),t[49]=f,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=(0,Z.jsx)(Ns,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==X||t[54]!==ie?(ae=(0,Z.jsxs)(Is,{children:[X,ie]}),t[53]=X,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==q||t[57]!==J||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,J,ee,ae]}),t[56]=q,t[57]=J,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===w?se=t[61]:(se=w.length>0&&(0,Z.jsx)(hy,{summaries:w}),t[60]=w,t[61]=se);let ce=S.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:S.join(`, `),children:S.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]!==l||t[67]!==P||t[68]!==V||t[69]!==W||t[70]!==G||t[71]!==K||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":V,"data-testid":`timeline-entry-expand`,className:W,onClick:P,onKeyDown:G,children:[K,le]}),t[66]=l,t[67]=P,t[68]=V,t[69]=W,t[70]=G,t[71]=K,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==o||t[75]!==a||t[76]!==A||t[77]!==c||t[78]!==n.sha||t[79]!==l?(de=l&&(0,Z.jsx)(vy,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:A}),t[74]=o,t[75]=a,t[76]=A,t[77]=c,t[78]=n.sha,t[79]=l,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]!==I||t[85]!==E?(pe=e=>{e?E(!0):I()},t[84]=I,t[85]=E,t[86]=pe):pe=t[86];let me;t[87]===f?me=t[88]:(me=f({id:`Pyp1NA`}),t[87]=f,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(Co,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==y||t[92]!==_||t[93]!==x||t[94]!==m?(ge={relative:m,absoluteTime:y,entrySha:x,authorName:_},t[91]=y,t[92]=_,t[93]=x,t[94]=m,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)(So,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Do,{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)(s,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===I?xe=t[104]:(xe=(0,Z.jsx)(ci,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:be}),t[103]=I,t[104]=xe);let Se;t[105]===R?Se=t[106]:(Se=()=>R(),t[105]=R,t[106]=Se);let Ce;t[107]===D?Ce=t[108]:(Ce=D?(0,Z.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t[107]=D,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==D||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(ci,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:D,onClick:Se,children:[Ce,we]}),t[110]=D,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(Eo,{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)(wo,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==T||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Oo,{open:T,onOpenChange:pe,children:De}),t[120]=T,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 by(e){return e.docs}function xy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=Nr(),l=c===`dark`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_]=(0,Q.useState)(Ty),[v,y]=(0,Q.useState)(wy),b;t[1]===_?b=t[2]:(b=()=>{y(new Set),_.clear()},t[1]=_,t[2]=b);let x;t[3]===n?x=t[4]:(x=[n],t[3]=n,t[4]=x),(0,Q.useEffect)(b,x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){y(new Set)},t[6]=w):w=t[6];let T=w,E,D;t[7]!==o||t[8]!==n?(E=()=>{if(!n){f([]);return}m(!0);let e=Dv({baseMs:ay,maxBackoffMs:oy,isPaused:Cy,poll:e=>sy(n,e,{setEntries:f,setError:g,setLoading:m,unavailableMessage:o({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)}},D=[n,o],t[7]=o,t[8]=n,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=!p&&!h&&d.length>0,k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(xn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[11]=k):k=t[11];let A;t[12]!==o||t[13]!==r||t[14]!==O||t[15]!==a?(A=O&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(xo,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":o({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)(yo,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Xl,{className:`size-3.5`})}),(0,Z.jsx)(yo,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ns,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[12]=o,t[13]=r,t[14]=O,t[15]=a,t[16]=A):A=t[16];let j;t[17]===A?j=t[18]:(j=(0,Z.jsxs)(vn,{children:[k,A]}),t[17]=A,t[18]=j);let M;t[19]!==o||t[20]!==p?(M=p&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":o({id:`o49mDZ`}),children:[1,2,3].map(Sy)}),t[19]=o,t[20]=p,t[21]=M):M=t[21];let N;t[22]!==h||t[23]!==p?(N=!p&&h&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:h})}),t[22]=h,t[23]=p,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==h||t[27]!==p?(P=!p&&!h&&d.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[25]=d,t[26]=h,t[27]=p,t[28]=P):P=t[28];let F;t[29]!==_||t[30]!==r||t[31]!==n||t[32]!==d||t[33]!==h||t[34]!==v||t[35]!==l||t[36]!==p?(F=!p&&!h&&d.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:d.map(e=>(0,Z.jsx)(yy,{entry:e,isDark:l,diffLayout:r,cache:_,docName:n,expanded:v.has(e.sha),onToggleExpanded:C,onRestoreSuccess:T},e.sha))}),t[29]=_,t[30]=r,t[31]=n,t[32]=d,t[33]=h,t[34]=v,t[35]=l,t[36]=p,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[M,N,P,F]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==j||t[44]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[j,I]}),t[43]=j,t[44]=I,t[45]=L):L=t[45],L}function Sy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Di,{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)(Di,{className:`h-3 w-28`}),(0,Z.jsx)(Di,{className:`h-3 w-40`})]})]},e)}function Cy(){return typeof document<`u`&&document.visibilityState===`hidden`}function wy(){return new Set}function Ty(){return new mi(32)}var Ey=[{id:`outline`,icon:Pl},{id:`links`,icon:ye},{id:`graph`,icon:Ll},{id:`timeline`,icon:ll}];function Dy(e){return e===`outline`?ms._({id:`dD7NPy`}):e===`links`?ms._({id:`Rj01Fz`}):e===`graph`?ms._({id:`x2fr_j`}):ms._({id:`cklVjM`})}function Oy(){return n(()=>import(`./GraphPanel-BLt5dvIN.js`),__vite__mapDeps([21,1,14,6,8,9,22,3,23,24,25,15,26,27,28,29,30,31,32,33,34,35]),import.meta.url)}var ky=(0,Q.lazy)(async()=>({default:(await Oy()).GraphPanel})),Ay=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CvNu5QeL.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function jy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(`unified`),f=Sg(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Ey.filter(Ny):Ey;p=e.some(e=>e.id===a)?a:`outline`,m=c===`doc`&&e.length>1,h=m?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(xo,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(My)})}):null,t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=f,t[5]=p,t[6]=m,t[7]=h}else p=t[5],m=t[6],h=t[7];let g;t[8]!==u||t[9]!==n||t[10]!==p||t[11]!==r||t[12]!==c||t[13]!==m?(g=c===`doc`?(0,Z.jsxs)(`div`,{...m?{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`}:{},className:`min-h-0 flex-1`,children:[p===`outline`&&(0,Z.jsx)(Dc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(Ev,{docName:n}),p===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(ky,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(xy,{docName:n,diffLayout:u,onDiffLayoutChange:d})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Ay,{})})}),t[8]=u,t[9]=n,t[10]=p,t[11]=r,t[12]=c,t[13]=m,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function My(e){let{id:t,icon:n}=e,r=Dy(t);return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(yo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:r})]},t)}function Ny(e){return e.id===`outline`}function Py(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Fy(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Iy(e){return e/100*window.innerHeight}function Ly(e){return e/100*window.innerWidth}function Ry(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 zy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Ry(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Fy(t,i);break;case`em`:r=Py(t,i);break;case`vh`:r=Iy(i);break;case`vw`:r=Ly(i);break}return r}function By(e){return parseFloat(e.toFixed(3))}function Vy({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 Hy(e){let{panels:t}=e,n=Vy({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=By(zy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=By(zy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=By(zy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=By(zy({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 Uy(e,t=`Assertion error`){if(!e)throw Error(t)}function Wy(e,t){return Array.from(t).sort(e===`horizontal`?Gy:Ky)}function Gy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ky(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function qy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Jy(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 Yy({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}=Jy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Uy(i,`No rect found`),i}var Xy;function Zy(){return Xy===void 0&&(Xy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Xy}function Qy(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Wy(n,Array.from(t.children).filter(qy).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,Yy({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=Zy()?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:Vy({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 $y=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)}}},eb=new Map,tb=new $y;function nb(e){eb=new Map(eb),eb.delete(e)}function rb(e,t){for(let[t]of eb)if(t.id===e)return t}function ib(e,t){for(let[t,n]of eb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ab(){return eb}function ob(e,t){return tb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function sb(e,t){let n=eb.get(e);eb=new Map(eb),eb.set(e,t),tb.emit(`groupChange`,{group:e,prev:n,next:t})}function cb(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Jy(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 lb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ub(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:gb(e),b:gb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Uy(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:hb(mb(n.a)),b:hb(mb(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 db=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function fb(e){let t=getComputedStyle(_b(e)??e).display;return t===`flex`||t===`inline-flex`}function pb(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||fb(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`||db.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function mb(e){let t=e.length;for(;t--;){let n=e[t];if(Uy(n,`Missing node`),pb(n))return n}return null}function hb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function gb(e){let t=[];for(;e;)t.push(e),e=_b(e);return t}function _b(e){let{parentNode:t}=e;return lb(t)?t.host:t}function vb(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 yb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!qy(n)||n.contains(e)||e.contains(n))return!0;if(ub(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(vb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function bb(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Qy(r),a=cb(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&yb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function xb(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 Sb(e,t,n=0){return Math.abs(By(e)-By(t))<=n}function Cb(e,t){return Sb(e,t)?0:e>t?1:-1}function wb({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Cb(r,c)<0)if(a){let e=(i+c)/2;r=Cb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=By(r),r}function Tb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Sb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Uy(u!=null,`Invalid first pivot index`),Uy(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,i)){let t=o-n;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,o)){let t=n-i;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Uy(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Cb(i,c)<0)if(e>0){let t=c-o,n=t/2;Cb(i+e,c)<0&&(e=Cb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Cb(i-e,c)<0&&(e=Cb(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];Uy(e!=null,`Previous layout not found for panel index ${r}`);let a=wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Uy(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Sb(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(xb(c,l))return i;{let t=e<0?d:u,r=s[t];Uy(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Sb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Uy(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Sb(i,s)||(t-=s-i,l[r]=s),Sb(t,0))break;e>0?r--:r++}}}if(!Sb(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 Eb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Cb(e[n],t[n])!==0)return!1;return!0}function Db({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(!Sb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Uy(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];Uy(i!=null,`No layout data found for index ${e}`);let o=r[e];Uy(o!=null,`No layout data found for index ${e}`);let s=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Sb(a,0))for(let e=0;e<t.length;e++){let n=r[e];Uy(n!=null,`No layout data found for index ${e}`);let i=n+a,o=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Sb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Ob({groupId:e,panelId:t}){let n=()=>{let t=ab();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=Db({layout:Tb({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Eb(l,p)||sb(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Sb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Vy({group:t});o(By(zy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function kb(e){e.defaultPrevented||bb(e,ab()).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=Ob({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ab(e){let t=ab();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 jb({groupId:e}){let t=()=>{let t=ab();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=Db({layout:e,panelConstraints:r});return n?o:(Eb(o,c)||sb(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Mb(e,t){let n=Ab(e),r=ib(n.id,!0),i=n.separators.find(t=>t.element===e);Uy(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Uy(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=jb({groupId:n.id}).getLayout(),c=Db({layout:Tb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Eb(s,c)||sb(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Nb(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ab(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,-5);break;case`End`:e.preventDefault(),Mb(t,100);break;case`Enter`:{e.preventDefault();let n=Ab(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ib(n.id,!0),o=n.separators.find(e=>e.element===t);Uy(o,`Matching separator not found`);let s=a.get(o);Uy(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Uy(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Mb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ab(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Uy(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(),Mb(t,-100);break}}var Pb={cursorFlags:0,state:`inactive`},Fb=new $y;function Ib(){return Pb}function Lb(e){return Fb.addListener(`change`,e)}function Rb(e){let t=Pb,n={...Pb};n.cursorFlags=e,Pb=n,Fb.emit(`change`,{prev:t,next:n})}function zb(e){let t=Pb;Pb=e,Fb.emit(`change`,{prev:t,next:e})}function Bb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ab(),n=bb(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),zb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Vb=e=>e,Hb=()=>{},Ub=1,Wb=2,Gb=4,Kb=8,qb=3,Jb=12,Yb;function Xb(){return Yb===void 0&&(Yb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Yb=!0)),Yb}function Zb({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&&Xb()){let t=(e&Ub)!==0,n=(e&Wb)!==0,r=(e&Gb)!==0,i=(e&Kb)!==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 Xb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Qb=new WeakMap;function $b(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Qb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Ib();switch(r.state){case`active`:case`hover`:{let e=Zb({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}Qb.set(e,{prevStyle:t,styleSheet:n})}function ex({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=Tb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Eb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ub:Wb;break;case`vertical`:s|=d<0?Gb:Kb;break}}else sb(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&qb:c|=s&qb,t.movementY===0?c|=o&Jb:c|=s&Jb,Rb(c),$b(e)}function tx(e){let t=ab(),n=Ib();switch(n.state){case`active`:ex({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function nx(e){if(e.defaultPrevented)return;let t=Ib(),n=ab();switch(t.state){case`active`:if(e.buttons===0){zb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=bb(e,n);r.length===0?t.state!==`inactive`&&zb({cursorFlags:0,state:`inactive`}):zb({cursorFlags:0,hitRegions:r,state:`hover`}),$b(e.currentTarget);break}}}function rx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ib().state){case`hover`:zb({cursorFlags:0,state:`inactive`})}}function ix(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ib();switch(t.state){case`active`:zb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&($b(e.currentTarget),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(e.group,t)}),e.preventDefault())}}function ax(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=By(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=By((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ox(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Vy({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:By(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function sx(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 cx({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=By(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]=By((r[e]??0)/a*l);else{let e=By(l/c.length);for(let t of c)u[t]=e}return u}function lx(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 ux=new Map;function dx(e){let t=!0;Uy(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=Vy({group:e});if(t===0)return;let n=ib(e.id);if(!n)return;let r=Hy(e),i=n.defaultLayoutDeferred?ax(r):n.layout,a=Db({layout:cx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Eb(n.layout,a)&&sx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;sb(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ox(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Uy(!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=Vy({group:e}),s=Hy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(lx(e.panels,l)||(l=void 0));let u=Db({layout:e.mutableState.layouts[c]??l??ax(s),panelConstraints:s}),d=e.element.ownerDocument;ux.set(d,(ux.get(d)??0)+1);let f=new Map;return Qy(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),sb(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Uy(!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`,Nb)}),ux.get(d)===1&&(d.addEventListener(`dblclick`,kb,!0),d.addEventListener(`pointerdown`,Bb,!0),d.addEventListener(`pointerleave`,tx),d.addEventListener(`pointermove`,nx),d.addEventListener(`pointerout`,rx),d.addEventListener(`pointerup`,ix,!0)),function(){t=!1,ux.set(d,Math.max(0,(ux.get(d)??0)-1)),nb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Nb)}),ux.get(d)||(d.removeEventListener(`dblclick`,kb,!0),d.removeEventListener(`pointerdown`,Bb,!0),d.removeEventListener(`pointerleave`,tx),d.removeEventListener(`pointermove`,nx),d.removeEventListener(`pointerout`,rx),d.removeEventListener(`pointerup`,ix,!0)),a.disconnect()}}function fx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function px(e){let t=(0,Q.useId)();return`${e??t}`}var mx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function hx(e){let t=(0,Q.useRef)(e);return mx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function gx(...e){return hx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function _x(e){let t=(0,Q.useRef)({...e});return mx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var vx=(0,Q.createContext)(null);function yx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Vb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),mx(()=>{Object.assign(n.current,jb({groupId:e}))})}function bx({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=hx(e=>{Eb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=hx(e=>{Eb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=px(s),v=(0,Q.useRef)(null),[y,b]=fx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=gx(v,a);yx(_,o);let C=hx((e,t)=>{let r=Ib(),i=rb(e),a=ib(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=_x({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=Wy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Wy(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=rb(_),i=ib(_);r&&i&&sb(r,{...i,derivedPanelConstraints:Hy(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 mx(()=>{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=dx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ib(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ob(_,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=Sb(t.collapsedSize,i[t.panelId]),a=Sb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ib().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(vx.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}bx.displayName=`Group`;function xx(){let e=(0,Q.useContext)(vx);return Uy(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Sx(e,t){let{id:n}=xx(),r=(0,Q.useRef)({collapse:Hb,expand:Hb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Hb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),mx(()=>{Object.assign(r.current,Ob({groupId:n,panelId:e}))})}function Cx({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=px(c),_=_x({disabled:a}),v=(0,Q.useRef)(null),y=gx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=xx(),T=d!==null,E=hx((e,t,n)=>{d?.(e,c,n)});mx(()=>{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]),Sx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>ob(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...wx,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Cx.displayName=`Panel`;var wx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Tx(){return(0,Q.useRef)(null)}function Ex({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=Db({layout:Tb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Db({layout:Tb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Dx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=px(a),l=_x({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=gx(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=xx(),x=v===`horizontal`?`vertical`:`horizontal`;mx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Lb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ob(_,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(Ex({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Dx.displayName=`Separator`;var Ox=new Map;function kx(e){let t=Ox.get(e);if(t)return t;let n=Ax(e);return Ox.set(e,n),n}async function Ax(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CpYUNWOc.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrSwTBuw.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrSwTBuw.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrSwTBuw.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Mxq-zflt.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([38,1,39,23,40]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-D0_HBszs.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DdpCnkcu.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-4lW4ME5D.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrSwTBuw.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrSwTBuw.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-BrsGSRvH.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-B9B58-J_.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([45,1,43,39,23,41,38,40,42]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrSwTBuw.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BvKrvbRb.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-D1rVZYi52.js`);return{python:e}},__vite__mapDeps([50,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-CfD_nMxU.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CEHR0ONp.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-CjXb6uie.js`);return{rust:e}},__vite__mapDeps([51,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-m6QogzU7.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CmJiKyqD.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-Bn0QvNGs.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([41,1,38,39,23,40,42,43]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-pSQcUvmU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([46,1,39,23,40]),import.meta.url)).yaml().language;default:return null}}async function jx(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;if(t){let e=await kx(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-CSZcBb2g.js`);return{toml:e}},[],import.meta.url)).toml):null}var Mx=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Nx=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Px(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n(t===413?{id:`C_WGy8`}:t===404?{id:`s0IDhW`}:t===400?{id:`N1mdmS`}:{id:`96w9hU`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Fx(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Nr(),l=Px(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=i.toLowerCase(),t=or(e),n=c===`dark`?Mx:Nx,r=!1,s=null;return jx(e,t).then(e=>{if(r||!a.current)return;let t=[Fc,...e?[e]:[],_c.editable.of(!0),sc.readOnly.of(!0),_c.lineWrapping,n];s=new _c({state:sc.create({doc:u,extensions:t}),parent:a.current}),o.current=s}),()=>{r=!0,s?.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ix(e){return qr(`/api/asset?path=${encodeURIComponent(e)}`)}function Lx(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Rx(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Ix(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p,m;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=u.includes(`.`)?u.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==u||t[14]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(X,{src:c,title:u,fillContainer:!0})}),t[13]=u,t[14]=c,t[15]=e):e=t[15];let n;t[16]!==u||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[16]=u,t[17]=e,t[18]=n):n=t[18],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=Lx(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Fx,{src:e,fileName:u,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==u||t[25]!==p||t[26]!==c?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(Ge,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:u})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(ci,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(s,{id:`qFWMl-`})}),(0,Z.jsx)(ci,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{rt({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=u,t[25]=p,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==u||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:h}),t[28]=u,t[29]=h,t[30]=g):g=t[30],g}function zx(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Di,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Di,{className:`h-4 w-full`}),(0,Z.jsx)(Di,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function Bx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:_l,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Pl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ll,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:cu,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:_l,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:tl,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function Vx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=Bx(n),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(void 0),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>clearTimeout(l.current),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,Q.useEffect)(u,d);let f,p;if(t[2]!==a||t[3]!==r||t[4]!==s||t[5]!==o){let e=function(e,t){Na(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(Hx)};t[8]===r?f=t[9]:(f=oi(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=f),p=o.map(t=>{let n=t.icon,r=s===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)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":a(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:oi(`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)(ko,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(tt,{className:`size-3.5`,"aria-hidden":`true`}),a(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=a,t[3]=r,t[4]=s,t[5]=o,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[10]!==f||t[11]!==p?(m=(0,Z.jsx)(`ul`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function Hx(){}var Ux={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Wx(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Nr(),s=Ux[r],c=s?(o===`dark`?zr[s]:void 0)??Jr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=oi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(fi,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(di,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(vi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var Gx=(0,Q.createContext)(null);function Kx(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Gx,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function qx(){return(0,Q.use)(Gx)}var Jx=ii(`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 Yx(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=oi(Jx({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 Xx=`ok-preferred-agent-v1`,Zx=new Set(_g.map(e=>e.id));function Qx(e){return typeof e==`string`&&Zx.has(e)}function $x(e){try{let t=(e??localStorage).getItem(Xx);return Qx(t)?t:null}catch{return null}}function eS(e,t){try{(t??localStorage).setItem(Xx,e)}catch{}}function tS(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:_g.find(e=>n[e.id]?.installed===!0)?.id??null}function nS(e){let t=(0,$.c)(52),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=O_(),{dispatch:l}=__(),u=Oa(),d=qx(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(iS),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!1),y=_&&d!==null,b=(0,Q.useRef)(null),x=Bx(n),S;t[0]===o?S=t[1]:(S=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=S);let C=_g.filter(S),w;t[2]===o?w=t[3]:(w=_g.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=w);let T=w,E=T&&C.length===0,D,O;t[4]!==T||t[5]!==o?(D=()=>{if(!T||g.current)return;let e=tS({lastUsed:$x(),states:o});h(t=>e===t?t:e)},O=[T,o],t[4]=T,t[5]=o,t[6]=D,t[7]=O):(D=t[6],O=t[7]),(0,Q.useEffect)(D,O);let k=function(e){g.current=!0,v(!1),h(e),eS(e)},A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){g.current=!0,v(!0)},t[8]=A):A=t[8];let j=A,M;t[9]!==f||t[10]!==n||t[11]!==d||t[12]!==u?(M=function(){if(d===null)return;let e=n_({workspace:u,description:f.trim(),scenario:n});e!==null&&d.launchInTerminal(e)},t[9]=f,t[10]=n,t[11]=d,t[12]=u,t[13]=M):M=t[13];let N=M,P;t[14]!==f||t[15]!==l||t[16]!==n||t[17]!==u?(P=function(e){let t=f.trim();eS(e);let r=n_({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[14]=f,t[15]=l,t[16]=n,t[17]=u,t[18]=P):P=t[18];let F=P,I;t[19]!==y||t[20]!==F||t[21]!==N||t[22]!==m?(I=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y?N():m!==null&&F(m))},t[19]=y,t[20]=F,t[21]=N,t[22]=m,t[23]=I):I=t[23];let L=I,R=function(e){p(e),b.current?.focus()};if(E){let e;t[24]===r?e=t[25]:(e=oi(`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[24]=r,t[25]=e);let n;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(yi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[26]=n):n=t[26];let i;t[27]===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)(s,{id:`3IseAk`})})]}),t[27]=i):i=t[27];let a;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:_g.map(rS)}),t[28]=a):a=t[28];let o;return t[29]===e?o=t[30]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[29]=e,t[30]=o),o}let z=C.length>0,B=d!==null,V;t[31]===r?V=t[32]:(V=oi(`flex w-full flex-col gap-3`,r),t[31]=r,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),t[33]=H):H=t[33];let U;t[34]===a?U=t[35]:(U=a({id:`0jD-Gn`}),t[34]=a,t[35]=U);let W;t[36]===a?W=t[37]:(W=a({id:`7hctf2`}),t[36]=a,t[37]=W);let G;t[38]!==f||t[39]!==L||t[40]!==U||t[41]!==W?(G=(0,Z.jsx)(qs,{ref:b,value:f,onChange:H,onKeyDown:L,rows:4,placeholder:U,"aria-label":W,className:`min-h-12 resize-none rounded-2xl border-0 bg-transparent dark:bg-transparent px-4 py-3.5 text-sm leading-relaxed shadow-none focus-visible:border-0 focus-visible:ring-0 max-h-96 subtle-scrollbar`}),t[38]=f,t[39]=L,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K=m===null?(0,Z.jsx)(ci,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(s,{id:`hYgDIe`})}):(0,Z.jsxs)(Yx,{children:[(0,Z.jsx)(ci,{type:`button`,onClick:()=>y?N():F(m),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ru,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`hozzkE`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wx,{id:m,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:m_(m)}})]})}),(0,Z.jsxs)(ao,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Ve,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(eo,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(La,{"aria-label":a({id:`BBqGS9`}),children:[(0,Z.jsx)(Ya,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),C.map(e=>(0,Z.jsxs)(Ea,{onSelect:()=>k(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!y&&e.id===m?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,B?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(no,{}):null,(0,Z.jsxs)(La,{"aria-label":a({id:`ALhMYW`}),children:[(0,Z.jsx)(Ya,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Ea,{onSelect:()=>j(),"data-testid":`create-with-claude-cli`,"aria-label":a({id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),y?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]})]}):null]})]})]}),q;t[43]===K?q=t[44]:(q=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 px-3 pb-3`,children:K}),t[43]=K,t[44]=q);let J;t[45]!==G||t[46]!==q?(J=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[G,q]}),t[45]=G,t[46]=q,t[47]=J):J=t[47];let ee=n!==`existing-repo`&&x.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:x.map(e=>{let t=e.icon;return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(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,Y;return t[48]!==J||t[49]!==ee||t[50]!==V?(Y=(0,Z.jsxs)(`div`,{className:V,children:[J,ee]}),t[48]=J,t[49]=ee,t[50]=V,t[51]=Y):Y=t[51],Y}function rS(e){return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r_(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(vo,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function iS(){return $x()}var aS=3100,oS=3;function sS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??oS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var cS={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},lS=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function uS(e,t={}){let n=t.rng??Math.random,r=t.colors??lS,i=cS[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var dS=1.8,fS=90,pS=16,mS=380,hS=.025,gS=.1,_S=.18,vS=400,yS=9.2736,bS=18.1799,xS=14.5244,SS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function CS(e,t){let{halfWidth:n,apexLift:r}=SS[t];return`M${e-n} ${xS+.3} Q${e} ${xS-r}, ${e+n} ${xS+.3}`}function wS(e){let t=1.5,n=.3;return`M${e-t} ${xS-n} Q${e} ${xS+1.4}, ${e+t} ${xS-n}`}var TS=15,ES=15;function DS(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function OS(e){let t=(0,$.c)(72),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o,gaze:s}=e,c=n===void 0?48:n,l=i===void 0?!0:i,u=a===void 0?`default`:a,d=o===void 0?0:o,f=s===void 0?`cursor`:s,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={x:0,y:0},t[0]=g):g=t[0];let _=(0,Q.useRef)(g),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(0),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),T=(0,Q.useRef)(0),E=(0,Q.useRef)(void 0),D=u===`sleeping`,O;t[2]!==v||t[3]!==D?(O=function(){if(D)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=T.current===0?1/0:e-T.current;T.current=e;let n=sS(v,t);y(n),x(MS),w(uS(n)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS)},t[2]=v,t[3]=D,t[4]=O):O=t[4];let k=O,A,j;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>clearTimeout(E.current),A=[],t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(j,A);let M,N;t[7]!==d||t[8]!==D?(M=()=>{d===0||D||(y(3),x(jS),w(uS(3)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS))},N=[d,D],t[7]=d,t[8]=D,t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,Q.useEffect)(M,N);let P,F;t[11]!==f||t[12]!==D||t[13]!==l?(P=()=>{if(!l||D)return;let e=f===`down`;if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=0,n=0,r=!1,i=0,a=0,o=0,s=0,c=0,u=function(){c===0&&(c=requestAnimationFrame(g))},d=function(e){t=e.clientX,n=e.clientY,r=!0,u()};function g(){c=0;let l=m.current,d=p.current;if(!l||!d){u();return}let f=r;r=!1;let g=l.getBoundingClientRect(),v=g.left+g.width/2,y=g.top+g.height*.48,b=t-v,x=n-y,S=Math.hypot(b,x),C,w,T=0,E=0;if(e)w=0,C=-pS*.8,E=dS;else{let e=Math.max(-1,Math.min(1,b/mS)),t=Math.max(-1,Math.min(1,x/mS));if(w=e*pS,C=-t*pS,S>=1){let e=Math.min(S/fS,1)*dS;T=b/S*e,E=x/S*e}}let D=Math.abs(C-i)<.01&&Math.abs(w-a)<.01&&Math.abs(T-o)<.01&&Math.abs(E-s)<.01;if(!f&&D)return;u(),i+=(C-i)*gS,a+=(w-a)*gS,d.style.transform=`perspective(${vS}px) rotateX(${i.toFixed(3)}deg) rotateY(${a.toFixed(3)}deg)`,o+=(T-o)*_S,s+=(E-s)*_S;let O=a*hS,k=-i*hS,A=o+O,j=s+k;_.current.x=A,_.current.y=j,h.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,d,{passive:!0}),u(),()=>{document.removeEventListener(`mousemove`,d),c!==0&&cancelAnimationFrame(c),c=0,p.current&&(p.current.style.transform=``),_.current={x:0,y:0},h.current?.removeAttribute(`transform`)}},F=[l,D,f],t[11]=f,t[12]=D,t[13]=l,t[14]=P,t[15]=F):(P=t[14],F=t[15]),(0,Q.useEffect)(P,F);let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=h.current;if(!e)return;let{x:t,y:n}=_.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=I):I=t[16],(0,Q.useLayoutEffect)(I);let L=v>0,R=L?v:1,z=L?`ok-blob-clicked-${v}`:null,B;t[17]===r?B=t[18]:(B=oi(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=B);let V=D?`cursor-default`:`cursor-pointer`,H=`body-${b}`,U=D&&`ok-blob-sleeping`,W;t[19]!==z||t[20]!==U?(W=oi(`ok-blob-group`,U,z),t[19]=z,t[20]=U,t[21]=W):W=t[21];let G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[22]=G):G=t[22];let K=(L||D)&&`ok-blob-eye-hidden`,q;t[23]===K?q=t[24]:(q=oi(`ok-blob-eye`,K),t[23]=K,t[24]=q);let J;t[25]===q?J=t[26]:(J=(0,Z.jsx)(`ellipse`,{cx:yS,cy:xS,rx:1.2722,ry:1.9083,className:q}),t[25]=q,t[26]=J);let ee=(L||D)&&`ok-blob-eye-hidden`,Y;t[27]===ee?Y=t[28]:(Y=oi(`ok-blob-eye ok-blob-eye-right`,ee),t[27]=ee,t[28]=Y);let te;t[29]===Y?te=t[30]:(te=(0,Z.jsx)(`ellipse`,{cx:bS,cy:xS,rx:1.2722,ry:1.9083,className:Y}),t[29]=Y,t[30]=te);let ne;t[31]===R?ne=t[32]:(ne=CS(yS,R),t[31]=R,t[32]=ne);let X=(!L||D)&&`ok-blob-eye-hidden`,re;t[33]===X?re=t[34]:(re=oi(`ok-blob-happy-eye`,X),t[33]=X,t[34]=re);let ie;t[35]!==ne||t[36]!==re?(ie=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[35]=ne,t[36]=re,t[37]=ie):ie=t[37];let ae;t[38]===R?ae=t[39]:(ae=CS(bS,R),t[38]=R,t[39]=ae);let oe=(!L||D)&&`ok-blob-eye-hidden`,se;t[40]===oe?se=t[41]:(se=oi(`ok-blob-happy-eye`,oe),t[40]=oe,t[41]=se);let ce;t[42]!==ae||t[43]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[42]=ae,t[43]=se,t[44]=ce):ce=t[44];let le;t[45]===D?le=t[46]:(le=D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:wS(yS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:wS(bS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=D,t[46]=le);let ue;t[47]!==J||t[48]!==te||t[49]!==ie||t[50]!==ce||t[51]!==le?(ue=(0,Z.jsxs)(`g`,{ref:h,children:[J,te,ie,ce,le]}),t[47]=J,t[48]=te,t[49]=ie,t[50]=ce,t[51]=le,t[52]=ue):ue=t[52];let de;t[53]!==H||t[54]!==W||t[55]!==ue?(de=(0,Z.jsxs)(`g`,{className:W,children:[G,ue]},H),t[53]=H,t[54]=W,t[55]=ue,t[56]=de):de=t[56];let fe;t[57]===D?fe=t[58]:(fe=D?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=D,t[58]=fe);let pe;t[59]!==b||t[60]!==C?(pe=C.length>0&&(0,Z.jsx)(`g`,{children:C.map(kS)},`firework-${b}`),t[59]=b,t[60]=C,t[61]=pe):pe=t[61];let me;t[62]!==k||t[63]!==c||t[64]!==V||t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:m,width:c,height:c,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:V,"aria-hidden":`true`,onClick:k,onMouseDown:AS,children:[de,fe,pe]}),t[62]=k,t[63]=c,t[64]=V,t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;return t[69]!==B||t[70]!==me?(he=(0,Z.jsx)(`span`,{ref:p,className:B,children:me}),t[69]=B,t[70]=me,t[71]=he):he=t[71],he}function kS(e){return(0,Z.jsx)(`circle`,{cx:TS+e.originDx,cy:ES+e.originDy,r:e.size,className:`ok-blob-firework`,style:DS(e)},e.id)}function AS(e){return e.preventDefault()}function jS(e){return e+1}function MS(e){return e+1}function NS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(OS,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}var PS=`open-knowledge:create-top-level-file`;function FS(e={}){window.dispatchEvent(new CustomEvent(PS,{detail:e}))}function IS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(PS,t),()=>window.removeEventListener(PS,t)}function LS(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=mg(),c=ta(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p;t[3]===a?p=t[4]:(p=a({id:`FOGD7m`}),t[3]=a,t[4]=p);let m;t[5]!==a||t[6]!==o?(m=a(o?{id:`3DTatP`}:{id:`MqQoV-`}),t[5]=a,t[6]=o,t[7]=m):m=t[7];let h;t[8]!==n||t[9]!==p||t[10]!==m?(h=(0,Z.jsx)(NS,{title:p,subtitle:m,celebrateSignal:n}),t[8]=n,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=o?(0,Z.jsx)(Vx,{scenario:`existing-repo`}):(0,Z.jsx)(nS,{scenario:`existing-repo`}),t[12]=o,t[13]=g);let _;t[14]!==u||t[15]!==f||t[16]!==d?(_=d||f||u.length>0?(0,Z.jsx)(BS,{templates:u,loading:d,error:f,onSelect:zS}):null,t[14]=u,t[15]=f,t[16]=d,t[17]=_):_=t[17];let v,y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3`}),y=(0,Z.jsx)(s,{id:`IajAbS`}),t[18]=v,t[19]=y):(v=t[18],y=t[19]);let b;t[20]===r?b=t[21]:(b=(0,Z.jsxs)(ci,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[v,y]}),t[20]=r,t[21]=b);let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ci,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:RS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(to,{"aria-hidden":`true`,className:`size-3`})}})}),t[22]=x):x=t[22];let S;t[23]===b?S=t[24]:(S=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[b,x]}),t[23]=b,t[24]=S);let C;t[25]!==S||t[26]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[_,S]}),t[25]=S,t[26]=_,t[27]=C):C=t[27];let w;return t[28]!==C||t[29]!==h||t[30]!==g?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[h,g,C]}),t[28]=C,t[29]=h,t[30]=g,t[31]=w):w=t[31],w}function RS(){return FS({initialDir:``})}function zS(e,t){return FS({template:{folder:e,name:t}})}function BS(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(st,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(VS,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":p,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function VS(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function HS(e){let t=(0,$.c)(15),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(KS);if(e)return;let r=t.ok?Ar.safeParse(n):null;r?.success?(l(qS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=$o(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(GS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(WS);if(!e.ok)return;let n=Ar.safeParse(t);n.success&&l(qS(n.data.documents))}).catch(US)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 pb-8 pt-10`,children:(0,Z.jsx)(OS,{size:64,gaze:`down`})}),t[4]=e):e=t[4],e}let S;t[5]!==u||t[6]!==y||t[7]!==v?(S=v?y?(0,Z.jsx)(JS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(LS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[5]=u,t[6]=y,t[7]=v,t[8]=S):S=t[8];let C;t[9]!==o||t[10]!==i?(C=(0,Z.jsx)(lg,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[9]=o,t[10]=i,t[11]=C):C=t[11];let w;return t[12]!==S||t[13]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function US(){}function WS(){return null}function GS(e){return e+1}function KS(){return null}function qS(e){return Xo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function JS(e){let t=(0,$.c)(25),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=mg(),s;t[0]===a?s=t[1]:(s=a({id:`6h4zVU`}),t[0]=a,t[1]=s);let c;t[2]!==a||t[3]!==o?(c=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l;t[5]!==n||t[6]!==s||t[7]!==c?(l=(0,Z.jsx)(NS,{title:s,subtitle:c,celebrateSignal:n}),t[5]=n,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===o?u=t[10]:(u=o?(0,Z.jsx)(Vx,{scenario:`new-project`}):(0,Z.jsx)(nS,{scenario:`new-project`}),t[9]=o,t[10]=u);let d;t[11]!==a||t[12]!==o?(d=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=d):d=t[13];let f;t[14]===d?f=t[15]:(f=(0,Z.jsx)(XS,{label:d}),t[14]=d,t[15]=f);let p;t[16]===r?p=t[17]:(p=(0,Z.jsx)(ng,{onPackSelect:r,onCreateBlankFile:YS}),t[16]=r,t[17]=p);let m;t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==l||t[22]!==u||t[23]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,u,m]}),t[21]=l,t[22]=u,t[23]=m,t[24]=h):h=t[24],h}function YS(){return FS()}function XS(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function ZS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function QS(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(eC,{}),(0,Z.jsx)(Di,{className:`h-7 w-full`}),(0,Z.jsx)(Di,{className:`h-7 w-full`}),(0,Z.jsx)(Di,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=ZS(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Qi(n,{[e]:t});if(!r.ok){let{error:e}=r;hs.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Qi(n,{[e]:null});if(!t.ok){let{error:e}=t;hs.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,oa(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Jn(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await Qi(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=h[f.key],r=await Qi(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let H=B,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){p(null)},t[38]=U):U=t[38];let W=U,G=!c,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>l(!e),t[39]=K):K=t[39];let q=`size-3 transition-transform ${c?``:`rotate-90`}`,J;t[40]===q?J=t[41]:(J=(0,Z.jsx)(No,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=ee):ee=t[42];let Y;t[43]===J?Y=t[44]:(Y=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,ee]}),t[43]=J,t[44]=Y);let te;t[45]===_?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:$S,children:_}),t[45]=_,t[46]=te);let ne;t[47]!==Y||t[48]!==te?(ne=(0,Z.jsxs)(Po,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[Y,te]}),t[47]=Y,t[48]=te,t[49]=ne):ne=t[49];let X;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=X):X=t[50];let re;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(re=y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(Ii,{keyName:e,value:t,declared:go(t,An(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:H,onCancel:W},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=H,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=re):re=t[59];let ie;t[60]!==u||t[61]!==F?(ie=u?(0,Z.jsx)(na,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:()=>void F(),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>D(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(Mo,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[X,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==G||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Fo,{open:G,onOpenChange:K,children:[ne,ae]})}),t[66]=G,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function $S(e){return e.stopPropagation()}function eC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Sl,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function tC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?ms._({id:`xOTzt5`}):t<3600?ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function nC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function rC(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:Ia,label:ms._({id:`QR5SP1`}),detail:nC(i)};case`template-edit`:return{Icon:oe,label:ms._({id:`-LHLx7`}),detail:nC(i)};case`template-delete`:return{Icon:K,label:ms._({id:`_gkGSK`}),detail:nC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:$c,label:ms._({id:`KPW5WC`}),detail:`${nC(e??``)} → ${nC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Sl,label:ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Sl,label:ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Sl,label:ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Ol,label:r.replace(/-/g,` `),detail:nC(i)}}}function iC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?ms._({id:`B2DrPb`}):e.author||ms._({id:`Ef7StM`})}function aC(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,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=ds(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(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)(Di,{className:`h-8 w-full`}),(0,Z.jsx)(Di,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(oC)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function oC(e){let{Icon:t,label:n,detail:r}=rC(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)(hu,{className:`size-3`,"aria-hidden":!0}),iC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:tC(e.timestamp)})]},e.sha)}function sC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function cC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=sC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function lC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function uC(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:cC(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:lC(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:cC(e,t.pageTitles),children:a}}function dC(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(Di,{className:`h-12 w-full`}),(0,Z.jsx)(Di,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(ci,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(ea,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Hi,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)(Ba,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(Ei,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(fC)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Xi,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(zh,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function fC(e){return e.name}function pC(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=oi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=oi(`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 mC(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=oi(`[&_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 hC(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=oi(`[&_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 gC(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=oi(`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 _C(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=oi(`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 vC(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=oi(`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 yC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return ms._({id:`xOTzt5`});if(r<60)return ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function bC(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 xC(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)(ft,{className:`ml-1 size-3`}):(0,Z.jsx)(Qe,{className:`ml-1 size-3`}):(0,Z.jsx)(el,{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)(ci,{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 SC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=rs(),d=Va(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Di,{className:`size-5 rounded`}),(0,Z.jsx)(Di,{className:`h-7 w-48`})]}),(0,Z.jsx)(Di,{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)(Di,{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)(Di,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(TC)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=uC(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=bC(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[29]===g?m=t[30]:(m=function(e){e===g?y(wC):(_(e),y(`asc`))},t[29]=g,t[30]=m);let j=m;A=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(re,{className:`size-5 text-muted-foreground`}),t[31]=M):M=t[31];let N=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(ci,{onClick:()=>h(!0),children:[(0,Z.jsx)(V,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=P):P=t[32],t[33]===N?E=t[34]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[N,P]})}),t[33]=N,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(QS,{folderPath:n,state:f,onChange:p}),t[35]=f,t[36]=n,t[37]=p,t[38]=D):D=t[38],t[39]!==f||t[40]!==d||t[41]!==n||t[42]!==p?(O=(0,Z.jsx)(dC,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[39]=f,t[40]=d,t[41]=n,t[42]=p,t[43]=O):O=t[43],t[44]===n?k=t[45]:(k=(0,Z.jsx)(aC,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=pC;let F=g===`name`?v===`asc`?`ascending`:`descending`:`none`,I;t[46]===r?I=t[47]:(I=r({id:`6YtxFj`}),t[46]=r,t[47]=I);let L;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==I?(L=(0,Z.jsx)(xC,{label:I,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=I,t[52]=L):L=t[52];let R;t[53]!==F||t[54]!==L?(R=(0,Z.jsx)(_C,{"aria-sort":F,children:L}),t[53]=F,t[54]=L,t[55]=R):R=t[55];let z=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,B;t[56]===r?B=t[57]:(B=r({id:`tgWuMB`}),t[56]=r,t[57]=B);let H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(H=(0,Z.jsx)(xC,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==z||t[64]!==H?(U=(0,Z.jsx)(_C,{className:`w-32`,"aria-sort":z,children:H}),t[63]=z,t[64]=H,t[65]=U):U=t[65],t[66]!==R||t[67]!==U?(C=(0,Z.jsx)(mC,{children:(0,Z.jsxs)(gC,{children:[R,U]})}),t[66]=R,t[67]=U,t[68]=C):C=t[68],b=hC,S=i.length?i.map(CC):(0,Z.jsx)(gC,{children:(0,Z.jsx)(vC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[69]!==b||t[70]!==S?(j=(0,Z.jsx)(b,{children:S}),t[69]=b,t[70]=S,t[71]=j):j=t[71];let M;t[72]!==x||t[73]!==j||t[74]!==C?(M=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==w?(N=(0,Z.jsx)(`div`,{className:w,children:M}),t[76]=M,t[77]=w,t[78]=N):N=t[78];let P;t[79]!==N||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(P=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,N]}),t[79]=N,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=P):P=t[85];let F;t[86]!==P||t[87]!==A?(F=(0,Z.jsx)(`div`,{className:A,children:P}),t[86]=P,t[87]=A,t[88]=F):F=t[88];let I;t[89]!==m||t[90]!==d||t[91]!==n?(I=(0,Z.jsx)(zh,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=I):I=t[92];let L;return t[93]!==F||t[94]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[93]=F,t[94]=I,t[95]=L):L=t[95],L}function CC(e){return(0,Z.jsxs)(gC,{children:[(0,Z.jsx)(vC,{children:(0,Z.jsxs)(`a`,{href:Vo(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(wl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(vC,{className:`text-muted-foreground`,children:e.kind===`file`?yC(e.modified):`—`})]},e.path)}function wC(e){return e===`asc`?`desc`:`asc`}function TC(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)(Di,{className:`size-4 rounded`}),(0,Z.jsx)(Di,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Di,{className:`h-4 w-16`})})]},e)}function EC(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(vl,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=Xr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Xr(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(ci,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(gi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function DC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(OC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ct(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let c;t[2]===n?c=t[3]:(c=function(){C(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(ci,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function OC(){return new Set}var kC=(0,Q.createContext)(null);function AC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(jC),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(kC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function jC(){return new Map}function MC(){let e=(0,Q.use)(kC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function NC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var PC=NC(()=>n(()=>import(`./SettingsDialogBody-pUhuKxTx.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([52,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,53,7,13,15,25,54]),import.meta.url));function FC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ci,{variant:`default`,onClick:IC,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function IC(){return window.location.reload()}function LC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(ce,{fallbackRender:zC,onError:RC,children:n}),t[0]=n,t[1]=r),r}function RC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function zC(e){return(0,Z.jsx)(FC,{...e})}function BC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function VC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=mt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=ae(),{desktopPresent:f}=Mi(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v=typeof window<`u`&&window.okDesktop!=null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`4KmEoC`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`hotkeys`,label:S},t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a({id:`AeXO77`}),t[13]=a,t[14]=w);let T;t[15]===w?T=t[16]:(T={id:`account`,label:w},t[15]=w,t[16]=T);let E;t[17]!==x||t[18]!==C||t[19]!==T?(E=[x,C,T],t[17]=x,t[18]=C,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==E||t[22]!==y?(D={id:`user`,label:y,enabled:!0,items:E},t[21]=E,t[22]=y,t[23]=D):D=t[23];let O;t[24]===a?O=t[25]:(O=a({id:`ZWyHmq`}),t[24]=a,t[25]=O);let k;t[26]===a?k=t[27]:(k=a({id:`Nu4DdT`}),t[26]=a,t[27]=k);let A;t[28]===k?A=t[29]:(A={id:`sync`,label:k},t[28]=k,t[29]=A);let j;t[30]===a?j=t[31]:(j=a({id:`A1taO8`}),t[30]=a,t[31]=j);let M;t[32]===j?M=t[33]:(M={id:`search`,label:j},t[32]=j,t[33]=M);let N;t[34]===a?N=t[35]:(N=v?[{id:`terminal`,label:a({id:`ALhMYW`})}]:[],t[34]=a,t[35]=N);let P;t[36]===a?P=t[37]:(P=a({id:`iTylMl`}),t[36]=a,t[37]=P);let F;t[38]===P?F=t[39]:(F={id:`project-templates`,label:P},t[38]=P,t[39]=F);let I;t[40]===a?I=t[41]:(I=a({id:`3zyg_A`}),t[40]=a,t[41]=I);let L;t[42]===I?L=t[43]:(L={id:`okignore`,label:I},t[42]=I,t[43]=L);let R;t[44]===a?R=t[45]:(R=a({id:`cs4mps`}),t[44]=a,t[45]=R);let z;t[46]===R?z=t[47]:(z={id:`sharing`,label:R},t[46]=R,t[47]=z);let B;t[48]!==A||t[49]!==M||t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==z?(B=[A,M,...N,F,L,z],t[48]=A,t[49]=M,t[50]=N,t[51]=F,t[52]=L,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==_||t[56]!==O||t[57]!==B?(V={id:`project`,label:O,enabled:_,items:B},t[55]=_,t[56]=O,t[57]=B,t[58]=V):V=t[58];let H;t[59]===a?H=t[60]:(H=a({id:`nbfdhU`}),t[59]=a,t[60]=H);let U;t[61]!==a||t[62]!==f?(U=[],t[61]=a,t[62]=f,t[63]=U):U=t[63];let W;t[64]!==H||t[65]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[64]=H,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==V||t[69]!==W?(G=[D,V,W],t[67]=D,t[68]=V,t[69]=W,t[70]=G):G=t[70];let K=G,q;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Co,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[71]=q):q=t[71];let J;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let ee;t[73]!==p||t[74]!==K?(ee=(0,Z.jsx)(HC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=ee):ee=t[75];let Y;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(GC,{}),t[76]=Y):Y=t[76];let te=l?c:null,ne;t[77]!==p||t[78]!==u||t[79]!==d||t[80]!==te?(ne=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(LC,{children:(0,Z.jsx)(Q.Suspense,{fallback:Y,children:(0,Z.jsx)(PC,{activeId:p,userBinding:te,okignoreBinding:u,okignoreSynced:d})})})}),t[77]=p,t[78]=u,t[79]=d,t[80]=te,t[81]=ne):ne=t[81];let X;t[82]!==ee||t[83]!==ne?(X=(0,Z.jsxs)(wo,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[q,J,ee,ne]}),t[82]=ee,t[83]=ne,t[84]=X):X=t[84];let re;return t[85]!==r||t[86]!==n||t[87]!==X?(re=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:X}),t[85]=r,t[86]=n,t[87]=X,t[88]=re):re=t[88],re}function HC(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(WC,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(UC,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function UC(){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=BC(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:oi(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(s,{id:`_PACVa`}),(0,Z.jsx)(vo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function WC(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=oi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:oi(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function GC(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(Di,{className:`h-5 w-32`}),r=(0,Z.jsx)(Di,{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)(Di,{className:`h-9 w-full`}),(0,Z.jsx)(Di,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function KC(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=oi(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qC(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)(Cx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function JC(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=oi(`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)(Dx,{"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 YC(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=oi(`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 XC=ii(`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 ZC(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=oi(XC({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:QC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function QC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ii(`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 $C(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=oi(`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 ew(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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)(jo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(ew,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(ol,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(Is,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(gu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Is,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(ZC,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(YC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=J);let ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let Y=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(It,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==ee||t[59]!==Y?(ne=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:Y,onClick:v,children:te})}),t[57]=v,t[58]=ee,t[59]=Y,t[60]=ne):ne=t[60];let X;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=X):X=t[61];let re;t[62]===ne?re=t[63]:(re=(0,Z.jsxs)(Is,{children:[ne,X]}),t[62]=ne,t[63]=re);let ie;t[64]===S?ie=t[65]:(ie=S({id:`SiUUCS`}),t[64]=S,t[65]=ie);let ae=!w,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Ve,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==_||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:_,children:oe})}),t[67]=_,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(Is,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=o?`secondary`:`ghost`,de;t[74]!==S||t[75]!==o?(de=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=de):de=t[76];let fe=o?`ok-replace-input`:void 0,pe;t[77]!==m||t[78]!==o?(pe=()=>m(!o),t[77]=m,t[78]=o,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==o||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":o,"aria-controls":fe,onClick:pe,children:me})}),t[81]=o,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===o?ge=t[88]:(ge=(0,Z.jsx)(Ns,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Is,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ve=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(jo,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Jl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=ve):ve=t[100];let ye;t[101]===S?ye=t[102]:(ye=S({id:`wJo9oS`}),t[101]=S,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==x||t[105]!==ye?(xe=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:x,children:be})}),t[104]=x,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Is,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==q||t[111]!==J||t[112]!==re||t[113]!==le||t[114]!==j||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,q,J,re,le,_e,ve,Ce]}),t[110]=q,t[111]=J,t[112]=re,t[113]=le,t[114]=j,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var nw={current:0,total:0},rw=120,iw=100;function aw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?q(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(E,n,ow)}function ow(){return null}function sw(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
24
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function ty(e,t){return`${e}\u0000${t}`}function ny(e,t,n){let r=Hr(e).body,i=Hr(t).body;return r===i?``:$v(n,r,i,``,``,{context:3})}function ry(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=mt(),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=ty(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=ny(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 iy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-InYkbArk.js`),__vite__mapDeps([19,1,6,20]),import.meta.url)).ActivityPanelDiffView})),ay=1e4,oy=6e4;async function sy(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 cy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return ms._({id:`xOTzt5`});if(r<3600){let e=Math.floor(r/60);return ms._({id:`UyROxs`,values:{mins:e}})}if(r<86400){let e=Math.floor(r/3600);return ms._({id:`wXO4Tg`,values:{hrs:e}})}if(r<86400*2)return ms._({id:`rQRrkB`});let i=Math.floor(r/86400);return i<7?ms._({id:`6u9LvN`,values:{days:i}}):t.toLocaleDateString()}function ly(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function uy(e){return e.slice(0,7)}function dy(e){return e.type===`upstream`?ms._({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`?ms._({id:`B2DrPb`}):e.author}function fy(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)(fi,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(vi,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ui,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(hi,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(Ci,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(xi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(yi,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function py(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)(Oe,{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=Qr(i),t[1]=i,t[2]=a);let o=a,s=r?zr[o]??Jr[o]:Jr[o],c;t[3]!==s||t[4]!==i?(c=s??Wn(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)(fy,{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)(El,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[11]=e):e=t[11],e}if(e.name===`Open Knowledge (service)`||e.name===`Git (upstream)`){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Qc,{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)(hu,{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)(yi,{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)(Qc,{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)(hu,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function my(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function hy(e){let t=(0,$.c)(21),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,c;t[0]===n?(o=t[1],c=t[2]):([o,...c]=n,t[0]=n,t[1]=o,t[2]=c);let l=c.length,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=u):u=t[3];let d;t[4]===o?d=t[5]:(d=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[u,o]}),t[4]=o,t[5]=d);let f;t[6]!==r||t[7]!==c?(f=r&&c.map(_y),t[6]=r,t[7]=c,t[8]=f):f=t[8];let p;t[9]!==a||t[10]!==d||t[11]!==f?(p=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[d,f]}),t[9]=a,t[10]=d,t[11]=f,t[12]=p):p=t[12];let m;t[13]!==r||t[14]!==l||t[15]!==a||t[16]!==c.length?(m=c.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(gy)},children:[r?(0,Z.jsx)(Ve,{className:`size-3`}):(0,Z.jsx)(No,{className:`size-3`}),r?(0,Z.jsx)(s,{id:`vLyv1R`}):(0,Z.jsx)(s,{id:`ZptNUh`,values:{hidden:l}})]}),t[13]=r,t[14]=l,t[15]=a,t[16]=c.length,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[p,m]}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function gy(e){return!e}function _y(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 vy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,c=ry(n,r,i),l;t[0]===c.status?l=t[1]:(l=c.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`38foVZ`})]}),t[0]=c.status,t[1]=l);let u;t[2]===c.status?u=t[3]:(u=c.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:(0,Z.jsx)(s,{id:`vvWZnu`})}),t[2]=c.status,t[3]=u);let d;t[4]!==a||t[5]!==c.diff||t[6]!==c.status?(d=c.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(h,{className:`size-3 animate-spin`}),(0,Z.jsx)(s,{id:`EDm3wJ`})]}),children:(0,Z.jsx)(iy,{diff:c.diff,viewType:a})}),t[4]=a,t[5]=c.diff,t[6]=c.status,t[7]=d):d=t[7];let f;return t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[l,u,d]}),t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12],f}function yy(e){let t=(0,$.c)(127),{entry:n,isDark:r,diffLayout:a,cache:o,docName:c,expanded:l,onToggleExpanded:u,onRestoreSuccess:d}=e,{_:f}=i(),p;t[0]===n.timestamp?p=t[1]:(p=cy(n.timestamp),t[0]=n.timestamp,t[1]=p);let m=p,g;t[2]===n?g=t[3]:(g=dy(n),t[2]=n,t[3]=g);let _=g,v;t[4]===n.timestamp?v=t[5]:(v=ly(n.timestamp),t[4]=n.timestamp,t[5]=v);let y=v,b;t[6]===n.sha?b=t[7]:(b=uy(n.sha),t[6]=n.sha,t[7]=b);let x=b,S=n.contributors.flatMap(by),C;t[8]===n?C=t[9]:(C=my(n),t[8]=n,t[9]=C);let w=C,[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useId)(),j,M;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>k.current?.abort(),M=[],t[10]=j,t[11]=M):(j=t[10],M=t[11]),(0,Q.useEffect)(j,M);let N;t[12]!==n.sha||t[13]!==u?(N=()=>u(n.sha),t[12]=n.sha,t[13]=u,t[14]=N):N=t[14];let P=N,F;t[15]===E?F=t[16]:(F=function(){k.current?.abort(),k.current=null,O(!1),E(!1)},t[15]=E,t[16]=F);let I=F,L;t[17]!==f||t[18]!==c||t[19]!==n.sha||t[20]!==d||t[21]!==E?(L=async function(){O(!0);let e=new AbortController;k.current=e;let t=function(){e.signal.aborted||O(!1),k.current===e&&(k.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:c,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:c,sha:n.sha,err:i}),hs.error(f({id:`NkXEFS`}),{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)E(!1),d();else{let e=`HTTP ${r.status}`;try{let t=mr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:c,sha:n.sha,status:r.status,detail:e}),hs.error(f({id:`uM6jnS`}),{description:e,duration:6e3})}t()},t[17]=f,t[18]=c,t[19]=n.sha,t[20]=d,t[21]=E,t[22]=L):L=t[22];let R=L,z;t[23]!==n||t[24]!==r?(z=(0,Z.jsx)(py,{entry:n,isDark:r}),t[23]=n,t[24]=r,t[25]=z):z=t[25];let B=z,V=l?A:void 0,H=l?`bg-muted`:`hover:bg-muted/80`,U;t[26]===H?U=t[27]:(U=[`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`,H],t[26]=H,t[27]=U);let W=U.join(` `),G;t[28]===P?G=t[29]:(G=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),P())},t[28]=P,t[29]=G);let K;t[30]===B?K=t[31]:(K=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:B}),t[30]=B,t[31]=K);let q;t[32]===_?q=t[33]:(q=(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:_}),t[32]=_,t[33]=q);let J;t[34]!==n.timestamp||t[35]!==m?(J=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:m}),t[34]=n.timestamp,t[35]=m,t[36]=J):J=t[36];let ee;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[37]=ee):ee=t[37];let Y;t[38]===f?Y=t[39]:(Y=f({id:`Yea-K5`}),t[38]=f,t[39]=Y);let te;t[40]===E?te=t[41]:(te=e=>{e.stopPropagation(),E(!0)},t[40]=E,t[41]=te);let ne;t[42]===D?ne=t[43]:(ne=D?(0,Z.jsx)(h,{className:`size-3 animate-spin`}):(0,Z.jsx)(pi,{className:`size-3`}),t[42]=D,t[43]=ne);let X;t[44]!==D||t[45]!==Y||t[46]!==te||t[47]!==ne?(X=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":Y,disabled:D,onClick:te,children:ne})}),t[44]=D,t[45]=Y,t[46]=te,t[47]=ne,t[48]=X):X=t[48];let re;t[49]===f?re=t[50]:(re=f({id:`Yea-K5`}),t[49]=f,t[50]=re);let ie;t[51]===re?ie=t[52]:(ie=(0,Z.jsx)(Ns,{side:`top`,children:re}),t[51]=re,t[52]=ie);let ae;t[53]!==X||t[54]!==ie?(ae=(0,Z.jsxs)(Is,{children:[X,ie]}),t[53]=X,t[54]=ie,t[55]=ae):ae=t[55];let oe;t[56]!==q||t[57]!==J||t[58]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[q,J,ee,ae]}),t[56]=q,t[57]=J,t[58]=ae,t[59]=oe):oe=t[59];let se;t[60]===w?se=t[61]:(se=w.length>0&&(0,Z.jsx)(hy,{summaries:w}),t[60]=w,t[61]=se);let ce=S.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:S.join(`, `),children:S.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]!==l||t[67]!==P||t[68]!==V||t[69]!==W||t[70]!==G||t[71]!==K||t[72]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":l,"aria-controls":V,"data-testid":`timeline-entry-expand`,className:W,onClick:P,onKeyDown:G,children:[K,le]}),t[66]=l,t[67]=P,t[68]=V,t[69]=W,t[70]=G,t[71]=K,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==o||t[75]!==a||t[76]!==A||t[77]!==c||t[78]!==n.sha||t[79]!==l?(de=l&&(0,Z.jsx)(vy,{sha:n.sha,docName:c,cache:o,diffLayout:a,panelId:A}),t[74]=o,t[75]=a,t[76]=A,t[77]=c,t[78]=n.sha,t[79]=l,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]!==I||t[85]!==E?(pe=e=>{e?E(!0):I()},t[84]=I,t[85]=E,t[86]=pe):pe=t[86];let me;t[87]===f?me=t[88]:(me=f({id:`Pyp1NA`}),t[87]=f,t[88]=me);let he;t[89]===me?he=t[90]:(he=(0,Z.jsx)(Co,{children:me}),t[89]=me,t[90]=he);let ge;t[91]!==y||t[92]!==_||t[93]!==x||t[94]!==m?(ge={relative:m,absoluteTime:y,entrySha:x,authorName:_},t[91]=y,t[92]=_,t[93]=x,t[94]=m,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)(So,{children:(0,Z.jsx)(s,{id:`h6EvY-`,values:ge,components:_e})}),t[97]=ge,t[98]=ve);let ye;t[99]!==he||t[100]!==ve?(ye=(0,Z.jsxs)(Do,{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)(s,{id:`dEgA5A`}),t[102]=be):be=t[102];let xe;t[103]===I?xe=t[104]:(xe=(0,Z.jsx)(ci,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:I,children:be}),t[103]=I,t[104]=xe);let Se;t[105]===R?Se=t[106]:(Se=()=>R(),t[105]=R,t[106]=Se);let Ce;t[107]===D?Ce=t[108]:(Ce=D?(0,Z.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t[107]=D,t[108]=Ce);let we;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(s,{id:`yKu_3Y`}),t[109]=we):we=t[109];let Te;t[110]!==D||t[111]!==Se||t[112]!==Ce?(Te=(0,Z.jsxs)(ci,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:D,onClick:Se,children:[Ce,we]}),t[110]=D,t[111]=Se,t[112]=Ce,t[113]=Te):Te=t[113];let Ee;t[114]!==xe||t[115]!==Te?(Ee=(0,Z.jsxs)(Eo,{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)(wo,{children:[ye,Ee]}),t[117]=ye,t[118]=Ee,t[119]=De):De=t[119];let Oe;t[120]!==T||t[121]!==pe||t[122]!==De?(Oe=(0,Z.jsx)(Oo,{open:T,onOpenChange:pe,children:De}),t[120]=T,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 by(e){return e.docs}function xy(e){let t=(0,$.c)(46),{docName:n,diffLayout:r,onDiffLayoutChange:a}=e,{_:o}=i(),{resolvedTheme:c}=Nr(),l=c===`dark`,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_]=(0,Q.useState)(Ty),[v,y]=(0,Q.useState)(wy),b;t[1]===_?b=t[2]:(b=()=>{y(new Set),_.clear()},t[1]=_,t[2]=b);let x;t[3]===n?x=t[4]:(x=[n],t[3]=n,t[4]=x),(0,Q.useEffect)(b,x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=S):S=t[5];let C=S,w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=function(){y(new Set)},t[6]=w):w=t[6];let T=w,E,D;t[7]!==o||t[8]!==n?(E=()=>{if(!n){f([]);return}m(!0);let e=Dv({baseMs:ay,maxBackoffMs:oy,isPaused:Cy,poll:e=>sy(n,e,{setEntries:f,setError:g,setLoading:m,unavailableMessage:o({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)}},D=[n,o],t[7]=o,t[8]=n,t[9]=E,t[10]=D):(E=t[9],D=t[10]),(0,Q.useEffect)(E,D);let O=!p&&!h&&d.length>0,k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(xn,{children:(0,Z.jsx)(s,{id:`cklVjM`})}),t[11]=k):k=t[11];let A;t[12]!==o||t[13]!==r||t[14]!==O||t[15]!==a?(A=O&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(xo,{type:`single`,value:r,onValueChange:e=>{e&&a(e)},"aria-label":o({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)(yo,{value:`unified`,"aria-label":o({id:`379t2h`}),className:`size-6 px-0`,children:(0,Z.jsx)(Xl,{className:`size-3.5`})}),(0,Z.jsx)(yo,{value:`split`,"aria-label":o({id:`HXFyWD`}),className:`size-6 px-0`,children:(0,Z.jsx)(ul,{className:`size-3.5`})})]})}),(0,Z.jsx)(Ns,{children:r===`unified`?(0,Z.jsx)(s,{id:`379t2h`}):(0,Z.jsx)(s,{id:`HXFyWD`})})]}),t[12]=o,t[13]=r,t[14]=O,t[15]=a,t[16]=A):A=t[16];let j;t[17]===A?j=t[18]:(j=(0,Z.jsxs)(vn,{children:[k,A]}),t[17]=A,t[18]=j);let M;t[19]!==o||t[20]!==p?(M=p&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":o({id:`o49mDZ`}),children:[1,2,3].map(Sy)}),t[19]=o,t[20]=p,t[21]=M):M=t[21];let N;t[22]!==h||t[23]!==p?(N=!p&&h&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:h})}),t[22]=h,t[23]=p,t[24]=N):N=t[24];let P;t[25]!==d||t[26]!==h||t[27]!==p?(P=!p&&!h&&d.length===0&&(0,Z.jsx)(`div`,{className:`px-4 py-8 text-center`,children:(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Ta25TG`})})}),t[25]=d,t[26]=h,t[27]=p,t[28]=P):P=t[28];let F;t[29]!==_||t[30]!==r||t[31]!==n||t[32]!==d||t[33]!==h||t[34]!==v||t[35]!==l||t[36]!==p?(F=!p&&!h&&d.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:d.map(e=>(0,Z.jsx)(yy,{entry:e,isDark:l,diffLayout:r,cache:_,docName:n,expanded:v.has(e.sha),onToggleExpanded:C,onRestoreSuccess:T},e.sha))}),t[29]=_,t[30]=r,t[31]=n,t[32]=d,t[33]=h,t[34]=v,t[35]=l,t[36]=p,t[37]=F):F=t[37];let I;t[38]!==M||t[39]!==N||t[40]!==P||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,children:[M,N,P,F]}),t[38]=M,t[39]=N,t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;return t[43]!==j||t[44]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[j,I]}),t[43]=j,t[44]=I,t[45]=L):L=t[45],L}function Sy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(za,{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)(za,{className:`h-3 w-28`}),(0,Z.jsx)(za,{className:`h-3 w-40`})]})]},e)}function Cy(){return typeof document<`u`&&document.visibilityState===`hidden`}function wy(){return new Set}function Ty(){return new mi(32)}var Ey=[{id:`outline`,icon:Pl},{id:`links`,icon:ye},{id:`graph`,icon:Ll},{id:`timeline`,icon:ll}];function Dy(e){return e===`outline`?ms._({id:`dD7NPy`}):e===`links`?ms._({id:`Rj01Fz`}):e===`graph`?ms._({id:`x2fr_j`}):ms._({id:`cklVjM`})}function Oy(){return n(()=>import(`./GraphPanel-5UhSd8l0.js`),__vite__mapDeps([21,1,14,6,8,9,22,3,23,24,25,15,26,27,28,29,30,31,32,33,34,35]),import.meta.url)}var ky=(0,Q.lazy)(async()=>({default:(await Oy()).GraphPanel})),Ay=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DKpBhLuw.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent}));function jy(e){let t=(0,$.c)(18),{docName:n,isSourceMode:r,activeTab:a,onActiveTabChange:o,mode:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(`unified`),f=Sg(),p,m,h;if(t[0]!==l||t[1]!==a||t[2]!==c||t[3]!==o||t[4]!==f){let e=f?Ey.filter(Ny):Ey;p=e.some(e=>e.id===a)?a:`outline`,m=c===`doc`&&e.length>1,h=m?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(xo,{type:`single`,variant:`outline`,value:p,onValueChange:e=>{e&&o(e)},"aria-label":l({id:`SrOuyg`}),children:e.map(My)})}):null,t[0]=l,t[1]=a,t[2]=c,t[3]=o,t[4]=f,t[5]=p,t[6]=m,t[7]=h}else p=t[5],m=t[6],h=t[7];let g;t[8]!==u||t[9]!==n||t[10]!==p||t[11]!==r||t[12]!==c||t[13]!==m?(g=c===`doc`?(0,Z.jsxs)(`div`,{...m?{role:`tabpanel`,id:`panel-${p}`,"aria-labelledby":`tab-${p}`}:{},className:`min-h-0 flex-1`,children:[p===`outline`&&(0,Z.jsx)(Dc,{docName:n,isSourceMode:r}),p===`links`&&(0,Z.jsx)(Ev,{docName:n}),p===`graph`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-lCAuQ`})}),children:(0,Z.jsx)(ky,{activeDocName:n})}),p===`timeline`&&(0,Z.jsx)(xy,{docName:n,diffLayout:u,onDiffLayoutChange:d})]}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(Ay,{})})}),t[8]=u,t[9]=n,t[10]=p,t[11]=r,t[12]=c,t[13]=m,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(Z.Fragment,{children:[h,g]}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function My(e){let{id:t,icon:n}=e,r=Dy(t);return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(yo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":r,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(n,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:r})]},t)}function Ny(e){return e.id===`outline`}function Py(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Fy(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function Iy(e){return e/100*window.innerHeight}function Ly(e){return e/100*window.innerWidth}function Ry(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 zy({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Ry(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Fy(t,i);break;case`em`:r=Py(t,i);break;case`vh`:r=Iy(i);break;case`vw`:r=Ly(i);break}return r}function By(e){return parseFloat(e.toFixed(3))}function Vy({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 Hy(e){let{panels:t}=e,n=Vy({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=By(zy({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=By(zy({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=By(zy({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=By(zy({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 Uy(e,t=`Assertion error`){if(!e)throw Error(t)}function Wy(e,t){return Array.from(t).sort(e===`horizontal`?Gy:Ky)}function Gy(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Ky(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function qy(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Jy(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 Yy({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}=Jy(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Uy(i,`No rect found`),i}var Xy;function Zy(){return Xy===void 0&&(Xy=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Xy}function Qy(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Wy(n,Array.from(t.children).filter(qy).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,Yy({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=Zy()?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:Vy({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 $y=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)}}},eb=new Map,tb=new $y;function nb(e){eb=new Map(eb),eb.delete(e)}function rb(e,t){for(let[t]of eb)if(t.id===e)return t}function ib(e,t){for(let[t,n]of eb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ab(){return eb}function ob(e,t){return tb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function sb(e,t){let n=eb.get(e);eb=new Map(eb),eb.set(e,t),tb.emit(`groupChange`,{group:e,prev:n,next:t})}function cb(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Jy(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 lb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function ub(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:gb(e),b:gb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Uy(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:hb(mb(n.a)),b:hb(mb(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 db=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function fb(e){let t=getComputedStyle(_b(e)??e).display;return t===`flex`||t===`inline-flex`}function pb(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||fb(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`||db.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function mb(e){let t=e.length;for(;t--;){let n=e[t];if(Uy(n,`Missing node`),pb(n))return n}return null}function hb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function gb(e){let t=[];for(;e;)t.push(e),e=_b(e);return t}function _b(e){let{parentNode:t}=e;return lb(t)?t.host:t}function vb(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 yb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!qy(n)||n.contains(e)||e.contains(n))return!0;if(ub(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(vb(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function bb(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Qy(r),a=cb(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&yb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function xb(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 Sb(e,t,n=0){return Math.abs(By(e)-By(t))<=n}function Cb(e,t){return Sb(e,t)?0:e>t?1:-1}function wb({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(Cb(r,c)<0)if(a){let e=(i+c)/2;r=Cb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=By(r),r}function Tb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Sb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Uy(u!=null,`Invalid first pivot index`),Uy(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,i)){let t=o-n;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Uy(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(Uy(n!=null,`Previous layout not found for panel index ${t}`),Sb(n,o)){let t=n-i;Cb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Uy(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Cb(i,c)<0)if(e>0){let t=c-o,n=t/2;Cb(i+e,c)<0&&(e=Cb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Cb(i-e,c)<0&&(e=Cb(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];Uy(e!=null,`Previous layout not found for panel index ${r}`);let a=wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];Uy(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Sb(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(xb(c,l))return i;{let t=e<0?d:u,r=s[t];Uy(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=wb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Sb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Uy(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=wb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Sb(i,s)||(t-=s-i,l[r]=s),Sb(t,0))break;e>0?r--:r++}}}if(!Sb(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 Eb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Cb(e[n],t[n])!==0)return!1;return!0}function Db({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(!Sb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Uy(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];Uy(i!=null,`No layout data found for index ${e}`);let o=r[e];Uy(o!=null,`No layout data found for index ${e}`);let s=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Sb(a,0))for(let e=0;e<t.length;e++){let n=r[e];Uy(n!=null,`No layout data found for index ${e}`);let i=n+a,o=wb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Sb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Ob({groupId:e,panelId:t}){let n=()=>{let t=ab();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{let r=a();if(e===r)return;let{defaultLayoutDeferred:i,derivedPanelConstraints:o,group:s,groupSize:c,layout:l,separatorToPanels:u}=n(),d=s.panels.findIndex(e=>e.id===t),f=d===s.panels.length-1,p=Db({layout:Tb({delta:f?r-e:e-r,initialLayout:l,panelConstraints:o,pivotIndices:f?[d-1,d]:[d,d+1],prevLayout:l,trigger:`imperative-api`}),panelConstraints:o});Eb(l,p)||sb(s,{defaultLayoutDeferred:i,derivedPanelConstraints:o,groupSize:c,layout:p,separatorToPanels:u})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),s=a();e&&s!==t&&(n.expandToSize=s,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:s}=i(),c=a();if(e&&c===t){let e=s.expandToSize??n;e===0&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Sb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Vy({group:t});o(By(zy({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function kb(e){e.defaultPrevented||bb(e,ab()).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=Ob({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function Ab(e){let t=ab();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 jb({groupId:e}){let t=()=>{let t=ab();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=Db({layout:e,panelConstraints:r});return n?o:(Eb(o,c)||sb(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Mb(e,t){let n=Ab(e),r=ib(n.id,!0),i=n.separators.find(t=>t.element===e);Uy(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Uy(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=jb({groupId:n.id}).getLayout(),c=Db({layout:Tb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Eb(s,c)||sb(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Nb(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Ab(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Mb(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Mb(t,-5);break;case`End`:e.preventDefault(),Mb(t,100);break;case`Enter`:{e.preventDefault();let n=Ab(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=ib(n.id,!0),o=n.separators.find(e=>e.element===t);Uy(o,`Matching separator not found`);let s=a.get(o);Uy(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Uy(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Mb(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=Ab(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Uy(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(),Mb(t,-100);break}}var Pb={cursorFlags:0,state:`inactive`},Fb=new $y;function Ib(){return Pb}function Lb(e){return Fb.addListener(`change`,e)}function Rb(e){let t=Pb,n={...Pb};n.cursorFlags=e,Pb=n,Fb.emit(`change`,{prev:t,next:n})}function zb(e){let t=Pb;Pb=e,Fb.emit(`change`,{prev:t,next:e})}function Bb(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ab(),n=bb(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),zb({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Vb=e=>e,Hb=()=>{},Ub=1,Wb=2,Gb=4,Kb=8,qb=3,Jb=12,Yb;function Xb(){return Yb===void 0&&(Yb=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Yb=!0)),Yb}function Zb({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&&Xb()){let t=(e&Ub)!==0,n=(e&Wb)!==0,r=(e&Gb)!==0,i=(e&Kb)!==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 Xb()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Qb=new WeakMap;function $b(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Qb.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=Ib();switch(r.state){case`active`:case`hover`:{let e=Zb({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}Qb.set(e,{prevStyle:t,styleSheet:n})}function ex({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=Tb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Eb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Ub:Wb;break;case`vertical`:s|=d<0?Gb:Kb;break}}else sb(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&qb:c|=s&qb,t.movementY===0?c|=o&Jb:c|=s&Jb,Rb(c),$b(e)}function tx(e){let t=ab(),n=Ib();switch(n.state){case`active`:ex({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function nx(e){if(e.defaultPrevented)return;let t=Ib(),n=ab();switch(t.state){case`active`:if(e.buttons===0){zb({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}ex({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=bb(e,n);r.length===0?t.state!==`inactive`&&zb({cursorFlags:0,state:`inactive`}):zb({cursorFlags:0,hitRegions:r,state:`hover`}),$b(e.currentTarget);break}}}function rx(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Ib().state){case`hover`:zb({cursorFlags:0,state:`inactive`})}}function ix(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ib();switch(t.state){case`active`:zb({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&($b(e.currentTarget),t.hitRegions.forEach(e=>{let t=ib(e.group.id,!0);sb(e.group,t)}),e.preventDefault())}}function ax(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=By(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=By((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function ox(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Vy({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:By(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function sx(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 cx({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=By(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]=By((r[e]??0)/a*l);else{let e=By(l/c.length);for(let t of c)u[t]=e}return u}function lx(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 ux=new Map;function dx(e){let t=!0;Uy(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=Vy({group:e});if(t===0)return;let n=ib(e.id);if(!n)return;let r=Hy(e),i=n.defaultLayoutDeferred?ax(r):n.layout,a=Db({layout:cx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Eb(n.layout,a)&&sx(n.derivedPanelConstraints,r)&&n.groupSize===t)return;sb(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else ox(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Uy(!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=Vy({group:e}),s=Hy(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(lx(e.panels,l)||(l=void 0));let u=Db({layout:e.mutableState.layouts[c]??l??ax(s),panelConstraints:s}),d=e.element.ownerDocument;ux.set(d,(ux.get(d)??0)+1);let f=new Map;return Qy(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),sb(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Uy(!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`,Nb)}),ux.get(d)===1&&(d.addEventListener(`dblclick`,kb,!0),d.addEventListener(`pointerdown`,Bb,!0),d.addEventListener(`pointerleave`,tx),d.addEventListener(`pointermove`,nx),d.addEventListener(`pointerout`,rx),d.addEventListener(`pointerup`,ix,!0)),function(){t=!1,ux.set(d,Math.max(0,(ux.get(d)??0)-1)),nb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Nb)}),ux.get(d)||(d.removeEventListener(`dblclick`,kb,!0),d.removeEventListener(`pointerdown`,Bb,!0),d.removeEventListener(`pointerleave`,tx),d.removeEventListener(`pointermove`,nx),d.removeEventListener(`pointerout`,rx),d.removeEventListener(`pointerup`,ix,!0)),a.disconnect()}}function fx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function px(e){let t=(0,Q.useId)();return`${e??t}`}var mx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function hx(e){let t=(0,Q.useRef)(e);return mx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function gx(...e){return hx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function _x(e){let t=(0,Q.useRef)({...e});return mx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var vx=(0,Q.createContext)(null);function yx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Vb});(0,Q.useImperativeHandle)(t,()=>n.current,[]),mx(()=>{Object.assign(n.current,jb({groupId:e}))})}function bx({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,Q.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=hx(e=>{Eb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=hx(e=>{Eb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=px(s),v=(0,Q.useRef)(null),[y,b]=fx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=gx(v,a);yx(_,o);let C=hx((e,t)=>{let r=Ib(),i=rb(e),a=ib(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=_x({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=Wy(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Wy(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=rb(_),i=ib(_);r&&i&&sb(r,{...i,derivedPanelConstraints:Hy(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 mx(()=>{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=dx(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=ib(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ob(_,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=Sb(t.collapsedSize,i[t.panelId]),a=Sb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=Ib().state!==`active`;h(i),o&&g(i)});return()=>{E.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,Q.useEffect)(()=>{let e=E.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,Z.jsx)(vx.Provider,{value:T,children:(0,Z.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}bx.displayName=`Group`;function xx(){let e=(0,Q.useContext)(vx);return Uy(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Sx(e,t){let{id:n}=xx(),r=(0,Q.useRef)({collapse:Hb,expand:Hb,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Hb});(0,Q.useImperativeHandle)(t,()=>r.current,[]),mx(()=>{Object.assign(r.current,Ob({groupId:n,panelId:e}))})}function Cx({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=px(c),_=_x({disabled:a}),v=(0,Q.useRef)(null),y=gx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=xx(),T=d!==null,E=hx((e,t,n)=>{d?.(e,c,n)});mx(()=>{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]),Sx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>ob(x,e),D,D),k;return k=O?JSON.parse(O):i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,Z.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...wx,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...k},children:(0,Z.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Cx.displayName=`Panel`;var wx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Tx(){return(0,Q.useRef)(null)}function Ex({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=Db({layout:Tb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Db({layout:Tb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Dx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=px(a),l=_x({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=gx(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=xx(),x=v===`horizontal`?`vertical`:`horizontal`;mx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=Lb(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ob(_,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(Ex({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[_,c,y,l]),(0,Q.useEffect)(()=>{b(c,{disabled:n,disableDoubleClick:r})},[n,r,c,b]);let S;return n&&!g&&(S=`not-allowed`),(0,Z.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":x,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?`disabled`:f,"data-testid":c,id:c,ref:h,role:`separator`,style:{flexBasis:`auto`,cursor:S,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Dx.displayName=`Separator`;var Ox=new Map;function kx(e){let t=Ox.get(e);if(t)return t;let n=Ax(e);return Ox.set(e,n),n}async function Ax(e){switch(e){case`bash`:case`shell`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{shell:e}=await import(`./shell-CpYUNWOc.js`);return{shell:e}},[],import.meta.url)).shell);case`c`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{c:e}=await import(`./clike-DrSwTBuw.js`);return{c:e}},[],import.meta.url)).c);case`cpp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{cpp:e}=await import(`./clike-DrSwTBuw.js`);return{cpp:e}},[],import.meta.url)).cpp);case`csharp`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{csharp:e}=await import(`./clike-DrSwTBuw.js`);return{csharp:e}},[],import.meta.url)).csharp);case`css`:case`less`:case`scss`:return(await n(async()=>{let{css:e}=await import(`./dist-Mxq-zflt.js`).then(e=>e.r);return{css:e}},__vite__mapDeps([38,1,39,23,40]),import.meta.url)).css().language;case`diff`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{diff:e}=await import(`./diff-D0_HBszs.js`);return{diff:e}},[],import.meta.url)).diff);case`go`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{go:e}=await import(`./go-DdpCnkcu.js`);return{go:e}},[],import.meta.url)).go);case`ini`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{properties:e}=await import(`./properties-4lW4ME5D.js`);return{properties:e}},[],import.meta.url)).properties);case`java`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{java:e}=await import(`./clike-DrSwTBuw.js`);return{java:e}},[],import.meta.url)).java);case`javascript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript().language;case`json`:return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;case`kotlin`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{kotlin:e}=await import(`./clike-DrSwTBuw.js`);return{kotlin:e}},[],import.meta.url)).kotlin);case`lua`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{lua:e}=await import(`./lua-BrsGSRvH.js`);return{lua:e}},[],import.meta.url)).lua);case`markdown`:return(await n(async()=>{let{markdown:e}=await import(`./dist-B9B58-J_.js`).then(e=>e.t);return{markdown:e}},__vite__mapDeps([45,1,43,39,23,41,38,40,42]),import.meta.url)).markdown().language;case`objectivec`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{objectiveC:e}=await import(`./clike-DrSwTBuw.js`);return{objectiveC:e}},[],import.meta.url)).objectiveC);case`perl`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{perl:e}=await import(`./perl-BvKrvbRb.js`);return{perl:e}},[],import.meta.url)).perl);case`python`:return(await n(async()=>{let{python:e}=await import(`./dist-D1rVZYi52.js`);return{python:e}},__vite__mapDeps([50,43,39,1,23,40]),import.meta.url)).python().language;case`r`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{r:e}=await import(`./r-CfD_nMxU.js`);return{r:e}},[],import.meta.url)).r);case`ruby`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{ruby:e}=await import(`./ruby-CEHR0ONp.js`);return{ruby:e}},[],import.meta.url)).ruby);case`rust`:return(await n(async()=>{let{rust:e}=await import(`./dist-CjXb6uie.js`);return{rust:e}},__vite__mapDeps([51,39,1,23,40]),import.meta.url)).rust().language;case`sql`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{standardSQL:e}=await import(`./sql-m6QogzU7.js`);return{standardSQL:e}},[],import.meta.url)).standardSQL);case`swift`:return(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{swift:e}=await import(`./swift-CmJiKyqD.js`);return{swift:e}},[],import.meta.url)).swift);case`typescript`:return(await n(async()=>{let{javascript:e}=await import(`./dist-Bui1BhSw.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([42,1,43,39,23,40]),import.meta.url)).javascript({typescript:!0,jsx:!0}).language;case`xml`:return(await n(async()=>{let{html:e}=await import(`./dist-Bn0QvNGs.js`).then(e=>e.t);return{html:e}},__vite__mapDeps([41,1,38,39,23,40,42,43]),import.meta.url)).html().language;case`yaml`:return(await n(async()=>{let{yaml:e}=await import(`./dist-pSQcUvmU.js`).then(e=>e.t);return{yaml:e}},__vite__mapDeps([46,1,39,23,40]),import.meta.url)).yaml().language;default:return null}}async function jx(e,t){if(e===`canvas`)return(await n(async()=>{let{json:e}=await import(`./dist-Debx6b6u.js`).then(e=>e.t);return{json:e}},__vite__mapDeps([44,1,39,23,40]),import.meta.url)).json().language;if(t){let e=await kx(t);if(e)return e}return e===`toml`?(await n(async()=>{let{StreamLanguage:e}=await import(`./dist-C0jOOVYt.js`).then(e=>e.h);return{StreamLanguage:e}},__vite__mapDeps([39,1,23]),import.meta.url)).StreamLanguage.define((await n(async()=>{let{toml:e}=await import(`./toml-CSZcBb2g.js`);return{toml:e}},[],import.meta.url)).toml):null}var Mx=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Nx=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Px(e){let t=(0,$.c)(5),{_:n}=i(),r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={status:`loading`},t[0]=r):r=t[0];let[a,o]=(0,Q.useState)(r),s,c;return t[1]!==n||t[2]!==e?(s=()=>{let t=!1,r=new AbortController;return o({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:r.signal}).then(async e=>{if(!e.ok){let t=e.status;throw Error(n(t===413?{id:`C_WGy8`}:t===404?{id:`s0IDhW`}:t===400?{id:`N1mdmS`}:{id:`96w9hU`,values:{status:t}}))}return e.text()}).then(e=>{t||o({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||o({status:`error`,message:e instanceof Error?e.message:n({id:`ig5vUe`})})}),()=>{t=!0,r.abort()}},c=[e,n],t[1]=n,t[2]=e,t[3]=s,t[4]=c):(s=t[3],c=t[4]),(0,Q.useEffect)(s,c),a}function Fx(e){let t=(0,$.c)(28),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:c}=Nr(),l=Px(n),u=l.status===`loaded`?l.content:null,d,f;if(t[0]!==i||t[1]!==u||t[2]!==c?(d=()=>{if(!a.current||u===null)return;let e=i.toLowerCase(),t=or(e),n=c===`dark`?Mx:Nx,r=!1,s=null;return jx(e,t).then(e=>{if(r||!a.current)return;let t=[Fc,...e?[e]:[],_c.editable.of(!0),sc.readOnly.of(!0),_c.lineWrapping,n];s=new _c({state:sc.create({doc:u,extensions:t}),parent:a.current}),o.current=s}),()=>{r=!0,s?.destroy(),o.current=null}},f=[u,i,c],t[0]=i,t[1]=u,t[2]=c,t[3]=d,t[4]=f):(d=t[3],f=t[4]),(0,Q.useEffect)(d,f),l.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`Md709y`,values:{fileName:r}})}),t[5]=r,t[6]=e);let n;return t[7]!==i||t[8]!==r||t[9]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center bg-background text-muted-foreground text-sm`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loading`,"data-text-viewer-extension":i,children:e}),t[7]=i,t[8]=r,t[9]=e,t[10]=n):n=t[10],n}if(l.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsx)(`div`,{className:`font-medium text-sm`,children:(0,Z.jsx)(s,{id:`qdBUHP`,values:{fileName:r}})}),t[11]=r,t[12]=e);let a;t[13]===l.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:l.message}),t[13]=l.message,t[14]=a);let o;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`9npOH9`}),t[15]=o):o=t[15];let c;t[16]===n?c=t[17]:(c=(0,Z.jsx)(`a`,{href:n,className:`mt-2 rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:o}),t[16]=n,t[17]=c);let u;return t[18]!==i||t[19]!==r||t[20]!==e||t[21]!==a||t[22]!==c?(u=(0,Z.jsxs)(`main`,{className:`flex h-full min-h-0 flex-col items-center justify-center gap-2 bg-background p-4 text-center`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`error`,"data-text-viewer-extension":i,children:[e,a,c]}),t[18]=i,t[19]=r,t[20]=e,t[21]=a,t[22]=c,t[23]=u):u=t[23],u}let p;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[24]=p):p=t[24];let m;return t[25]!==i||t[26]!==r?(m=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":r,"data-text-viewer":``,"data-text-viewer-state":`loaded`,"data-text-viewer-extension":i,children:p}),t[25]=i,t[26]=r,t[27]=m):m=t[27],m}function Ix(e){return qr(`/api/asset?path=${encodeURIComponent(e)}`)}function Lx(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function Rx(e){let t=(0,$.c)(31),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),o;t[0]===n?o=t[1]:(o=Ix(n),t[0]=n,t[1]=o);let c=o,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p,m;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){m=Symbol.for(`react.early_return_sentinel`);bb0:{if(p=u.includes(`.`)?u.split(`.`).pop()??``:``,f=p.length>0?p.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[13]!==u||t[14]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(X,{src:c,title:u,fillContainer:!0})}),t[13]=u,t[14]=c,t[15]=e):e=t[15];let n;t[16]!==u||t[17]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[16]=u,t[17]=e,t[18]=n):n=t[18],m=n;break bb0}if(d===`text`){let e;t[19]===n?e=t[20]:(e=Lx(n),t[19]=n,t[20]=e),m=(0,Z.jsx)(Fx,{src:e,fileName:u,extension:p.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else d=t[9],f=t[10],p=t[11],m=t[12];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[21]!==n||t[22]!==d||t[23]!==f||t[24]!==u||t[25]!==p||t[26]!==c?(h=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(Ge,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-8 text-center`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,Z.jsx)(`div`,{className:`flex items-center justify-center tracking-wide text-muted-foreground/80 text-2xs font-mono`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full text-balance break-words tracking-tight font-light text-2xl`,children:u})]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(ci,{variant:`default`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,className:`font-mono uppercase`,children:(0,Z.jsx)(s,{id:`qFWMl-`})}),(0,Z.jsx)(ci,{variant:`outline`,size:`sm`,className:`font-mono uppercase`,onClick:()=>{rt({url:c,projectRelPath:n,ext:p.toLowerCase(),title:u,forceOsDelegation:!1})},children:(0,Z.jsx)(s,{id:`9npOH9`})})]})]})}),t[21]=n,t[22]=d,t[23]=f,t[24]=u,t[25]=p,t[26]=c,t[27]=h):h=t[27];let g;return t[28]!==u||t[29]!==h?(g=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:h}),t[28]=u,t[29]=h,t[30]=g):g=t[30],g}function zx(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`3VsNTI`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(za,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(za,{className:`h-4 w-full`}),(0,Z.jsx)(za,{className:`h-4 w-3/4`})]}),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function Bx(e){let{_:t}=i();return e===`existing-repo`?[{id:`draft-spec`,icon:_l,label:t({id:`LdKIHS`}),prompt:t({id:`N_7kkF`})},{id:`organize-specs`,icon:Pl,label:t({id:`cuA8QW`}),prompt:t({id:`mPy9lS`})},{id:`document-architecture`,icon:Ll,label:t({id:`6eniID`}),prompt:t({id:`uDlyqd`})}]:[{id:`competitor-research`,icon:cu,label:t({id:`GUqTzn`}),prompt:t({id:`KOZud0`})},{id:`eng-specs`,icon:_l,label:t({id:`Qvls7J`}),prompt:t({id:`6qMe0o`})},{id:`bird-wiki`,icon:tl,label:t({id:`FqTpiN`}),prompt:t({id:`jtg_8-`})}]}function Vx(e){let t=(0,$.c)(13),{scenario:n,className:r}=e,{_:a}=i(),o=Bx(n),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(void 0),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>clearTimeout(l.current),d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,Q.useEffect)(u,d);let f,p;if(t[2]!==a||t[3]!==r||t[4]!==s||t[5]!==o){let e=function(e,t){Pa(t).then(()=>{c(e),clearTimeout(l.current),l.current=setTimeout(()=>c(null),1600)}).catch(Hx)};t[8]===r?f=t[9]:(f=oi(`w-full divide-y divide-border/60 overflow-hidden rounded-2xl border border-border/60 bg-card`,r),t[8]=r,t[9]=f),p=o.map(t=>{let n=t.icon,r=s===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)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>e(t.id,t.prompt),"aria-label":a(r?{id:`6V3Ea3`}:{id:`RG4XHV`,values:{0:t.label}}),className:oi(`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)(ko,{className:`size-3.5`,"aria-hidden":`true`}):(0,Z.jsx)(tt,{className:`size-3.5`,"aria-hidden":`true`}),a(r?{id:`6V3Ea3`}:{id:`he3ygx`})]})]},t.id)}),t[2]=a,t[3]=r,t[4]=s,t[5]=o,t[6]=f,t[7]=p}else f=t[6],p=t[7];let m;return t[10]!==f||t[11]!==p?(m=(0,Z.jsx)(`ul`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}function Hx(){}var Ux={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Wx(e){let t=(0,$.c)(23),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({id:r,style:a,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{resolvedTheme:o}=Nr(),s=Ux[r],c=s?(o===`dark`?zr[s]:void 0)??Jr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=oi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(fi,{style:u,className:p,...i}),t[11]=p,t[12]=u,t[13]=i,t[14]=e):e=t[14],e}if(r===`codex`){let e;return t[15]!==p||t[16]!==u||t[17]!==i?(e=(0,Z.jsx)(di,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(vi,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}var Gx=(0,Q.createContext)(null);function Kx(e){let t=(0,$.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,Z.jsx)(Gx,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function qx(){return(0,Q.use)(Gx)}var Jx=ii(`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 Yx(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=oi(Jx({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 Xx=`ok-preferred-agent-v1`,Zx=new Set(_g.map(e=>e.id));function Qx(e){return typeof e==`string`&&Zx.has(e)}function $x(e){try{let t=(e??localStorage).getItem(Xx);return Qx(t)?t:null}catch{return null}}function eS(e,t){try{(t??localStorage).setItem(Xx,e)}catch{}}function tS(e){let{lastUsed:t,states:n}=e;return t&&n[t]?.installed===!0?t:_g.find(e=>n[e.id]?.installed===!0)?.id??null}function nS(e){let t=(0,$.c)(52),{scenario:n,className:r}=e,{_:a}=i(),{states:o,refresh:c}=O_(),{dispatch:l}=__(),u=po(),d=qx(),[f,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(iS),g=(0,Q.useRef)(!1),[_,v]=(0,Q.useState)(!1),y=_&&d!==null,b=(0,Q.useRef)(null),x=Bx(n),S;t[0]===o?S=t[1]:(S=e=>o[e.id]?.installed===!0,t[0]=o,t[1]=S);let C=_g.filter(S),w;t[2]===o?w=t[3]:(w=_g.every(e=>o[e.id]?.installed!=null),t[2]=o,t[3]=w);let T=w,E=T&&C.length===0,D,O;t[4]!==T||t[5]!==o?(D=()=>{if(!T||g.current)return;let e=tS({lastUsed:$x(),states:o});h(t=>e===t?t:e)},O=[T,o],t[4]=T,t[5]=o,t[6]=D,t[7]=O):(D=t[6],O=t[7]),(0,Q.useEffect)(D,O);let k=function(e){g.current=!0,v(!1),h(e),eS(e)},A;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){g.current=!0,v(!0)},t[8]=A):A=t[8];let j=A,M;t[9]!==f||t[10]!==n||t[11]!==d||t[12]!==u?(M=function(){if(d===null)return;let e=n_({workspace:u,description:f.trim(),scenario:n});e!==null&&d.launchInTerminal(e)},t[9]=f,t[10]=n,t[11]=d,t[12]=u,t[13]=M):M=t[13];let N=M,P;t[14]!==f||t[15]!==l||t[16]!==n||t[17]!==u?(P=function(e){let t=f.trim();eS(e);let r=n_({workspace:u,description:t,scenario:n});r!==null&&l(e,r)},t[14]=f,t[15]=l,t[16]=n,t[17]=u,t[18]=P):P=t[18];let F=P,I;t[19]!==y||t[20]!==F||t[21]!==N||t[22]!==m?(I=function(e){(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y?N():m!==null&&F(m))},t[19]=y,t[20]=F,t[21]=N,t[22]=m,t[23]=I):I=t[23];let L=I,R=function(e){p(e),b.current?.focus()};if(E){let e;t[24]===r?e=t[25]:(e=oi(`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[24]=r,t[25]=e);let n;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(yi,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}),t[26]=n):n=t[26];let i;t[27]===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)(s,{id:`3IseAk`})})]}),t[27]=i):i=t[27];let a;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:_g.map(rS)}),t[28]=a):a=t[28];let o;return t[29]===e?o=t[30]:(o=(0,Z.jsxs)(`div`,{className:e,"data-testid":`create-no-agents`,children:[i,a]}),t[29]=e,t[30]=o),o}let z=C.length>0,B=d!==null,V;t[31]===r?V=t[32]:(V=oi(`flex w-full flex-col gap-3`,r),t[31]=r,t[32]=V);let H;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>p(e.target.value),t[33]=H):H=t[33];let U;t[34]===a?U=t[35]:(U=a({id:`0jD-Gn`}),t[34]=a,t[35]=U);let W;t[36]===a?W=t[37]:(W=a({id:`7hctf2`}),t[36]=a,t[37]=W);let G;t[38]!==f||t[39]!==L||t[40]!==U||t[41]!==W?(G=(0,Z.jsx)(qs,{ref:b,value:f,onChange:H,onKeyDown:L,rows:4,placeholder:U,"aria-label":W,className:`min-h-12 resize-none rounded-2xl border-0 bg-transparent dark:bg-transparent px-4 py-3.5 text-sm leading-relaxed shadow-none focus-visible:border-0 focus-visible:ring-0 max-h-96 subtle-scrollbar`}),t[38]=f,t[39]=L,t[40]=U,t[41]=W,t[42]=G):G=t[42];let K=m===null?(0,Z.jsx)(ci,{type:`button`,variant:`outline`,disabled:!0,className:`gap-1.5`,"data-testid":`create-with-agent`,children:(0,Z.jsx)(s,{id:`hYgDIe`})}):(0,Z.jsxs)(Yx,{children:[(0,Z.jsx)(ci,{type:`button`,onClick:()=>y?N():F(m),variant:`outline`,className:`gap-1.5`,"data-testid":`create-with-agent`,children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ru,{"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`hozzkE`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wx,{id:m,"aria-hidden":`true`,className:`size-3.5`}),(0,Z.jsx)(s,{id:`9dw5bW`,values:{0:m_(m)}})]})}),(0,Z.jsxs)(ao,{onOpenChange:e=>{e&&c()},children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,"aria-label":a({id:`nskygk`}),size:`icon`,variant:`outline`,"data-testid":`create-with-agent-menu`,children:(0,Z.jsx)(Ve,{"aria-hidden":`true`,className:`size-3.5`})})}),(0,Z.jsxs)(eo,{align:`end`,className:`min-w-[200px]`,children:[z?(0,Z.jsxs)(La,{"aria-label":a({id:`BBqGS9`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),C.map(e=>(0,Z.jsxs)(Ea,{onSelect:()=>k(e.id),"data-testid":`create-agent-option-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-4`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:e.displayName}),!y&&e.id===m?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]},e.id))]}):null,B?(0,Z.jsxs)(Z.Fragment,{children:[z?(0,Z.jsx)(no,{}):null,(0,Z.jsxs)(La,{"aria-label":a({id:`ALhMYW`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Ea,{onSelect:()=>j(),"data-testid":`create-with-claude-cli`,"aria-label":a({id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),y?(0,Z.jsx)(ko,{"aria-hidden":`true`,className:`size-4 text-muted-foreground`}):null]})]})]}):null]})]})]}),q;t[43]===K?q=t[44]:(q=(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 px-3 pb-3`,children:K}),t[43]=K,t[44]=q);let J;t[45]!==G||t[46]!==q?(J=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col rounded-2xl border border-border/60 bg-card shadow-sm transition-colors focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[G,q]}),t[45]=G,t[46]=q,t[47]=J):J=t[47];let ee=n!==`existing-repo`&&x.length>0?(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:x.map(e=>{let t=e.icon;return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(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,Y;return t[48]!==J||t[49]!==ee||t[50]!==V?(Y=(0,Z.jsxs)(`div`,{className:V,children:[J,ee]}),t[48]=J,t[49]=ee,t[50]=V,t[51]=Y):Y=t[51],Y}function rS(e){return(0,Z.jsxs)(ci,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r_(e),className:`gap-1.5`,"data-testid":`install-agent-${e.id}`,children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`,className:`size-3.5`}),e.displayName,(0,Z.jsx)(vo,{"aria-hidden":`true`,className:`size-3`})]},e.id)}function iS(){return $x()}var aS=3100,oS=3;function sS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??oS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var cS={0:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},1:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},2:{count:0,startRadius:0,baseDistance:0,distanceVariance:0,sizeMin:0,sizeMax:0,maxDelay:0,durationMin:0,durationMax:0},3:{count:16,startRadius:11,baseDistance:7,distanceVariance:3,sizeMin:.45,sizeMax:1.2,maxDelay:500,durationMin:1100,durationMax:2400}},lS=[`var(--color-azure-blue)`,`var(--color-sky-blue)`,`var(--color-violet-300)`,`var(--color-orange-light)`,`var(--color-crystal-blue)`,`var(--color-white-cream)`];function uS(e,t={}){let n=t.rng??Math.random,r=t.colors??lS,i=cS[e];if(i.count===0||r.length===0)return[];let a=[],o=Math.PI*2/i.count;for(let e=0;e<i.count;e++){let t=e*o+(n()-.5)*o*.7,s=i.baseDistance+(n()-.5)*2*i.distanceVariance,c=i.sizeMin+n()*(i.sizeMax-i.sizeMin),l=n()*i.maxDelay,u=i.durationMin+n()*(i.durationMax-i.durationMin),d=Math.floor(n()*r.length),f=Math.cos(t),p=Math.sin(t);a.push({id:e,dx:f*s,dy:p*s,originDx:f*i.startRadius,originDy:p*i.startRadius,size:c,color:r[d]??`currentColor`,delay:l,duration:u})}return a}var dS=1.8,fS=90,pS=16,mS=380,hS=.025,gS=.1,_S=.18,vS=400,yS=9.2736,bS=18.1799,xS=14.5244,SS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function CS(e,t){let{halfWidth:n,apexLift:r}=SS[t];return`M${e-n} ${xS+.3} Q${e} ${xS-r}, ${e+n} ${xS+.3}`}function wS(e){let t=1.5,n=.3;return`M${e-t} ${xS-n} Q${e} ${xS+1.4}, ${e+t} ${xS-n}`}var TS=15,ES=15;function DS(e){return{fill:e.color,"--fx-tx":`${e.dx}px`,"--fx-ty":`${e.dy}px`,"--fx-delay":`${e.delay}ms`,"--fx-duration":`${e.duration}ms`}}function OS(e){let t=(0,$.c)(72),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o,gaze:s}=e,c=n===void 0?48:n,l=i===void 0?!0:i,u=a===void 0?`default`:a,d=o===void 0?0:o,f=s===void 0?`cursor`:s,p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g={x:0,y:0},t[0]=g):g=t[0];let _=(0,Q.useRef)(g),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(0),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),T=(0,Q.useRef)(0),E=(0,Q.useRef)(void 0),D=u===`sleeping`,O;t[2]!==v||t[3]!==D?(O=function(){if(D)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=T.current===0?1/0:e-T.current;T.current=e;let n=sS(v,t);y(n),x(MS),w(uS(n)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS)},t[2]=v,t[3]=D,t[4]=O):O=t[4];let k=O,A,j;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>clearTimeout(E.current),A=[],t[5]=A,t[6]=j):(A=t[5],j=t[6]),(0,Q.useEffect)(j,A);let M,N;t[7]!==d||t[8]!==D?(M=()=>{d===0||D||(y(3),x(jS),w(uS(3)),clearTimeout(E.current),E.current=setTimeout(()=>{y(0),w([])},aS))},N=[d,D],t[7]=d,t[8]=D,t[9]=M,t[10]=N):(M=t[9],N=t[10]),(0,Q.useEffect)(M,N);let P,F;t[11]!==f||t[12]!==D||t[13]!==l?(P=()=>{if(!l||D)return;let e=f===`down`;if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=0,n=0,r=!1,i=0,a=0,o=0,s=0,c=0,u=function(){c===0&&(c=requestAnimationFrame(g))},d=function(e){t=e.clientX,n=e.clientY,r=!0,u()};function g(){c=0;let l=m.current,d=p.current;if(!l||!d){u();return}let f=r;r=!1;let g=l.getBoundingClientRect(),v=g.left+g.width/2,y=g.top+g.height*.48,b=t-v,x=n-y,S=Math.hypot(b,x),C,w,T=0,E=0;if(e)w=0,C=-pS*.8,E=dS;else{let e=Math.max(-1,Math.min(1,b/mS)),t=Math.max(-1,Math.min(1,x/mS));if(w=e*pS,C=-t*pS,S>=1){let e=Math.min(S/fS,1)*dS;T=b/S*e,E=x/S*e}}let D=Math.abs(C-i)<.01&&Math.abs(w-a)<.01&&Math.abs(T-o)<.01&&Math.abs(E-s)<.01;if(!f&&D)return;u(),i+=(C-i)*gS,a+=(w-a)*gS,d.style.transform=`perspective(${vS}px) rotateX(${i.toFixed(3)}deg) rotateY(${a.toFixed(3)}deg)`,o+=(T-o)*_S,s+=(E-s)*_S;let O=a*hS,k=-i*hS,A=o+O,j=s+k;_.current.x=A,_.current.y=j,h.current?.setAttribute(`transform`,`translate(${A.toFixed(3)} ${j.toFixed(3)})`)}return document.addEventListener(`mousemove`,d,{passive:!0}),u(),()=>{document.removeEventListener(`mousemove`,d),c!==0&&cancelAnimationFrame(c),c=0,p.current&&(p.current.style.transform=``),_.current={x:0,y:0},h.current?.removeAttribute(`transform`)}},F=[l,D,f],t[11]=f,t[12]=D,t[13]=l,t[14]=P,t[15]=F):(P=t[14],F=t[15]),(0,Q.useEffect)(P,F);let I;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{let e=h.current;if(!e)return;let{x:t,y:n}=_.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[16]=I):I=t[16],(0,Q.useLayoutEffect)(I);let L=v>0,R=L?v:1,z=L?`ok-blob-clicked-${v}`:null,B;t[17]===r?B=t[18]:(B=oi(`ok-blob-3d-wrapper`,r),t[17]=r,t[18]=B);let V=D?`cursor-default`:`cursor-pointer`,H=`body-${b}`,U=D&&`ok-blob-sleeping`,W;t[19]!==z||t[20]!==U?(W=oi(`ok-blob-group`,U,z),t[19]=z,t[20]=U,t[21]=W):W=t[21];let G;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[22]=G):G=t[22];let K=(L||D)&&`ok-blob-eye-hidden`,q;t[23]===K?q=t[24]:(q=oi(`ok-blob-eye`,K),t[23]=K,t[24]=q);let J;t[25]===q?J=t[26]:(J=(0,Z.jsx)(`ellipse`,{cx:yS,cy:xS,rx:1.2722,ry:1.9083,className:q}),t[25]=q,t[26]=J);let ee=(L||D)&&`ok-blob-eye-hidden`,Y;t[27]===ee?Y=t[28]:(Y=oi(`ok-blob-eye ok-blob-eye-right`,ee),t[27]=ee,t[28]=Y);let te;t[29]===Y?te=t[30]:(te=(0,Z.jsx)(`ellipse`,{cx:bS,cy:xS,rx:1.2722,ry:1.9083,className:Y}),t[29]=Y,t[30]=te);let ne;t[31]===R?ne=t[32]:(ne=CS(yS,R),t[31]=R,t[32]=ne);let X=(!L||D)&&`ok-blob-eye-hidden`,re;t[33]===X?re=t[34]:(re=oi(`ok-blob-happy-eye`,X),t[33]=X,t[34]=re);let ie;t[35]!==ne||t[36]!==re?(ie=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:re}),t[35]=ne,t[36]=re,t[37]=ie):ie=t[37];let ae;t[38]===R?ae=t[39]:(ae=CS(bS,R),t[38]=R,t[39]=ae);let oe=(!L||D)&&`ok-blob-eye-hidden`,se;t[40]===oe?se=t[41]:(se=oi(`ok-blob-happy-eye`,oe),t[40]=oe,t[41]=se);let ce;t[42]!==ae||t[43]!==se?(ce=(0,Z.jsx)(`path`,{d:ae,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:se}),t[42]=ae,t[43]=se,t[44]=ce):ce=t[44];let le;t[45]===D?le=t[46]:(le=D?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:wS(yS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:wS(bS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[45]=D,t[46]=le);let ue;t[47]!==J||t[48]!==te||t[49]!==ie||t[50]!==ce||t[51]!==le?(ue=(0,Z.jsxs)(`g`,{ref:h,children:[J,te,ie,ce,le]}),t[47]=J,t[48]=te,t[49]=ie,t[50]=ce,t[51]=le,t[52]=ue):ue=t[52];let de;t[53]!==H||t[54]!==W||t[55]!==ue?(de=(0,Z.jsxs)(`g`,{className:W,children:[G,ue]},H),t[53]=H,t[54]=W,t[55]=ue,t[56]=de):de=t[56];let fe;t[57]===D?fe=t[58]:(fe=D?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[57]=D,t[58]=fe);let pe;t[59]!==b||t[60]!==C?(pe=C.length>0&&(0,Z.jsx)(`g`,{children:C.map(kS)},`firework-${b}`),t[59]=b,t[60]=C,t[61]=pe):pe=t[61];let me;t[62]!==k||t[63]!==c||t[64]!==V||t[65]!==de||t[66]!==fe||t[67]!==pe?(me=(0,Z.jsxs)(`svg`,{ref:m,width:c,height:c,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:V,"aria-hidden":`true`,onClick:k,onMouseDown:AS,children:[de,fe,pe]}),t[62]=k,t[63]=c,t[64]=V,t[65]=de,t[66]=fe,t[67]=pe,t[68]=me):me=t[68];let he;return t[69]!==B||t[70]!==me?(he=(0,Z.jsx)(`span`,{ref:p,className:B,children:me}),t[69]=B,t[70]=me,t[71]=he):he=t[71],he}function kS(e){return(0,Z.jsx)(`circle`,{cx:TS+e.originDx,cy:ES+e.originDy,r:e.size,className:`ok-blob-firework`,style:DS(e)},e.id)}function AS(e){return e.preventDefault()}function jS(e){return e+1}function MS(e){return e+1}function NS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(OS,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}var PS=`open-knowledge:create-top-level-file`;function FS(e={}){window.dispatchEvent(new CustomEvent(PS,{detail:e}))}function IS(e){let t=t=>{let n=t.detail;e(n??{})};return window.addEventListener(PS,t),()=>window.removeEventListener(PS,t)}function LS(e){let t=(0,$.c)(32),{celebrateSignal:n,onAddStarterPack:r}=e,{_:a}=i(),o=mg(),c=Va(),l;t[0]!==c.data||t[1]!==c.status?(l=c.status===`ready`?c.data:[],t[0]=c.data,t[1]=c.status,t[2]=l):l=t[2];let u=l,d=c.status===`loading`||c.status===`idle`,f=c.status===`error`,p;t[3]===a?p=t[4]:(p=a({id:`FOGD7m`}),t[3]=a,t[4]=p);let m;t[5]!==a||t[6]!==o?(m=a(o?{id:`3DTatP`}:{id:`MqQoV-`}),t[5]=a,t[6]=o,t[7]=m):m=t[7];let h;t[8]!==n||t[9]!==p||t[10]!==m?(h=(0,Z.jsx)(NS,{title:p,subtitle:m,celebrateSignal:n}),t[8]=n,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===o?g=t[13]:(g=o?(0,Z.jsx)(Vx,{scenario:`existing-repo`}):(0,Z.jsx)(nS,{scenario:`existing-repo`}),t[12]=o,t[13]=g);let _;t[14]!==u||t[15]!==f||t[16]!==d?(_=d||f||u.length>0?(0,Z.jsx)(BS,{templates:u,loading:d,error:f,onSelect:zS}):null,t[14]=u,t[15]=f,t[16]=d,t[17]=_):_=t[17];let v,y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`,className:`size-3`}),y=(0,Z.jsx)(s,{id:`IajAbS`}),t[18]=v,t[19]=y):(v=t[18],y=t[19]);let b;t[20]===r?b=t[21]:(b=(0,Z.jsxs)(ci,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[v,y]}),t[20]=r,t[21]=b);let x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ci,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:RS,children:(0,Z.jsx)(s,{id:`L4Cdd9`,components:{0:(0,Z.jsx)(ka,{"aria-hidden":`true`,className:`size-3`})}})}),t[22]=x):x=t[22];let S;t[23]===b?S=t[24]:(S=(0,Z.jsxs)(`div`,{className:`-mt-6 flex w-full items-center justify-between gap-4`,children:[b,x]}),t[23]=b,t[24]=S);let C;t[25]!==S||t[26]!==_?(C=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8`,children:[_,S]}),t[25]=S,t[26]=_,t[27]=C):C=t[27];let w;return t[28]!==C||t[29]!==h||t[30]!==g?(w=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-8 py-12 max-w-5xl my-auto`,children:[h,g,C]}),t[28]=C,t[29]=h,t[30]=g,t[31]=w):w=t[31],w}function RS(){return FS({initialDir:``})}function zS(e,t){return FS({template:{folder:e,name:t}})}function BS(e){let t=(0,$.c)(25),{templates:n,loading:r,error:a,onSelect:o}=e,{_:c}=i(),l;t[0]===c?l=t[1]:(l=c({id:`_8quCH`}),t[0]=c,t[1]=l);let u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`_8quCH`})}),t[2]=u):u=t[2];let d;t[3]!==c||t[4]!==a||t[5]!==r||t[6]!==n?(d=r||a?null:(0,Z.jsx)(st,{className:`text-2xs`,variant:`gray`,"aria-label":c({id:`X7u0xR`,values:{0:n.length}}),children:n.length}),t[3]=c,t[4]=a,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f;t[8]===d?f=t[9]:(f=(0,Z.jsxs)(`header`,{className:`flex items-center gap-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[u,d]}),t[8]=d,t[9]=f);let p;t[10]===c?p=t[11]:(p=c({id:`irFGwu`}),t[10]=c,t[11]=p);let m;t[12]!==a||t[13]!==r||t[14]!==o||t[15]!==n?(m=r?(0,Z.jsx)(`p`,{className:`p-4 text-1sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Hl89Qd`})}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`p-4 text-1sm text-destructive`,children:(0,Z.jsx)(s,{id:`54Y6Fg`})}):n.map(e=>(0,Z.jsx)(VS,{template:e,targetLabel:e.source_folder===``?`/`:`${e.source_folder}/`,onClick:()=>o(e.source_folder,e.name)},`${e.source_folder}/${e.name}`)),t[12]=a,t[13]=r,t[14]=o,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==r||t[18]!==p||t[19]!==m?(h=(0,Z.jsx)(`div`,{className:`w-full overflow-hidden rounded-xl border border-border/60 bg-card`,children:(0,Z.jsx)(`section`,{"aria-busy":r,"aria-label":p,tabIndex:0,className:`subtle-scrollbar scroll-fade-mask flex max-h-[260px] w-full flex-col overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:m})}),t[17]=r,t[18]=p,t[19]=m,t[20]=h):h=t[20];let g;return t[21]!==l||t[22]!==f||t[23]!==h?(g=(0,Z.jsxs)(`section`,{"aria-label":l,className:`flex w-full flex-col gap-3`,children:[f,h]}),t[21]=l,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function VS(e){let t=(0,$.c)(24),{template:n,targetLabel:r,onClick:a}=e,{_:o}=i(),s;t[0]!==n.name||t[1]!==n.title?(s=n.title?.trim()||n.name,t[0]=n.name,t[1]=n.title,t[2]=s):s=t[2];let c=s,l=`${n.name}.md`,u=n.source_folder===``,d;t[3]!==o||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==r?(d=o(u?{id:`89TtiD`,values:{displayTitle:c,fileName:l}}:{id:`0_J12R`,values:{displayTitle:c,fileName:l,targetLabel:r}}),t[3]=o,t[4]=c,t[5]=l,t[6]=u,t[7]=r,t[8]=d):d=t[8];let f=d,p;t[9]===c?p=t[10]:(p=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium leading-tight text-foreground/80`,children:c}),t[9]=c,t[10]=p);let m;t[11]===l?m=t[12]:(m=(0,Z.jsx)(`span`,{className:`truncate font-mono text-1sm font-normal text-muted-foreground`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g=`shrink-0 font-mono text-1sm ${u?`text-muted-foreground/70`:`text-muted-foreground`}`,_;t[16]!==g||t[17]!==r?(_=(0,Z.jsx)(`span`,{className:g,children:r}),t[16]=g,t[17]=r,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==a||t[21]!==h||t[22]!==_?(v=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,onClick:a,"aria-label":f,className:`group flex h-auto w-full items-center justify-between gap-4 rounded-none p-4 text-left transition-colors hover:bg-muted/50 focus-visible:bg-muted/50`,children:[h,_]}),t[19]=f,t[20]=a,t[21]=h,t[22]=_,t[23]=v):v=t[23],v}function HS(e){let t=(0,$.c)(15),{terminalVisible:n}=e,r=n===void 0?!1:n,[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(void 0),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(0),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(void 0),m,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(KS);if(e)return;let r=t.ok?Ar.safeParse(n):null;r?.success?(l(qS(r.data.documents)),f.current=!0):f.current||=(l(1),!0)}catch{!e&&!f.current&&(l(1),f.current=!0)}};t();let n=$o(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(GS),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(WS);if(!e.ok)return;let n=Ar.safeParse(t);n.success&&l(qS(n.data.documents))}).catch(US)},t[2]=g):g=t[2];let _=g,v=c!==null,y=c===0,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){a(e),e||s(void 0)},t[3]=b):b=t[3];let x=b;if(r){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-end px-6 pb-8 pt-10`,children:(0,Z.jsx)(OS,{size:64,gaze:`down`})}),t[4]=e):e=t[4],e}let S;t[5]!==u||t[6]!==y||t[7]!==v?(S=v?y?(0,Z.jsx)(JS,{celebrateSignal:u,onPackSelect:e=>{s(e),a(!0)}}):(0,Z.jsx)(LS,{celebrateSignal:u,onAddStarterPack:()=>{a(!0)}}):null,t[5]=u,t[6]=y,t[7]=v,t[8]=S):S=t[8];let C;t[9]!==o||t[10]!==i?(C=(0,Z.jsx)(lg,{open:i,onOpenChange:x,onSeedApplied:_,initialPackId:o}),t[9]=o,t[10]=i,t[11]=C):C=t[11];let w;return t[12]!==S||t[13]!==C?(w=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 sm:px-12 md:px-16 subtle-scrollbar`,children:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14],w}function US(){}function WS(){return null}function GS(e){return e+1}function KS(){return null}function qS(e){return Xo(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function JS(e){let t=(0,$.c)(25),{celebrateSignal:n,onPackSelect:r}=e,{_:a}=i(),o=mg(),s;t[0]===a?s=t[1]:(s=a({id:`6h4zVU`}),t[0]=a,t[1]=s);let c;t[2]!==a||t[3]!==o?(c=a(o?{id:`vGeNNQ`}:{id:`qpQwGC`}),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l;t[5]!==n||t[6]!==s||t[7]!==c?(l=(0,Z.jsx)(NS,{title:s,subtitle:c,celebrateSignal:n}),t[5]=n,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===o?u=t[10]:(u=o?(0,Z.jsx)(Vx,{scenario:`new-project`}):(0,Z.jsx)(nS,{scenario:`new-project`}),t[9]=o,t[10]=u);let d;t[11]!==a||t[12]!==o?(d=a(o?{id:`GubkSu`}:{id:`xeXS4P`}),t[11]=a,t[12]=o,t[13]=d):d=t[13];let f;t[14]===d?f=t[15]:(f=(0,Z.jsx)(XS,{label:d}),t[14]=d,t[15]=f);let p;t[16]===r?p=t[17]:(p=(0,Z.jsx)(ng,{onPackSelect:r,onCreateBlankFile:YS}),t[16]=r,t[17]=p);let m;t[18]!==f||t[19]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==l||t[22]!==u||t[23]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[l,u,m]}),t[21]=l,t[22]=u,t[23]=m,t[24]=h):h=t[24],h}function YS(){return FS()}function XS(e){let t=(0,$.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,Z.jsx)(`span`,{className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground whitespace-nowrap`,children:n})}),t[0]=n,t[1]=r),r}function ZS(e){return e===``?`.ok/frontmatter.yml`:`${e}/.ok/frontmatter.yml`}function QS(e){let t=(0,$.c)(70),{folderPath:n,state:r,onChange:a}=e,{_:o}=i(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(eC,{}),(0,Z.jsx)(za,{className:`h-7 w-full`}),(0,Z.jsx)(za,{className:`h-7 w-full`}),(0,Z.jsx)(za,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`lzmtKp`,values:{message:e}})}),t[1]=e,t[2]=n),n}let m;t[3]===r.data.frontmatterLocal?m=t[4]:(m=r.data.frontmatterLocal??{},t[3]=r.data.frontmatterLocal,t[4]=m);let h=m,g;t[5]===r.data.folder.path?g=t[6]:(g=ZS(r.data.folder.path),t[5]=r.data.folder.path,t[6]=g);let _=g,v;t[7]===h?v=t[8]:(v=Object.keys(h),t[7]=h,t[8]=v);let y=v,b;t[9]!==o||t[10]!==n||t[11]!==a?(b=async function(e,t){let r=await Qi(n,{[e]:t});if(!r.ok){let{error:e}=r;hs.error(o({id:`xXo8FT`,values:{error:e}}));return}a()},t[9]=o,t[10]=n,t[11]=a,t[12]=b):b=t[12];let x=b,S;t[13]!==o||t[14]!==n||t[15]!==a?(S=async function(e){let t=await Qi(n,{[e]:null});if(!t.ok){let{error:e}=t;hs.error(o({id:`ZU8VV_`,values:{error:e}}));return}a()},t[13]=o,t[14]=n,t[15]=a,t[16]=S):S=t[16];let C=S,w;t[17]!==x||t[18]!==h?(w=function(e,t){let n=h[e];x(e,oa(n,t))},t[17]=x,t[18]=h,t[19]=w):w=t[19];let T=w,E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(){d({name:``,type:`text`,value:``,error:null}),l(!1)},t[20]=E):E=t[20];let D=E,O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){d(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[21]=O):O=t[21];let k=O,A;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){d(t=>t&&{...t,value:e})},t[22]=A):A=t[22];let j=A,M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){d(t=>t&&{...t,name:e,error:null})},t[23]=M):M=t[23];let N=M,P;t[24]!==o||t[25]!==u||t[26]!==n||t[27]!==a||t[28]!==h?(P=async function(){if(!u)return;let e=u.name.trim();if(!e){d({...u,error:o({id:`8_brI5`})});return}if(Jn(u.value)){d({...u,error:o({id:`hXUWyd`})});return}if(Object.hasOwn(h,e)){d({...u,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=await Qi(n,{[e]:u.value});if(!t.ok){d({...u,error:t.error});return}d(null),a()},t[24]=o,t[25]=u,t[26]=n,t[27]=a,t[28]=h,t[29]=P):P=t[29];let F=P,I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){p({key:e,draft:e,error:null})},t[30]=I):I=t[30];let L=I,R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){p(t=>t&&{...t,draft:e,error:null})},t[31]=R):R=t[31];let z=R,B;t[32]!==o||t[33]!==n||t[34]!==a||t[35]!==h||t[36]!==f?(B=async function(){if(!f)return;let e=f.draft.trim();if(!e){p({...f,error:o({id:`8_brI5`})});return}if(e===f.key){p(null);return}if(Object.hasOwn(h,e)){p({...f,error:o({id:`CTJLpz`,values:{trimmed:e}})});return}let t=h[f.key],r=await Qi(n,{[f.key]:null,[e]:t});if(!r.ok){p({...f,error:r.error});return}p(null),a()},t[32]=o,t[33]=n,t[34]=a,t[35]=h,t[36]=f,t[37]=B):B=t[37];let H=B,U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=function(){p(null)},t[38]=U):U=t[38];let W=U,G=!c,K;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>l(!e),t[39]=K):K=t[39];let q=`size-3 transition-transform ${c?``:`rotate-90`}`,J;t[40]===q?J=t[41]:(J=(0,Z.jsx)(No,{className:q,"aria-hidden":!0}),t[40]=q,t[41]=J);let ee;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`vQIVHc`})}),t[42]=ee):ee=t[42];let Y;t[43]===J?Y=t[44]:(Y=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[J,ee]}),t[43]=J,t[44]=Y);let te;t[45]===_?te=t[46]:(te=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:$S,children:_}),t[45]=_,t[46]=te);let ne;t[47]!==Y||t[48]!==te?(ne=(0,Z.jsxs)(Po,{className:`flex w-full cursor-pointer items-center justify-between gap-2 px-3 py-2.5 data-[state=open]:border-b border-border`,children:[Y,te]}),t[47]=Y,t[48]=te,t[49]=ne):ne=t[49];let X;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(`p`,{className:`px-1 pb-2 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`hSBIG-`})}),t[50]=X):X=t[50];let re;t[51]!==u||t[52]!==x||t[53]!==H||t[54]!==y||t[55]!==h||t[56]!==C||t[57]!==f||t[58]!==T?(re=y.length===0&&!u?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`4c_a6S`})}):y.map(e=>{let t=h[e];return(0,Z.jsx)(Ii,{keyName:e,value:t,declared:go(t,An(t)),rename:{state:f?.key===e?f:null,onBegin:()=>L(e),onChangeDraft:z,onCommit:H,onCancel:W},badge:null,onCommit:t=>void x(e,t),onChangeType:t=>T(e,t),onRemove:()=>void C(e)},e)}),t[51]=u,t[52]=x,t[53]=H,t[54]=y,t[55]=h,t[56]=C,t[57]=f,t[58]=T,t[59]=re):re=t[59];let ie;t[60]!==u||t[61]!==F?(ie=u?(0,Z.jsx)(na,{draft:u,onChangeName:N,onChangeType:k,onChangeValue:j,onCommit:()=>void F(),onCancel:()=>d(null)}):(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:()=>D(),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`G8t9NN`})})]})}),t[60]=u,t[61]=F,t[62]=ie):ie=t[62];let ae;t[63]!==re||t[64]!==ie?(ae=(0,Z.jsx)(Mo,{children:(0,Z.jsxs)(`div`,{className:`px-2 py-2`,children:[X,re,ie]})}),t[63]=re,t[64]=ie,t[65]=ae):ae=t[65];let oe;return t[66]!==G||t[67]!==ne||t[68]!==ae?(oe=(0,Z.jsx)(`section`,{className:`rounded-lg border bg-card`,children:(0,Z.jsxs)(Fo,{open:G,onOpenChange:K,children:[ne,ae]})}),t[66]=G,t[67]=ne,t[68]=ae,t[69]=oe):oe=t[69],oe}function $S(e){return e.stopPropagation()}function eC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Sl,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`vQIVHc`})})]}),e[1]=n):n=e[1],n}function tC(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?ms._({id:`xOTzt5`}):t<3600?ms._({id:`zbymaY`,values:{0:Math.floor(t/60)}}):t<86400?ms._({id:`optX0N`,values:{0:Math.floor(t/3600)}}):t<86400*7?ms._({id:`l1l8sj`,values:{0:Math.floor(t/86400)}}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function nC(e){return(e.split(`/`).pop()??e).replace(/\.md$/,``)}function rC(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:Ta,label:ms._({id:`QR5SP1`}),detail:nC(i)};case`template-edit`:return{Icon:oe,label:ms._({id:`-LHLx7`}),detail:nC(i)};case`template-delete`:return{Icon:K,label:ms._({id:`_gkGSK`}),detail:nC(i)};case`template-rename`:case`template-move`:{let[e,t]=i.split(` -> `);return{Icon:$c,label:ms._({id:`KPW5WC`}),detail:`${nC(e??``)} → ${nC(t??i)}`}}case`folder-frontmatter-edit`:return{Icon:Sl,label:ms._({id:`_tekeB`}),detail:``};case`folder-frontmatter-delete`:return{Icon:Sl,label:ms._({id:`ZWxfrc`}),detail:``};case`folder-create`:return{Icon:Sl,label:ms._({id:`ZQLDTl`}),detail:``};default:return{Icon:Ol,label:r.replace(/-/g,` `),detail:nC(i)}}}function iC(e){return e.contributors.length>0?e.contributors[0].name:e.author===`openknowledge-service`||e.author===`server`?ms._({id:`B2DrPb`}):e.author||ms._({id:`Ef7StM`})}function aC(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,c]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(!1),d,f;if(t[1]===n?(d=t[2],f=t[3]):(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/history?folder=${encodeURIComponent(n)}&limit=50`);if(e)return;if(!t.ok){u(!0),c(!1);return}let r=await t.json();if(e)return;a(r.entries??[]),u(!1),c(!1)}catch(t){e||(console.warn(`[FolderTimelineCard] failed to load folder timeline:`,t),u(!0),c(!1))}};c(!0),t();let r=ds(t);return()=>{e=!0,r()}},f=[n],t[1]=n,t[2]=d,t[3]=f),(0,Q.useEffect)(d,f),l||!o&&i.length===0)return null;let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XJOV1Y`})}),t[4]=p):p=t[4];let m;t[5]===i.length?m=t[6]:(m=i.length>0?(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:i.length}):null,t[5]=i.length,t[6]=m);let h;t[7]===m?h=t[8]:(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border px-3 py-1`,children:[p,m]}),t[7]=m,t[8]=h);let g;t[9]!==i||t[10]!==o?(g=(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)(za,{className:`h-8 w-full`}),(0,Z.jsx)(za,{className:`h-8 w-full`})]}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:i.map(oC)})}),t[9]=i,t[10]=o,t[11]=g):g=t[11];let _;return t[12]!==h||t[13]!==g?(_=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,"data-testid":`folder-timeline-card`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14],_}function oC(e){let{Icon:t,label:n,detail:r}=rC(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)(hu,{className:`size-3`,"aria-hidden":!0}),iC(e)]}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/80`,dateTime:e.timestamp,title:new Date(e.timestamp).toLocaleString(),children:tC(e.timestamp)})]},e.sha)}function sC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function cC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=sC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function lC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function uC(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:cC(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:lC(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:cC(e,t.pageTitles),children:a}}function dC(e){let t=(0,$.c)(44),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})})}),(0,Z.jsx)(za,{className:`h-12 w-full`}),(0,Z.jsx)(za,{className:`h-12 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(s,{id:`iDZtvM`,values:{message:e}})}),t[1]=e,t[2]=n),n}let h;t[3]===r.data.folder.templates_available?h=t[4]:(h=r.data.folder.templates_available??[],t[3]=r.data.folder.templates_available,t[4]=h);let g=h,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(s,{id:`-QCLWk`})}),t[5]=_):_=t[5];let v;t[6]===g.length?v=t[7]:(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,(0,Z.jsx)(st,{className:`text-xs`,variant:`secondary`,children:g.length})]}),t[6]=g.length,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(ci,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>m(!0),children:[(0,Z.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(s,{id:`G1Gw0v`})]}),t[8]=y):y=t[8];let b;t[9]===v?b=t[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[v,y]}),t[9]=v,t[10]=b);let x;t[11]===g?x=t[12]:(x=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:g.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`MZSBsh`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:g.map(e=>(0,Z.jsx)(ea,{template:e,onCreate:()=>f(e.name),onEdit:()=>c(e),onDelete:()=>u(e),badge:e.scope===`inherited`?(0,Z.jsx)(Hi,{source:e.source_folder,target:`templates/${e.name}.md`}):void 0},e.path))})}),t[11]=g,t[12]=x);let S;t[13]!==b||t[14]!==x?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[b,x]}),t[13]=b,t[14]=x,t[15]=S):S=t[15];let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e||c(null)},t[16]=C):C=t[16];let w;t[17]!==o||t[18]!==n||t[19]!==i?(w=(0,Z.jsx)(Ba,{folderPath:n,template:o,onOpenChange:C,onSaved:i}),t[17]=o,t[18]=n,t[19]=i,t[20]=w):w=t[20];let T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||u(null)},t[21]=T):T=t[21];let E;t[22]!==l||t[23]!==i?(E=(0,Z.jsx)(Ei,{template:l,onOpenChange:T,onDeleted:i}),t[22]=l,t[23]=i,t[24]=E):E=t[24];let D;t[25]===g?D=t[26]:(D=new Set(g.map(fC)),t[25]=g,t[26]=D);let O;t[27]!==n||t[28]!==p||t[29]!==i||t[30]!==D?(O=(0,Z.jsx)(Xi,{folderPath:n,existingNames:D,open:p,onOpenChange:m,onCreated:i}),t[27]=n,t[28]=p,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k=d!==null,A;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e||f(null)},t[32]=A):A=t[32];let j=d??void 0,M;t[33]!==a||t[34]!==n||t[35]!==k||t[36]!==j?(M=(0,Z.jsx)(zh,{open:k,onOpenChange:A,kind:`file`,initialDir:n,initialTemplate:j,folderConfig:a}),t[33]=a,t[34]=n,t[35]=k,t[36]=j,t[37]=M):M=t[37];let N;return t[38]!==E||t[39]!==O||t[40]!==M||t[41]!==S||t[42]!==w?(N=(0,Z.jsxs)(Z.Fragment,{children:[S,w,E,O,M]}),t[38]=E,t[39]=O,t[40]=M,t[41]=S,t[42]=w,t[43]=N):N=t[43],N}function fC(e){return e.name}function pC(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=oi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=oi(`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 mC(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=oi(`[&_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 hC(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=oi(`[&_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 gC(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=oi(`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 _C(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=oi(`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 vC(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=oi(`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 yC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return ms._({id:`xOTzt5`});if(r<60)return ms._({id:`NRSLBe`,values:{diffMin:r}});let i=Math.floor(r/60);if(i<24)return ms._({id:`hDKtoF`,values:{diffHrs:i}});let a=Math.floor(i/24);return a<30?ms._({id:`QDZbvN`,values:{diffDays:a}}):t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function bC(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 xC(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)(ft,{className:`ml-1 size-3`}):(0,Z.jsx)(Qe,{className:`ml-1 size-3`}):(0,Z.jsx)(el,{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)(ci,{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 SC(e){let t=(0,$.c)(96),{folderPath:n}=e,{_:r}=i(),{folderPaths:a,loading:o,pages:c,pageTitles:l,pageMeta:u}=rs(),d=Di(n),{state:f,refresh:p}=d,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(`name`),[v,y]=(0,Q.useState)(`asc`);if(o){let e;t[0]===r?e=t[1]:(e=r({id:`X9VpsP`}),t[0]=r,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(za,{className:`size-5 rounded`}),(0,Z.jsx)(za,{className:`h-7 w-48`})]}),(0,Z.jsx)(za,{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)(za,{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)(za,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(TC)]})]}),t[4]=a):a=t[4];let o;return t[5]===e?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,role:`status`,"aria-busy":`true`,"aria-label":e,children:a}),t[5]=e,t[6]=o),o}let b,x,S,C,w,T,E,D,O,k,A;if(t[7]!==r||t[8]!==f||t[9]!==d||t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==l||t[14]!==c||t[15]!==p||t[16]!==v||t[17]!==g){let e=uC(n,{pages:c,pageTitles:l,pageMeta:u,folderPaths:a}),i=bC(e.children,g,v),o=e.title||(n===``?r({id:`3aeN7X`}):e.title),m;t[29]===g?m=t[30]:(m=function(e){e===g?y(wC):(_(e),y(`asc`))},t[29]=g,t[30]=m);let j=m;A=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,T=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(re,{className:`size-5 text-muted-foreground`}),t[31]=M):M=t[31];let N=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[M,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:o})]}),P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsxs)(ci,{onClick:()=>h(!0),children:[(0,Z.jsx)(V,{className:`size-4`}),(0,Z.jsx)(s,{id:`isRobC`})]}),t[32]=P):P=t[32],t[33]===N?E=t[34]:(E=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[N,P]})}),t[33]=N,t[34]=E),t[35]!==f||t[36]!==n||t[37]!==p?(D=(0,Z.jsx)(QS,{folderPath:n,state:f,onChange:p}),t[35]=f,t[36]=n,t[37]=p,t[38]=D):D=t[38],t[39]!==f||t[40]!==d||t[41]!==n||t[42]!==p?(O=(0,Z.jsx)(dC,{folderPath:n,state:f,onChange:p,folderConfigHandle:d}),t[39]=f,t[40]=d,t[41]=n,t[42]=p,t[43]=O):O=t[43],t[44]===n?k=t[45]:(k=(0,Z.jsx)(aC,{folderPath:n}),t[44]=n,t[45]=k),w=`rounded-lg border`,x=pC;let F=g===`name`?v===`asc`?`ascending`:`descending`:`none`,I;t[46]===r?I=t[47]:(I=r({id:`6YtxFj`}),t[46]=r,t[47]=I);let L;t[48]!==j||t[49]!==v||t[50]!==g||t[51]!==I?(L=(0,Z.jsx)(xC,{label:I,sortKey:`name`,activeKey:g,activeDir:v,onSort:j}),t[48]=j,t[49]=v,t[50]=g,t[51]=I,t[52]=L):L=t[52];let R;t[53]!==F||t[54]!==L?(R=(0,Z.jsx)(_C,{"aria-sort":F,children:L}),t[53]=F,t[54]=L,t[55]=R):R=t[55];let z=g===`modified`?v===`asc`?`ascending`:`descending`:`none`,B;t[56]===r?B=t[57]:(B=r({id:`tgWuMB`}),t[56]=r,t[57]=B);let H;t[58]!==j||t[59]!==v||t[60]!==g||t[61]!==B?(H=(0,Z.jsx)(xC,{label:B,sortKey:`modified`,activeKey:g,activeDir:v,onSort:j}),t[58]=j,t[59]=v,t[60]=g,t[61]=B,t[62]=H):H=t[62];let U;t[63]!==z||t[64]!==H?(U=(0,Z.jsx)(_C,{className:`w-32`,"aria-sort":z,children:H}),t[63]=z,t[64]=H,t[65]=U):U=t[65],t[66]!==R||t[67]!==U?(C=(0,Z.jsx)(mC,{children:(0,Z.jsxs)(gC,{children:[R,U]})}),t[66]=R,t[67]=U,t[68]=C):C=t[68],b=hC,S=i.length?i.map(CC):(0,Z.jsx)(gC,{children:(0,Z.jsx)(vC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Pkw7J9`})})}),t[7]=r,t[8]=f,t[9]=d,t[10]=n,t[11]=a,t[12]=u,t[13]=l,t[14]=c,t[15]=p,t[16]=v,t[17]=g,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O,t[27]=k,t[28]=A}else b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25],O=t[26],k=t[27],A=t[28];let j;t[69]!==b||t[70]!==S?(j=(0,Z.jsx)(b,{children:S}),t[69]=b,t[70]=S,t[71]=j):j=t[71];let M;t[72]!==x||t[73]!==j||t[74]!==C?(M=(0,Z.jsxs)(x,{children:[C,j]}),t[72]=x,t[73]=j,t[74]=C,t[75]=M):M=t[75];let N;t[76]!==M||t[77]!==w?(N=(0,Z.jsx)(`div`,{className:w,children:M}),t[76]=M,t[77]=w,t[78]=N):N=t[78];let P;t[79]!==N||t[80]!==T||t[81]!==E||t[82]!==D||t[83]!==O||t[84]!==k?(P=(0,Z.jsxs)(`div`,{className:T,children:[E,D,O,k,N]}),t[79]=N,t[80]=T,t[81]=E,t[82]=D,t[83]=O,t[84]=k,t[85]=P):P=t[85];let F;t[86]!==P||t[87]!==A?(F=(0,Z.jsx)(`div`,{className:A,children:P}),t[86]=P,t[87]=A,t[88]=F):F=t[88];let I;t[89]!==m||t[90]!==d||t[91]!==n?(I=(0,Z.jsx)(zh,{open:m,onOpenChange:h,kind:`file`,initialDir:n,folderConfig:d,suggestedName:`index`}),t[89]=m,t[90]=d,t[91]=n,t[92]=I):I=t[92];let L;return t[93]!==F||t[94]!==I?(L=(0,Z.jsxs)(Z.Fragment,{children:[F,I]}),t[93]=F,t[94]=I,t[95]=L):L=t[95],L}function CC(e){return(0,Z.jsxs)(gC,{children:[(0,Z.jsx)(vC,{children:(0,Z.jsxs)(`a`,{href:Vo(e.path),className:`flex items-center gap-2 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[e.kind===`folder`?(0,Z.jsx)(wl,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(u,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(vC,{className:`text-muted-foreground`,children:e.kind===`file`?yC(e.modified):`—`})]},e.path)}function wC(e){return e===`asc`?`desc`:`asc`}function TC(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)(za,{className:`size-4 rounded`}),(0,Z.jsx)(za,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(za,{className:`h-4 w-16`})})]},e)}function EC(e){let t=(0,$.c)(24),{docName:n,size:r,limit:i,backNav:a}=e,o=a!==void 0,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u,d;t[0]===o?(u=t[1],d=t[2]):(u=()=>{o?c.current?.focus():l.current?.focus()},d=[o],t[0]=o,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-full border bg-muted/40 text-muted-foreground`,children:(0,Z.jsx)(vl,{className:`size-9`,"aria-hidden":`true`})}),t[3]=f):f=t[3];let p=o?void 0:-1,m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(s,{id:`P3hnm0`}),t[4]=m):m=t[4];let h;t[5]===p?h=t[6]:(h=(0,Z.jsx)(`h2`,{ref:l,id:`large-file-title`,tabIndex:p,className:`text-2xl font-light text-balance outline-none`,children:m}),t[5]=p,t[6]=h);let g;t[7]===r?g=t[8]:(g=Xr(r),t[7]=r,t[8]=g);let _;t[9]===i?_=t[10]:(_=Xr(i),t[9]=i,t[10]=_);let v;t[11]!==n||t[12]!==g||t[13]!==_?(v=(0,Z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_GBioJ`,values:{0:g,1:_,docName:n}})}),t[11]=n,t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,v]}),t[15]=h,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==a||t[19]!==o?(b=o?(0,Z.jsxs)(ci,{ref:c,variant:`default`,onClick:()=>a.onNavigateBack(a.previousDocName),children:[(0,Z.jsx)(gi,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CKyk7Q`})]}):null,t[18]=a,t[19]=o,t[20]=b):b=t[20];let x;return t[21]!==y||t[22]!==b?(x=(0,Z.jsxs)(`div`,{role:`status`,"aria-labelledby":`large-file-title`,"data-slot":`large-file-editor-state`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[f,y,b]}),t[21]=y,t[22]=b,t[23]=x):x=t[23],x}function DC(e){let t=(0,$.c)(8),{docName:n}=e,[r,i]=(0,Q.useState)(OC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ct(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let c;t[2]===n?c=t[3]:(c=function(){C(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`A67Uwj`})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(s,{id:`dEgA5A`}),t[5]=d):d=t[5];let f;return t[6]===l?f=t[7]:(f=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[u,(0,Z.jsx)(ci,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:l,children:d})]}),t[6]=l,t[7]=f),f}function OC(){return new Set}var kC=(0,Q.createContext)(null);function AC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(jC),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{i(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>{i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},t[1]=s):s=t[1];let c=s,l;t[2]===r?l=t[3]:(l={addPropertySignal:r,requestAddProperty:o,clearAddProperty:c},t[2]=r,t[3]=l);let u=l,d;return t[4]!==n||t[5]!==u?(d=(0,Z.jsx)(kC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function jC(){return new Map}function MC(){let e=(0,Q.use)(kC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function NC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var PC=NC(()=>n(()=>import(`./SettingsDialogBody-COy0tfdt.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([52,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,53,7,13,15,25,54]),import.meta.url));function FC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(s,{id:`hwFOFD`})}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[c,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:o})]}),t[4]=o,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(ci,{variant:`default`,onClick:IC,children:(0,Z.jsx)(s,{id:`HpK_8d`})}),t[6]=u):u=t[6];let d;return t[7]===l?d=t[8]:(d=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[l,u]}),t[7]=l,t[8]=d),d}function IC(){return window.location.reload()}function LC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(ce,{fallbackRender:zC,onError:RC,children:n}),t[0]=n,t[1]=r),r}function RC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function zC(e){return(0,Z.jsx)(FC,{...e})}function BC(e){return`https://github.com/inkeep/open-knowledge/releases/tag/v${encodeURIComponent(e)}`}function VC(e){let t=(0,$.c)(89),{open:n,onOpenChange:r}=e,{_:a}=i(),{collabUrl:o}=mt(),{userBinding:c,userSynced:l,okignoreBinding:u,okignoreSynced:d}=ae(),{desktopPresent:f}=Mi(),[p,m]=(0,Q.useState)(`preferences`),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&m(`preferences`)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _=o!==null,v=typeof window<`u`&&window.okDesktop!=null,y;t[3]===a?y=t[4]:(y=a({id:`7PzzBU`}),t[3]=a,t[4]=y);let b;t[5]===a?b=t[6]:(b=a({id:`Q6hhn8`}),t[5]=a,t[6]=b);let x;t[7]===b?x=t[8]:(x={id:`preferences`,label:b},t[7]=b,t[8]=x);let S;t[9]===a?S=t[10]:(S=a({id:`4KmEoC`}),t[9]=a,t[10]=S);let C;t[11]===S?C=t[12]:(C={id:`hotkeys`,label:S},t[11]=S,t[12]=C);let w;t[13]===a?w=t[14]:(w=a({id:`AeXO77`}),t[13]=a,t[14]=w);let T;t[15]===w?T=t[16]:(T={id:`account`,label:w},t[15]=w,t[16]=T);let E;t[17]!==x||t[18]!==C||t[19]!==T?(E=[x,C,T],t[17]=x,t[18]=C,t[19]=T,t[20]=E):E=t[20];let D;t[21]!==E||t[22]!==y?(D={id:`user`,label:y,enabled:!0,items:E},t[21]=E,t[22]=y,t[23]=D):D=t[23];let O;t[24]===a?O=t[25]:(O=a({id:`ZWyHmq`}),t[24]=a,t[25]=O);let k;t[26]===a?k=t[27]:(k=a({id:`Nu4DdT`}),t[26]=a,t[27]=k);let A;t[28]===k?A=t[29]:(A={id:`sync`,label:k},t[28]=k,t[29]=A);let j;t[30]===a?j=t[31]:(j=a({id:`A1taO8`}),t[30]=a,t[31]=j);let M;t[32]===j?M=t[33]:(M={id:`search`,label:j},t[32]=j,t[33]=M);let N;t[34]===a?N=t[35]:(N=v?[{id:`terminal`,label:a({id:`ALhMYW`})}]:[],t[34]=a,t[35]=N);let P;t[36]===a?P=t[37]:(P=a({id:`iTylMl`}),t[36]=a,t[37]=P);let F;t[38]===P?F=t[39]:(F={id:`project-templates`,label:P},t[38]=P,t[39]=F);let I;t[40]===a?I=t[41]:(I=a({id:`3zyg_A`}),t[40]=a,t[41]=I);let L;t[42]===I?L=t[43]:(L={id:`okignore`,label:I},t[42]=I,t[43]=L);let R;t[44]===a?R=t[45]:(R=a({id:`cs4mps`}),t[44]=a,t[45]=R);let z;t[46]===R?z=t[47]:(z={id:`sharing`,label:R},t[46]=R,t[47]=z);let B;t[48]!==A||t[49]!==M||t[50]!==N||t[51]!==F||t[52]!==L||t[53]!==z?(B=[A,M,...N,F,L,z],t[48]=A,t[49]=M,t[50]=N,t[51]=F,t[52]=L,t[53]=z,t[54]=B):B=t[54];let V;t[55]!==_||t[56]!==O||t[57]!==B?(V={id:`project`,label:O,enabled:_,items:B},t[55]=_,t[56]=O,t[57]=B,t[58]=V):V=t[58];let H;t[59]===a?H=t[60]:(H=a({id:`nbfdhU`}),t[59]=a,t[60]=H);let U;t[61]!==a||t[62]!==f?(U=[],t[61]=a,t[62]=f,t[63]=U):U=t[63];let W;t[64]!==H||t[65]!==U?(W={id:`integrations`,label:H,enabled:!0,items:U},t[64]=H,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==D||t[68]!==V||t[69]!==W?(G=[D,V,W],t[67]=D,t[68]=V,t[69]=W,t[70]=G):G=t[70];let K=G,q;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(Co,{className:`sr-only`,id:`settings-dialog-title`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})}),t[71]=q):q=t[71];let J;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`RDrXh4`})}),t[72]=J):J=t[72];let ee;t[73]!==p||t[74]!==K?(ee=(0,Z.jsx)(HC,{groups:K,activeId:p,onSelect:m}),t[73]=p,t[74]=K,t[75]=ee):ee=t[75];let Y;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Z.jsx)(GC,{}),t[76]=Y):Y=t[76];let te=l?c:null,ne;t[77]!==p||t[78]!==u||t[79]!==d||t[80]!==te?(ne=(0,Z.jsx)(`section`,{"aria-labelledby":`settings-dialog-title`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,tabIndex:0,children:(0,Z.jsx)(LC,{children:(0,Z.jsx)(Q.Suspense,{fallback:Y,children:(0,Z.jsx)(PC,{activeId:p,userBinding:te,okignoreBinding:u,okignoreSynced:d})})})}),t[77]=p,t[78]=u,t[79]=d,t[80]=te,t[81]=ne):ne=t[81];let X;t[82]!==ee||t[83]!==ne?(X=(0,Z.jsxs)(wo,{className:`flex h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] flex-col gap-0 overflow-hidden p-0 sm:grid sm:grid-cols-[220px_1fr] sm:max-w-[min(900px,calc(100%-2rem))]`,"data-testid":`settings-dialog`,children:[q,J,ee,ne]}),t[82]=ee,t[83]=ne,t[84]=X):X=t[84];let re;return t[85]!==r||t[86]!==n||t[87]!==X?(re=(0,Z.jsx)(Oo,{open:n,onOpenChange:r,children:X}),t[85]=r,t[86]=n,t[87]=X,t[88]=re):re=t[88],re}function HC(e){let t=(0,$.c)(13),{groups:n,activeId:r,onSelect:a}=e,{_:o}=i(),s;t[0]===o?s=t[1]:(s=o({id:`y1t8bQ`}),t[0]=o,t[1]=s);let c;if(t[2]!==r||t[3]!==n||t[4]!==a){let e;t[6]!==r||t[7]!==a?(e=e=>(0,Z.jsx)(WC,{group:e,activeId:r,onSelect:a},e.id),t[6]=r,t[7]=a,t[8]=e):e=t[8],c=n.map(e),t[2]=r,t[3]=n,t[4]=a,t[5]=c}else c=t[5];let l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(UC,{}),t[9]=l):l=t[9];let u;return t[10]!==s||t[11]!==c?(u=(0,Z.jsxs)(`nav`,{"aria-label":s,className:`flex shrink-0 gap-x-3 overflow-x-auto overscroll-contain subtle-scrollbar scroll-fade-mask-x-max-sm border-b bg-muted/30 px-3 py-2 max-sm:pt-10 sm:h-full sm:flex-col sm:gap-0 sm:overflow-x-visible sm:overflow-y-auto sm:border-r sm:border-b-0 sm:py-4`,children:[c,l]}),t[10]=s,t[11]=c,t[12]=u):u=t[12],u}function UC(){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=BC(n),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`p`,{className:`whitespace-nowrap font-mono text-xs text-muted-foreground/70`,"data-testid":`settings-sidebar-version`,children:[`v`,n]}),e[1]=a):a=e[1];let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{t.shell.openExternal(i)},e[2]=o):o=e[2];let c;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(`div`,{className:`ml-auto shrink-0 px-2 sm:ml-0 sm:mt-auto sm:pt-3`,children:[a,(0,Z.jsxs)(`button`,{type:`button`,onClick:o,"data-testid":`settings-sidebar-release-notes`,className:oi(`mt-0.5 inline-flex items-center gap-1 whitespace-nowrap rounded text-xs text-muted-foreground transition-colors hover:text-foreground`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),children:[(0,Z.jsx)(s,{id:`_PACVa`}),(0,Z.jsx)(vo,{className:`size-3`,"aria-hidden":`true`})]})]}),e[3]=c):c=e[3],c}function WC(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,c=n.enabled?void 0:o,l=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,u;t[0]===l?u=t[1]:(u=oi(`shrink-0 whitespace-nowrap px-2 text-xs font-semibold uppercase tracking-wide font-mono sm:mb-1`,l),t[0]=l,t[1]=u);let d;t[2]!==n.label||t[3]!==a||t[4]!==c||t[5]!==u?(d=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":c,className:u,children:n.label}),t[2]=n.label,t[3]=a,t[4]=c,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==n.enabled?(f=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`px-2 text-xs italic text-muted-foreground/60 sm:mb-1`,children:(0,Z.jsx)(s,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=f):f=t[9];let p;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:oi(`w-auto whitespace-nowrap rounded px-2 py-1.5 text-left text-sm transition-colors sm:w-full`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],p=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=p}else p=t[15];let m;t[21]!==a||t[22]!==p?(m=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`flex gap-1 sm:block sm:space-y-0.5`,children:p}),t[21]=a,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==d||t[25]!==f||t[26]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:mb-4 sm:block`,children:[d,f,m]}),t[24]=d,t[25]=f,t[26]=m,t[27]=h):h=t[27],h}function GC(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`GsBUCk`})}),n=(0,Z.jsx)(za,{className:`h-5 w-32`}),r=(0,Z.jsx)(za,{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)(za,{className:`h-9 w-full`}),(0,Z.jsx)(za,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}function KC(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=oi(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bx,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function qC(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)(Cx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function JC(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=oi(`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)(Dx,{"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 YC(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=oi(`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 XC=ii(`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 ZC(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=oi(XC({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:QC,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function QC(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}ii(`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 $C(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=oi(`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 ew(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=oi(`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)(jo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:a,replaceOpen:o,caseSensitive:c,wholeWord:l,current:u,total:d,onQueryChange:f,onReplacementChange:p,onReplaceOpenChange:m,onCaseSensitiveChange:h,onWholeWordChange:g,onNext:_,onPrevious:v,onReplaceCurrent:y,onReplaceAll:b,onClose:x}=e,{_:S}=i(),C=r.length>0,w=d>0,T;t[0]!==S||t[1]!==u||t[2]!==w||t[3]!==C||t[4]!==d?(T=C?w?`${u} / ${d}`:S({id:`Ev2r9A`}):``,t[0]=S,t[1]=u,t[2]=w,t[3]=C,t[4]=d,t[5]=T):T=t[5];let E=T,D;t[6]!==x||t[7]!==_||t[8]!==v?(D=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?v():_()):e.key===`Escape`&&(e.preventDefault(),x())},t[6]=x,t[7]=_,t[8]=v,t[9]=D):D=t[9];let O=D,k;t[10]!==x||t[11]!==y?(k=function(e){e.key===`Enter`?(e.preventDefault(),y()):e.key===`Escape`&&(e.preventDefault(),x())},t[10]=x,t[11]=y,t[12]=k):k=t[12];let A=k,j;t[13]===S?j=t[14]:(j=S({id:`MVxpbf`}),t[13]=S,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(s,{id:`KujtjC`})}),t[15]=M):M=t[15];let N;t[16]===f?N=t[17]:(N=e=>f(e.target.value),t[16]=f,t[17]=N);let P;t[18]===S?P=t[19]:(P=S({id:`KujtjC`}),t[18]=S,t[19]=P);let F;t[20]!==n||t[21]!==O||t[22]!==r||t[23]!==N||t[24]!==P?(F=(0,Z.jsx)(ew,{ref:n,id:`ok-find-input`,value:r,onChange:N,onKeyDown:O,placeholder:P,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=O,t[22]=r,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]===S?I=t[27]:(I=S({id:`-8PP0T`}),t[26]=S,t[27]=I);let L;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(ol,{"aria-hidden":`true`}),t[28]=L):L=t[28];let R;t[29]!==c||t[30]!==h||t[31]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":I,pressed:c,onPressedChange:h,className:`size-6 min-w-6 px-0`,children:L})}),t[29]=c,t[30]=h,t[31]=I,t[32]=R):R=t[32];let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`-8PP0T`})}),t[33]=z):z=t[33];let B;t[34]===R?B=t[35]:(B=(0,Z.jsxs)(Is,{children:[R,z]}),t[34]=R,t[35]=B);let V;t[36]===S?V=t[37]:(V=S({id:`_7UQ7y`}),t[36]=S,t[37]=V);let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(gu,{"aria-hidden":`true`}),t[38]=H):H=t[38];let U;t[39]!==g||t[40]!==V||t[41]!==l?(U=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bo,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":V,pressed:l,onPressedChange:g,className:`size-6 min-w-6 px-0`,children:H})}),t[39]=g,t[40]=V,t[41]=l,t[42]=U):U=t[42];let W;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`_7UQ7y`})}),t[43]=W):W=t[43];let G;t[44]===U?G=t[45]:(G=(0,Z.jsxs)(Is,{children:[U,W]}),t[44]=U,t[45]=G);let K;t[46]!==B||t[47]!==G?(K=(0,Z.jsxs)(ZC,{align:`inline-end`,className:`gap-0.5`,children:[B,G]}),t[46]=B,t[47]=G,t[48]=K):K=t[48];let q;t[49]!==K||t[50]!==F?(q=(0,Z.jsxs)(YC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[F,K]}),t[49]=K,t[50]=F,t[51]=q):q=t[51];let J;t[52]===E?J=t[53]:(J=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:E}),t[52]=E,t[53]=J);let ee;t[54]===S?ee=t[55]:(ee=S({id:`oqB2ez`}),t[54]=S,t[55]=ee);let Y=!w,te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(It,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=te):te=t[56];let ne;t[57]!==v||t[58]!==ee||t[59]!==Y?(ne=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ee,disabled:Y,onClick:v,children:te})}),t[57]=v,t[58]=ee,t[59]=Y,t[60]=ne):ne=t[60];let X;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`oqB2ez`})}),t[61]=X):X=t[61];let re;t[62]===ne?re=t[63]:(re=(0,Z.jsxs)(Is,{children:[ne,X]}),t[62]=ne,t[63]=re);let ie;t[64]===S?ie=t[65]:(ie=S({id:`SiUUCS`}),t[64]=S,t[65]=ie);let ae=!w,oe;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Ve,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=oe):oe=t[66];let se;t[67]!==_||t[68]!==ie||t[69]!==ae?(se=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ie,disabled:ae,onClick:_,children:oe})}),t[67]=_,t[68]=ie,t[69]=ae,t[70]=se):se=t[70];let ce;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`SiUUCS`})}),t[71]=ce):ce=t[71];let le;t[72]===se?le=t[73]:(le=(0,Z.jsxs)(Is,{children:[se,ce]}),t[72]=se,t[73]=le);let ue=o?`secondary`:`ghost`,de;t[74]!==S||t[75]!==o?(de=S(o?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=S,t[75]=o,t[76]=de):de=t[76];let fe=o?`ok-replace-input`:void 0,pe;t[77]!==m||t[78]!==o?(pe=()=>m(!o),t[77]=m,t[78]=o,t[79]=pe):pe=t[79];let me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=me):me=t[80];let he;t[81]!==o||t[82]!==ue||t[83]!==de||t[84]!==fe||t[85]!==pe?(he=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:ue,size:`icon-sm`,"aria-label":de,"aria-expanded":o,"aria-controls":fe,onClick:pe,children:me})}),t[81]=o,t[82]=ue,t[83]=de,t[84]=fe,t[85]=pe,t[86]=he):he=t[86];let ge;t[87]===o?ge=t[88]:(ge=(0,Z.jsx)(Ns,{side:`bottom`,children:o?(0,Z.jsx)(s,{id:`UkQGhd`}):(0,Z.jsx)(s,{id:`1RluQD`})}),t[87]=o,t[88]=ge);let _e;t[89]!==he||t[90]!==ge?(_e=(0,Z.jsxs)(Is,{children:[he,ge]}),t[89]=he,t[90]=ge,t[91]=_e):_e=t[91];let ve;t[92]!==S||t[93]!==A||t[94]!==w||t[95]!==b||t[96]!==y||t[97]!==p||t[98]!==o||t[99]!==a?(ve=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(s,{id:`fqSfXY`})}),(0,Z.jsx)(jo,{id:`ok-replace-input`,value:a,onChange:e=>p(e.target.value),onKeyDown:A,placeholder:S({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`bS_boY`}),disabled:!w,onClick:y,children:(0,Z.jsx)(Yl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`bS_boY`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":S({id:`dr1vFs`}),disabled:!w,onClick:b,children:(0,Z.jsx)(Jl,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`dr1vFs`})})]})]}):null,t[92]=S,t[93]=A,t[94]=w,t[95]=b,t[96]=y,t[97]=p,t[98]=o,t[99]=a,t[100]=ve):ve=t[100];let ye;t[101]===S?ye=t[102]:(ye=S({id:`wJo9oS`}),t[101]=S,t[102]=ye);let be;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(gs,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=be):be=t[103];let xe;t[104]!==x||t[105]!==ye?(xe=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":ye,onClick:x,children:be})}),t[104]=x,t[105]=ye,t[106]=xe):xe=t[106];let Se;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`yz7wBu`})}),t[107]=Se):Se=t[107];let Ce;t[108]===xe?Ce=t[109]:(Ce=(0,Z.jsxs)(Is,{children:[xe,Se]}),t[108]=xe,t[109]=Ce);let we;return t[110]!==q||t[111]!==J||t[112]!==re||t[113]!==le||t[114]!==j||t[115]!==_e||t[116]!==ve||t[117]!==Ce?(we=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":j,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[M,q,J,re,le,_e,ve,Ce]}),t[110]=q,t[111]=J,t[112]=re,t[113]=le,t[114]=j,t[115]=_e,t[116]=ve,t[117]=Ce,t[118]=we):we=t[118],we}var nw={current:0,total:0},rw=120,iw=100;function aw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?q(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(E,n,ow)}function ow(){return null}function sw(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,`
25
25
  `,`
26
26
  `).trim();return i.length===0||i.length>rw||i.includes(`
27
- `)?null:i}function cw(e){let t=ze(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function lw(e,t){return e.current===t.current&&e.total===t.total}function uw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(nw)}function dw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=w(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 fw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=aw(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)(nw),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(mw))},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(pw)},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(nw);return}if(!u.open||r){i.commands.clearFindMatches(),p(nw);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=cw(i);p(t=>lw(t,e)?t:e)},iw);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=ze(i.state),t=cw(i);p(e=>lw(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=sw(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(nc(t,`find`)){t.preventDefault(),u.open?uw(i,d,p):e(!1);return}if(nc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=nc(t,`find-next`),n=nc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&dw(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),uw(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=ze(i.state),t=cw(i);p(e=>lw(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(){uw(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()&&dw(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()&&dw(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)&&dw(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)&&dw(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(ee=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(tw,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=ee):ee=t[80],ee}function pw(e){return{...e,open:!1,activeIndex:0}}function mw(e){return{...e,activeIndex:0}}var hw=300;function gw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Ac(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,hw)};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 _w(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function vw(e){let t=(0,$.c)(8),{poolEntries:n}=mt(),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=()=>_w(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(_w(i));let t=()=>s(_w(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 yw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Mc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Nc,r)}var bw=`ok-doc-panel-width-v1`;function xw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function Sw(e){try{let t=(e??localStorage).getItem(bw);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?xw(n):320}catch{return 320}}function Cw(e,t){try{(t??localStorage).setItem(bw,String(xw(e)))}catch{}}function ww(){try{return typeof localStorage>`u`?320:Sw()}catch{return 320}}var Tw=1024,Ew=1280,Dw={left:Tw,right:Ew};function Ow(e,t,n){return e==null?t>=Dw[n]?`above`:`below`:`embedded`}function kw(e){return e===`above`?`open`:`collapsed`}var Aw=`ok-sidebar-pins-v2`;function jw(e){return e===`open`||e===`collapsed`}function Mw(e){return e===`above`||e===`below`||e===`embedded`}function Nw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!Mw(e)||!jw(t[e]))return!1;return!0}function Pw(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Nw(n.left)&&(r.left=n.left),Nw(n.right)&&(r.right=n.right),r}function Fw(e){try{let t=(e??localStorage).getItem(Aw);return t==null?{}:Pw(t)}catch{return{}}}function Iw(e,t){try{t.setItem(Aw,JSON.stringify(e))}catch{}}function Lw(e,t,n){return n[e]?.[t]??kw(t)}function Rw(e,t,n,r){let i=r??localStorage,a=Fw(i);return a[e]={...a[e],[t]:n},Iw(a,i),a}function zw(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`?Bw: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 Bw(e){return e===`synced`?`synced`:`connected`}var Vw=Lr;function Hw(e,t={}){let n=De(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Uw=200,Ww=`Outside any block`;function Gw(e){let t=(0,$.c)(5),{editor:n}=e,r=Gt(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?Kw(n,r):o.current?Ww:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Uw),()=>{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 Kw(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=Hw(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=Hw(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function qw(){let[e]=(0,Q.useState)(Ir);return e}function Jw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:br(e.display_name),color:Wn(e.id,Nn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Wn(e.id,Nn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Yw(e,t){return e>t}function Xw(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 Zw=3,Qw=6e4;function $w(e,t){let n=0;for(let r of e)t-r<Qw&&(n+=1);return n<Zw}var eT=new Map;function tT(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 nT(e){let t=Ot.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function rT(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=Ot.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){le.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=>{Yw(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!Yw(i,a)||l!==null&&nT(l.state))return;o=!0;let e=Date.now();for(let[t,n]of eT)n.every(t=>e-t>=Qw)&&eT.delete(t);let t=(eT.get(n)??[]).filter(t=>e-t<Qw);if(!$w(t,e)){eT.set(n,t),le.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),eT.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,le.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Ot&&tT(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ar({state:{init:()=>null,apply:e=>(Xw(e.getMeta(Ot))&&(a=i,o&&le.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!Yw(i,a)||nT(t)?!0:e.getMeta(Ot)!==void 0,view:e=>{let r=t.doc;return r==null?(le.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 iT(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 aT=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&&Qn(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(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=Hn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof rr){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 Er){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():iT(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ps(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()}},oT=e=>new ar({key:typeof e.pluginKey==`string`?new Bn(e.pluginKey):e.pluginKey,view:t=>new aT({view:t,...e})});ei.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[oT({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 sT=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 Mr(e,{textSerializers:jn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=Hn(this.view,e.from,e.to);Ps({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()}},cT=e=>new ar({key:typeof e.pluginKey==`string`?new Bn(e.pluginKey):e.pluginKey,view:t=>new sT({view:t,...e})});ei.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?[cT({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 lT(e,t){return e??new Bn(t)}var uT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,dT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),fT=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(`.`)),pT=new Set([`children`,`className`,`style`]),mT=new Set([`tabIndex`]),hT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),gT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function _T(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function vT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function yT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||hT.has(e)}function bT(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function xT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:gT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ST(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 CT(e){return mT.has(e)}function wT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function TT(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 ET(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||fT.has(e)?String(t):`${t}px`}function DT(e,t){dT.has(t)||e.style.removeProperty(bT(t))}function OT(e,t,n){dT.has(t)||e.style.setProperty(bT(t),ET(t,n))}function kT(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(pT.has(r)||!yT(r)||_T(r,t[r])||_T(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=vT(r);if(a==null||a===!1){CT(r)&&TT(e,r),e.removeAttribute(o);return}if(a===!0){CT(r)&&wT(e,r,!0),e.setAttribute(o,``);return}if(CT(r)){wT(e,r,a);return}e.setAttribute(o,String(a))})}function AT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function jT(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){DT(e,t);return}OT(e,t,a)}})}function MT(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(!_T(t,n))return;let{eventName:i,options:a}=xT(t),o=t=>{n(ST(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function NT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);uT(()=>{let i=n.current;return AT(e,i.className,t.className),jT(e,i.style,t.style),kT(e,i,t),r.current=MT(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 PT=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)(lT(e,`bubbleMenu`)).current;NT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Kt(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=oT({...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,rl.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)(lT(e,`floatingMenu`)).current;NT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Kt(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=cT({...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,rl.createPortal)(s,u.current)});var FT=[{name:`paragraph`,label:`Text`,icon:Wl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Te,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:F,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Tt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:ge,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:me,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:k,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:M,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tu,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function IT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:LT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Ie(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)(Ve,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsxs)(ci,{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=FT.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ea,{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)(eo,{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)(ao,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function LT(e){let t=Object.fromEntries(FT.map(t=>[t.name,t.isActive(e.editor)]));return{current:FT.find(e=>t[e.name])??FT[0],activeStates:t}}function RT(e){let t=(0,$.c)(17),{installStates:n,onPick:r}=e,{_:a}=i(),[o,c]=(0,Q.useState)(``),l;if(t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==r){let e;t[5]===n?e=t[6]:(e=e=>n[e.id]?.installed===!0,t[5]=n,t[6]=e);let i=_g.filter(e),u=_g.some(e=>n[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a({id:`Rah7yq`}),t[9]=a,t[10]=p);let m;t[11]===a?m=t[12]:(m=a({id:`ZBt4rI`}),t[11]=a,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,Z.jsx)(jo,{value:o,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,i.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,"data-testid":`edit-with-ai-send-label`,children:(0,Z.jsx)(s,{id:`C37Zkt`})}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>r(e,o),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.displayName})]},e.id))})]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=a,t[1]=n,t[2]=o,t[3]=r,t[4]=l}else l=t[4];return l}function zT(e){let t=(0,$.c)(27),{open:n,onOpenChange:r,snapshot:a,children:o}=e,{_:s}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d;t[0]===l?d=t[1]:(d=()=>{l()},t[0]=l,t[1]=d);let f=(0,Q.useEffectEvent)(d),p;t[2]!==n||t[3]!==f?(p=()=>{n&&f()},t[2]=n,t[3]=f,t[4]=p):p=t[4];let m;t[5]===n?m=t[6]:(m=[n],t[5]=n,t[6]=m),(0,Q.useEffect)(p,m);let h;t[7]!==s||t[8]!==u||t[9]!==r||t[10]!==a?(h=(e,t)=>{if(a!==null){let n=o_({docName:a.docName,workspace:a.workspace,instruction:t,selectionMarkdown:a.selectionMarkdown});n===null?hs.error(s({id:`_VRtd7`})):u(e.id,n)}r(!1)},t[7]=s,t[8]=u,t[9]=r,t[10]=a,t[11]=h):h=t[11];let g=h,_;t[12]===o?_=t[13]:(_=(0,Z.jsx)(J,{asChild:!0,children:o}),t[12]=o,t[13]=_);let v;t[14]===s?v=t[15]:(v=s({id:`EVnzPs`}),t[14]=s,t[15]=v);let y;t[16]!==g||t[17]!==c?(y=(0,Z.jsx)(RT,{installStates:c,onPick:g}),t[16]=g,t[17]=c,t[18]=y):y=t[18];let x;t[19]!==v||t[20]!==y?(x=(0,Z.jsx)(b,{align:`start`,"aria-label":v,"data-testid":`edit-with-ai-popover`,children:y}),t[19]=v,t[20]=y,t[21]=x):x=t[21];let S;return t[22]!==r||t[23]!==n||t[24]!==_||t[25]!==x?(S=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[_,x]}),t[22]=r,t[23]=n,t[24]=_,t[25]=x,t[26]=S):S=t[26],S}function BT(e){let t=P(e.state.selection.content(),e.state.schema);return l().serialize(t).trim()}function VT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function HT(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=Yn(),o=mg();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(UT,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function UT(e){let t=(0,$.c)(19),{editor:n,shortcutEnabled:r}=e,{_:a}=i(),o=Oa(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;if(t[0]!==a||t[1]!==n||t[2]!==o){let e=()=>{let e;try{e=BT(n)}catch(e){return console.error(`Edit with AI: could not read the selection`,e),hs.error(a({id:`-RXIMO`})),null}return{docName:bt(n),workspace:o,selectionMarkdown:e}};f=()=>{let t=e();t!==null&&(d(t),l(!0))},t[0]=a,t[1]=n,t[2]=o,t[3]=f}else f=t[3];let p=f,m;t[4]===p?m=t[5]:(m=e=>{if(e){p();return}l(!1),d(null)},t[4]=p,t[5]=m);let h=m,g;t[6]===p?g=t[7]:(g=()=>{p()},t[6]=p,t[7]=g);let _=(0,Q.useEffectEvent)(g),v;t[8]!==_||t[9]!==r?(v=()=>{let e=e=>{r&&nc(e,`edit-with-ai`)&&(VT(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[8]=_,t[9]=r,t[10]=v):v=t[10];let y;t[11]===r?y=t[12]:(y=[r],t[11]=r,t[12]=y),(0,Q.useEffect)(v,y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[14]=x):x=t[14];let S;return t[15]!==h||t[16]!==c||t[17]!==u?(S=(0,Z.jsxs)(Z.Fragment,{children:[b,(0,Z.jsx)(zT,{open:c,onOpenChange:h,snapshot:u,children:x})]}),t[15]=h,t[16]=c,t[17]=u,t[18]=S):S=t[18],S}function WT(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 GT(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:Pt(typeof n.src==`string`?n.src:``)}function KT(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 qT(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:JT},t[0]=n,t[1]=a),Ie(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=WT(n);t&&KT(t,GT(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Ja,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Is,{children:[u,d]})}),t[11]=u,t[12]=f),f}function JT(e){return WT(e.editor)}function YT(e){return WT(e)!==null}function XT(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function ZT(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 QT(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function $T(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:eE},t[0]=n,t[1]=a);let o=Ie(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!XT(n)||n.state.selection.empty||QT(n)||ZT(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=zn(Vn(n.state.doc)),a=Pr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(Is,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function eE(e){let t=e.editor;return!!(!XT(t)||t.state.selection.empty||QT(t)||ZT(t))}var tE=`img, .ok-embed, .ok-video`,nE=220,rE=`cubic-bezier(0.23, 1, 0.32, 1)`,iE=`ok-image-align-flip`,aE=.5;function oE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function sE(){return typeof requestAnimationFrame==`function`}function cE(e){return e?e.querySelector(tE):null}function lE(e,t){if(oE()||!sE()){t();return}let n=cE(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=cE(e);if(!t)return;for(let e of t.getAnimations())e.id===iE&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<aE)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:nE,easing:rE,fill:`none`});i.id=iE})}var uE=[{value:`left`,label:`Align left`,icon:du},{value:`center`,label:`Align center`,icon:lu},{value:`right`,label:`Align right`,icon:uu}];function dE(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Rt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function fE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:pE},t[0]=n,t[1]=r);let i=Ie(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=uE.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{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(!Rt.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(rr.create(u.doc,s)),lE(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{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 pE(e){return dE(e.editor)}function mE(e){return dE(e)!==null}var hE=[{name:`bold`,icon:nl,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:kl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:pu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:ou,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:yt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Dl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function gE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:_E},t[0]=n,t[1]=r);let i=Ie(r),a;t[2]!==i||t[3]!==n?(a=hE.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{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)(Ns,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Jt,{"aria-label":rc(e.shortcutId),children:tc(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 _E(e){return Object.fromEntries(hE.map(t=>[t.name,t.isActive(e.editor)]))}function vE(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:p,pages:m}=rs(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let g=h,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,b;t[4]===n?b=t[5]:(b=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=b);let x=b,S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w,T;t[9]===a?(w=t[10],T=t[11]):(w=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=w,t[11]=T),(0,Q.useEffect)(w,T);let E;t[12]!==n||t[13]!==g||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=g,t[14]=c,t[15]=E):E=t[15];let D=E,O;t[16]===n?O=t[17]:(O=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=O);let k=O,A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(ot(e.path,null))},t[18]=A):A=t[18];let j=A,M;t[19]!==D||t[20]!==n?(M=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=D,t[20]=n,t[21]=M):M=t[21];let N=M;if(a){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==d||t[27]!==N||t[28]!==p||t[29]!==m||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(_,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:d,loading:p,onValueChange:l,onSuggestionSelect:j,onKeyDown:N,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=d,t[27]=N,t[28]=p,t[29]=m,t[30]=e,t[31]=n,t[32]=c,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let o;t[36]===D?o=t[37]:(o=()=>{D()},t[36]=D,t[37]=o);let h;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=h):h=t[38];let v;t[39]!==a||t[40]!==o?(v=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:h}),t[39]=a,t[40]=o,t[41]=v):v=t[41];let b;t[42]!==i||t[43]!==v?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,v]}),t[42]=i,t[43]=v,t[44]=b):b=t[44];let x;t[45]!==r||t[46]!==y||t[47]!==g||t[48]!==k?(x=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),f(y)},children:(0,Z.jsx)(vo,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(K,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=y,t[47]=g,t[48]=k,t[49]=x):x=t[49];let S;return t[50]!==b||t[51]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[b,x]}),t[50]=b,t[51]=x,t[52]=S):S=t[52],S}let P;t[53]===r?P=t[54]:(P=r({id:`p0Iq25`}),t[53]=r,t[54]=P);let F=g?`bg-accent text-primary`:`text-accent-foreground`,I;t[55]===x?I=t[56]:(I=e=>{e.preventDefault(),l(x()),o(!0)},t[55]=x,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(jl,{className:`size-3.5`}),t[57]=L):L=t[57];let R;t[58]!==P||t[59]!==F||t[60]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":P,className:F,onMouseDown:I,children:L})}),t[58]=P,t[59]=F,t[60]=I,t[61]=R):R=t[61];let z;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(Jt,{children:tc(`command-palette`)})]}),t[63]=B):B=t[63];let V;return t[64]===R?V=t[65]:(V=(0,Z.jsxs)(Is,{children:[R,B]}),t[64]=R,t[65]=V),V}function yE({editor:e}){if(ze(e.state).query||e.isActive(`codeBlock`))return!1;if(mE(e)||YT(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 bE(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:TE},t[0]=n,t[1]=l);let u=Ie(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:wE},t[2]=n,t[3]=d);let f=Ie(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Hn(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=Os(e,t,()=>{Ps(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ts(8),Ms(),Rs({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(CE)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(SE)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(fE,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(qT,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IT,{editor:n}),(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(gE,{editor:n},o),(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(vE,{editor:n},`${o}-link`),(0,Z.jsx)($T,{editor:n},`${o}-footnote`),(0,Z.jsx)(HT,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(PT,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:xE,shouldShow:yE,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function xE(){return document.body}function SE(e){return e+1}function CE(){}function wE(e){return YT(e.editor)}function TE(e){return mE(e.editor)}var EE=56,DE=`0 2px 4px rgba(0, 0, 0, 0.08)`,OE=150,kE=globalThis.ScrollTimeline;function AE(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+EE);return{startOffset:o,endOffset:o+a,maxShift:a}}var jE=new WeakMap;function ME(e){let t=jE.get(e);if(t){for(let e of t.animations)e.cancel();jE.delete(e)}}function NE(e){for(let t of Array.from(e.cells))ME(t)}var PE=e=>e.cellIndex===0?`3`:`2`;function FE(e,t){return IE(e,t,e=>({transform:`translateY(${e}px)`}))}function IE(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 LE(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 RE(e,t,n){return LE(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:DE})}function zE(e,t){return LE(e,t,{opacity:`0`},{opacity:`1`})}function BE(e,t,n,r){let i=PE(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=jE.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(FE(n,r),s),l=e.animate(RE(n,r,i),s),u=e.animate(zE(n,r),{...s,pseudoElement:`::before`});jE.set(e,{key:a,animations:[c,l,u]})}function VE(e,t){let n=PE(e),r=`in|${t}|${n}`,i=jE.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:DE}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});jE.set(e,{key:r,animations:[a,o]})}function HE(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=AE(a,i,c.top,c.height,l.height);if(!u){NE(s);continue}if(n){if(o<=0){NE(s);continue}for(let e of Array.from(s.cells))BE(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+EE){NE(s);continue}for(let e of Array.from(s.cells))VE(e,d)}}var UE=ei.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ar({key:new Bn(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||HE(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()},OE);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&kE)try{n=new kE({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`))NE(t)}}}})]}}),WE=`application/x-open-knowledge-sidebar-item+json`,GE={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function KE(e){return JSON.stringify(e)}function qE(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Uo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:Jo(e.assetPath)}:{target:us(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:Vo(e.docName)}}function JE(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(WE);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!YE(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!XE(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function YE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function XE(e){return typeof e==`string`&&Object.hasOwn(GE,e)}function ZE(e,t){return(n,r)=>{let i=r,a=JE(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function QE(e,t){let n=qE(e);t(n.target,{tabBehavior:`append`}),Yo(n.hash)}function $E(e){return[...e?[{label:`Toggle header column`,icon:dl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:gi,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:to,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function eD(e){return[...e?[{label:`Toggle header row`,icon:su,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:ft,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Qe,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function tD(e){if(!e.isEditable||ze(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 nD(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Os(r,e,()=>{Ps(r,e,{strategy:`absolute`,placement:t,middleware:[Ts(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(rD)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?hl:Ta,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(no,{}),(0,Z.jsxs)(Ea,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(eo,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(ao,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function rD(){}function iD(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=tD(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=$E(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)(nD,{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=eD(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)(nD,{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 aD(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=Ot.getState(e.state)?.binding;if(!t){le.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){le.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}le.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ei.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ar({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var oD=new WeakMap;function sD(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=Gr(e.color),n.textContent=e.name,t.append(n),t}var cD={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},lD=100,uD=100,dD=3,fD=250;function pD(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function mD(e,t){let n=w(e);if(!n||t.contains(n.dom))return!1;if(!pD(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 hD(){let e=new sr({extensions:pr});return{mdManager:e,text:wt({mdManager:e}),html:L({mdManager:e}),paste:xe({mdManager:e}),drop:we({mdManager:e})}}function gD(e,t){return t?{collaboration:de.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[aD({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:de.configure({document:e.document}),guard:[]}}function _D(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=gD(t,r);return[...xt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),Vw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ei.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[nt]}}),ei.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[ht(e,{cursorBuilder:sD})]}}),ei.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[rT({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,UE]}function vD(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{oD.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=oD.get(e);if(oD.delete(e),r==null)return;let i=performance.now();le(`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:ZE(n.drop,e.onSidebarDrop)},extensions:Zp(_D(e))}}function yD(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=vD({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}=Nt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var bD=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(cD),c=qw(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=mt(),p=n.configuration.name??``,[m]=(0,Q.useState)(hD),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new gr(yD({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;le(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{QE(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=at(p)??crypto.randomUUID();_=Q.use,v=ee({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{ue(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)(xD,{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},xD=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,b;t[3]!==c||t[4]!==f?(v=()=>{mD(c,f)&&h(SD)},b=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=b):(v=t[5],b=t[6]),(0,Q.useEffect)(v,b);let x;t[7]!==c||t[8]!==n.configuration.name?(x=()=>(jt(c,n.configuration.name??null),()=>{jt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==c||t[11]!==n?(S=[c,n],t[10]=c,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==c||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return ne(e,c),()=>N(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=C):C=t[15];let T;t[16]!==c||t[17]!==n?(T=[c,n],t[16]=c,t[17]=n,t[18]=T):T=t[18],(0,Q.useEffect)(C,T);let E;t[19]!==c||t[20]!==n.configuration.name?(E=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,kc(e,`wysiwyg`,jc(c))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),kc(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==n?(D=[c,n],t[22]=c,t[23]=n,t[24]=D):D=t[24],(0,Q.useEffect)(E,D);let O;t[25]!==c||t[26]!==n.configuration.name?(O=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=O):O=t[27];let k;t[28]!==c||t[29]!==n?(k=[c,n],t[28]=c,t[29]=n,t[30]=k):k=t[30],(0,Q.useEffect)(O,k);let A,j;t[31]===c?(A=t[32],j=t[33]):(A=()=>{let e=CD,t=null,n=()=>{if(t||c.isDestroyed)return;let n=w(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 w(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},j=[c],t[31]=c,t[32]=A,t[33]=j),(0,Q.useEffect)(A,j);let M,P;t[34]!==i||t[35]!==c?(M=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!w(c))return;e=!0;let t=y(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})),le(`ok/editor/selection-restore-failed`,{docName:i,message:n})}qt(i)};if(w(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[34]=i,t[35]=c,t[36]=M,t[37]=P):(M=t[36],P=t[37]),(0,Q.useEffect)(M,P);let F,I;t[38]!==u||t[39]!==n.document||t[40]!==l?(F=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Ln)};c(cD);let f=()=>{if(fr(e),!Tr(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`?Tr(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)}},I=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=F,t[42]=I):(F=t[41],I=t[42]),(0,Q.useEffect)(F,I);let L,R;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(L=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<lD){e+=1,t=window.setTimeout(p,uD);return}r=null,o=null,e=0},u=function(e){let t=w(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=dD,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,fD)))};t=window.setTimeout(o,fD)};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=as(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)}},R=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=L,t[48]=R):(L=t[47],R=t[48]),(0,Q.useEffect)(L,R);let z,B;t[49]===c?(z=t[50],B=t[51]):(z=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=w(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(Ec,e),()=>window.removeEventListener(Ec,e)},B=[c],t[49]=c,t[50]=z,t[51]=B),(0,Q.useEffect)(z,B);let V;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:Jw({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]=V):V=t[58];let H;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(H=[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]=H):H=t[65],(0,Q.useEffect)(V,H);let U,W;t[66]!==c||t[67]!==r?(U=()=>(d(c,r),()=>{d(c,!1)}),W=[c,r],t[66]=c,t[67]=r,t[68]=U,t[69]=W):(U=t[68],W=t[69]),(0,Q.useEffect)(U,W);let G;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(G=!r&&(0,Z.jsx)(bE,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=G):G=t[74];let K;t[75]!==c||t[76]!==r?(K=!r&&(0,Z.jsx)(iD,{editor:c}),t[75]=c,t[76]=r,t[77]=K):K=t[77];let q;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=q):q=t[78];let J;t[79]!==c||t[80]!==m?(J=(0,Z.jsx)(Ae,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=J):J=t[81];let ee;t[82]!==f||t[83]!==J?(ee=(0,rl.createPortal)(J,f),t[82]=f,t[83]=J,t[84]=ee):ee=t[84];let Y;t[85]===c?Y=t[86]:(Y=(0,Z.jsx)(Gw,{editor:c}),t[85]=c,t[86]=Y);let te;t[87]===c?te=t[88]:(te=_t(c),t[87]=c,t[88]=te);let X;t[89]===te.store?X=t[90]:(X=(0,Z.jsx)(kt,{store:te.store}),t[89]=te.store,t[90]=X);let re;return t[91]!==G||t[92]!==K||t[93]!==ee||t[94]!==Y||t[95]!==X||t[96]!==l?(re=(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:[G,K,q,ee,Y,X]}),t[91]=G,t[92]=K,t[93]=ee,t[94]=Y,t[95]=X,t[96]=l,t[97]=re):re=t[97],re};function SD(e){return e+1}function CD(){return j()}var wD=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 TD(e,t,n,r,i,a){if(e==r)return[];let o=FD(e,t,n,r,i,a),s=ID(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 wD(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new wD(t,t+o,i,i),new wD(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 wD(t,t,i,i+o),new wD(n,n,i+o+c,a)]}if(c==1||l==1)return[new wD(t,n,i,a)];let u=RD(e,t,n,r,i,a);if(u){let[o,s,c]=u;return TD(e,t,o,r,i,s).concat(TD(e,o+c,n,r,s+c,a))}return kD(e,t,n,r,i,a)}var ED=1e9,DD=0,OD=!1;function kD(e,t,n,r,i,a){let o=n-t,s=a-i;if(ED<1e9&&Math.min(o,s)>ED*16||DD>0&&Date.now()>DD)return Math.min(o,s)>ED*64?[new wD(t,n,i,a)]:zD(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);jD.reset(c),MD.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:MD,f=d?null:jD;for(let p=0;p<c;p++){if(p>ED||DD>0&&!(p&63)&&Date.now()>DD)return zD(e,t,n,r,i,a);let m=jD.advance(p,o,s,c,d,!1,l)||MD.advance(p,o,s,c,f,!0,u);if(m)return ND(e,t,n,t+m[0],r,i,a,i+m[1])}return[new wD(t,n,i,a)]}var AD=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}},jD=new AD,MD=new AD;function ND(e,t,n,r,i,a,o,s){let c=!1;return!eO(e,r)&&++r==n&&(c=!0),!eO(i,s)&&++s==o&&(c=!0),c?[new wD(t,n,a,o)]:TD(e,t,r,i,a,s).concat(TD(e,r,n,i,s,o))}function PD(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function FD(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=PD(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-+!eO(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ID(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=PD(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-+!eO(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function LD(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;;){eO(e,s)||s++;let u=s+o;if(eO(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=FD(e,u,n,r,i+f+d.length,a),c=ID(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 RD(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=RD(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:LD(e,t,n,r,i,a,Math.floor(o/4),-1)}function zD(e,t,n,r,i,a){OD=!0;let o=n-t,s=a-i,c;if(o<s){let s=LD(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=LD(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new wD(t,n,i,a)];let[l,u,d]=c;return TD(e,t,l,r,i,u).concat(TD(e,l+d,n,r,u+d,a))}function BD(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 wD(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function VD(e,t,n){for(;;){BD(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=FD(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wD(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ID(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wD(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 wD(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 wD(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function HD(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=YD(t,a.fromA,l),f=JD(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 wD(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=JD(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new wD(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=YD(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new wD(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=ZD(n,a.fromB,a.toB),r,o=t<0?-1:XD(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=ZD(t,a.fromA,a.toA),r,o=n<0?-1:XD(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 BD(e,3),e}var UD;try{UD=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function WD(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function GD(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!WD(n):UD?!QD(n)||t==e.length-1?+!!UD.test(String.fromCharCode(n)):UD.test(e.slice(t,t+2))?2:0:0}function KD(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!WD(n):UD?!$D(n)||t==1?+!!UD.test(String.fromCharCode(n)):UD.test(e.slice(t-2,t))?2:0:0}var qD=8;function JD(e,t,n){if(t==e.length||!KD(e,t))return t;for(let r=t,i=t+n,a=0;a<qD;a++){let t=GD(e,r);if(!t||r+t>i)return r;r+=t}return t}function YD(e,t,n){if(!t||!GD(e,t))return t;for(let r=t,i=t-n,a=0;a<qD;a++){let t=KD(e,r);if(!t||r-t<i)return r;r-=t}return t}function XD(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function ZD(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var QD=e=>e>=55296&&e<=56319,$D=e=>e>=56320&&e<=57343;function eO(e,t){return!t||t==e.length||!QD(e.charCodeAt(t-1))||!$D(e.charCodeAt(t))}function tO(e,t,n){let r=n?.override;return r?r(e,t):(ED=(n?.scanLimit??1e9)>>1,DD=n?.timeout?Date.now()+n.timeout:0,OD=!1,VD(e,t,TD(e,0,e.length,t,0,t.length)))}function nO(){return!OD}function rO(e,t,n){return HD(tO(e,t,n),e,t)}var iO=pc.define({combine:e=>e[0]}),aO=mc.define(),oO=pc.define(),sO=cc.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(aO)&&(e=n.value);for(let n of t.state.facet(oO))e=n(e,t);return e}});function cO(e){let t=e.field(sO,!1);if(!t)return null;let n=e.facet(iO);return{chunks:t,side:n?n.side:null}}var lO=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 fO(rO(e.toString(),t.toString(),n),e,t,0,0,nO())}static updateA(e,t,n,r,i){return gO(hO(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return gO(hO(e,r,!1,t.length),e,t,n,i)}};function uO(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 dO(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 fO(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=uO(c.fromA+r,c.fromB+i,t,n),[d,f]=dO(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]=uO(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]=dO(a.toA+r,a.toB+i,t,n),s++}o.push(new lO(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var pO=1e3;function mO(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 hO(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>pO&&([l,d]=mO(e,a-pO,n,!0)),o<t.length-pO&&([u,f]=mO(e,o+pO,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 gO(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=rO(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of fO(h,n,r,d,f,nO()))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 _O={scanLimit:500},vO=hc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=OO(e))}update(e){(e.docChanged||e.viewportChanged||bO(e.startState,e.state)||xO(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=OO(e.view))}},{decorations:e=>e.deco}),yO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(vO)?.gutter||xc.empty}));function bO(e,t){return e.field(sO,!1)!=t.field(sO,!1)}function xO(e,t){return e.facet(iO)!=t.facet(iO)}var SO=dc.line({class:`cm-changedLine`}),CO=dc.mark({class:`cm-changedText`}),wO=dc.mark({tagName:`ins`,class:`cm-insertedLine`}),TO=dc.mark({tagName:`del`,class:`cm-deletedLine`}),EO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function DO(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,SO),i.add(o,s,n?TO:wO),a&&a.add(o,o,EO);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,SO),a&&a.add(u,u,EO);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,CO),s<t)c++;else break}u=t}}}function OO(e){let t=e.state.field(sO),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(iO),o=n==`a`,s=new fc,c=i?new fc: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))&&DO(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var kO=class extends ic{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}},AO=mc.define({map:(e,t)=>e.map(t)}),jO=cc.define({create:()=>dc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(AO))return e.value;return e.map(t.changes)},provide:e=>_c.decorations.from(e)}),MO=.01;function NO(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 PO(e,t,n){let r=new fc,i=new fc,a=e.state.field(jO).iter(),o=t.state.field(jO).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<-MO?(l-=n,r.add(s,s,dc.widget({widget:new kO(-n),block:!0,side:-1}))):n>MO&&(u+=n,i.add(c,c,dc.widget({widget:new kO(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<MO?r.add(e.state.doc.length,e.state.doc.length,dc.widget({widget:new kO(-p),block:!0,side:1})):p>MO&&i.add(t.state.doc.length,t.state.doc.length,dc.widget({widget:new kO(p),block:!0,side:1}));let m=r.finish(),h=i.finish();NO(m,e.state.field(jO))||e.dispatch({effects:AO.of(m)}),NO(h,t.state.field(jO))||t.dispatch({effects:AO.of(h)})}var FO=mc.define({map:(e,t)=>t.mapPos(e)}),IO=class extends ic{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:FO.of(n)});let{side:r,sibling:i}=e.state.facet(iO);i&&i().dispatch({effects:FO.of(LO(n,e.state.field(sO),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function LO(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 RO=cc.define({create(e){return dc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(FO)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>_c.decorations.from(e)});function zO({margin:e=3,minSize:t=4}){return RO.init(n=>BO(n,e,t))}function BO(e,t,n){let r=new fc,i=e.facet(iO).side==`a`,a=e.field(sO),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,dc.replace({widget:new IO(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var VO=_c.styleModule.of(new bc({".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`}})),HO=_c.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`}}),UO=new gc,WO=new gc,GO=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||_O;let t=[ac.low(vO),HO,VO,jO,_c.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(AO)))&&this.measure()})],n=[iO.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(yO);let r=sc.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],_c.editorAttributes.of({class:`cm-merge-a`}),WO.of(n),t]}),i=[iO.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(yO);let a=sc.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],_c.editorAttributes.of({class:`cm-merge-b`}),WO.of(i),t]});this.chunks=lO.build(r.doc,a.doc,this.diffConf);let o=[sO.init(()=>this.chunks),UO.of(e.collapseUnchanged?zO(e.collapseUnchanged):[])];r=r.update({effects:mc.appendConfig.of(o)}).state,a=a.update({effects:mc.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 _c({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new _c({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),oc.empty(e[0].startState.doc.length));this.chunks=t==this.a?lO.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):lO.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:aO.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:aO.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(iO),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(WO.reconfigure([iO.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?yO:[]])),a.push(WO.reconfigure([iO.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?yO:[]]))}if(r){let t=UO.reconfigure(e.collapseUnchanged?zO(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(){PO(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=KO(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=KO(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 KO(e){let t=e.nextSibling;return e.remove(),t}var qO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},JO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(vO)?.gutter||xc.empty,widgetMarker:(e,t)=>t instanceof $O?qO:null}));function YO(e){let t=typeof e.original==`string`?uc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||_O;return[ac.low(vO),ik,HO,_c.editorAttributes.of({class:`cm-merge-b`}),oO.of((e,t)=>{let r=t.effects.find(e=>e.is(XO));return r&&(e=lO.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=lO.updateB(e,t.state.field(ZO),t.newDoc,t.changes,n)),e}),iO.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?uk:void 0,side:`b`}),ZO.init(()=>t),e.gutter===!1?[]:JO,e.collapseUnchanged?zO(e.collapseUnchanged):[],sO.init(e=>lO.build(t,e.doc,n))]}var XO=mc.define(),ZO=cc.define({create:()=>uc.empty,update(e,t){for(let n of t.effects)n.is(XO)&&(e=n.value.doc);return e}}),QO=new WeakMap,$O=class extends ic{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 ek(e,t,n){let r=QO.get(t.changes);if(r)return r;let i=dc.widget({block:!0,side:-1,widget:new $O(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(iO),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(),tk(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),nk(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(ZO).sliceString(t.fromA,t.endA),u=a&&e.facet(Sc),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
27
+ `)?null:i}function cw(e){let t=ze(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function lw(e,t){return e.current===t.current&&e.total===t.total}function uw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(nw)}function dw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=w(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 fw(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=aw(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)(nw),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(mw))},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(pw)},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(nw);return}if(!u.open||r){i.commands.clearFindMatches(),p(nw);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=cw(i);p(t=>lw(t,e)?t:e)},iw);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=ze(i.state),t=cw(i);p(e=>lw(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=sw(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(nc(t,`find`)){t.preventDefault(),u.open?uw(i,d,p):e(!1);return}if(nc(t,`replace`)){t.preventDefault(),e(!0);return}if(u.open){let e=nc(t,`find-next`),n=nc(t,`find-previous`);if(e||n){t.preventDefault(),(n?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&dw(i);return}}t.key===`Escape`&&u.open&&(t.preventDefault(),uw(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=ze(i.state),t=cw(i);p(e=>lw(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(){uw(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()&&dw(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()&&dw(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)&&dw(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)&&dw(i),N())},t[58]=j,t[59]=i,t[60]=u.replacement,t[61]=N,t[62]=H):H=t[62];let U=H;if(!u.open||!n||r)return null;let W,G,K,q,J;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),K=e=>d(t=>({...t,replaceOpen:e})),q=e=>d(t=>({...t,caseSensitive:e})),J=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=K,t[66]=q,t[67]=J):(W=t[63],G=t[64],K=t[65],q=t[66],J=t[67]);let ee;return t[68]!==F||t[69]!==u.caseSensitive||t[70]!==u.query||t[71]!==u.replaceOpen||t[72]!==u.replacement||t[73]!==u.wholeWord||t[74]!==f.current||t[75]!==f.total||t[76]!==U||t[77]!==V||t[78]!==L||t[79]!==z?(ee=(0,Z.jsx)(`div`,{className:`editor-content-aligned pointer-events-none absolute inset-x-0 top-2 z-30 px-2`,children:(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(tw,{findInputRef:a,query:u.query,replacement:u.replacement,replaceOpen:u.replaceOpen,caseSensitive:u.caseSensitive,wholeWord:u.wholeWord,current:f.current,total:f.total,onQueryChange:W,onReplacementChange:G,onReplaceOpenChange:K,onCaseSensitiveChange:q,onWholeWordChange:J,onNext:L,onPrevious:z,onReplaceCurrent:V,onReplaceAll:U,onClose:F})})}),t[68]=F,t[69]=u.caseSensitive,t[70]=u.query,t[71]=u.replaceOpen,t[72]=u.replacement,t[73]=u.wholeWord,t[74]=f.current,t[75]=f.total,t[76]=U,t[77]=V,t[78]=L,t[79]=z,t[80]=ee):ee=t[80],ee}function pw(e){return{...e,open:!1,activeIndex:0}}function mw(e){return{...e,activeIndex:0}}var hw=300;function gw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tc),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tc);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Ac(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,hw)};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 _w(e){return e&&e.document.getMap(`lifecycle`).get(`status`)===`conflict`?`conflict`:null}function vw(e){let t=(0,$.c)(8),{poolEntries:n}=mt(),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=()=>_w(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(_w(i));let t=()=>s(_w(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 yw(e,t){let n=(0,$.c)(3),r;return n[0]!==e||n[1]!==t?(r=()=>Mc(e,t),n[0]=e,n[1]=t,n[2]=r):r=n[2],(0,Q.useSyncExternalStore)(Nc,r)}var bw=`ok-doc-panel-width-v1`;function xw(e){return Number.isFinite(e)?e<300?300:e>600?600:Math.round(e):320}function Sw(e){try{let t=(e??localStorage).getItem(bw);if(t==null)return 320;let n=Number.parseInt(t,10);return Number.isFinite(n)?xw(n):320}catch{return 320}}function Cw(e,t){try{(t??localStorage).setItem(bw,String(xw(e)))}catch{}}function ww(){try{return typeof localStorage>`u`?320:Sw()}catch{return 320}}var Tw=1024,Ew=1280,Dw={left:Tw,right:Ew};function Ow(e,t,n){return e==null?t>=Dw[n]?`above`:`below`:`embedded`}function kw(e){return e===`above`?`open`:`collapsed`}var Aw=`ok-sidebar-pins-v2`;function jw(e){return e===`open`||e===`collapsed`}function Mw(e){return e===`above`||e===`below`||e===`embedded`}function Nw(e){if(typeof e!=`object`||!e)return!1;let t=e;for(let e of Object.keys(t))if(!Mw(e)||!jw(t[e]))return!1;return!0}function Pw(e){let t=JSON.parse(e);if(typeof t!=`object`||!t)return{};let n=t,r={};return Nw(n.left)&&(r.left=n.left),Nw(n.right)&&(r.right=n.right),r}function Fw(e){try{let t=(e??localStorage).getItem(Aw);return t==null?{}:Pw(t)}catch{return{}}}function Iw(e,t){try{t.setItem(Aw,JSON.stringify(e))}catch{}}function Lw(e,t,n){return n[e]?.[t]??kw(t)}function Rw(e,t,n,r){let i=r??localStorage,a=Fw(i);return a[e]={...a[e],[t]:n},Iw(a,i),a}function zw(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`?Bw: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 Bw(e){return e===`synced`?`synced`:`connected`}var Vw=Lr;function Hw(e,t={}){let n=De(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var Uw=200,Ww=`Outside any block`;function Gw(e){let t=(0,$.c)(5),{editor:n}=e,r=Gt(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?Kw(n,r):o.current?Ww:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},Uw),()=>{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 Kw(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=Hw(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=Hw(a);try{let t=e.state.doc.resolve(r.pos),n=t.index(t.depth),a=t.parent.childCount;return`Selected: ${i}, ${n+1} of ${a} in ${o}`}catch{return`Selected: ${i} in ${o}`}}function qw(){let[e]=(0,Q.useState)(Ir);return e}function Jw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:br(e.display_name),color:Wn(e.id,Nn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Wn(e.id,Nn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Yw(e,t){return e>t}function Xw(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 Zw=3,Qw=6e4;function $w(e,t){let n=0;for(let r of e)t-r<Qw&&(n+=1);return n<Zw}var eT=new Map;function tT(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 nT(e){let t=Ot.getState(e);return t?.snapshot!=null||t?.prevSnapshot!=null}function rT(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=Ot.getState(e)?.binding;if(!t)return;if(typeof t._prosemirrorChanged!=`function`){le.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=>{Yw(i,a)||r(e)}},f=()=>{if(c=!1,!s||o||!Yw(i,a)||l!==null&&nT(l.state))return;o=!0;let e=Date.now();for(let[t,n]of eT)n.every(t=>e-t>=Qw)&&eT.delete(t);let t=(eT.get(n)??[]).filter(t=>e-t<Qw);if(!$w(t,e)){eT.set(n,t),le.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),eT.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,le.count(`ok/editor/binding-wedge-recovery-error`,{docName:n}),console.error(`[binding-staleness-guard] wedge recovery threw for "${n}":`,e)}},p=e=>{e.origin!==Ot&&tT(e,t)&&(i+=1,c||(c=!0,queueMicrotask(f)))};return new ar({state:{init:()=>null,apply:e=>(Xw(e.getMeta(Ot))&&(a=i,o&&le.count(`ok/editor/binding-wedge-recovered`,{docName:n}),o=!1),null)},filterTransaction:(e,t)=>!Yw(i,a)||nT(t)?!0:e.getMeta(Ot)!==void 0,view:e=>{let r=t.doc;return r==null?(le.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 iT(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 aT=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&&Qn(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(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=Hn(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof rr){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 Er){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():iT(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Ps(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()}},oT=e=>new ar({key:typeof e.pluginKey==`string`?new Bn(e.pluginKey):e.pluginKey,view:t=>new aT({view:t,...e})});ei.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[oT({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 sT=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 Mr(e,{textSerializers:jn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Ms(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Rs(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Ts(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(Ls(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(zs(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ds(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(As(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(ks(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=Hn(this.view,e.from,e.to);Ps({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()}},cT=e=>new ar({key:typeof e.pluginKey==`string`?new Bn(e.pluginKey):e.pluginKey,view:t=>new sT({view:t,...e})});ei.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?[cT({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 lT(e,t){return e??new Bn(t)}var uT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,dT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),fT=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(`.`)),pT=new Set([`children`,`className`,`style`]),mT=new Set([`tabIndex`]),hT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),gT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function _T(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function vT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function yT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||hT.has(e)}function bT(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function xT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:gT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function ST(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 CT(e){return mT.has(e)}function wT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function TT(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 ET(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||fT.has(e)?String(t):`${t}px`}function DT(e,t){dT.has(t)||e.style.removeProperty(bT(t))}function OT(e,t,n){dT.has(t)||e.style.setProperty(bT(t),ET(t,n))}function kT(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(pT.has(r)||!yT(r)||_T(r,t[r])||_T(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=vT(r);if(a==null||a===!1){CT(r)&&TT(e,r),e.removeAttribute(o);return}if(a===!0){CT(r)&&wT(e,r,!0),e.setAttribute(o,``);return}if(CT(r)){wT(e,r,a);return}e.setAttribute(o,String(a))})}function AT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function jT(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){DT(e,t);return}OT(e,t,a)}})}function MT(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(!_T(t,n))return;let{eventName:i,options:a}=xT(t),o=t=>{n(ST(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function NT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);uT(()=>{let i=n.current;return AT(e,i.className,t.className),jT(e,i.style,t.style),kT(e,i,t),r.current=MT(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 PT=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)(lT(e,`bubbleMenu`)).current;NT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Kt(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,Q.useRef)(h);g.current=h;let[_,v]=(0,Q.useState)(!1),y=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=oT({...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,rl.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)(lT(e,`floatingMenu`)).current;NT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Kt(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,Q.useRef)(m);h.current=m;let[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=cT({...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,rl.createPortal)(s,u.current)});var FT=[{name:`paragraph`,label:`Text`,icon:Wl,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:Te,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:F,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:Tt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:ge,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:me,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:k,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:M,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tu,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock({language:`js`}).run()}];function IT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:LT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Ie(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)(Ve,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(ci,{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=FT.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ea,{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)(eo,{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)(ao,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function LT(e){let t=Object.fromEntries(FT.map(t=>[t.name,t.isActive(e.editor)]));return{current:FT.find(e=>t[e.name])??FT[0],activeStates:t}}function RT(e){let t=(0,$.c)(17),{installStates:n,onPick:r}=e,{_:a}=i(),[o,c]=(0,Q.useState)(``),l;if(t[0]!==a||t[1]!==n||t[2]!==o||t[3]!==r){let e;t[5]===n?e=t[6]:(e=e=>n[e.id]?.installed===!0,t[5]=n,t[6]=e);let i=_g.filter(e),u=_g.some(e=>n[e.id]?.installed==null),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`div`,{className:`font-mono text-xs uppercase tracking-wide text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EVnzPs`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>c(e.target.value),t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a({id:`Rah7yq`}),t[9]=a,t[10]=p);let m;t[11]===a?m=t[12]:(m=a({id:`ZBt4rI`}),t[11]=a,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,Z.jsx)(jo,{value:o,onChange:f,placeholder:p,"aria-label":m,"data-testid":`edit-with-ai-instruction`}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16],l=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,h,i.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,"data-testid":`edit-with-ai-send-label`,children:(0,Z.jsx)(s,{id:`C37Zkt`})}),(0,Z.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:i.map(e=>(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`w-full justify-start gap-2`,"data-testid":`edit-with-ai-target-${e.id}`,onClick:()=>r(e,o),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:e.displayName})]},e.id))})]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`edit-with-ai-empty`,"aria-live":`polite`,children:u?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=a,t[1]=n,t[2]=o,t[3]=r,t[4]=l}else l=t[4];return l}function zT(e){let t=(0,$.c)(27),{open:n,onOpenChange:r,snapshot:a,children:o}=e,{_:s}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d;t[0]===l?d=t[1]:(d=()=>{l()},t[0]=l,t[1]=d);let f=(0,Q.useEffectEvent)(d),p;t[2]!==n||t[3]!==f?(p=()=>{n&&f()},t[2]=n,t[3]=f,t[4]=p):p=t[4];let m;t[5]===n?m=t[6]:(m=[n],t[5]=n,t[6]=m),(0,Q.useEffect)(p,m);let h;t[7]!==s||t[8]!==u||t[9]!==r||t[10]!==a?(h=(e,t)=>{if(a!==null){let n=o_({docName:a.docName,workspace:a.workspace,instruction:t,selectionMarkdown:a.selectionMarkdown});n===null?hs.error(s({id:`_VRtd7`})):u(e.id,n)}r(!1)},t[7]=s,t[8]=u,t[9]=r,t[10]=a,t[11]=h):h=t[11];let g=h,_;t[12]===o?_=t[13]:(_=(0,Z.jsx)(J,{asChild:!0,children:o}),t[12]=o,t[13]=_);let v;t[14]===s?v=t[15]:(v=s({id:`EVnzPs`}),t[14]=s,t[15]=v);let y;t[16]!==g||t[17]!==c?(y=(0,Z.jsx)(RT,{installStates:c,onPick:g}),t[16]=g,t[17]=c,t[18]=y):y=t[18];let x;t[19]!==v||t[20]!==y?(x=(0,Z.jsx)(b,{align:`start`,"aria-label":v,"data-testid":`edit-with-ai-popover`,children:y}),t[19]=v,t[20]=y,t[21]=x):x=t[21];let S;return t[22]!==r||t[23]!==n||t[24]!==_||t[25]!==x?(S=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[_,x]}),t[22]=r,t[23]=n,t[24]=_,t[25]=x,t[26]=S):S=t[26],S}function BT(e){let t=P(e.state.selection.content(),e.state.schema);return l().serialize(t).trim()}function VT(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toUpperCase();return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`}function HT(e){let t=(0,$.c)(3),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!1:r,a=Yn(),o=mg();if(!a||o)return null;let s;return t[0]!==n||t[1]!==i?(s=(0,Z.jsx)(UT,{editor:n,shortcutEnabled:i}),t[0]=n,t[1]=i,t[2]=s):s=t[2],s}function UT(e){let t=(0,$.c)(19),{editor:n,shortcutEnabled:r}=e,{_:a}=i(),o=po(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f;if(t[0]!==a||t[1]!==n||t[2]!==o){let e=()=>{let e;try{e=BT(n)}catch(e){return console.error(`Edit with AI: could not read the selection`,e),hs.error(a({id:`-RXIMO`})),null}return{docName:bt(n),workspace:o,selectionMarkdown:e}};f=()=>{let t=e();t!==null&&(d(t),l(!0))},t[0]=a,t[1]=n,t[2]=o,t[3]=f}else f=t[3];let p=f,m;t[4]===p?m=t[5]:(m=e=>{if(e){p();return}l(!1),d(null)},t[4]=p,t[5]=m);let h=m,g;t[6]===p?g=t[7]:(g=()=>{p()},t[6]=p,t[7]=g);let _=(0,Q.useEffectEvent)(g),v;t[8]!==_||t[9]!==r?(v=()=>{let e=e=>{r&&nc(e,`edit-with-ai`)&&(VT(e.target)||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_()))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},t[8]=_,t[9]=r,t[10]=v):v=t[10];let y;t[11]===r?y=t[12]:(y=[r],t[11]=r,t[12]=y),(0,Q.useEffect)(v,y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ta,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`edit-with-ai-bubble-button`,className:`gap-1 px-2 text-sm font-medium text-accent-foreground/80`,children:[(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`EVnzPs`})})]}),t[14]=x):x=t[14];let S;return t[15]!==h||t[16]!==c||t[17]!==u?(S=(0,Z.jsxs)(Z.Fragment,{children:[b,(0,Z.jsx)(zT,{open:c,onOpenChange:h,snapshot:u,children:x})]}),t[15]=h,t[16]=c,t[17]=u,t[18]=S):S=t[18],S}function WT(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 GT(e){let t=e.state.selection.node;if(!t)return``;let n=t.attrs.props??{},r=typeof n.alias==`string`?n.alias:``;if(r.length>0)return r;let i=typeof n.name==`string`?n.name:``;return i.length>0?i:Pt(typeof n.src==`string`?n.src:``)}function KT(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 qT(e){let t=(0,$.c)(13),{editor:n}=e,{_:r}=i(),a;if(t[0]===n?a=t[1]:(a={editor:n,selector:JT},t[0]=n,t[1]=a),Ie(a)===null)return null;let o;t[2]===r?o=t[3]:(o=r({id:`WcWS__`}),t[2]=r,t[3]=o);let c;t[4]===n?c=t[5]:(c=e=>{e.preventDefault();let t=WT(n);t&&KT(t,GT(n))},t[4]=n,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(to,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]!==o||t[8]!==c?(u=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":o,className:`text-accent-foreground`,onMouseDown:c,children:l})}),t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`WcWS__`})}),t[10]=d):d=t[10];let f;return t[11]===u?f=t[12]:(f=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Is,{children:[u,d]})}),t[11]=u,t[12]=f),f}function JT(e){return WT(e.editor)}function YT(e){return WT(e)!==null}function XT(e){let t=e.schema.nodes;return!!(t.footnoteReference&&t.footnoteDefinition)}function ZT(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 QT(e){let{$from:t,$to:n}=e.state.selection;return!t.sameParent(n)}function $T(e){let t=(0,$.c)(21),{editor:n}=e,{_:r}=i(),a;t[0]===n?a=t[1]:(a={editor:n,selector:eE},t[0]=n,t[1]=a);let o=Ie(a),s;t[2]!==o||t[3]!==n?(s=()=>{if(o||!XT(n)||n.state.selection.empty||QT(n)||ZT(n))return;let{from:e,to:t}=n.state.selection,r=n.state.doc.textBetween(e,t,` `);if(!r.trim())return;let i=zn(Vn(n.state.doc)),a=Pr(n.state.doc)+1-(t-e);n.chain().focus().deleteSelection().insertFootnoteReference(i).insertContentAt(a,{type:`footnoteDefinition`,attrs:{identifier:i,label:i},content:[{type:`paragraph`,content:[{type:`text`,text:r}]}]}).run()},t[2]=o,t[3]=n,t[4]=s):s=t[4];let c=s,l;t[5]===r?l=t[6]:(l=r({id:`sIGbBZ`}),t[5]=r,t[6]=l);let u;t[7]===c?u=t[8]:(u=e=>{e.preventDefault(),c()},t[7]=c,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(te,{className:`size-3.5`,"aria-hidden":`true`}),t[9]=d):d=t[9];let f;t[10]!==o||t[11]!==l||t[12]!==u?(f=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"data-testid":`footnote-bubble-button`,className:`text-accent-foreground/80`,"aria-label":l,onMouseDown:u,disabled:o,children:d})}),t[10]=o,t[11]=l,t[12]=u,t[13]=f):f=t[13];let p;t[14]===r?p=t[15]:(p=r({id:`sIGbBZ`}),t[14]=r,t[15]=p);let m;t[16]===p?m=t[17]:(m=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:p}),t[16]=p,t[17]=m);let h;return t[18]!==f||t[19]!==m?(h=(0,Z.jsxs)(Is,{children:[f,m]}),t[18]=f,t[19]=m,t[20]=h):h=t[20],h}function eE(e){let t=e.editor;return!!(!XT(t)||t.state.selection.empty||QT(t)||ZT(t))}var tE=`img, .ok-embed, .ok-video`,nE=220,rE=`cubic-bezier(0.23, 1, 0.32, 1)`,iE=`ok-image-align-flip`,aE=.5;function oE(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function sE(){return typeof requestAnimationFrame==`function`}function cE(e){return e?e.querySelector(tE):null}function lE(e,t){if(oE()||!sE()){t();return}let n=cE(e);if(!n){t();return}let r=n.getBoundingClientRect().left;t(),requestAnimationFrame(()=>{let t=cE(e);if(!t)return;for(let e of t.getAnimations())e.id===iE&&e.cancel();let n=r-t.getBoundingClientRect().left;if(Math.abs(n)<aE)return;let i=t.animate([{transform:`translateX(${n}px)`},{transform:`translateX(0)`}],{duration:nE,easing:rE,fill:`none`});i.id=iE})}var uE=[{value:`left`,label:`Align left`,icon:du},{value:`center`,label:`Align center`,icon:lu},{value:`right`,label:`Align right`,icon:uu}];function dE(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(!Rt.has(String(n)))return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function fE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:pE},t[0]=n,t[1]=r);let i=Ie(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=uE.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{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(!Rt.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(rr.create(u.doc,s)),lE(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{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 pE(e){return dE(e.editor)}function mE(e){return dE(e)!==null}var hE=[{name:`bold`,icon:nl,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcutId:`format-bold`},{name:`italic`,icon:kl,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcutId:`format-italic`},{name:`underline`,icon:pu,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcutId:`format-underline`},{name:`strikethrough`,icon:ou,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcutId:`format-strike`},{name:`code`,icon:yt,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcutId:`format-inline-code`},{name:`highlight`,icon:Dl,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcutId:`format-highlight`}];function gE(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:_E},t[0]=n,t[1]=r);let i=Ie(r),a;t[2]!==i||t[3]!==n?(a=hE.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{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)(Ns,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(Jt,{"aria-label":rc(e.shortcutId),children:tc(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 _E(e){return Object.fromEntries(hE.map(t=>[t.name,t.isActive(e.editor)]))}function vE(e){let t=(0,$.c)(66),{editor:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(``),u=(0,Q.useRef)(null),{folderPaths:d,loading:p,pages:m}=rs(),h;t[0]===n?h=t[1]:(h=n.state.selection.empty&&n.isActive(`link`),t[0]=n,t[1]=h);let g=h,v;t[2]===n?v=t[3]:(v=n.getAttributes(`link`).href??``,t[2]=n,t[3]=v);let y=v,b;t[4]===n?b=t[5]:(b=function(){return n.state.selection.empty&&n.isActive(`link`)?n.getAttributes(`link`).href??``:``},t[4]=n,t[5]=b);let x=b,S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{let e=function(){n.state.selection.empty&&o(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,Q.useEffect)(S,C);let w,T;t[9]===a?(w=t[10],T=t[11]):(w=()=>{a&&requestAnimationFrame(()=>u.current?.focus())},T=[a],t[9]=a,t[10]=w,t[11]=T),(0,Q.useEffect)(w,T);let E;t[12]!==n||t[13]!==g||t[14]!==c?(E=function(){c.trim()?n.chain().focus().setLink({href:c.trim()}).run():g&&n.chain().focus().unsetLink().run(),o(!1)},t[12]=n,t[13]=g,t[14]=c,t[15]=E):E=t[15];let D=E,O;t[16]===n?O=t[17]:(O=function(){n.chain().focus().unsetLink().run(),o(!1)},t[16]=n,t[17]=O);let k=O,A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(e){l(ot(e.path,null))},t[18]=A):A=t[18];let j=A,M;t[19]!==D||t[20]!==n?(M=function(e){e.key===`Enter`&&(e.preventDefault(),D()),e.key===`Escape`&&(e.preventDefault(),o(!1),n.chain().focus().run())},t[19]=D,t[20]=n,t[21]=M):M=t[21];let N=M;if(a){let e;t[22]===r?e=t[23]:(e=r({id:`ZsGpr_`}),t[22]=r,t[23]=e);let n;t[24]===r?n=t[25]:(n=r({id:`roAe2K`}),t[24]=r,t[25]=n);let i;t[26]!==d||t[27]!==N||t[28]!==p||t[29]!==m||t[30]!==e||t[31]!==n||t[32]!==c?(i=(0,Z.jsx)(_,{ref:u,type:`text`,placeholder:e,value:c,pages:m,folderPaths:d,loading:p,onValueChange:l,onSuggestionSelect:j,onKeyDown:N,"aria-label":n,className:`h-5 w-44 rounded-none border-none bg-transparent px-0 py-0 text-sm placeholder:text-muted-foreground focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent`}),t[26]=d,t[27]=N,t[28]=p,t[29]=m,t[30]=e,t[31]=n,t[32]=c,t[33]=i):i=t[33];let a;t[34]===r?a=t[35]:(a=r({id:`tP5DDk`}),t[34]=r,t[35]=a);let o;t[36]===D?o=t[37]:(o=()=>{D()},t[36]=D,t[37]=o);let h;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(pl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[38]=h):h=t[38];let v;t[39]!==a||t[40]!==o?(v=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":a,onClick:o,children:h}),t[39]=a,t[40]=o,t[41]=v):v=t[41];let b;t[42]!==i||t[43]!==v?(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50`,children:[i,v]}),t[42]=i,t[43]=v,t[44]=b):b=t[44];let x;t[45]!==r||t[46]!==y||t[47]!==g||t[48]!==k?(x=g&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`2vIPtm`}),onMouseDown:e=>{e.preventDefault(),f(y)},children:(0,Z.jsx)(vo,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`2vIPtm`})})]}),(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":r({id:`484LKL`}),onMouseDown:e=>{e.preventDefault(),k()},children:(0,Z.jsx)(K,{className:`size-3.5`})})}),(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`484LKL`})})]})]}),t[45]=r,t[46]=y,t[47]=g,t[48]=k,t[49]=x):x=t[49];let S;return t[50]!==b||t[51]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[b,x]}),t[50]=b,t[51]=x,t[52]=S):S=t[52],S}let P;t[53]===r?P=t[54]:(P=r({id:`p0Iq25`}),t[53]=r,t[54]=P);let F=g?`bg-accent text-primary`:`text-accent-foreground`,I;t[55]===x?I=t[56]:(I=e=>{e.preventDefault(),l(x()),o(!0)},t[55]=x,t[56]=I);let L;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(jl,{className:`size-3.5`}),t[57]=L):L=t[57];let R;t[58]!==P||t[59]!==F||t[60]!==I?(R=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,"aria-label":P,className:F,onMouseDown:I,children:L})}),t[58]=P,t[59]=F,t[60]=I,t[61]=R):R=t[61];let z;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(s,{id:`yzF66j`}),t[62]=z):z=t[62];let B;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Ns,{side:`bottom`,sideOffset:8,children:[z,(0,Z.jsx)(Jt,{children:tc(`command-palette`)})]}),t[63]=B):B=t[63];let V;return t[64]===R?V=t[65]:(V=(0,Z.jsxs)(Is,{children:[R,B]}),t[64]=R,t[65]=V),V}function yE({editor:e}){if(ze(e.state).query||e.isActive(`codeBlock`))return!1;if(mE(e)||YT(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 bE(e){let t=(0,$.c)(23),{editor:n,shortcutEnabled:r}=e,i=r===void 0?!0:r,a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(0),c=(0,Q.useRef)(null),l;t[0]===n?l=t[1]:(l={editor:n,selector:TE},t[0]=n,t[1]=l);let u=Ie(l),d;t[2]===n?d=t[3]:(d={editor:n,selector:wE},t[2]=n,t[3]=d);let f=Ie(d),p;t[4]!==n.state||t[5]!==n.view?(p=()=>{try{let{from:e,to:t}=n.state.selection;return Hn(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=p):p=t[6];let m;if(t[7]!==n.view.dom||t[8]!==p){let e={getBoundingClientRect:p,contextElement:n.view.dom};m=()=>{let t=a.current;t&&(c.current?.(),c.current=Os(e,t,()=>{Ps(e,t,{placement:`top`,strategy:`fixed`,middleware:[Ts(8),Ms(),Rs({padding:8})]}).then(e=>{let{x:n,y:r}=e;t.isConnected&&(t.style.position=`fixed`,t.style.left=`${n}px`,t.style.top=`${r}px`)}).catch(CE)}))},t[7]=n.view.dom,t[8]=p,t[9]=m}else m=t[9];let h=m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{c.current?.(),c.current=null,s(SE)},t[10]=g):g=t[10];let _=g,v;t[11]===h?v=t[12]:(v={onShow:h,onHide:_,strategy:`fixed`},t[11]=h,t[12]=v);let y;t[13]!==n||t[14]!==f||t[15]!==u||t[16]!==i||t[17]!==o?(y=u?(0,Z.jsx)(fE,{editor:n},`${o}-img-align`):f?(0,Z.jsx)(qT,{editor:n},`${o}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(IT,{editor:n}),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(gE,{editor:n},o),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(vE,{editor:n},`${o}-link`),(0,Z.jsx)($T,{editor:n},`${o}-footnote`),(0,Z.jsx)(HT,{editor:n,shortcutEnabled:i},`${o}-edit-ai`)]}),t[13]=n,t[14]=f,t[15]=u,t[16]=i,t[17]=o,t[18]=y):y=t[18];let b;return t[19]!==n||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(PT,{ref:a,editor:n,"data-testid":`bubble-menu-bar`,appendTo:xE,shouldShow:yE,updateDelay:250,options:v,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:y}),t[19]=n,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function xE(){return document.body}function SE(e){return e+1}function CE(){}function wE(e){return YT(e.editor)}function TE(e){return mE(e.editor)}var EE=56,DE=`0 2px 4px rgba(0, 0, 0, 0.08)`,OE=150,kE=globalThis.ScrollTimeline;function AE(e,t,n,r,i){let a=r-i;if(a<=0)return null;let o=e+n-(t+EE);return{startOffset:o,endOffset:o+a,maxShift:a}}var jE=new WeakMap;function ME(e){let t=jE.get(e);if(t){for(let e of t.animations)e.cancel();jE.delete(e)}}function NE(e){for(let t of Array.from(e.cells))ME(t)}var PE=e=>e.cellIndex===0?`3`:`2`;function FE(e,t){return IE(e,t,e=>({transform:`translateY(${e}px)`}))}function IE(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 LE(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 RE(e,t,n){return LE(e,t,{zIndex:`auto`,boxShadow:`none`},{zIndex:n,boxShadow:DE})}function zE(e,t){return LE(e,t,{opacity:`0`},{opacity:`1`})}function BE(e,t,n,r){let i=PE(e),a=`sd|${n.startOffset}|${n.maxShift}|${r}|${i}`,o=jE.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(FE(n,r),s),l=e.animate(RE(n,r,i),s),u=e.animate(zE(n,r),{...s,pseudoElement:`::before`});jE.set(e,{key:a,animations:[c,l,u]})}function VE(e,t){let n=PE(e),r=`in|${t}|${n}`,i=jE.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:DE}],{duration:0,fill:`forwards`}),o=e.animate([{opacity:`1`}],{duration:0,fill:`forwards`,pseudoElement:`::before`});jE.set(e,{key:r,animations:[a,o]})}function HE(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=AE(a,i,c.top,c.height,l.height);if(!u){NE(s);continue}if(n){if(o<=0){NE(s);continue}for(let e of Array.from(s.cells))BE(e,n,u,o);continue}let d=Math.max(0,Math.min(a-u.startOffset,u.maxShift));if(d<=0||c.bottom<=i+EE){NE(s);continue}for(let e of Array.from(s.cells))VE(e,d)}}var UE=ei.create({name:`frozenTableHeaders`,addProseMirrorPlugins(){return[new ar({key:new Bn(`frozenTableHeaders`),view(e){let t=null,n=null,r=null,i=null,a=null,o=!1,s=new Set,c=()=>{o||!t||HE(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()},OE);return}l()};return requestAnimationFrame(()=>{if(!o){if(t=e.dom.closest(`[data-testid="editor-scroll-container"]`),t&&kE)try{n=new kE({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`))NE(t)}}}})]}}),WE=`application/x-open-knowledge-sidebar-item+json`,GE={image:!0,video:!0,audio:!0,pdf:!0,text:!0};function KE(e){return JSON.stringify(e)}function qE(e){return e.kind===`folder`?{target:{kind:`folder`,target:e.folderPath,folderPath:e.folderPath},hash:Uo(e.folderPath)}:e.kind===`asset`?{target:{kind:`asset`,target:e.assetPath,assetPath:e.assetPath,mediaKind:e.mediaKind},hash:Jo(e.assetPath)}:{target:us(e.docName,e.size)??{kind:`doc`,target:e.docName,docName:e.docName},hash:Vo(e.docName)}}function JE(e){if(!e||!Array.from(e.types).includes(`application/x-open-knowledge-sidebar-item+json`))return null;let t=e.getData(WE);if(!t)return null;let n;try{n=JSON.parse(t)}catch{return null}if(!YE(n)||n.v!==1||typeof n.kind!=`string`)return null;if(n.kind===`doc`){if(typeof n.docName!=`string`||n.docName.length===0)return null;let e=n.size;return e!==null&&typeof e!=`number`?null:{v:1,kind:`doc`,docName:n.docName,size:e}}if(n.kind===`folder`)return typeof n.folderPath==`string`?{v:1,kind:`folder`,folderPath:n.folderPath}:null;if(n.kind===`asset`){if(typeof n.assetPath!=`string`||n.assetPath.length===0)return null;let e=n.mediaKind;return e!==null&&!XE(e)?null:{v:1,kind:`asset`,assetPath:n.assetPath,mediaKind:e}}return null}function YE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function XE(e){return typeof e==`string`&&Object.hasOwn(GE,e)}function ZE(e,t){return(n,r)=>{let i=r,a=JE(i.dataTransfer);return a?(i.preventDefault(),t?.(a),!0):e(n,i)}}function QE(e,t){let n=qE(e);t(n.target,{tabBehavior:`append`}),Yo(n.hash)}function $E(e){return[...e?[{label:`Toggle header column`,icon:dl,run:e=>e.chain().focus().toggleHeaderColumn().run()}]:[],{label:`Insert column left`,icon:gi,run:e=>e.chain().focus().addColumnBefore().run()},{label:`Insert column right`,icon:ka,run:e=>e.chain().focus().addColumnAfter().run()},{label:`Delete column`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteColumn().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function eD(e){return[...e?[{label:`Toggle header row`,icon:su,run:e=>e.chain().focus().toggleHeaderRow().run()}]:[],{label:`Insert row above`,icon:ft,run:e=>e.chain().focus().addRowBefore().run()},{label:`Insert row below`,icon:Qe,run:e=>e.chain().focus().addRowAfter().run()},{label:`Delete row`,icon:K,separatorBefore:!0,run:e=>e.chain().focus().deleteRow().run()},{label:`Delete table`,icon:Tl,run:e=>e.chain().focus().deleteTable().run()}]}function tD(e){if(!e.isEditable||ze(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 nD(e){let t=(0,$.c)(22),{editor:n,anchor:r,axis:i,items:a}=e,o=(0,Q.useRef)(null),s,c;t[0]!==r||t[1]!==i?(s=()=>{let e=o.current;if(!e)return;let t=i===`column`?`top`:`left`,n=i===`column`?-14:-6;return Os(r,e,()=>{Ps(r,e,{strategy:`absolute`,placement:t,middleware:[Ts(n)]}).then(t=>{let{x:n,y:r}=t;e.style.left=`${n}px`,e.style.top=`${r}px`,e.style.opacity=`1`}).catch(rD)})},c=[r,i],t[0]=r,t[1]=i,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,Q.useEffect)(s,c);let l=i===`column`?hl:qa,u=i===`column`?`h-3 w-7 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`:`h-7 w-3 rounded-full p-0 text-gray-700 dark:text-muted-foreground bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 hover:text-foreground dark:hover:bg-gray-600 dark:hover:text-gray-100 relative before:absolute before:-inset-[6px] before:content-[""]`,d=i===`column`?`Column options`:`Row options`,f;t[4]===l?f=t[5]:(f=(0,Z.jsx)(l,{className:`size-3.5`,"aria-hidden":!0}),t[4]=l,t[5]=f);let p;t[6]!==u||t[7]!==d||t[8]!==f?(p=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`secondary`,className:u,"aria-label":d,children:f})}),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m=i===`column`?`center`:`start`,h=i===`column`?`bottom`:`right`,g;if(t[10]!==n||t[11]!==a){let e;t[13]===n?e=t[14]:(e=e=>(0,Z.jsxs)(Q.Fragment,{children:[e.separatorBefore&&(0,Z.jsx)(no,{}),(0,Z.jsxs)(Ea,{onSelect:()=>e.run(n),children:[(0,Z.jsx)(e.icon,{"aria-hidden":!0}),e.label]})]},e.label),t[13]=n,t[14]=e),g=a.map(e),t[10]=n,t[11]=a,t[12]=g}else g=t[12];let _;t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,Z.jsx)(eo,{align:m,side:h,className:`w-auto min-w-44 whitespace-nowrap`,children:g}),t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;return t[19]!==_||t[20]!==p?(v=(0,Z.jsx)(`div`,{ref:o,"data-testid":`table-cell-handle`,className:`absolute left-0 top-0 z-10 opacity-0`,children:(0,Z.jsxs)(ao,{children:[p,_]})}),t[19]=_,t[20]=p,t[21]=v):v=t[21],v}function rD(){}function iD(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=tD(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=$E(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)(nD,{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=eD(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)(nD,{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 aD(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=Ot.getState(e.state)?.binding;if(!t){le.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-binding`}),s(`no ySync binding on "${n}"`);return}if(typeof t._forceRerender!=`function`){le.count(`ok/editor/walk-currency-disarmed`,{docName:n,reason:`no-force-rerender`}),s(`ySync binding on "${n}" exposes no _forceRerender`);return}le.count(`ok/editor/pattern-d-stale-prewarm`,{docName:n}),t._forceRerender()};return ei.create({name:`walkCurrency`,onBeforeCreate(){t.observeDeep(o),i=!0},onDestroy(){c()},addProseMirrorPlugins(){return[new ar({view:e=>(a||(a=!0,c(),r&&l(e)),{})})]}})}var oD=new WeakMap;function sD(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=Gr(e.color),n.textContent=e.name,t.append(n),t}var cD={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},lD=100,uD=100,dD=3,fD=250;function pD(e){return`contentComponent`in e&&`isEditorContentInitialized`in e}function mD(e,t){let n=w(e);if(!n||t.contains(n.dom))return!1;if(!pD(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 hD(){let e=new sr({extensions:pr});return{mdManager:e,text:wt({mdManager:e}),html:L({mdManager:e}),paste:xe({mdManager:e}),drop:we({mdManager:e})}}function gD(e,t){return t?{collaboration:de.configure({document:e.document,ySyncOptions:{mapping:t}}),guard:[aD({fragment:e.document.getXmlFragment(`default`),docName:e.configuration.name??``})]}:{collaboration:de.configure({document:e.document}),guard:[]}}function _D(e){let{provider:t,placeholder:n,prebuiltMapping:r,onWedged:i}=e,{collaboration:a,guard:o}=gD(t,r);return[...xt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e),Vw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),a,ei.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[nt]}}),ei.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[ht(e,{cursorBuilder:sD})]}}),ei.create({name:`bindingStalenessGuard`,addProseMirrorPlugins(){return[rT({fragment:t.document.getXmlFragment(`default`),docName:t.configuration.name??``,onWedged:i??(()=>{})})]}}),...o,UE]}function vD(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{oD.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=oD.get(e);if(oD.delete(e),r==null)return;let i=performance.now();le(`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:ZE(n.drop,e.onSidebarDrop)},extensions:Zp(_D(e))}}function yD(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i,onWedged:a,onSidebarDrop:o}=e,s=t.document.getXmlFragment(`default`),c=new Map,l=vD({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}=Nt(s,t.schema);r.forEach((e,t)=>{c.set(t,e)}),t.options.content=n.toJSON()},element:null}}var bD=e=>{let t=(0,$.c)(24),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(cD),c=qw(),{principal:l,activeDocName:u,recycleDocument:d,openTarget:f}=mt(),p=n.configuration.name??``,[m]=(0,Q.useState)(hD),h;t[0]!==m||t[1]!==p||t[2]!==f||t[3]!==r||t[4]!==n||t[5]!==d?(h=()=>()=>({editor:new gr(yD({provider:n,placeholder:r,clipboard:m,ctorStart:performance.now(),onWedged:e=>{let{externalSeq:t,appliedSeq:n}=e;le(`ok/editor/binding-wedge-recycle`,{docName:p,externalSeq:t,appliedSeq:n}),d(p)},onSidebarDrop:e=>{QE(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=at(p)??crypto.randomUUID();_=Q.use,v=ee({docName:p,mountId:r,construct:g,sizeStats:e}),t[7]=g,t[8]=p,t[9]=n.document,t[10]=_,t[11]=v}else _=t[10],v=t[11];let y=_(v),b=y.editor,x,S;t[12]===y?(x=t[13],S=t[14]):(x=()=>()=>{ue(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)(xD,{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},xD=e=>{let t=(0,$.c)(98),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:f}=e,p=(0,Q.useRef)(null),[m,h]=(0,Q.useState)(0),g,_;t[0]===f?(g=t[1],_=t[2]):(g=()=>{let e=p.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},_=[f],t[0]=f,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_);let v,b;t[3]!==c||t[4]!==f?(v=()=>{mD(c,f)&&h(SD)},b=[c,f],t[3]=c,t[4]=f,t[5]=v,t[6]=b):(v=t[5],b=t[6]),(0,Q.useEffect)(v,b);let x;t[7]!==c||t[8]!==n.configuration.name?(x=()=>(jt(c,n.configuration.name??null),()=>{jt(c,null)}),t[7]=c,t[8]=n.configuration.name,t[9]=x):x=t[9];let S;t[10]!==c||t[11]!==n?(S=[c,n],t[10]=c,t[11]=n,t[12]=S):S=t[12],(0,Q.useEffect)(x,S);let C;t[13]!==c||t[14]!==n.configuration.name?(C=()=>{let e=n.configuration.name;if(e)return ne(e,c),()=>N(e,c)},t[13]=c,t[14]=n.configuration.name,t[15]=C):C=t[15];let T;t[16]!==c||t[17]!==n?(T=[c,n],t[16]=c,t[17]=n,t[18]=T):T=t[18],(0,Q.useEffect)(C,T);let E;t[19]!==c||t[20]!==n.configuration.name?(E=()=>{let e=n.configuration.name;if(!e)return;let t=null,r=()=>{t=null,kc(e,`wysiwyg`,jc(c))},i=()=>{t&&clearTimeout(t),t=setTimeout(r,120)};return r(),c.on(`selectionUpdate`,i),c.on(`update`,i),()=>{t&&clearTimeout(t),c.off(`selectionUpdate`,i),c.off(`update`,i),kc(e,`wysiwyg`,null)}},t[19]=c,t[20]=n.configuration.name,t[21]=E):E=t[21];let D;t[22]!==c||t[23]!==n?(D=[c,n],t[22]=c,t[23]=n,t[24]=D):D=t[24],(0,Q.useEffect)(E,D);let O;t[25]!==c||t[26]!==n.configuration.name?(O=()=>{},t[25]=c,t[26]=n.configuration.name,t[27]=O):O=t[27];let k;t[28]!==c||t[29]!==n?(k=[c,n],t[28]=c,t[29]=n,t[30]=k):k=t[30],(0,Q.useEffect)(O,k);let A,j;t[31]===c?(A=t[32],j=t[33]):(A=()=>{let e=CD,t=null,n=()=>{if(t||c.isDestroyed)return;let n=w(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 w(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},j=[c],t[31]=c,t[32]=A,t[33]=j),(0,Q.useEffect)(A,j);let M,P;t[34]!==i||t[35]!==c?(M=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!w(c))return;e=!0;let t=y(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})),le(`ok/editor/selection-restore-failed`,{docName:i,message:n})}qt(i)};if(w(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},P=[c,i],t[34]=i,t[35]=c,t[36]=M,t[37]=P):(M=t[36],P=t[37]),(0,Q.useEffect)(M,P);let F,I;t[38]!==u||t[39]!==n.document||t[40]!==l?(F=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},Ln)};c(cD);let f=()=>{if(fr(e),!Tr(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`?Tr(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)}},I=[n.document,u,l],t[38]=u,t[39]=n.document,t[40]=l,t[41]=F,t[42]=I):(F=t[41],I=t[42]),(0,Q.useEffect)(F,I);let L,R;t[43]!==a||t[44]!==i||t[45]!==c||t[46]!==n?(L=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<lD){e+=1,t=window.setTimeout(p,uD);return}r=null,o=null,e=0},u=function(e){let t=w(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=dD,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,fD)))};t=window.setTimeout(o,fD)};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=as(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)}},R=[n,c,i,a],t[43]=a,t[44]=i,t[45]=c,t[46]=n,t[47]=L,t[48]=R):(L=t[47],R=t[48]),(0,Q.useEffect)(L,R);let z,B;t[49]===c?(z=t[50],B=t[51]):(z=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=w(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(Ec,e),()=>window.removeEventListener(Ec,e)},B=[c],t[49]=c,t[50]=z,t[51]=B),(0,Q.useEffect)(z,B);let V;t[52]!==a||t[53]!==i||t[54]!==o||t[55]!==r||t[56]!==s||t[57]!==n.awareness?(V=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:Jw({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]=V):V=t[58];let H;t[59]!==a||t[60]!==i||t[61]!==o||t[62]!==r||t[63]!==s||t[64]!==n?(H=[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]=H):H=t[65],(0,Q.useEffect)(V,H);let U,W;t[66]!==c||t[67]!==r?(U=()=>(d(c,r),()=>{d(c,!1)}),W=[c,r],t[66]=c,t[67]=r,t[68]=U,t[69]=W):(U=t[68],W=t[69]),(0,Q.useEffect)(U,W);let G;t[70]!==a||t[71]!==i||t[72]!==c||t[73]!==r?(G=!r&&(0,Z.jsx)(bE,{editor:c,shortcutEnabled:i===a}),t[70]=a,t[71]=i,t[72]=c,t[73]=r,t[74]=G):G=t[74];let K;t[75]!==c||t[76]!==r?(K=!r&&(0,Z.jsx)(iD,{editor:c}),t[75]=c,t[76]=r,t[77]=K):K=t[77];let q;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,Z.jsx)(`div`,{ref:p,style:{display:`contents`}}),t[78]=q):q=t[78];let J;t[79]!==c||t[80]!==m?(J=(0,Z.jsx)(Ae,{editor:c,className:`tiptap-editor-portal-content h-full`},m),t[79]=c,t[80]=m,t[81]=J):J=t[81];let ee;t[82]!==f||t[83]!==J?(ee=(0,rl.createPortal)(J,f),t[82]=f,t[83]=J,t[84]=ee):ee=t[84];let Y;t[85]===c?Y=t[86]:(Y=(0,Z.jsx)(Gw,{editor:c}),t[85]=c,t[86]=Y);let te;t[87]===c?te=t[88]:(te=_t(c),t[87]=c,t[88]=te);let X;t[89]===te.store?X=t[90]:(X=(0,Z.jsx)(kt,{store:te.store}),t[89]=te.store,t[90]=X);let re;return t[91]!==G||t[92]!==K||t[93]!==ee||t[94]!==Y||t[95]!==X||t[96]!==l?(re=(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:[G,K,q,ee,Y,X]}),t[91]=G,t[92]=K,t[93]=ee,t[94]=Y,t[95]=X,t[96]=l,t[97]=re):re=t[97],re};function SD(e){return e+1}function CD(){return j()}var wD=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 TD(e,t,n,r,i,a){if(e==r)return[];let o=FD(e,t,n,r,i,a),s=ID(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 wD(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new wD(t,t+o,i,i),new wD(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 wD(t,t,i,i+o),new wD(n,n,i+o+c,a)]}if(c==1||l==1)return[new wD(t,n,i,a)];let u=RD(e,t,n,r,i,a);if(u){let[o,s,c]=u;return TD(e,t,o,r,i,s).concat(TD(e,o+c,n,r,s+c,a))}return kD(e,t,n,r,i,a)}var ED=1e9,DD=0,OD=!1;function kD(e,t,n,r,i,a){let o=n-t,s=a-i;if(ED<1e9&&Math.min(o,s)>ED*16||DD>0&&Date.now()>DD)return Math.min(o,s)>ED*64?[new wD(t,n,i,a)]:zD(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);jD.reset(c),MD.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:MD,f=d?null:jD;for(let p=0;p<c;p++){if(p>ED||DD>0&&!(p&63)&&Date.now()>DD)return zD(e,t,n,r,i,a);let m=jD.advance(p,o,s,c,d,!1,l)||MD.advance(p,o,s,c,f,!0,u);if(m)return ND(e,t,n,t+m[0],r,i,a,i+m[1])}return[new wD(t,n,i,a)]}var AD=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}},jD=new AD,MD=new AD;function ND(e,t,n,r,i,a,o,s){let c=!1;return!eO(e,r)&&++r==n&&(c=!0),!eO(i,s)&&++s==o&&(c=!0),c?[new wD(t,n,a,o)]:TD(e,t,r,i,a,s).concat(TD(e,r,n,i,s,o))}function PD(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function FD(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=PD(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-+!eO(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function ID(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=PD(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-+!eO(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function LD(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;;){eO(e,s)||s++;let u=s+o;if(eO(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=FD(e,u,n,r,i+f+d.length,a),c=ID(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 RD(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=RD(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:LD(e,t,n,r,i,a,Math.floor(o/4),-1)}function zD(e,t,n,r,i,a){OD=!0;let o=n-t,s=a-i,c;if(o<s){let s=LD(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=LD(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new wD(t,n,i,a)];let[l,u,d]=c;return TD(e,t,l,r,i,u).concat(TD(e,l+d,n,r,u+d,a))}function BD(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 wD(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function VD(e,t,n){for(;;){BD(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=FD(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wD(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=ID(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wD(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 wD(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 wD(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function HD(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=YD(t,a.fromA,l),f=JD(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 wD(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=JD(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new wD(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=YD(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new wD(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=ZD(n,a.fromB,a.toB),r,o=t<0?-1:XD(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=ZD(t,a.fromA,a.toA),r,o=n<0?-1:XD(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 BD(e,3),e}var UD;try{UD=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function WD(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function GD(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!WD(n):UD?!QD(n)||t==e.length-1?+!!UD.test(String.fromCharCode(n)):UD.test(e.slice(t,t+2))?2:0:0}function KD(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!WD(n):UD?!$D(n)||t==1?+!!UD.test(String.fromCharCode(n)):UD.test(e.slice(t-2,t))?2:0:0}var qD=8;function JD(e,t,n){if(t==e.length||!KD(e,t))return t;for(let r=t,i=t+n,a=0;a<qD;a++){let t=GD(e,r);if(!t||r+t>i)return r;r+=t}return t}function YD(e,t,n){if(!t||!GD(e,t))return t;for(let r=t,i=t-n,a=0;a<qD;a++){let t=KD(e,r);if(!t||r-t<i)return r;r-=t}return t}function XD(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function ZD(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var QD=e=>e>=55296&&e<=56319,$D=e=>e>=56320&&e<=57343;function eO(e,t){return!t||t==e.length||!QD(e.charCodeAt(t-1))||!$D(e.charCodeAt(t))}function tO(e,t,n){let r=n?.override;return r?r(e,t):(ED=(n?.scanLimit??1e9)>>1,DD=n?.timeout?Date.now()+n.timeout:0,OD=!1,VD(e,t,TD(e,0,e.length,t,0,t.length)))}function nO(){return!OD}function rO(e,t,n){return HD(tO(e,t,n),e,t)}var iO=pc.define({combine:e=>e[0]}),aO=mc.define(),oO=pc.define(),sO=cc.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(aO)&&(e=n.value);for(let n of t.state.facet(oO))e=n(e,t);return e}});function cO(e){let t=e.field(sO,!1);if(!t)return null;let n=e.facet(iO);return{chunks:t,side:n?n.side:null}}var lO=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 fO(rO(e.toString(),t.toString(),n),e,t,0,0,nO())}static updateA(e,t,n,r,i){return gO(hO(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return gO(hO(e,r,!1,t.length),e,t,n,i)}};function uO(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 dO(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 fO(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=uO(c.fromA+r,c.fromB+i,t,n),[d,f]=dO(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]=uO(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]=dO(a.toA+r,a.toB+i,t,n),s++}o.push(new lO(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var pO=1e3;function mO(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 hO(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>pO&&([l,d]=mO(e,a-pO,n,!0)),o<t.length-pO&&([u,f]=mO(e,o+pO,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 gO(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=rO(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of fO(h,n,r,d,f,nO()))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 _O={scanLimit:500},vO=hc.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=OO(e))}update(e){(e.docChanged||e.viewportChanged||bO(e.startState,e.state)||xO(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=OO(e.view))}},{decorations:e=>e.deco}),yO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(vO)?.gutter||xc.empty}));function bO(e,t){return e.field(sO,!1)!=t.field(sO,!1)}function xO(e,t){return e.facet(iO)!=t.facet(iO)}var SO=dc.line({class:`cm-changedLine`}),CO=dc.mark({class:`cm-changedText`}),wO=dc.mark({tagName:`ins`,class:`cm-insertedLine`}),TO=dc.mark({tagName:`del`,class:`cm-deletedLine`}),EO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function DO(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,SO),i.add(o,s,n?TO:wO),a&&a.add(o,o,EO);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,SO),a&&a.add(u,u,EO);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,CO),s<t)c++;else break}u=t}}}function OO(e){let t=e.state.field(sO),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(iO),o=n==`a`,s=new fc,c=i?new fc: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))&&DO(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var kO=class extends ic{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}},AO=mc.define({map:(e,t)=>e.map(t)}),jO=cc.define({create:()=>dc.none,update:(e,t)=>{for(let e of t.effects)if(e.is(AO))return e.value;return e.map(t.changes)},provide:e=>_c.decorations.from(e)}),MO=.01;function NO(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 PO(e,t,n){let r=new fc,i=new fc,a=e.state.field(jO).iter(),o=t.state.field(jO).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<-MO?(l-=n,r.add(s,s,dc.widget({widget:new kO(-n),block:!0,side:-1}))):n>MO&&(u+=n,i.add(c,c,dc.widget({widget:new kO(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<MO?r.add(e.state.doc.length,e.state.doc.length,dc.widget({widget:new kO(-p),block:!0,side:1})):p>MO&&i.add(t.state.doc.length,t.state.doc.length,dc.widget({widget:new kO(p),block:!0,side:1}));let m=r.finish(),h=i.finish();NO(m,e.state.field(jO))||e.dispatch({effects:AO.of(m)}),NO(h,t.state.field(jO))||t.dispatch({effects:AO.of(h)})}var FO=mc.define({map:(e,t)=>t.mapPos(e)}),IO=class extends ic{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:FO.of(n)});let{side:r,sibling:i}=e.state.facet(iO);i&&i().dispatch({effects:FO.of(LO(n,e.state.field(sO),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function LO(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 RO=cc.define({create(e){return dc.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(FO)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>_c.decorations.from(e)});function zO({margin:e=3,minSize:t=4}){return RO.init(n=>BO(n,e,t))}function BO(e,t,n){let r=new fc,i=e.facet(iO).side==`a`,a=e.field(sO),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,dc.replace({widget:new IO(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var VO=_c.styleModule.of(new bc({".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`}})),HO=_c.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`}}),UO=new gc,WO=new gc,GO=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||_O;let t=[ac.low(vO),HO,VO,jO,_c.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(AO)))&&this.measure()})],n=[iO.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(yO);let r=sc.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],_c.editorAttributes.of({class:`cm-merge-a`}),WO.of(n),t]}),i=[iO.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(yO);let a=sc.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],_c.editorAttributes.of({class:`cm-merge-b`}),WO.of(i),t]});this.chunks=lO.build(r.doc,a.doc,this.diffConf);let o=[sO.init(()=>this.chunks),UO.of(e.collapseUnchanged?zO(e.collapseUnchanged):[])];r=r.update({effects:mc.appendConfig.of(o)}).state,a=a.update({effects:mc.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 _c({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new _c({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),oc.empty(e[0].startState.doc.length));this.chunks=t==this.a?lO.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):lO.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:aO.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:aO.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(iO),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(WO.reconfigure([iO.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?yO:[]])),a.push(WO.reconfigure([iO.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?yO:[]]))}if(r){let t=UO.reconfigure(e.collapseUnchanged?zO(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(){PO(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=KO(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=KO(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 KO(e){let t=e.nextSibling;return e.remove(),t}var qO=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},JO=ac.low(yc({class:`cm-changeGutter`,markers:e=>e.plugin(vO)?.gutter||xc.empty,widgetMarker:(e,t)=>t instanceof $O?qO:null}));function YO(e){let t=typeof e.original==`string`?uc.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||_O;return[ac.low(vO),ik,HO,_c.editorAttributes.of({class:`cm-merge-b`}),oO.of((e,t)=>{let r=t.effects.find(e=>e.is(XO));return r&&(e=lO.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=lO.updateB(e,t.state.field(ZO),t.newDoc,t.changes,n)),e}),iO.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?uk:void 0,side:`b`}),ZO.init(()=>t),e.gutter===!1?[]:JO,e.collapseUnchanged?zO(e.collapseUnchanged):[],sO.init(e=>lO.build(t,e.doc,n))]}var XO=mc.define(),ZO=cc.define({create:()=>uc.empty,update(e,t){for(let n of t.effects)n.is(XO)&&(e=n.value.doc);return e}}),QO=new WeakMap,$O=class extends ic{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 ek(e,t,n){let r=QO.get(t.changes);if(r)return r;let i=dc.widget({block:!0,side:-1,widget:new $O(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(iO),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(),tk(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),nk(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(ZO).sliceString(t.fromA,t.endA),u=a&&e.facet(Sc),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)==`
28
28
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
29
- `,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;lc(t,{style:t=>Cc(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 QO.set(t.changes,i),i}function tk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(sO).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(ZO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:XO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function nk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(sO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(ZO).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 rk(e){let t=new fc;for(let n of e.field(sO)){let r=e.facet(iO).overrideChunk&&ok(e,n);t.add(n.fromB,n.fromB,ek(e,n,!!r))}return t.finish()}var ik=cc.define({create:e=>rk(e),update(e,t){return t.state.field(sO,!1)==t.startState.field(sO,!1)?e:rk(t.state)},provide:e=>_c.decorations.from(e)}),ak=new WeakMap;function ok(e,t){let n=ak.get(t);if(n!==void 0)return n;n=null;let r=e.field(ZO),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(dc.widget({widget:new sk(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(CO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return ak.set(t,n),n}var sk=class extends ic{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}},ck=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},lk=dc.line({class:`cm-inlineChangedLine`});function uk(e,t,n,r){let i=ok(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ck),n.add(o.from,o.from,lk);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 dk=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),pk=_c.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 mk({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 hk(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Nr(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?dk:fk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=mk({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,pk,_c.lineWrapping,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=cO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=cO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new GO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof _c)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof _c)||ve(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):ms._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,rl.createPortal)((0,Z.jsx)(ci,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(ci,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function gk(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 _k(e,t){return gk(e,`content`,t)}async function vk(e){return gk(e,`mine`)}async function yk(e){return gk(e,`theirs`)}async function bk(e){return gk(e,`delete`)}async function xk(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 Sk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Pi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ko(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),xk(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await _k(u,e);t.ok||hs.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),hs.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(bk),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(yk),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(vk),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(bk),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(hk,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function Ck(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Ft(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 wk=`__back-nav__`;function Tk(e){return e instanceof Le||e instanceof vt||e instanceof Me||e instanceof et||e instanceof At||e instanceof pe?e.docName:null}function Ek(e){if(e instanceof Le){let t=e.docName;return{title:ms._({id:`Jejur6`}),summary:ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof vt){let t=e.docName;return{title:ms._({id:`V7QxyT`}),summary:ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Me){let t=e.docName;return{title:ms._({id:`1di5fu`}),summary:ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:ms._({id:`wvbc1r`}),summary:ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:ms._({id:`Gfr4fu`}),summary:ms._({id:`j6LB7S`})};if(e instanceof pe){let t=e.docName;return{title:ms._({id:`vv7kpg`}),summary:ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:ms._({id:`W5A0Ly`});return{title:ms._({id:`29VNqC`}),summary:t}}function Dk(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=Ek(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(OS,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(ci,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(Tk(n)??i),o(a),r(wk))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Ok(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)(Dk,{...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]===wk){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}: ${Ek(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)(ce,{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 kk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function Ak(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>kk(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=Mn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(jk,{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)(Mk,{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 jk(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 Mk(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function Nk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function Pk(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>Nk(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Mn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=yr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let H=B,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=yr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:ga},t[28]=Y):Y=t[28];let te=wi(ia(va,ee),ia(ba,Y)),ne;t[29]!==z||t[30]!==p?(ne=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=oa(n,t);(!Object.hasOwn(p,e)||!Cr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=ne):ne=t[31];let X=ne,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=MC(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let ge=he,_e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=_e):_e=t[45];let ve=_e,ye;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(ye=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=N({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=ye):ye=t[50];let be=ye,xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){S(null)},t[51]=xe):xe=t[51];let Se=xe,Ce;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){w({key:e,draft:e,error:null})},t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Te):Te=t[53];let Ee=Te,De;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){w(null)},t[54]=De):De=t[54];let Oe=De,ke;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(ke=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=ke):ke=t[59];let Ae=ke,je;t[60]!==p||t[61]!==m?(je=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=je):je=t[62];let Me=je,Ne;if(t[63]!==Me){Ne=new Map;for(let e of Me)Ne.set(e,(Ne.get(e)??0)+1);t[63]=Me,t[64]=Ne}else Ne=t[64];if(Me.length===0&&!x&&!h)return null;let Pe=!g,Fe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>_(!e),t[65]=Fe):Fe=t[65];let Ie=!g,Le;t[66]===Ie?Le=t[67]:(Le=(0,Z.jsx)(No,{"data-expanded":Ie,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Ie,t[67]=Le);let Re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Re):Re=t[68];let ze;t[69]===Le?ze=t[70]:(ze=(0,Z.jsx)(Po,{asChild:!0,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Le,Re]})}),t[69]=Le,t[70]=ze);let Be;t[71]===h?Be=t[72]:(Be=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Lo,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Be);let Ve;if(t[73]!==Me){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],Ve=Me.map(e),t[73]=Me,t[74]=Ve}else Ve=t[74];let He;if(t[76]!==z||t[77]!==Ae||t[78]!==Ne||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Me||t[85]!==k||t[86]!==X){let e;t[88]!==z||t[89]!==Ae||t[90]!==Ne||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==X?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??An(n),i=C?.key===e?C:null,a=(Ne.get(e)??0)>1;return(0,Z.jsx)(Ii,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>we(e),onChangeDraft:Ee,onCommit:Ae,onCancel:Oe},onCommit:t=>z(e,t),onChangeType:t=>X(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=Ae,t[90]=Ne,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=X,t[98]=e):e=t[98],He=Me.map(e),t[76]=z,t[77]=Ae,t[78]=Ne,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Me,t[85]=k,t[86]=X,t[87]=He}else He=t[87];let Ue;t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsx)(ma,{items:Ve,strategy:Ki,children:He}),t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]!==J||t[103]!==te||t[104]!==Ue?(We=(0,Z.jsx)(Za,{sensors:te,collisionDetection:Sa,onDragEnd:J,children:Ue}),t[102]=J,t[103]=te,t[104]=Ue,t[105]=We):We=t[105];let Ge;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ge=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Ii,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Fk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ge):Ge=t[110];let Ke;t[111]!==r||t[112]!==x||t[113]!==be?(Ke=x?(0,Z.jsx)(na,{draft:x,onChangeName:ve,onChangeType:me,onChangeValue:ge,onCommit:be,onCancel:Se}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ie,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=be,t[114]=Ke):Ke=t[114];let qe;t[115]!==Be||t[116]!==We||t[117]!==Ge||t[118]!==Ke?(qe=(0,Z.jsxs)(Mo,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Be,We,Ge,Ke]}),t[115]=Be,t[116]=We,t[117]=Ge,t[118]=Ke,t[119]=qe):qe=t[119];let Je;t[120]!==Pe||t[121]!==ze||t[122]!==qe?(Je=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Fo,{open:Pe,onOpenChange:Fe,children:[ze,qe]})}),t[120]=Pe,t[121]=ze,t[122]=qe,t[123]=Je):Je=t[123];let Ye;return t[124]!==a||t[125]!==Je?(Ye=(0,Z.jsx)(Oi,{binding:a,children:Je}),t[124]=a,t[125]=Je,t[126]=Ye):Ye=t[126],Ye}function Fk(){}var Ik=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Lk(e){let t=e.threshold??Ik;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Rk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var zk=v(`ACTIVITY_MOUNT_LIMIT`,3);function Bk(){return n(()=>import(`./SourceEditor-D_Cx18k-.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Vk=(0,Q.lazy)(async()=>({default:(await Bk()).SourceEditor}));function Hk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Uk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?ms._({id:`Sc1bKE`,values:{docName:e}}):ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?ms._({id:`bmC18N`,values:{docName:e}}):ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function Wk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Wt,{name:`activity-pool`,children:(0,Z.jsx)(Gk,{...e})}),t[0]=e,t[1]=n),n}function Gk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=mt(),{pages:u,loading:d}=rs(),f=Hk(c,n,zk),p=(0,Q.useRef)(``),h=f.map(Kk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}le(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Ut(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)(Qk,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let 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 Kk(e){return e.docName}function qk(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&&le(`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&&(le(`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&&le(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Jk(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)(zx,{}),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)(Vk,{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 Yk(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)(Ga,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{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)(ci,{type:`button`,onClick:Xk,children:[(0,Z.jsx)(Ga,{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 Xk(){return window.location.reload()}function Zk(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 Qk(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=Uk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=vw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Lk({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&le(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>y(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{Rk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(le(`ok/cold/first-toggle`,{docName:n.docName,mountId:at(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(Yk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Ok,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Zk,{html:j}):(0,Z.jsx)(zx,{}),children:(0,Z.jsx)(Ck,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(Sk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Ak,{provider:n.provider}),!i&&(0,Z.jsx)(Pk,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Jk,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(bD,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(qk,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function $k(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function eA(e){let{value:t,unit:n}=$k(e);return n===`rem`?t*16:t}function tA(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var nA=3600*24*7;function rA(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?iA:m,O=g===void 0?nA: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=eA(b),J;t[6]===x?J=t[7]:(J=eA(x),t[6]=x,t[7]=J);let ee=J,Y;t[8]!==E||t[9]!==k?(Y=function(e){E&&(P.current=!0,j.current=H.current?0:eA(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]=Y):Y=t[10];let te=Y,ne,X;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=$k(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=tA(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=tA(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)}},X=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=X):(ne=t[24],X=t[25]),(0,Q.useEffect)(ne,X);let re;return t[26]===te?re=t[27]:(re={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=re),re}function iA(){}var aA=3600*24*7,oA=`18rem`,sA=`3rem`,cA=`app-file-sidebar`,lA=`14.625rem`,uA=`32rem`,dA=`sidebar_width`,fA=/^\d+(?:\.\d+)?(?:rem|px)$/,pA=Q.createContext(null);function mA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${dA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return fA.test(n)?n:e}function hA(){let e=Q.use(pA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function gA(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?oA:c,[u]=Q.useState(vA),d;t[8]===u?d=t[9]:(d=()=>Ow(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>mA(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=Fw();return Lw(`left`,Ow(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),Rw(`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(_A)},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: ${Tw}px)`),t=()=>{let e=Ow(u,window.innerWidth,`left`);p(e),C(Lw(`left`,e,Fw())===`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(cA)?.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=>{nc(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":sA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=oi(`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)(pA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function _A(e){return!e}function vA(){return Or()}function yA(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=hA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=oi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=oi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=oi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:cA,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function bA(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=hA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=ci,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=cA,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=oi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Yt,{}):(0,Z.jsx)(Bl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function xA(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=hA(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:lA,maxResizeWidth:uA,setIsDraggingRail:h,widthCookieName:dA,widthCookieMaxAge:aA},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=rA(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=oi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function SA(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}=hA(),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=oi(`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 CA(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=oi(`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 wA(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=oi(`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 TA(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=oi(`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 EA(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=oi(`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 DA(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=oi(`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 OA=ii(`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 kA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?si:`button`,{state:m}=hA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=oi(OA({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)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{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)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function AA(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 jA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Rr.safeParse(t);return n.success?n.data.currentBranch??null:null}var MA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:AA({fetchBranch:jA,subscribeToEvent:ns}),NA=MA.subscribe,PA=MA.getSnapshot;function FA(){return(0,Q.useSyncExternalStore)(NA,PA,PA)}function IA(){let e=(0,$.c)(6),t=FA(),n=Oa(),{state:r}=hA(),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&&ua(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 LA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=IA();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(RA,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function RA(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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{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)(Oe,{"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 zA(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=oi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function BA(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=oi(`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 VA(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=oi(`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 HA(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=oi(`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 UA(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=oi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(No,{}),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 WA=1,GA=2,KA=4;function qA(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=je(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>KA?[...u.slice(0,WA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(WA,-GA)},...u.slice(-GA).map((e,t)=>d(e,u.length-GA+t))]:u.map((e,t)=>d(e,t));a=zA,t[8]===r?c=t[9]:(c=oi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=BA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(JA)}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 JA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(UA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(VA,{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)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(VA,{className:`min-w-0`,children:(0,Z.jsx)(HA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var YA={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`},XA=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`,...YA,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},ZA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},QA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function $A(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=tc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=rc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(qA,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(js,{children:(0,Z.jsx)(QA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(yo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(Is,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ZA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(yo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ns,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(Is,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(xo,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=ci,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ns,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function ej(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function tj(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=oi(`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)(Vd,{"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 nj=ii(`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 rj(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=oi(nj({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)(Hd,{"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 ij(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=oi(`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)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aj(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=oi(`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)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var oj=`ok-terminal-height-v1`,sj=.5;function cj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*sj))}function lj(e,t){let n=cj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function uj(){return typeof window>`u`?0:window.innerHeight}function dj(e,t){try{let n=e??localStorage,r=t??uj(),i=n.getItem(oj);if(i==null)return lj(240,r);let a=Number.parseInt(i,10);return lj(Number.isFinite(a)?a:240,r)}catch{return 240}}function fj(e,t,n){try{let r=t??localStorage,i=n??uj();r.setItem(oj,String(lj(e,i)))}catch{}}function pj(){try{return typeof localStorage>`u`?240:dj()}catch{return 240}}var mj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-BPH4SxUM.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function hj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Ai(),l=lo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){hs.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||hs.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){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 i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(ce,{fallbackRender:_j,onError:gj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(bj,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function gj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _j(e){return(0,Z.jsx)(vj,{...e})}function vj(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(ci,{onClick:yj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function yj(){return window.location.reload()}function bj(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(ci,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xj(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:c,onClose:l,children:u,className:d}=e,{_:f}=i(),p;t[0]===d?p=t[1]:(p=oi(`flex min-h-0 min-w-0 flex-1 flex-col`,d),t[0]=d,t[1]=p);let m;t[2]===f?m=t[3]:(m=f({id:`1MGRQl`}),t[2]=f,t[3]=m);let h;if(t[4]!==f||t[5]!==r||t[6]!==l||t[7]!==o||t[8]!==n){let e;t[10]!==f||t[11]!==r||t[12]!==l||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:oi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(ij,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":f({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:oi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=f,t[11]=r,t[12]=l,t[13]=o,t[14]=e):e=t[14],h=n.map(e),t[4]=f,t[5]=r,t[6]=l,t[7]=o,t[8]=n,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,Z.jsx)(rj,{variant:`line`,"aria-label":m,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===f?_=t[19]:(_=f({id:`AB4qw9`}),t[18]=f,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==_?(y=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:c,children:v})}),t[21]=c,t[22]=_,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`AB4qw9`})}),t[24]=b):b=t[24];let x;t[25]===y?x=t[26]:(x=(0,Z.jsxs)(Is,{children:[y,b]}),t[25]=y,t[26]=x);let S;t[27]!==g||t[28]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[g,x]}),t[27]=g,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==r||t[31]!==u||t[32]!==a||t[33]!==p||t[34]!==S?(C=(0,Z.jsxs)(tj,{value:r,onValueChange:a,className:p,children:[S,u]}),t[30]=r,t[31]=u,t[32]=a,t[33]=p,t[34]=S,t[35]=C):C=t[35],C}var Sj=`terminal-dock-panel`;function Cj(e){return`terminal-session-${e}`}function wj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Tj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Nr(),d=Tx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:Cj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?Cj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=Cj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>wj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Oj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(Dj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{fj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(Sj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>wj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let Y;t[26]!==n.editor||t[27]!==g.length?(Y=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=Y):Y=t[28];let te;t[29]!==n||t[30]!==g.length?(te=[n,g.length],t[29]=n,t[30]=g.length,t[31]=te):te=t[31],(0,Q.useEffect)(Y,te);let ne,X;t[32]!==d||t[33]!==a?(ne=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},X=[a,d],t[32]=d,t[33]=a,t[34]=ne,t[35]=X):(ne=t[34],X=t[35]),(0,Q.useEffect)(ne,X);let re,ie;t[36]===p?(re=t[37],ie=t[38]):(re=()=>{p&&document.getElementById(Sj)?.contains(document.activeElement)&&f.current?.focus()},ie=[p],t[36]=p,t[37]=re,t[38]=ie),(0,Q.useLayoutEffect)(re,ie);let ae,oe;t[39]===p?(ae=t[40],oe=t[41]):(ae=()=>{p||wj(x.current)},oe=[p],t[39]=p,t[40]=ae,t[41]=oe),(0,Q.useEffect)(ae,oe);let se;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),se=g.map(e),t[42]=l,t[43]=g,t[44]=se}else se=t[44];let ce=se,le=F||void 0,ue;t[47]===r?ue=t[48]:(ue=(0,Z.jsx)(qC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(JC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=de):de=t[49];let fe;t[50]===u?fe=t[51]:(fe=Lc(u),t[50]=u,t[51]=fe);let pe;t[52]===fe.background?pe=t[53]:(pe={backgroundColor:fe.background},t[52]=fe.background,t[53]=pe);let me=a?`${N}px`:0,he;t[54]!==o||t[55]!==a?(he=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=he):he=t[56];let ge=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,_e;t[57]===ge?_e=t[58]:(_e=oi(`flex flex-col`,ge),t[57]=ge,t[58]=_e);let ve;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==ce?(ve=g.length>0?(0,Z.jsx)(xj,{sessions:ce,activeSessionId:y,onSelect:b,onTabActivate:Ej,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(aj,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(hj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=ce,t[64]=ve):ve=t[64];let ye;t[65]!==p||t[66]!==d||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==_e||t[71]!==ve?(ye=(0,Z.jsx)(qC,{id:Sj,style:pe,panelRef:d,defaultSize:me,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:he,inert:p,className:_e,children:ve}),t[65]=p,t[66]=d,t[67]=pe,t[68]=me,t[69]=he,t[70]=_e,t[71]=ve,t[72]=ye):ye=t[72];let be;return t[73]!==le||t[74]!==ue||t[75]!==ye?(be=(0,Z.jsxs)(KC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":le,children:[ue,de,ye]}),t[73]=le,t[74]=ue,t[75]=ye,t[76]=be):be=t[76],be}function Ej(e){return queueMicrotask(()=>wj(e))}function Dj(){return pj()}function Oj(){}var kj=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-CvNu5QeL.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent})),Aj=`300px`,jj=`600px`;function Mj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Pj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Nj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Wt,{name:`editor-area`,children:(0,Z.jsxs)(AC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Nj(){let e=(0,$.c)(5),t=Dg(),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)(VC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function Pj(e){let t=(0,$.c)(157),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=mt(),{openDocumentTransition:C}=Dt(),{requestAddProperty:w}=MC(),T=gw(g,h),E=yw(h,n===`source`?`source`:`wysiwyg`),D=zw(g),O=D===`connected`||D===`synced`,k=vw(h)===`conflict`,[A,j]=(0,Q.useState)(!1),M,N;t[0]!==g||t[1]!==A?(M=()=>{g!=null&&!A&&j(!0)},N=[g,A],t[0]=g,t[1]=A,t[2]=M,t[3]=N):(M=t[2],N=t[3]),(0,Q.useEffect)(M,N);let P=(0,Q.useDeferredValue)(h),F=_?.kind===`missing`,I=!!h&&_?.kind!==`folder`,L;t[4]!==m||t[5]!==F?(L=F?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=F,t[6]=L):L=t[6];let R=L,[z]=(0,Q.useState)(Lj),B=z!==null,V;t[7]===z?V=t[8]:(V=()=>Ow(z,window.innerWidth,`right`),t[7]=z,t[8]=V);let[H,U]=(0,Q.useState)(V),W=(0,Q.useRef)(H),G,K;t[9]===H?(G=t[10],K=t[11]):(G=()=>{W.current=H},K=[H],t[9]=H,t[10]=G,t[11]=K),(0,Q.useEffect)(G,K);let q=Tx(),J;t[12]===H?J=t[13]:(J=()=>Lw(`right`,H,Fw())===`collapsed`,t[12]=H,t[13]=J);let[ee]=(0,Q.useState)(J),[Y,te]=(0,Q.useState)(ee),ne=(0,Q.useRef)(Y),X,re;t[14]===Y?(X=t[15],re=t[16]):(X=()=>{ne.current=Y},re=[Y],t[14]=Y,t[15]=X,t[16]=re),(0,Q.useEffect)(X,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(Ij),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{Cw(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==q?(ge=function(){if(q.current==null)return;let e=W.current;Y?(Rw(`right`,e,`open`),q.current?.expand()):(Rw(`right`,e,`collapsed`),q.current?.collapse())},t[20]=Y,t[21]=q,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==z||t[24]!==q?(ve=()=>{let e=window.matchMedia(`(min-width: ${Ew}px)`),t=()=>{let e=Ow(z,window.innerWidth,`right`);U(e);let t=Lw(`right`,e,Fw())===`collapsed`;te(t),t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[z,q],t[23]=z,t[24]=q,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==B||t[29]!==q?(be=()=>{if(me==null||B)return;let e=new ResizeObserver(()=>{ne.current||oe.current||q.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,B,q],t[27]=me,t[28]=B,t[29]=q,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==o||t[33]!==q?(Se=()=>{let e=e=>{o(e),q.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},Ce=[o,q],t[32]=o,t[33]=q,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==S||t[37]!==q?(we=()=>{S!==0&&q.current?.expand()},Te=[S,q],t[36]=S,t[37]=q,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Fe,Ie]=(0,Q.useState)(null),Le=_?.kind===`large-file`?_.docName:h,Re,ze;t[52]===Le?(Re=t[53],ze=t[54]):(Re=()=>{if(Le&&Le!==Pe.current){let e=Pe.current;Pe.current=Le,Ie(e)}},ze=[Le],t[52]=Le,t[53]=Re,t[54]=ze),(0,Q.useEffect)(Re,ze);let Ve;t[55]===C?Ve=t[56]:(Ve=function(e){let t=Vo(e);window.location.hash===t?C(e):window.location.hash=t},t[55]=C,t[56]=Ve);let He=Ve,Ue,We=null;if(_?.kind===`large-file`){let e;t[57]!==He||t[58]!==Fe?(e=Fe?{previousDocName:Fe,onNavigateBack:He}:void 0,t[57]=He,t[58]=Fe,t[59]=e):e=t[59];let n;t[60]!==_.docName||t[61]!==_.limit||t[62]!==_.size||t[63]!==e?(n=(0,Z.jsx)(EC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[60]=_.docName,t[61]=_.limit,t[62]=_.size,t[63]=e,t[64]=n):n=t[64],Ue=n}else if(_?.kind===`folder`){let e;if(t[65]===_.folderPath?e=t[66]:(e=(0,Z.jsx)(SC,{folderPath:_.folderPath}),t[65]=_.folderPath,t[66]=e),Ue=e,y===`agent`&&b!==null){let e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(JC,{withHandle:!0}),t[67]=e):e=t[67];let n;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(qC,{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)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(kj,{showBackButton:!1})})})]}),t[68]=n):n=t[68],We=n}}else if(_?.kind===`asset`){let e;t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(Rx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],Ue=e}else if(!g||!h)if((typeof window<`u`?is(window.location.hash):null)!==null)if(c!=null&&A){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[72]=e):e=t[72],Ue=e;let n;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(JC,{withHandle:!0,disabled:!0}),t[73]=n):n=t[73];let r=ee?0:`${se}px`,i;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[74]=i):i=t[74];let a;t[75]===r?a=t[76]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(qC,{id:`doc-panel`,defaultSize:r,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[75]=r,t[76]=a),We=a}else{let e;return t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[77]=e):e=t[77],e}else{let e;t[78]===f?e=t[79]:(e=(0,Z.jsx)(HS,{terminalVisible:f}),t[78]=f,t[79]=e),Ue=e}else{let e=n===`source`,i=!O,s=Y,c;t[80]!==h||t[81]!==w?(c=function(){h&&w(h)},t[80]=h,t[81]=w,t[82]=c):c=t[82];let l=c,u=P??h,d=Fe??void 0,f;t[83]!==R||t[84]!==e||t[85]!==He||t[86]!==v||t[87]!==u||t[88]!==d?(f=(0,Z.jsx)(Wk,{activeDocName:u,isSourceMode:e,editorPlaceholder:R,previousDocName:d,onNavigateBack:He,onRecycle:v}),t[83]=R,t[84]=e,t[85]=He,t[86]=v,t[87]=u,t[88]=d,t[89]=f):f=t[89];let p;t[90]!==h||t[91]!==e?(p=(0,Z.jsx)(fw,{activeDocName:h,isSourceMode:e}),t[90]=h,t[91]=e,t[92]=p):p=t[92];let m;t[93]!==h||t[94]!==P?(m=ej({activeDocName:h,deferredActiveDocName:P,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Be(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(zx,{}),h===null?null:(0,Z.jsx)(DC,{docName:h})]}):null,t[93]=h,t[94]=P,t[95]=m):m=t[95];let g;t[96]!==f||t[97]!==p||t[98]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[96]=f,t[97]=p,t[98]=m,t[99]=g):g=t[99];let _;t[100]!==h||t[101]!==k||t[102]!==s||t[103]!==e||t[104]!==r||t[105]!==l||t[106]!==i||t[107]!==_e?(_=!k&&(0,Z.jsx)($A,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[100]=h,t[101]=k,t[102]=s,t[103]=e,t[104]=r,t[105]=l,t[106]=i,t[107]=_e,t[108]=_):_=t[108];let b;t[109]!==g||t[110]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[109]=g,t[110]=_,t[111]=b):b=t[111];let S;t[112]!==E||t[113]!==I||t[114]!==T?(S=(0,Z.jsx)(LA,{stats:T,selectionStats:E,showStats:I}),t[112]=E,t[113]=I,t[114]=T,t[115]=S):S=t[115];let C;t[116]!==b||t[117]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[116]=b,t[117]=S,t[118]=C):C=t[118],Ue=C;let D=B&&Y,A;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=A):A=t[119];let j;t[120]===D?j=t[121]:(j=(0,Z.jsx)(JC,{withHandle:!0,disabled:D,onPointerDown:A}),t[120]=D,t[121]=j);let M=ee?0:`${se}px`,N;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{te(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[122]=N):N=t[122];let F=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,L;t[123]===F?L=t[124]:(L=oi(`flex flex-col bg-muted/20`,F),t[123]=F,t[124]=L);let z;t[125]!==h||t[126]!==a||t[127]!==y||t[128]!==e||t[129]!==o?(z=(0,Z.jsx)(jy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[125]=h,t[126]=a,t[127]=y,t[128]=e,t[129]=o,t[130]=z):z=t[130];let V;t[131]!==Y||t[132]!==q||t[133]!==M||t[134]!==L||t[135]!==z?(V=(0,Z.jsx)(qC,{id:`doc-panel`,panelRef:q,defaultSize:M,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,onResize:N,inert:Y,className:L,children:z}),t[131]=Y,t[132]=q,t[133]=M,t[134]=L,t[135]=z,t[136]=V):V=t[136];let H;t[137]!==j||t[138]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[j,V]}),t[137]=j,t[138]=V,t[139]=H):H=t[139],We=H}let Ge;t[140]!==u||t[141]!==c||t[142]!==p||t[143]!==f||t[144]!==Ue?(Ge=c==null?Ue:(0,Z.jsx)(Tj,{bridge:c,visible:f,onVisibleChange:u??Fj,launch:p,children:Ue}),t[140]=u,t[141]=c,t[142]=p,t[143]=f,t[144]=Ue,t[145]=Ge):Ge=t[145];let Ke=Ge,qe=ie||void 0,Je;t[146]!==ee||t[147]!==We?(Je=We!=null&&!ee?{}:{defaultSize:`100%`},t[146]=ee,t[147]=We,t[148]=Je):Je=t[148];let Ye=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Xe;t[149]!==Ke||t[150]!==Je||t[151]!==Ye?(Xe=(0,Z.jsx)(qC,{minSize:`30%`,...Je,className:Ye,children:Ke}),t[149]=Ke,t[150]=Je,t[151]=Ye,t[152]=Xe):Xe=t[152];let Ze;return t[153]!==We||t[154]!==qe||t[155]!==Xe?(Ze=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(KC,{orientation:`horizontal`,"data-dragging":qe,children:[Xe,We]})}),t[153]=We,t[154]=qe,t[155]=Xe,t[156]=Ze):Ze=t[156],Ze}function Fj(){}function Ij(){return ww()}function Lj(){return Or()}function Rj(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 zj(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 Bj=1e3,Vj=!1;function Hj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Uj(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:Si(i)?a=i:(a=void 0,Vj||(Vj=!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`&&(Hj({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=zj(i),{current:c,crossDoc:l}=a?_i(a,n,Date.now()):{current:[],crossDoc:[]},u=Wj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Rj(e.current,p)&&Rj(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,Bj);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 Wj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Gj=`sync-status`;function Kj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){hs.dismiss(Gj);return}s.current=!0,hs.warning(r({id:`HGNCsl`}),{id:Gj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,hs.success(r({id:`GhjUB_`}),{id:Gj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var qj=4,Jj=3,Yj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Yj));function Xj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Yj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Zj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Xj(n),c=s.kind===`animal`?Yj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=er(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Gr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function $j(e){let t=Zj[e.icon];return e.displayName||t||ms._({id:`iEQQyu`})}function eM(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 tM(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=mt(),{presence:u,agentId:d}=n,f=$j(u),p=eM(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(js,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ns,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function nM(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?ms._({id:`9euN0m`,values:{count:n}}):ms._({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)(J,{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)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(b,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(fe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function rM(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function iM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=mt(),{current:s,crossDoc:c}=Uj(t,r,n);if(Kj(zw(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,qj),n;e[6]===s?n=e[7]:(n=s.slice(qj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Jj),d;e[8]===c?d=e[9]:(d=c.slice(Jj),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=>rM(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)(nM,{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=>rM(e,p,!0,m)),f.length>0?(0,Z.jsx)(nM,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var aM=new Set([`.md`,`.mdx`]);function oM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function sM(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function cM(e){return aM.has(oM(e).toLowerCase())}function lM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=oM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:oM(t)?t:sM(t,r)}}var uM=`.md`,dM=/\.(md|mdx)$/i;function fM(e,t=uM){return`${e}${t}`}function pM(e){return BM(e).replace(dM,``)}function mM(e){return Zo(e)?_M(e.path):Ro(e)?e.path:fM(e.docName,e.docExt)}function hM(e){let t=BM(e).match(dM);return t?`.${t[1].toLowerCase()}`:void 0}function gM(e){return BM(e)}function _M(e){let t=BM(e.trim());return t?`${t}/`:``}function vM(e){return e.endsWith(`/`)?gM(e):pM(e)}function yM(e){return e.map(mM)}function bM(e){return[...e].sort().join(`\0`)}function xM(e){return bM(yM(e))}function SM(e){let t=new Set;for(let n of e){if(Zo(n)){let e=_M(n.path);e&&t.add(e)}let e=(Zo(n)||Ro(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Zo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function CM(e){if(!e)return[];let t=BM(e.replace(dM,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function wM(e,t,n){let r=hM(e);if(r)return r;let i=n.find(e=>fs(e)&&e.docName===t);return i?i.docExt??uM:zM(e).includes(`.`)?void 0:uM}function TM(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!Ro(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function EM(e,t,n){if(hM(e))return null;let r=n.find(e=>Ro(e)&&e.path===t);return r?r.path:zM(e).includes(`.`)?t:TM(t,n)}function DM(e,t){let n=e.kind===`directory`,r=n?gM(e.path):pM(e.path);if(n)return{kind:`folder`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!0)};let i=EM(e.path,r,t);if(i)return{kind:`asset`,name:BM(zM(i)),path:i,treePath:i};let a=wM(e.path,r,t);return{kind:`file`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!1),docExt:a}}function OM(e){return e.kind===`directory`?gM(e.path):e.path}function kM(e,t){return t?_M(e):dM.test(e)?e:`${e}${uM}`}function AM(e,t,n){let r=_M(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${uM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function jM(e,t){return e===`file`?kM(t,!1):`${gM(t)}/index${uM}`}function MM(e,t){return t.kind===`root`||t.directoryPath==null?zM(e):`${t.directoryPath}${zM(e)}`}function NM(e,t){if(t)return gM(_M(e));let n=pM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function PM(e,t){let n=gM(_M(e));return n?`${n}/${t}`:t}function FM(e,t){return(t.path??PM(e,t.src)).replace(/^\/+/,``)}function IM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function LM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function RM(e,t){let n=oM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:pM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:nr(i),modified:r,size:t.size}}function zM(e){let t=BM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function BM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function VM(e,t){return t.trim()}function HM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function UM(e,t){let n=VM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function WM(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(fs(e)){let t=s.get(fM(e.docName,e.docExt));if(t){let n=Bo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:nr(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(Zo(e))return{...e,path:ZM(e.path,n)};if(Ro(e)){let t=s.get(e.path);return t&&cM(t)?{kind:`document`,docName:pM(t),docExt:oM(t),size:e.size,modified:e.modified}:{...e,path:t??ZM(e.path,n)}}return e})}function GM(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=>fs(e)?!i.has(e.docName)&&!tN(e.docName,n):Zo(e)?!tN(e.path,n):Ro(e)?!a.has(e.path)&&!tN(e.path,n):!0)}function KM(e,t){if(e.kind!==`asset`||t.some(t=>Ro(t)&&t.path===e.path))return e;let n=TM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function qM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>QM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>fs(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=>Zo(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(fs(i)){let e=eN(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Zo(i)){let e=$M(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function JM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function YM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function XM(e,t){let n=e.kind===`file`?fM(e.path,e.docExt):e.path;return Qg(t.contentDir,n,t.pathSeparator)}function ZM(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 QM(e,t){return fs(e)&&fs(t)?e.docName===t.docName:Zo(e)&&Zo(t)||Ro(e)&&Ro(t)?e.path===t.path:!1}function $M(e,t,n){return e===t?n:eN(e,t,n)}function eN(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function tN(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function nN(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)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function rN(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=oi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iN(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)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function aN(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)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function oN(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=oi(`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)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sN(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=oi(`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)(yd,{"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 cN(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=oi(`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)(No,{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)(wd,{"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 lN(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=oi(`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)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uN(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=oi(`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)(xd,{children:(0,Z.jsx)(ko,{})})}),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)(bd,{"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 dN(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=oi(`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)(vd,{"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 fN(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=oi(`-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)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pN=`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`,mN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,hN={start:[Wi.Space],cancel:[Wi.Esc],end:[Wi.Space,Wi.Enter]};function gN(e){return oi(pN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function _N(e){return e?void 0:-1}function vN({className:e,isDragging:t}){return oi(e,t&&mN)}function yN(e){return e.code===Wi.Enter&&e.target===e.currentTarget}function bN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&yN(e)?`activate-tab`:`delegate-sortable`}function xN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Ma.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 SN(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function CN(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 wN=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 Sa(e)},TN=[`.md`,`.mdx`],EN=`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`,DN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,ON=oi(DN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),kN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function AN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function jN(e){let t=Vo(e);window.location.hash!==t&&(window.location.hash=t)}function MN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function NN(e,t){let n=[t,...TN].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 PN(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:_}=Ri(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=xN({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=bN({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=vN({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 FN(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Je(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Je(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(rN,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(sN,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(sN,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(sN,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fN,{}),(0,Z.jsx)(sN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(oN,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(nN,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function IN(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=gN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=_N(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function LN(e){let t=(0,$.c)(1),{docName:n}=e;if(vw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Lo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function RN(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=mt(),{_:T}=i(),{pageMeta:E}=rs(),D=(0,Q.useRef)(null),[O,k]=(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=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Xe(a):t?He(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,Y;e[10]===t?(ee=e[11],Y=e[12]):(ee=()=>{W.current=t},Y=[t],e[10]=t,e[11]=ee,e[12]=Y),(0,Q.useEffect)(ee,Y);let te,ne;e[13]===J?(te=e[14],ne=e[15]):(te=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[J],e[13]=J,e[14]=te,e[15]=ne),(0,Q.useEffect)(te,ne);let X,re;e[16]===j?(X=e[17],re=e[18]):(X=()=>{j&&(z.current?.focus(),z.current?.select())},re=[j],e[16]=j,e[17]=X,e[18]=re),(0,Q.useEffect)(X,re);let ie,ae;e[19]!==v||e[20]!==j?(ie=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},ae=[v,j],e[19]=v,e[20]=j,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},se=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},ce=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){se();return}let t=VM(`file`,NN(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===U.current){z.current?.focus();return}if(!HM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=UM({kind:`file`,path:e,name:r},t);B.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(H.current){R(!1),B.current=!1;return}let r=await _e(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Zr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=JM(o,a);Bt(a);let c=!0;try{let e=YM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),ss([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),hs.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&jN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,fe;e[25]===O?fe=e[26]:(fe=CN(O),e[25]=O,e[26]=fe);let pe;e[27]===fe?pe=e[28]:(pe=[fe],e[27]=fe,e[28]=pe);let me=pe,he;e[29]!==u||e[30]!==f||e[31]!==de?(he=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=de,e[32]=he):he=e[32];let ge=he,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:ga,keyboardCodes:hN},e[34]=ye):ye=e[34];let be=wi(ia(va,ve),ia(ba,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(SN(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(Te=function(e){we();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Bi([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=le?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=oi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=MN,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=oi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let Me=Za,Ne=wN,Pe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={container:typeof document<`u`?document.body:void 0},e[43]=Pe):Pe=e[43];let Fe=ma,Ie;e[44]===w?Ie=e[45]:(Ie=[...w],e[44]=w,e[45]=Ie);let Le=fa,Re=w.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(FN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:oi(EN,t?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:kN,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:gN(t),tabIndex:_N(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=pt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=je(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:oi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=je(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:oi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=je(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${AN(a)}`;return(0,Z.jsx)(FN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(PN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ew,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{P(NN(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ZC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)($C,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:kN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},tabIndex:-1,children:[(0,Z.jsx)(LN,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(IN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),ze;e[46]!==Fe||e[47]!==Ie||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Fe,{items:Ie,strategy:Le,children:Re}),e[46]=Fe,e[47]=Ie,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==Me||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Ne||e[58]!==Pe||e[59]!==ze||e[60]!==me?(Be=(0,Z.jsx)(Me,{sensors:be,autoScroll:!1,collisionDetection:Ne,modifiers:me,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Pe,children:ze}),e[51]=Me,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Ne,e[58]=Pe,e[59]=ze,e[60]=me,e[61]=Be):Be=e[61];let Ve;e[62]===T?Ve=e[63]:(Ve=T({id:`3YvS-c`}),e[62]=T,e[63]=Ve);let Ue;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=Ue):Ue=e[64];let We;e[65]!==_||e[66]!==Ve?(We=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ue})}),e[65]=_,e[66]=Ve,e[67]=We):We=e[67];let Ge;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ge):Ge=e[68];let Ke;e[69]===We?Ke=e[70]:(Ke=(0,Z.jsxs)(Is,{children:[We,Ge]}),e[69]=We,e[70]=Ke);let qe;e[71]!==Ae||e[72]!==Be||e[73]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ke]}),e[71]=Ae,e[72]=Be,e[73]=Ke,e[74]=qe):qe=e[74];let Je;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==qe?(Je=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":De,className:Oe,onWheel:ke,children:qe}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=qe,e[79]=Je):Je=e[79],Je}function zN(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 BN(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 VN=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:St},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Qo},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:zN},{label:`Twitter`,href:`https://x.com/inkeep`,icon:BN}],HN=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Re,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Is,{children:[o,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=VN.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ca(e,r),onAuxClick:e=>Ca(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(b,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function UN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=_g.filter(e),p=_g.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,Z.jsx)(jo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(Ni,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function WN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d=qx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=mg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(UN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,className:`p-1`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(fe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var GN=50,KN=()=>{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,PC.preload()},GN))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Cg)},u=(0,Z.jsx)(Zl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function qN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=ho(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await ca({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Na,toastSuccess:$N,toastError:QN,logEvent:ZN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{hs.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(jo,{ref:f,readOnly:!0,value:A,onFocus:XN,onClick:YN,onContextMenu:JN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(fe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function JN(e){return e.currentTarget.select()}function YN(e){return e.currentTarget.select()}function XN(e){return e.currentTarget.select()}function ZN(e){return console.log(e)}function QN(e){e!==`Link ready but could not copy to clipboard.`&&hs.error(e)}function $N(e){return hs.success(e)}function eP(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=mt(),{state:p,isDraggingRail:m}=hA(),h=Sg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=Oa(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=t_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=i_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=e_({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=fo(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Da(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=oi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bA,{className:oi(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:oi(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(Ni,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(RN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=oi(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(qN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(mo,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Ua,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(iM,{}),z=(0,Z.jsx)(Ni,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(KN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(HN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var tP=`open-knowledge:terminal-launch`;function nP(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(tP,{detail:{prompt:e}}))}function rP(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(tP,n),()=>t.removeEventListener(tP,n)}function iP(e){let t=(0,$.c)(61),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=lv(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Ey[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=co(),{projectLocalConfig:k,projectLocalSynced:A}=ae(),j=Oa(),{activeDocName:M}=mt(),N=O?.hasRemote,P=O?.pushPermission?.checkStatus,F;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==N||t[6]!==P?(F=pv({autoSyncOnboardingDismissed:g,hasRemote:N,projectLocalSynced:A,projectLocalConfig:k,pushPermissionCheckStatus:P}),t[2]=g,t[3]=k,t[4]=A,t[5]=N,t[6]=P,t[7]=F):F=t[7];let I=F,L,R;t[8]===M?(L=t[9],R=t[10]):(L=()=>{let e=function(e){let t=e.detail;t&&M&&Oc(M,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(tv,e),()=>window.removeEventListener(tv,e)},R=[M],t[8]=M,t[9]=L,t[10]=R),(0,Q.useEffect)(L,R);let z,B;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(oP):e===`new-terminal`&&w(!0)})},B=[],t[11]=z,t[12]=B):(z=t[11],B=t[12]),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(aP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},V=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(H,V);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(U=()=>rP(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),W=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(U,W);let G,K;t[17]===C?(G=t[18],K=t[19]):(G=()=>{C||E(null)},K=[C],t[17]=C,t[18]=G,t[19]=K),(0,Q.useEffect)(G,K);let q,J;t[20]===C?(q=t[21],J=t[22]):(q=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},J=[C],t[20]=C,t[21]=q,t[22]=J),(0,Q.useEffect)(q,J);let ee,Y;t[23]===C?(ee=t[24],Y=t[25]):(ee=()=>{window.okDesktop!=null&&C&&wa()},Y=[C],t[23]=C,t[24]=ee,t[25]=Y),(0,Q.useEffect)(ee,Y),uv(O?.pausedReason);let te;t[26]===s?te=t[27]:(te=function(e){l(e),s(e)},t[26]=s,t[27]=te);let ne=te,X;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(X=function(e){y(e),e||x(null)},t[28]=X):X=t[28];let re=X,ie;t[29]!==a||t[30]!==M||t[31]!==j?(ie={openSelection(e){let t=o_({docName:e.docName??M,workspace:j,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(hs.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[29]=a,t[30]=M,t[31]=j,t[32]=ie):ie=t[32];let oe,se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>{p(`auth`),d(!0)},se=()=>{p(`identity`),d(!0)},t[33]=oe,t[34]=se):(oe=t[33],se=t[34]);let ce;t[35]!==r||t[36]!==b||t[37]!==v?(ce=(0,Z.jsx)(eP,{onSignIn:oe,onSetIdentity:se,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:re}),t[35]=r,t[36]=b,t[37]=v,t[38]=ce):ce=t[38];let le;t[39]!==m||t[40]!==c||t[41]!==ne||t[42]!==T||t[43]!==C?(le=(0,Z.jsx)(Mj,{editorMode:c,onModeChange:ne,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[39]=m,t[40]=c,t[41]=ne,t[42]=T,t[43]=C,t[44]=le):le=t[44];let ue;t[45]!==ie||t[46]!==ce||t[47]!==le?(ue=(0,Z.jsxs)(Pc,{value:ie,children:[ce,le]}),t[45]=ie,t[46]=ce,t[47]=le,t[48]=ue):ue=t[48];let de=f===`identity`,fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>{d(!1)},t[49]=fe):fe=t[49];let pe;t[50]!==u||t[51]!==de?(pe=(0,Z.jsx)($i,{open:u,onOpenChange:d,identityPrompt:de,onSuccess:fe}),t[50]=u,t[51]=de,t[52]=pe):pe=t[52];let me;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>_(!0),t[53]=me):me=t[53];let he;t[54]===I?he=t[55]:(he=(0,Z.jsx)(dv,{open:I,onResolved:me}),t[54]=I,t[55]=he);let ge;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Q_,{}),t[56]=ge):ge=t[56];let _e;return t[57]!==ue||t[58]!==pe||t[59]!==he?(_e=(0,Z.jsxs)(Z.Fragment,{children:[ue,pe,he,ge]}),t[57]=ue,t[58]=pe,t[59]=he,t[60]=_e):_e=t[60],_e}function aP(e){return!e}function oP(e){return!e}function sP(e){let t=Vo(Ko(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Pi();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)(Lo,{"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)(Lo,{"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(lP),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 lP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ci,{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:()=>sP(e.file),children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
29
+ `,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;lc(t,{style:t=>Cc(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 QO.set(t.changes,i),i}function tk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(sO).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(ZO);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=oc.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:XO.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function nk(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(sO).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(ZO).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 rk(e){let t=new fc;for(let n of e.field(sO)){let r=e.facet(iO).overrideChunk&&ok(e,n);t.add(n.fromB,n.fromB,ek(e,n,!!r))}return t.finish()}var ik=cc.define({create:e=>rk(e),update(e,t){return t.state.field(sO,!1)==t.startState.field(sO,!1)?e:rk(t.state)},provide:e=>_c.decorations.from(e)}),ak=new WeakMap;function ok(e,t){let n=ak.get(t);if(n!==void 0)return n;n=null;let r=e.field(ZO),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(dc.widget({widget:new sk(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(CO.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return ak.set(t,n),n}var sk=class extends ic{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}},ck=new class extends vc{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},lk=dc.line({class:`cm-inlineChangedLine`});function uk(e,t,n,r){let i=ok(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,ck),n.add(o.from,o.from,lk);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 dk=Y({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fk=G({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),pk=_c.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 mk({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 hk(e){let t=(0,$.c)(32),{oldContent:n,newContent:r,layout:a,conflictMode:o,previewMode:c,oursOverride:l,onResolve:u,onAbort:d}=e,{_:f}=i(),p=l??r,m=(0,Q.useRef)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(0),{resolvedTheme:_}=Nr(),v=(0,Q.useRef)(u),y=(0,Q.useRef)(d),[b,x]=(0,Q.useState)(null),S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[0]=S):S=t[0];let[C,w]=(0,Q.useState)(S),T;t[1]!==d||t[2]!==u?(T=()=>{v.current=u,y.current=d},t[1]=d,t[2]=u,t[3]=T):T=t[3],(0,Q.useEffect)(T);let E,D;t[4]!==o||t[5]!==p||t[6]!==a||t[7]!==n||t[8]!==c||t[9]!==_?(E=()=>{let e=m.current;if(!e)return;w([]);let t=new Map,r=!1,i=e=>{r||!t.delete(e)||w(t=>t.filter(t=>t.id!==e))},s=new MutationObserver(()=>{for(let[n,r]of t)e.contains(r)||i(n)});s.observe(e,{childList:!0,subtree:!0});let l=_===`dark`?dk:fk,u=[_c.editable.of(!1),sc.readOnly.of(!0)],d=[Fc,wc(),...u,l,_c.lineWrapping];if(h.current&&=(h.current.destroy(),null),c)h.current=new _c({doc:p,extensions:d,parent:e}),x(null);else if(o){let a=mk({addControl:e=>{r||(t.set(e.id,e.host),w(t=>[...t,e]))},nextId:()=>(g.current+=1,g.current),removeControl:i,root:e}),o=new _c({doc:p,extensions:[Fc,wc(),_c.editable.of(!1),l,pk,_c.lineWrapping,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:a,collapseUnchanged:{margin:3,minSize:4}}),_c.updateListener.of(e=>{let t=cO(e.state);x(t?t.chunks.length:0)})],parent:e});h.current=o;let s=cO(o.state);x(s?s.chunks.length:0)}else a===`split`?h.current=new GO({a:{doc:n,extensions:d},b:{doc:p,extensions:d},parent:e,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):h.current=new _c({doc:p,extensions:[...d,YO({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:e});return()=>{r=!0,s.disconnect(),h.current&&=(h.current.destroy(),null)}},D=[n,p,a,_,o,c],t[4]=o,t[5]=p,t[6]=a,t[7]=n,t[8]=c,t[9]=_,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(){let e=h.current;!e||!(e instanceof _c)||v.current?.(e.state.doc.toString())},t[12]=O):O=t[12];let k=O,A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){let e=h.current;!e||!(e instanceof _c)||ve(e)},t[13]=A):A=t[13];let j=A,M=b===0,N;t[14]!==f||t[15]!==b?(N=b===null?``:b===0?f({id:`lPzyrU`}):ms._({id:`8FqTCr`,values:{chunksRemaining:b}}),t[14]=f,t[15]=b,t[16]=N):N=t[16];let P=N,F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:m,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[17]=F):F=t[17];let I;if(t[18]!==f||t[19]!==C){let e;t[21]===f?e=t[22]:(e=e=>(0,rl.createPortal)((0,Z.jsx)(ci,{type:`button`,variant:e.type===`accept`?`default`:`destructive`,size:`xs`,onClick:t=>{e.action(t.nativeEvent)},children:e.type===`accept`?f({id:`g3UF2V`}):f({id:`1t_NnN`})}),e.host,e.id),t[21]=f,t[22]=e),I=C.map(e),t[18]=f,t[19]=C,t[20]=I}else I=t[20];let L;t[23]!==M||t[24]!==o||t[25]!==P||t[26]!==d||t[27]!==u?(L=o&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${M?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:P}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d&&(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`ghost`,size:`sm`,onClick:d,children:(0,Z.jsx)(s,{id:`XyOUTJ`})}),(0,Z.jsx)(ci,{className:`uppercase font-mono`,variant:`outline`,size:`sm`,onClick:j,children:`Undo`}),u&&(0,Z.jsx)(ci,{variant:`default`,size:`sm`,disabled:!M,onClick:k,children:(0,Z.jsx)(s,{id:`Lcehxn`})})]})]}),t[23]=M,t[24]=o,t[25]=P,t[26]=d,t[27]=u,t[28]=L):L=t[28];let R;return t[29]!==L||t[30]!==I?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[F,I,L]}),t[29]=L,t[30]=I,t[31]=R):R=t[31],R}async function gk(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 _k(e,t){return gk(e,`content`,t)}async function vk(e){return gk(e,`mine`)}async function yk(e){return gk(e,`theirs`)}async function bk(e){return gk(e,`delete`)}async function xk(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 Sk(e){let t=(0,$.c)(84),{docName:n}=e,{_:r}=i(),{conflicts:a,loading:o}=Pi(),c;if(t[0]!==a||t[1]!==n){let e;t[3]===n?e=t[4]:(e=e=>Ko(e.file)===n,t[3]=n,t[4]=e),c=a.find(e),t[0]=a,t[1]=n,t[2]=c}else c=t[2];let l=c,u=l?.file??`${n}.md`,[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>(console.warn(JSON.stringify({event:`editor-area-swap-to-diffview`,"doc.name":n})),()=>{console.warn(JSON.stringify({event:`editor-area-swap-from-diffview`,"doc.name":n}))}),v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Q.useEffect)(_,v);let y=o||l===void 0,b,x;t[8]!==y||t[9]!==u?(b=()=>{if(y)return;let e=!1;return f(null),m(!1),xk(u).then(t=>{e||(t===null?m(!0):f(t))}),()=>{e=!0}},x=[u,y],t[8]=y,t[9]=u,t[10]=b,t[11]=x):(b=t[10],x=t[11]),(0,Q.useEffect)(b,x);let S;t[12]!==r||t[13]!==u?(S=async function(e){let t=await _k(u,e);t.ok||hs.error(r({id:`K-h9cT`,values:{filePath:u}}),{description:t.detail})},t[12]=r,t[13]=u,t[14]=S):S=t[14];let C=S,w;t[15]!==r||t[16]!==u?(w=async function(e){g(!0);let t=await e(u);t.ok||(g(!1),hs.error(r({id:`jPUPvG`,values:{filePath:u}}),{description:t.detail}))},t[15]=r,t[16]=u,t[17]=w):w=t[17];let T=w;if(p){let e;return t[18]===u?e=t[19]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ajz9F8`,values:{filePath:u}})}),t[18]=u,t[19]=e),e}if(d===null){let e;return t[20]===u?e=t[21]:(e=(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`DF1MtZ`,values:{filePath:u}})}),t[20]=u,t[21]=e),e}if(d.kind===`delete-modify`){let e;t[22]===d.theirs?e=t[23]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.theirs,layout:`unified`,previewMode:!0})}),t[22]=d.theirs,t[23]=e);let n;t[24]===u?n=t[25]:(n={filePath:u},t[24]=u,t[25]=n);let r;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[26]=r):r=t[26];let i;t[27]===n?i=t[28]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`V48OUT`,values:n,components:r})}),t[27]=n,t[28]=i);let a;t[29]===T?a=t[30]:(a=()=>void T(bk),t[29]=T,t[30]=a);let o;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`Vlc75q`}),t[31]=o):o=t[31];let c;t[32]!==h||t[33]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:a,children:o}),t[32]=h,t[33]=a,t[34]=c):c=t[34];let l;t[35]===T?l=t[36]:(l=()=>void T(yk),t[35]=T,t[36]=l);let f;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`3mFsc3`}),t[37]=f):f=t[37];let p;t[38]!==h||t[39]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:l,children:f}),t[38]=h,t[39]=l,t[40]=p):p=t[40];let m;t[41]!==c||t[42]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[41]=c,t[42]=p,t[43]=m):m=t[43];let g;t[44]!==i||t[45]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[44]=i,t[45]=m,t[46]=g):g=t[46];let _;return t[47]!==g||t[48]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[47]=g,t[48]=e,t[49]=_):_=t[49],_}if(d.kind===`modify-delete`){let e;t[50]===d.ours?e=t[51]:(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Z.jsx)(hk,{oldContent:``,newContent:d.ours,layout:`unified`,previewMode:!0})}),t[50]=d.ours,t[51]=e);let n;t[52]===u?n=t[53]:(n={filePath:u},t[52]=u,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r={0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})},t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`EhDLBx`,values:n,components:r})}),t[55]=n,t[56]=i);let a;t[57]===T?a=t[58]:(a=()=>void T(vk),t[57]=T,t[58]=a);let o;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(s,{id:`0NA4b3`}),t[59]=o):o=t[59];let c;t[60]!==h||t[61]!==a?(c=(0,Z.jsx)(ci,{type:`button`,variant:`default`,disabled:h,onClick:a,children:o}),t[60]=h,t[61]=a,t[62]=c):c=t[62];let l;t[63]===T?l=t[64]:(l=()=>void T(bk),t[63]=T,t[64]=l);let f;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(s,{id:`qSxaOz`}),t[65]=f):f=t[65];let p;t[66]!==h||t[67]!==l?(p=(0,Z.jsx)(ci,{type:`button`,variant:`destructive`,disabled:h,onClick:l,children:f}),t[66]=h,t[67]=l,t[68]=p):p=t[68];let m;t[69]!==c||t[70]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-3`,children:[c,p]}),t[69]=c,t[70]=p,t[71]=m):m=t[71];let g;t[72]!==i||t[73]!==m?(g=(0,Z.jsxs)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center justify-between gap-x-6 gap-y-3 border-t px-6 py-4`,children:[i,m]}),t[72]=i,t[73]=m,t[74]=g):g=t[74];let _;return t[75]!==g||t[76]!==e?(_=(0,Z.jsxs)(`div`,{className:`flex h-full flex-col bg-background`,children:[e,g]}),t[75]=g,t[76]=e,t[77]=_):_=t[77],_}let E;t[78]===C?E=t[79]:(E=e=>void C(e),t[78]=C,t[79]=E);let D;return t[80]!==d.ours||t[81]!==d.theirs||t[82]!==E?(D=(0,Z.jsx)(hk,{oldContent:d.theirs,newContent:d.ours,layout:`unified`,conflictMode:!0,onResolve:E}),t[80]=d.ours,t[81]=d.theirs,t[82]=E,t[83]=D):D=t[83],D}function Ck(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Ft(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 wk=`__back-nav__`;function Tk(e){return e instanceof Le||e instanceof vt||e instanceof Me||e instanceof et||e instanceof At||e instanceof pe?e.docName:null}function Ek(e){if(e instanceof Le){let t=e.docName;return{title:ms._({id:`Jejur6`}),summary:ms._({id:`jSY41h`,values:{docName:t}})}}if(e instanceof vt){let t=e.docName;return{title:ms._({id:`V7QxyT`}),summary:ms._({id:`xG4tb6`,values:{docName:t}})}}if(e instanceof Me){let t=e.docName;return{title:ms._({id:`1di5fu`}),summary:ms._({id:`PQCdtv`,values:{docName:t}})}}if(e instanceof et){let t=e.docName;return{title:ms._({id:`wvbc1r`}),summary:ms._({id:`IX7-sq`,values:{docName:t}})}}if(e instanceof At)return{title:ms._({id:`Gfr4fu`}),summary:ms._({id:`j6LB7S`})};if(e instanceof pe){let t=e.docName;return{title:ms._({id:`vv7kpg`}),summary:ms._({id:`mdKFEy`,values:{docName:t}})}}let t=e instanceof Error&&e.message?e.message:ms._({id:`W5A0Ly`});return{title:ms._({id:`29VNqC`}),summary:t}}function Dk(e){let t=(0,$.c)(28),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,c;t[0]===n?c=t[1]:(c=Ek(n),t[0]=n,t[1]=c);let{title:l,summary:u}=c,d=!!a&&!!o,f=(0,Q.useRef)(null),p,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>{f.current?.focus()},m=[],t[2]=p,t[3]=m):(p=t[2],m=t[3]),(0,Q.useEffect)(p,m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(OS,{size:80,variant:`sleeping`}),t[4]=h):h=t[4];let g;t[5]===l?g=t[6]:(g=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:l}),t[5]=l,t[6]=g);let _;t[7]===u?_=t[8]:(_=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:u}),t[7]=u,t[8]=_);let v;t[9]!==g||t[10]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[g,_]}),t[9]=g,t[10]=_,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(s,{id:`KDw4GX`}),t[12]=y):y=t[12];let b;t[13]===r?b=t[14]:(b=(0,Z.jsx)(ci,{ref:f,variant:`default`,onClick:r,children:y}),t[13]=r,t[14]=b);let x;t[15]!==i||t[16]!==d||t[17]!==n||t[18]!==o||t[19]!==a||t[20]!==r?(x=d?(0,Z.jsx)(ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(lt(Tk(n)??i),o(a),r(wk))},children:(0,Z.jsx)(s,{id:`CKyk7Q`})}):null,t[15]=i,t[16]=d,t[17]=n,t[18]=o,t[19]=a,t[20]=r,t[21]=x):x=t[21];let S;t[22]!==x||t[23]!==b?(S=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[b,x]}),t[22]=x,t[23]=b,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==v?(C=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[h,v,S]}),t[25]=S,t[26]=v,t[27]=C):C=t[27],C}function Ok(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)(Dk,{...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]===wk){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}: ${Ek(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)(ce,{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 kk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function Ak(e){let t=(0,$.c)(21),{provider:n}=e,r;t[0]===n?r=t[1]:(r=()=>kk(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=Mn(n);a(e.current());let t=e.subscribe(e=>{a(e)});return()=>{t(),e.dispose()}},s=[n],t[2]=n,t[3]=o,t[4]=s),(0,Q.useEffect)(o,s);let c;t[5]===i.map.icon?c=t[6]:(c=Ze(i.map.icon),t[5]=i.map.icon,t[6]=c);let l=c,u;t[7]===i.map.cover?u=t[8]:(u=dt(i.map.cover),t[7]=i.map.cover,t[8]=u);let d=u,f=d.kind===`url`||d.kind===`path`,p=l.kind!==`unsupported`;if(!f&&!p)return null;let m=f?`true`:`false`,h=p?`true`:`false`,g;t[9]!==d||t[10]!==f?(g=f?(0,Z.jsx)(jk,{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)(Mk,{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 jk(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 Mk(e){let t=(0,$.c)(9),{icon:n,hasCover:r}=e,i=r?`page-header-icon page-header-icon--with-cover`:`page-header-icon`;if(n.kind===`emoji`){let e;return t[0]!==n.value||t[1]!==i?(e=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":`emoji`,children:n.value}),t[0]=n.value,t[1]=i,t[2]=e):e=t[2],e}let a;t[3]===n.value?a=t[4]:(a=(0,Z.jsx)(`img`,{src:n.value,alt:``,draggable:!1,referrerPolicy:`no-referrer`,className:`page-header-icon-img`}),t[3]=n.value,t[4]=a);let o;return t[5]!==n.kind||t[6]!==i||t[7]!==a?(o=(0,Z.jsx)(`span`,{className:i,"data-testid":`page-header-icon`,"data-kind":n.kind,children:a}),t[5]=n.kind,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function Nk(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Sr(t);return{map:n,keys:On(t),parseError:r}}function Pk(e){let t=(0,$.c)(127),{provider:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),c;t[0]===n?c=t[1]:(c=()=>Nk(n),t[0]=n,t[1]=c);let[l,u]=(0,Q.useState)(c),d,f;t[2]===n?(d=t[3],f=t[4]):(d=()=>{let e=Mn(n);o(e),u(e.current());let t=e.subscribe(e=>{u(e)});return()=>{t(),e.dispose(),o(t=>t===e?null:t)}},f=[n],t[2]=n,t[3]=d,t[4]=f),(0,Q.useEffect)(d,f);let p=l.map,m=l.keys,h=l.parseError,[g,_]=(0,Q.useState)(!1),v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[5]=v):v=t[5];let[y,b]=(0,Q.useState)(v),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),T;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T={},t[6]=T):T=t[6];let[E,D]=(0,Q.useState)(T),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O={},t[7]=O):O=t[7];let[k,A]=(0,Q.useState)(O),j=n.configuration.name??``,M;t[8]!==r||t[9]!==a?(M=function(e){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};let t=a.patch(e);if(t.ok)return{ok:!0};if(t.error.code===`WRITE_ERROR`)return console.warn(`[PropertyPanel] binding write error:`,t.error.detail),{ok:!1,error:t.error.detail};let n=yr(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[8]=r,t[9]=a,t[10]=M):M=t[10];let N=M,P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){D(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[11]=P):P=t[11];let F=P,I;t[12]===r?I=t[13]:(I=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};D(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),A(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[12]=r,t[13]=I);let L=I,R;t[14]!==N||t[15]!==L?(R=function(e,t){F(e),L(N({[e]:t}),[e])},t[14]=N,t[15]=L,t[16]=R):R=t[16];let z=R,B;t[17]!==N||t[18]!==L?(B=function(e){F(e),L(N({[e]:null}),[e])},t[17]=N,t[18]=L,t[19]=B):B=t[19];let H=B,U;t[20]!==r||t[21]!==a?(U=function(e,t){if(!a)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=a.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=yr(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(i).length>0?i:void 0}},t[20]=r,t[21]=a,t[22]=U):U=t[22];let W=U,G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=function(e,t){return`${e} ${t}`},t[23]=G):G=t[23];let K=G,q;t[24]!==a||t[25]!==m?(q=function(e){if(!a)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=m.map((e,t)=>K(e,t)),i=r.indexOf(t),o=r.indexOf(n);if(i<0||o<0)return;let s=m.slice(),[c]=s.splice(i,1);if(!c)return;s.splice(o,0,c);let l=a.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[24]=a,t[25]=m,t[26]=q):q=t[26];let J=q,ee;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ee={activationConstraint:{distance:4}},t[27]=ee):ee=t[27];let Y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Y={coordinateGetter:ga},t[28]=Y):Y=t[28];let te=wi(ia(va,ee),ia(ba,Y)),ne;t[29]!==z||t[30]!==p?(ne=function(e,t){let n=p[e];if(n===void 0)return;b(n=>({...n,[e]:t}));let r=oa(n,t);(!Object.hasOwn(p,e)||!Cr(n,r))&&z(e,r)},t[29]=z,t[30]=p,t[31]=ne):ne=t[31];let X=ne,re;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(){S({name:``,type:`text`,value:``,error:null}),_(!1)},t[32]=re):re=t[32];let ie=re,{addPropertySignal:ae,clearAddProperty:oe}=MC(),se;t[33]!==ae||t[34]!==j?(se=ae.get(j)??0,t[33]=ae,t[34]=j,t[35]=se):se=t[35];let ce=se,le,ue;t[36]===ce?(le=t[37],ue=t[38]):(le=()=>{ce>0&&(S({name:``,type:`text`,value:``,error:null}),_(!1))},ue=[ce],t[36]=ce,t[37]=le,t[38]=ue),(0,Q.useEffect)(le,ue);let de,fe;t[39]!==oe||t[40]!==j?(de=()=>()=>oe(j),fe=[j,oe],t[39]=oe,t[40]=j,t[41]=de,t[42]=fe):(de=t[41],fe=t[42]),(0,Q.useEffect)(de,fe);let pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(e){S(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Ji[e];return{...t,type:e,value:n,error:null}})},t[43]=pe):pe=t[43];let me=pe,he;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(he=function(e){S(t=>t&&{...t,value:e})},t[44]=he):he=t[44];let ge=he,_e;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){S(t=>t&&{...t,name:e,error:null})},t[45]=_e):_e=t[45];let ve=_e,ye;t[46]!==r||t[47]!==x||t[48]!==N||t[49]!==p?(ye=function(){if(!x)return;let e=x.name.trim();if(!e){S({...x,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){S({...x,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){S({...x,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=N({[e]:x.value});if(t.ok){S(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});S({...x,error:n??i})},t[46]=r,t[47]=x,t[48]=N,t[49]=p,t[50]=ye):ye=t[50];let be=ye,xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){S(null)},t[51]=xe):xe=t[51];let Se=xe,Ce;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){w({key:e,draft:e,error:null})},t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){w(t=>t&&{...t,draft:e,error:null})},t[53]=Te):Te=t[53];let Ee=Te,De;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(){w(null)},t[54]=De):De=t[54];let Oe=De,ke;t[55]!==r||t[56]!==p||t[57]!==W||t[58]!==C?(ke=function(){if(!C)return;let e=C.draft.trim();if(!e){w(null);return}if(e===C.key){w(null);return}if(e===`frontmatter`){w({...C,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(p,e)){w({...C,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=W(C.key,e);if(t.ok){b(t=>{if(!Object.hasOwn(t,C.key))return t;let n={...t};return n[e]=n[C.key],delete n[C.key],n}),F(C.key),w(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[C.key]??t.error??r({id:`2ryd91`});w({...C,error:n})},t[55]=r,t[56]=p,t[57]=W,t[58]=C,t[59]=ke):ke=t[59];let Ae=ke,je;t[60]!==p||t[61]!==m?(je=m.length>0?m:Object.keys(p),t[60]=p,t[61]=m,t[62]=je):je=t[62];let Me=je,Ne;if(t[63]!==Me){Ne=new Map;for(let e of Me)Ne.set(e,(Ne.get(e)??0)+1);t[63]=Me,t[64]=Ne}else Ne=t[64];if(Me.length===0&&!x&&!h)return null;let Pe=!g,Fe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=e=>_(!e),t[65]=Fe):Fe=t[65];let Ie=!g,Le;t[66]===Ie?Le=t[67]:(Le=(0,Z.jsx)(No,{"data-expanded":Ie,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[66]=Ie,t[67]=Le);let Re;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`l_UFPv`})}),t[68]=Re):Re=t[68];let ze;t[69]===Le?ze=t[70]:(ze=(0,Z.jsx)(Po,{asChild:!0,children:(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[Le,Re]})}),t[69]=Le,t[70]=ze);let Be;t[71]===h?Be=t[72]:(Be=h?(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`property-panel-yaml-error`,className:`mb-1 flex items-start gap-1.5 rounded border border-destructive/30 bg-destructive/5 px-2 py-1.5 text-[11px] text-destructive`,children:[(0,Z.jsx)(Lo,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(s,{id:`zaXlhf`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:h})]})]}):null,t[71]=h,t[72]=Be);let Ve;if(t[73]!==Me){let e;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>K(e,t),t[75]=e):e=t[75],Ve=Me.map(e),t[73]=Me,t[74]=Ve}else Ve=t[74];let He;if(t[76]!==z||t[77]!==Ae||t[78]!==Ne||t[79]!==E||t[80]!==p||t[81]!==y||t[82]!==H||t[83]!==C||t[84]!==Me||t[85]!==k||t[86]!==X){let e;t[88]!==z||t[89]!==Ae||t[90]!==Ne||t[91]!==E||t[92]!==p||t[93]!==y||t[94]!==H||t[95]!==C||t[96]!==k||t[97]!==X?(e=(e,t)=>{let n=p[e];if(n===void 0)return null;let r=y[e]??An(n),i=C?.key===e?C:null,a=(Ne.get(e)??0)>1;return(0,Z.jsx)(Ii,{sortableId:K(e,t),keyName:e,value:n,declared:r,error:E[e]??null,resetCounter:k[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>we(e),onChangeDraft:Ee,onCommit:Ae,onCancel:Oe},onCommit:t=>z(e,t),onChangeType:t=>X(e,t),onRemove:()=>H(e)},`${e}-${t}`)},t[88]=z,t[89]=Ae,t[90]=Ne,t[91]=E,t[92]=p,t[93]=y,t[94]=H,t[95]=C,t[96]=k,t[97]=X,t[98]=e):e=t[98],He=Me.map(e),t[76]=z,t[77]=Ae,t[78]=Ne,t[79]=E,t[80]=p,t[81]=y,t[82]=H,t[83]=C,t[84]=Me,t[85]=k,t[86]=X,t[87]=He}else He=t[87];let Ue;t[99]!==Ve||t[100]!==He?(Ue=(0,Z.jsx)(ma,{items:Ve,strategy:Ki,children:He}),t[99]=Ve,t[100]=He,t[101]=Ue):Ue=t[101];let We;t[102]!==J||t[103]!==te||t[104]!==Ue?(We=(0,Z.jsx)(Xa,{sensors:te,collisionDetection:Sa,onDragEnd:J,children:Ue}),t[102]=J,t[103]=te,t[104]=Ue,t[105]=We):We=t[105];let Ge;t[106]!==z||t[107]!==E||t[108]!==p||t[109]!==k?(Ge=Object.hasOwn(p,`tags`)?null:(0,Z.jsx)(Ii,{keyName:`tags`,value:[],declared:`list`,error:E.tags??null,resetCounter:k.tags??0,isPlaceholder:!0,onCommit:e=>z(`tags`,e),onChangeType:Fk},`virtual-tags`),t[106]=z,t[107]=E,t[108]=p,t[109]=k,t[110]=Ge):Ge=t[110];let Ke;t[111]!==r||t[112]!==x||t[113]!==be?(Ke=x?(0,Z.jsx)(na,{draft:x,onChangeName:ve,onChangeType:me,onChangeValue:ge,onCommit:be,onCancel:Se}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:ie,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(V,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`m16xKo`})})]})]}),t[111]=r,t[112]=x,t[113]=be,t[114]=Ke):Ke=t[114];let qe;t[115]!==Be||t[116]!==We||t[117]!==Ge||t[118]!==Ke?(qe=(0,Z.jsxs)(Mo,{className:`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,children:[Be,We,Ge,Ke]}),t[115]=Be,t[116]=We,t[117]=Ge,t[118]=Ke,t[119]=qe):qe=t[119];let Je;t[120]!==Pe||t[121]!==ze||t[122]!==qe?(Je=(0,Z.jsx)(`div`,{className:`property-panel editor-content-aligned pt-4 pb-4 text-sm`,"data-testid":`property-panel`,children:(0,Z.jsxs)(Fo,{open:Pe,onOpenChange:Fe,children:[ze,qe]})}),t[120]=Pe,t[121]=ze,t[122]=qe,t[123]=Je):Je=t[123];let Ye;return t[124]!==a||t[125]!==Je?(Ye=(0,Z.jsx)(Oi,{binding:a,children:Je}),t[124]=a,t[125]=Je,t[126]=Ye):Ye=t[126],Ye}function Fk(){}var Ik=v(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function Lk(e){let t=e.threshold??Ik;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function Rk(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var zk=v(`ACTIVITY_MOUNT_LIMIT`,3);function Bk(){return n(()=>import(`./SourceEditor-Dv-b05s_.js`),__vite__mapDeps([55,1,37,2,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,56,26,54]),import.meta.url)}var Vk=(0,Q.lazy)(async()=>({default:(await Bk()).SourceEditor}));function Hk(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Ke(e.docName)),i=[...r].sort((e,t)=>t.lastAccessedAt-e.lastAccessedAt).slice(0,n);if(t===null||i.some(e=>e.docName===t))return i;let a=r.find(e=>e.docName===t);return a?[...i.slice(0,n-1),a]:i}function Uk(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:ms._({id:`MTs6g3`}),summary:t.reason===`clear-data-timeout`?ms._({id:`Sc1bKE`,values:{docName:e}}):ms._({id:`ovIGrT`,values:{docName:e}}),actionLabel:ms._({id:`HpK_8d`})}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:ms._({id:`cF9DyA`}),summary:t.phase===`clearing-local-cache`?ms._({id:`bmC18N`,values:{docName:e}}):ms._({id:`pAgkuZ`,values:{docName:e}})}:null}function Wk(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Wt,{name:`activity-pool`,children:(0,Z.jsx)(Gk,{...e})}),t[0]=e,t[1]=n),n}function Gk(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=mt(),{pages:u,loading:d}=rs(),f=Hk(c,n,zk),p=(0,Q.useRef)(``),h=f.map(Kk).join(`,`),g=(0,Q.useRef)(c),_,v;t[0]===c?(_=t[1],v=t[2]):(_=()=>{g.current=c},v=[c],t[0]=c,t[1]=_,t[2]=v),(0,Q.useLayoutEffect)(_,v),(0,Q.useLayoutEffect)(()=>{if(p.current===h)return;let e=p.current?p.current.split(`,`):[],t=h?h.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)m(e);for(let e of i){let t=g.current.find(t=>t.docName===e)?.poolEventId;W(e,t&&t.length>0?t:crypto.randomUUID())}le(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=h,Ut(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)(Qk,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=y):y=t[12];let 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 Kk(e){return e.docName}function qk(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&&le(`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&&(le(`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&&le(`ok/scroll-restore/abandoned`,{target:t,elapsedMs:performance.now()-r,scrollHeight:e.scrollHeight,finalScrollTop:e.scrollTop}),l())},2e3);return l},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useLayoutEffect)(l,u);let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={overflowAnchor:`auto`},t[5]=d):d=t[5];let f;return t[6]===i?f=t[7]:(f=(0,Z.jsx)(`div`,{ref:a,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:d,children:i}),t[6]=i,t[7]=f),f}function Jk(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)(zx,{}),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)(Vk,{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 Yk(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)($a,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(h,{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)(ci,{type:`button`,onClick:Xk,children:[(0,Z.jsx)($a,{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 Xk(){return window.location.reload()}function Zk(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 Qk(e){let t=(0,$.c)(53),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a,isNewDoc:o,previousDocName:s,onNavigateBack:c,onRecycle:l,serverRestartRecovery:u}=e,d;t[0]!==n.docName||t[1]!==u?(d=Uk(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p=vw(n.docName)===`conflict`,m;t[3]===n.docName?m=t[4]:(m=()=>{let e=document.createElement(`div`);return e.setAttribute(`data-ok-editor-portal`,n.docName),e.style.display=`contents`,e},t[3]=n.docName,t[4]=m);let[h]=(0,Q.useState)(m),g=n.provider.document.getText(`source`).length,[_,v]=(0,Q.useState)(i),[b,x]=(0,Q.useState)(!i),S,C;t[5]!==i||t[6]!==_||t[7]!==b?(S=()=>{i&&!_?v(!0):!i&&!b&&x(!0)},C=[i,_,b],t[5]=i,t[6]=_,t[7]=b,t[8]=S,t[9]=C):(S=t[8],C=t[9]),(0,Q.useEffect)(S,C);let w=Lk({ytextLength:g,isSourceMode:i,visitedSource:_,visitedVisual:b}),T=(0,Q.useRef)(``),E=`${w.isLarge}-${w.renderSource}-${w.renderVisual}`,D,O;t[10]!==n.docName||t[11]!==w.isLarge||t[12]!==w.renderSource||t[13]!==w.renderVisual||t[14]!==E||t[15]!==i||t[16]!==g?(D=()=>{T.current!==E&&(T.current=E,w.isLarge&&le(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:g,isSourceMode:i,renderSource:w.renderSource,renderVisual:w.renderVisual}))},O=[E,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[10]=n.docName,t[11]=w.isLarge,t[12]=w.renderSource,t[13]=w.renderVisual,t[14]=E,t[15]=i,t[16]=g,t[17]=D,t[18]=O):(D=t[17],O=t[18]),(0,Q.useEffect)(D,O);let k;t[19]===n.docName?k=t[20]:(k=()=>y(n.docName),t[19]=n.docName,t[20]=k);let[A]=(0,Q.useState)(k),j=A?.html??null,[M,N]=(0,Q.useState)(!1),P,F;t[21]!==n.docName||t[22]!==w.isLarge||t[23]!==w.renderSource||t[24]!==w.renderVisual||t[25]!==M||t[26]!==i||t[27]!==g?(P=()=>{Rk({isLarge:w.isLarge,renderSource:w.renderSource,renderVisual:w.renderVisual,hasEmittedFirstToggle:M})&&(le(`ok/cold/first-toggle`,{docName:n.docName,mountId:at(n.docName),ytextLength:g,modeEnteredFirst:i?`source`:`visual`}),N(!0))},F=[M,w.isLarge,w.renderSource,w.renderVisual,n.docName,g,i],t[21]=n.docName,t[22]=w.isLarge,t[23]=w.renderSource,t[24]=w.renderVisual,t[25]=M,t[26]=i,t[27]=g,t[28]=P,t[29]=F):(P=t[28],F=t[29]),(0,Q.useEffect)(P,F);let I=r?`visible`:`hidden`,L=`editor:${n.docName}`,R=A?.scrollTop,z;t[30]!==a||t[31]!==n||t[32]!==w.renderSource||t[33]!==w.renderVisual||t[34]!==r||t[35]!==p||t[36]!==o||t[37]!==i||t[38]!==c||t[39]!==l||t[40]!==h||t[41]!==s||t[42]!==f||t[43]!==j?(z=f?(0,Z.jsx)(Yk,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(Ok,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:j?(0,Z.jsx)(Zk,{html:j}):(0,Z.jsx)(zx,{}),children:(0,Z.jsx)(Ck,{docName:n.docName,provider:n.provider,children:p?(0,Z.jsx)(Sk,{docName:n.docName,provider:n.provider}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(Ak,{provider:n.provider}),!i&&(0,Z.jsx)(Pk,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[w.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(Jk,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,w.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(bD,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:h},`${n.docName}-${String(o)}-${n.poolEventId}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=w.renderSource,t[33]=w.renderVisual,t[34]=r,t[35]=p,t[36]=o,t[37]=i,t[38]=c,t[39]=l,t[40]=h,t[41]=s,t[42]=f,t[43]=j,t[44]=z):z=t[44];let B;t[45]!==r||t[46]!==R||t[47]!==z?(B=(0,Z.jsx)(qk,{isActive:r,initialScrollTop:R,children:z}),t[45]=r,t[46]=R,t[47]=z,t[48]=B):B=t[48];let V;return t[49]!==I||t[50]!==L||t[51]!==B?(V=(0,Z.jsx)(Q.Activity,{mode:I,name:L,children:B}),t[49]=I,t[50]=L,t[51]=B,t[52]=V):V=t[52],V}function $k(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function eA(e){let{value:t,unit:n}=$k(e);return n===`rem`?t*16:t}function tA(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var nA=3600*24*7;function rA(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?iA:m,O=g===void 0?nA: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=eA(b),J;t[6]===x?J=t[7]:(J=eA(x),t[6]=x,t[7]=J);let ee=J,Y;t[8]!==E||t[9]!==k?(Y=function(e){E&&(P.current=!0,j.current=H.current?0:eA(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]=Y):Y=t[10];let te=Y,ne,X;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==ee||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ne=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=$k(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(ee,t)),u=tA(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(ee,u)),f=tA(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)}},X=[i,a,D,q,ee,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=ee,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ne,t[25]=X):(ne=t[24],X=t[25]),(0,Q.useEffect)(ne,X);let re;return t[26]===te?re=t[27]:(re={dragRef:A,isDragging:N,handleMouseDown:te},t[26]=te,t[27]=re),re}function iA(){}var aA=3600*24*7,oA=`18rem`,sA=`3rem`,cA=`app-file-sidebar`,lA=`14.625rem`,uA=`32rem`,dA=`sidebar_width`,fA=/^\d+(?:\.\d+)?(?:rem|px)$/,pA=Q.createContext(null);function mA(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${dA}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return fA.test(n)?n:e}function hA(){let e=Q.use(pA);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function gA(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?oA:c,[u]=Q.useState(vA),d;t[8]===u?d=t[9]:(d=()=>Ow(u,window.innerWidth,`left`),t[8]=u,t[9]=d);let[f,p]=Q.useState(d),m;t[10]===l?m=t[11]:(m=()=>mA(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=Fw();return Lw(`left`,Ow(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),Rw(`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(_A)},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: ${Tw}px)`),t=()=>{let e=Ow(u,window.innerWidth,`left`);p(e),C(Lw(`left`,e,Fw())===`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(cA)?.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=>{nc(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":sA,...s},t[45]=s,t[46]=h,t[47]=U):U=t[47];let W=U,G;t[48]===r?G=t[49]:(G=oi(`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)(pA.Provider,{value:H,children:K}),t[55]=H,t[56]=K,t[57]=q):q=t[57],q}function _A(e){return!e}function vA(){return Or()}function yA(e){let t=(0,$.c)(39),n,r,a,o,s,c;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6]):({side:o,variant:s,collapsible:c,className:r,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`left`:o,u=s===void 0?`sidebar`:s,d=c===void 0?`offcanvas`:c,{_:f}=i(),{state:p,isDraggingRail:m}=hA();if(d===`none`){let e;t[7]===r?e=t[8]:(e=oi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let i;return t[9]!==n||t[10]!==a||t[11]!==e||t[12]!==u?(i=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":u,className:e,...a,children:n}),t[9]=n,t[10]=a,t[11]=e,t[12]=u,t[13]=i):i=t[13],i}let h=p===`collapsed`?d:``,g=u===`floating`||u===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[14]===g?_=t[15]:(_=oi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[14]=g,t[15]=_);let v;t[16]===_?v=t[17]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[16]=_,t[17]=v);let y;t[18]===f?y=t[19]:(y=f({id:`07q4Qk`}),t[18]=f,t[19]=y);let b=u===`floating`||u===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,x;t[20]!==r||t[21]!==b?(x=oi(`fixed inset-y-0 z-10 flex h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none motion-reduce:duration-0 data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,b,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[20]=r,t[21]=b,t[22]=x):x=t[22];let S;t[23]===n?S=t[24]:(S=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[23]=n,t[24]=S);let C;t[25]!==a||t[26]!==l||t[27]!==x||t[28]!==S||t[29]!==y?(C=(0,Z.jsx)(`nav`,{id:cA,"aria-label":y,"data-slot":`sidebar-container`,"data-side":l,className:x,...a,children:S}),t[25]=a,t[26]=l,t[27]=x,t[28]=S,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==m||t[32]!==l||t[33]!==p||t[34]!==C||t[35]!==h||t[36]!==v||t[37]!==u?(w=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":p,"data-collapsible":h,"data-variant":u,"data-side":l,"data-slot":`sidebar`,"data-dragging":m,children:[v,C]}),t[31]=m,t[32]=l,t[33]=p,t[34]=C,t[35]=h,t[36]=v,t[37]=u,t[38]=w):w=t[38],w}function bA(e){let t=(0,$.c)(34),n,r,a;t[0]===e?(n=t[1],r=t[2],a=t[3]):({className:n,onClick:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a);let{_:o}=i(),{toggleSidebar:s,state:c}=hA(),l,u,d,f,p,m,h,g;if(t[4]!==o||t[5]!==c){let e=rc(`toggle-files-sidebar`);l=ci,u=`trigger`,d=`sidebar-trigger`,f=`ghost`,p=`icon-sm`,m=c===`expanded`,h=cA,g=o(c===`expanded`?{id:`4PYsOz`,values:{sidebarShortcutLabel:e}}:{id:`jbSG8V`,values:{sidebarShortcutLabel:e}}),t[4]=o,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[14]===n?_=t[15]:(_=oi(n),t[14]=n,t[15]=_);let v;t[16]!==r||t[17]!==s?(v=e=>{r?.(e),s()},t[16]=r,t[17]=s,t[18]=v):v=t[18];let y;t[19]===c?y=t[20]:(y=c===`expanded`?(0,Z.jsx)(Yt,{}):(0,Z.jsx)(Bl,{}),t[19]=c,t[20]=y);let b;return t[21]!==l||t[22]!==a||t[23]!==u||t[24]!==y||t[25]!==d||t[26]!==f||t[27]!==p||t[28]!==m||t[29]!==h||t[30]!==g||t[31]!==_||t[32]!==v?(b=(0,Z.jsx)(l,{"data-sidebar":u,"data-slot":d,variant:f,size:p,"aria-expanded":m,"aria-controls":h,"aria-label":g,className:_,onClick:v,...a,children:y}),t[21]=l,t[22]=a,t[23]=u,t[24]=y,t[25]=d,t[26]=f,t[27]=p,t[28]=m,t[29]=h,t[30]=g,t[31]=_,t[32]=v,t[33]=b):b=t[33],b}function xA(e){let t=(0,$.c)(32),n,r,a,o,s;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5]):({className:n,enableDrag:o,enableToggle:s,onMouseDown:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s);let c=o===void 0?!0:o,l=s===void 0?!0:s,{_:u}=i(),{toggleSidebar:d,setWidth:f,state:p,width:m,setIsDraggingRail:h}=hA(),g=p===`collapsed`,_;t[6]!==c||t[7]!==l||t[8]!==h||t[9]!==f||t[10]!==g||t[11]!==d||t[12]!==m?(_={direction:`right`,enableDrag:c,enableToggle:l,onResize:f,onToggle:d,currentWidth:m,isCollapsed:g,minResizeWidth:lA,maxResizeWidth:uA,setIsDraggingRail:h,widthCookieName:dA,widthCookieMaxAge:aA},t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=g,t[11]=d,t[12]=m,t[13]=_):_=t[13];let{dragRef:v,handleMouseDown:y}=rA(_),b;t[14]!==u||t[15]!==p?(b=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[14]=u,t[15]=p,t[16]=b):b=t[16];let x;t[17]!==y||t[18]!==r?(x=e=>{r?.(e),e.defaultPrevented||y(e)},t[17]=y,t[18]=r,t[19]=x):x=t[19];let S;t[20]!==u||t[21]!==p?(S=u(p===`expanded`?{id:`w3vFfL`}:{id:`e8zRrb`}),t[20]=u,t[21]=p,t[22]=S):S=t[22];let C;t[23]===n?C=t[24]:(C=oi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[23]=n,t[24]=C);let w;return t[25]!==v||t[26]!==a||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C?(w=(0,Z.jsx)(`button`,{ref:v,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":b,tabIndex:-1,onMouseDown:x,title:S,className:C,...a}),t[25]=v,t[26]=a,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w):w=t[31],w}function SA(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}=hA(),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=oi(`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 CA(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=oi(`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 wA(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=oi(`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 TA(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=oi(`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 EA(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=oi(`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 DA(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=oi(`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 OA=ii(`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 kA(e){let t=(0,$.c)(28),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?si:`button`,{state:m}=hA(),h;t[8]!==n||t[9]!==f||t[10]!==d?(h=oi(OA({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)(js,{asChild:!0,children:_}),t[20]=_,t[21]=v);let y=m!==`collapsed`,b;t[22]!==y||t[23]!==c?(b=(0,Z.jsx)(Ns,{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)(Is,{children:[v,b]}),t[25]=v,t[26]=b,t[27]=x):x=t[27],x}function AA(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 jA(){let e=await fetch(`/api/server-info`,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return null;let t=await e.json(),n=Rr.safeParse(t);return n.success?n.data.currentBranch??null:null}var MA=typeof window>`u`?{getSnapshot:()=>null,subscribe:()=>()=>{}}:AA({fetchBranch:jA,subscribeToEvent:ns}),NA=MA.subscribe,PA=MA.getSnapshot;function FA(){return(0,Q.useSyncExternalStore)(NA,PA,PA)}function IA(){let e=(0,$.c)(6),t=FA(),n=po(),{state:r}=hA(),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&&ua(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 LA(e){let t=(0,$.c)(23),{stats:n,selectionStats:r,showStats:a}=e,o=a===void 0?!0:a,{_:c}=i(),l=IA();if(!o&&l===null)return null;let u=r??n,d=r!=null,{words:f,chars:p,tokens:m}=u,h;t[0]!==c||t[1]!==d||t[2]!==o?(h=c(o?d?{id:`Bv5a9_`}:{id:`L1ZE3M`}:{id:`goO4Ll`}),t[0]=c,t[1]=d,t[2]=o,t[3]=h):h=t[3];let g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-full h-2 bg-linear-to-t from-background to-transparent`}),t[4]=g):g=t[4];let _;t[5]===l?_=t[6]:(_=l===null?null:(0,Z.jsx)(RA,{identity:l}),t[5]=l,t[6]=_);let v;t[7]===_?v=t[8]:(v=(0,Z.jsx)(`span`,{className:`flex min-w-0 items-center gap-3`,children:_}),t[7]=_,t[8]=v);let y;t[9]!==c||t[10]!==u.chars||t[11]!==u.tokens||t[12]!==u.words||t[13]!==p||t[14]!==d||t[15]!==o||t[16]!==m||t[17]!==f?(y=o?(0,Z.jsxs)(`span`,{className:`flex items-center shrink-0 gap-3`,children:[d?(0,Z.jsx)(`span`,{className:`font-medium text-foreground/70`,"data-testid":`editor-footer-selected-label`,children:c({id:`ylXj1N`})}):null,(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.words.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`gljvbT`,values:{words:f}})]}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.chars.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`d5rK4X`,values:{chars:p}})]}),(0,Z.jsxs)(`span`,{children:[u.tokens>0?`~`:``,(0,Z.jsx)(`span`,{className:`tabular-nums`,children:u.tokens.toLocaleString()}),` `,(0,Z.jsx)(s,{id:`uynXup`,values:{tokens:m}})]})]}):null,t[9]=c,t[10]=u.chars,t[11]=u.tokens,t[12]=u.words,t[13]=p,t[14]=d,t[15]=o,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==h||t[20]!==v||t[21]!==y?(b=(0,Z.jsxs)(`section`,{"aria-label":h,className:`relative flex h-6 shrink-0 items-center justify-between gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[g,v,y]}),t[19]=h,t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function RA(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)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`truncate`,"data-testid":`editor-footer-project-name`,children:r})}),(0,Z.jsx)(Ns,{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)(Oe,{"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 zA(e){let t=(0,$.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{_:a}=i(),o;t[3]===a?o=t[4]:(o=a({id:`3__SjS`}),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=oi(n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==o||t[9]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,"data-slot":`breadcrumb`,className:s,...r}),t[7]=r,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function BA(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=oi(`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 VA(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=oi(`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 HA(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=oi(`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 UA(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=oi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(No,{}),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 WA=1,GA=2,KA=4;function qA(e){let t=(0,$.c)(18),{docName:n,className:r}=e;if(!n)return null;let i,a,o,s,c,l;if(t[0]!==r||t[1]!==n){l=Symbol.for(`react.early_return_sentinel`);bb0:{let{prefix:e}=je(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}let d=(e,t)=>({kind:`segment`,value:e,key:u.slice(0,t+1).join(`/`)}),f=u.length>KA?[...u.slice(0,WA).map((e,t)=>d(e,t)),{kind:`ellipsis`,hidden:u.slice(WA,-GA)},...u.slice(-GA).map((e,t)=>d(e,u.length-GA+t))]:u.map((e,t)=>d(e,t));a=zA,t[8]===r?c=t[9]:(c=oi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=BA,o=`min-w-0 flex-nowrap gap-1 overflow-hidden text-muted-foreground/70 text-xs`,s=f.map(JA)}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 JA(e,t){let n=e.kind===`segment`?e.key:`ellipsis`;return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(UA,{className:`shrink-0 text-muted-foreground/70 [&>svg]:size-3`}),e.kind===`ellipsis`?(0,Z.jsxs)(VA,{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)(hl,{className:`size-3.5`})}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.hidden.join(` / `)})]}):(0,Z.jsx)(VA,{className:`min-w-0`,children:(0,Z.jsx)(HA,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e.value,children:e.value})})]},n)}var YA={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`},XA=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`,...YA,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},ZA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},QA=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)(XA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function $A(e){let t=(0,$.c)(90),{activeDocName:n,isSourceMode:r,sourceDisabled:a,onModeChange:o,showAddPropertyButton:c,onAddProperty:l,isPanelCollapsed:u,onTogglePanel:d}=e,{_:f}=i(),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=tc(`toggle-document-panel`),t[0]=p):p=t[0];let m=p,h,g,_,v,y,b,x,S,C,w,T,E,D,O;if(t[1]!==f||t[2]!==n||t[3]!==u||t[4]!==r||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==c||t[9]!==a){let e=rc(`toggle-document-panel`);v=`editor-toolbar`,y=`pointer-events-none absolute inset-x-0 top-0 z-10`;let i;t[24]===n?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-center`,children:(0,Z.jsx)(qA,{docName:n})}),t[24]=n,t[25]=i);let p=r?`source`:`wysiwyg`,m;t[26]===o?m=t[27]:(m=e=>{e&&o(e)},t[26]=o,t[27]=m);let k;t[28]===f?k=t[29]:(k=f({id:`n7aopT`}),t[28]=f,t[29]=k);let A;t[30]===f?A=t[31]:(A=f({id:`ur2XSb`}),t[30]=f,t[31]=A);let j;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(js,{children:(0,Z.jsx)(QA,{className:`size-4`})}),t[32]=j):j=t[32];let M;t[33]===A?M=t[34]:(M=(0,Z.jsx)(yo,{value:`wysiwyg`,"aria-label":A,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:j}),t[33]=A,t[34]=M);let N;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`Mb_20S`})}),t[35]=N):N=t[35];let P;t[36]===M?P=t[37]:(P=(0,Z.jsxs)(Is,{children:[M,N]}),t[36]=M,t[37]=P);let F;t[38]===f?F=t[39]:(F=f({id:`xbdtfY`}),t[38]=f,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(ZA,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==F?(L=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(yo,{value:`source`,"aria-label":F,disabled:a,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:I})})}),t[41]=a,t[42]=F,t[43]=L):L=t[43];let R;t[44]===a?R=t[45]:(R=(0,Z.jsx)(Ns,{side:`bottom`,children:a?(0,Z.jsx)(s,{id:`G-JBA1`}):(0,Z.jsx)(s,{id:`u6Hp4N`})}),t[44]=a,t[45]=R);let z;t[46]!==L||t[47]!==R?(z=(0,Z.jsxs)(Is,{children:[L,R]}),t[46]=L,t[47]=R,t[48]=z):z=t[48];let B;t[49]!==p||t[50]!==m||t[51]!==k||t[52]!==P||t[53]!==z?(B=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(xo,{type:`single`,value:p,onValueChange:m,"aria-label":k,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[P,z]})}),t[49]=p,t[50]=m,t[51]=k,t[52]=P,t[53]=z,t[54]=B):B=t[54],t[55]!==i||t[56]!==B?(b=(0,Z.jsx)(`div`,{className:`editor-content-aligned bg-background py-2`,children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center`,children:[i,B]})}),t[55]=i,t[56]=B,t[57]=b):b=t[57],O=`pointer-events-auto absolute top-0 right-0 flex items-center justify-end gap-1 py-2 pr-2`,t[58]!==f||t[59]!==l||t[60]!==c?(_=c&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,"aria-label":f({id:`81H_23`}),onClick:l,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(js,{children:(0,Z.jsx)(Nl,{})})}),(0,Z.jsx)(Ns,{side:`bottom`,children:(0,Z.jsx)(s,{id:`81H_23`})})]}),t[58]=f,t[59]=l,t[60]=c,t[61]=_):_=t[61],g=Is,h=ci,x=``,S=`ghost`,C=`icon`,w=d,T=!u,E=`doc-panel`,D=f(u?{id:`u7H-Wn`,values:{panelShortcutLabel:e}}:{id:`2hpdRq`,values:{panelShortcutLabel:e}}),t[1]=f,t[2]=n,t[3]=u,t[4]=r,t[5]=l,t[6]=o,t[7]=d,t[8]=c,t[9]=a,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O}else h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23];let k;t[62]===u?k=t[63]:(k=(0,Z.jsx)(js,{children:u?(0,Z.jsx)(Hl,{}):(0,Z.jsx)(Vl,{})}),t[62]=u,t[63]=k);let A;t[64]!==h||t[65]!==k||t[66]!==x||t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==T||t[71]!==E||t[72]!==D?(A=(0,Z.jsx)(h,{"data-doc-panel-toggle":x,variant:S,size:C,onClick:w,"aria-expanded":T,"aria-controls":E,"aria-label":D,asChild:!0,children:k}),t[64]=h,t[65]=k,t[66]=x,t[67]=S,t[68]=C,t[69]=w,t[70]=T,t[71]=E,t[72]=D,t[73]=A):A=t[73];let j;t[74]===u?j=t[75]:(j=(0,Z.jsx)(Ns,{side:`bottom`,children:u?(0,Z.jsx)(s,{id:`KFdXwz`,values:{panelShortcut:m}}):(0,Z.jsx)(s,{id:`MsuXaI`,values:{panelShortcut:m}})}),t[74]=u,t[75]=j);let M;t[76]!==g||t[77]!==A||t[78]!==j?(M=(0,Z.jsxs)(g,{children:[A,j]}),t[76]=g,t[77]=A,t[78]=j,t[79]=M):M=t[79];let N;t[80]!==_||t[81]!==M||t[82]!==O?(N=(0,Z.jsxs)(`div`,{className:O,children:[_,M]}),t[80]=_,t[81]=M,t[82]=O,t[83]=N):N=t[83];let P;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[84]=P):P=t[84];let F;return t[85]!==v||t[86]!==y||t[87]!==b||t[88]!==N?(F=(0,Z.jsxs)(`div`,{"data-testid":v,className:y,children:[b,N,P]}),t[85]=v,t[86]=y,t[87]=b,t[88]=N,t[89]=F):F=t[89],F}function ej(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}function tj(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=oi(`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)(Vd,{"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 nj=ii(`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 rj(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=oi(nj({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)(Hd,{"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 ij(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=oi(`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)(Ud,{"data-slot":`tabs-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function aj(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=oi(`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)(Wd,{"data-slot":`tabs-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var oj=`ok-terminal-height-v1`,sj=.5;function cj(e){return Math.max(120,Math.round((Number.isFinite(e)?e:0)*sj))}function lj(e,t){let n=cj(t);return Number.isFinite(e)?e<120?120:e>n?n:Math.round(e):Math.min(240,n)}function uj(){return typeof window>`u`?0:window.innerHeight}function dj(e,t){try{let n=e??localStorage,r=t??uj(),i=n.getItem(oj);if(i==null)return lj(240,r);let a=Number.parseInt(i,10);return lj(Number.isFinite(a)?a:240,r)}catch{return 240}}function fj(e,t,n){try{let r=t??localStorage,i=n??uj();r.setItem(oj,String(lj(e,i)))}catch{}}function pj(){try{return typeof localStorage>`u`?240:dj()}catch{return 240}}var mj=(0,Q.lazy)(()=>n(()=>import(`./TerminalPanel-Bj2Zsd7g.js`).then(e=>({default:e.TerminalPanel})),__vite__mapDeps([57,1,22,6,3,23,9,11,58,59]),import.meta.url));function hj(e){let t=(0,$.c)(11),{bridge:n,onClose:r,launch:a}=e,o=a===void 0?null:a,{enabled:s,synced:c}=Ai(),l=lo(),{_:u}=i(),d=c&&s===!1,f;t[0]!==u||t[1]!==l?(f=function(){if(l===null){hs.error(u({id:`V_6bJ4`}));return}let e=l(!0);e.ok||hs.error(u({id:`jKd3AP`,values:{0:e.error}}))},t[0]=u,t[1]=l,t[2]=f):f=t[2];let p=f;if(c&&!d){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 i;return t[4]!==n||t[5]!==o||t[6]!==r?(i=(0,Z.jsx)(ce,{fallbackRender:_j,onError:gj,children:(0,Z.jsx)(Q.Suspense,{fallback:e,children:(0,Z.jsx)(mj,{bridge:n,className:`h-full`,onClose:r,launch:o})})}),t[4]=n,t[5]=o,t[6]=r,t[7]=i):i=t[7],i}let m;return t[8]!==p||t[9]!==d?(m=d?(0,Z.jsx)(bj,{onEnable:p}):(0,Z.jsx)(`div`,{className:`h-full w-full bg-background`,"aria-hidden":`true`}),t[8]=p,t[9]=d,t[10]=m):m=t[10],m}function gj(e,t){console.error(`[TerminalGate] rendered fallback for the terminal panel`,e,t.componentStack)}function _j(e){return(0,Z.jsx)(vj,{...e})}function vj(e){let t=(0,$.c)(15),{error:n}=e,{_:r}=i(),a;t[0]!==r||t[1]!==n?(a=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`fbsiBw`}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===r?s=t[4]:(s=r({id:`6MnZEC`}),t[3]=r,t[4]=s);let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[5]=o,t[6]=c);let l;t[7]===r?l=t[8]:(l=r({id:`HpK_8d`}),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(ci,{onClick:yj,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==s||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(`section`,{"aria-label":s,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,role:`alert`,children:[c,u]}),t[11]=s,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function yj(){return window.location.reload()}function bj(e){let t=(0,$.c)(20),{onEnable:n}=e,{_:r}=i(),a;t[0]===r?a=t[1]:(a=r({id:`_XWY2J`}),t[0]=r,t[1]=a);let o;t[2]===r?o=t[3]:(o=r({id:`oYepHb`}),t[2]=r,t[3]=o);let s;t[4]===o?s=t[5]:(s=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-foreground`,children:o}),t[4]=o,t[5]=s);let c;t[6]===r?c=t[7]:(c=r({id:`v2ZW0K`}),t[6]=r,t[7]=c);let l;t[8]!==n||t[9]!==c?(l=(0,Z.jsx)(ci,{onClick:n,children:c}),t[8]=n,t[9]=c,t[10]=l):l=t[10];let u;t[11]===r?u=t[12]:(u=r({id:`ICoNYz`}),t[11]=r,t[12]=u);let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u}),t[13]=u,t[14]=d);let f;return t[15]!==a||t[16]!==s||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{"aria-label":a,className:`flex h-full w-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[s,l,d]}),t[15]=a,t[16]=s,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xj(e){let t=(0,$.c)(36),{sessions:n,activeSessionId:r,onSelect:a,onTabActivate:o,onNew:c,onClose:l,children:u,className:d}=e,{_:f}=i(),p;t[0]===d?p=t[1]:(p=oi(`flex min-h-0 min-w-0 flex-1 flex-col`,d),t[0]=d,t[1]=p);let m;t[2]===f?m=t[3]:(m=f({id:`1MGRQl`}),t[2]=f,t[3]=m);let h;if(t[4]!==f||t[5]!==r||t[6]!==l||t[7]!==o||t[8]!==n){let e;t[10]!==f||t[11]!==r||t[12]!==l||t[13]!==o?(e=e=>{let t=e.id===r;return(0,Z.jsxs)(`div`,{className:oi(`group flex shrink-0 items-center rounded-md pr-0.5 transition-colors`,t?`bg-muted`:`hover:bg-muted/50`),children:[(0,Z.jsx)(ij,{value:e.id,onClick:()=>o?.(e.id),className:`h-7 flex-none rounded-md px-2 text-xs`,children:(0,Z.jsx)(`span`,{className:`max-w-40 truncate`,children:e.label})}),(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":f({id:`nzHlj8`,values:{0:e.label}}),tabIndex:t?0:-1,className:oi(`text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 group-focus-within:opacity-100`,t&&`opacity-100`),onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`})})]},e.id)},t[10]=f,t[11]=r,t[12]=l,t[13]=o,t[14]=e):e=t[14],h=n.map(e),t[4]=f,t[5]=r,t[6]=l,t[7]=o,t[8]=n,t[9]=h}else h=t[9];let g;t[15]!==m||t[16]!==h?(g=(0,Z.jsx)(rj,{variant:`line`,"aria-label":m,className:`flex h-auto min-w-0 flex-1 items-center justify-start gap-0.5 overflow-x-auto bg-transparent p-0 [scrollbar-width:none] scroll-fade-mask-x`,children:h}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===f?_=t[19]:(_=f({id:`AB4qw9`}),t[18]=f,t[19]=_);let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(V,{"aria-hidden":`true`}),t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==_?(y=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":_,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:c,children:v})}),t[21]=c,t[22]=_,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Ns,{side:`bottom`,sideOffset:8,children:(0,Z.jsx)(s,{id:`AB4qw9`})}),t[24]=b):b=t[24];let x;t[25]===y?x=t[26]:(x=(0,Z.jsxs)(Is,{children:[y,b]}),t[25]=y,t[26]=x);let S;t[27]!==g||t[28]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-1 px-1.5 py-1`,children:[g,x]}),t[27]=g,t[28]=x,t[29]=S):S=t[29];let C;return t[30]!==r||t[31]!==u||t[32]!==a||t[33]!==p||t[34]!==S?(C=(0,Z.jsxs)(tj,{value:r,onValueChange:a,className:p,children:[S,u]}),t[30]=r,t[31]=u,t[32]=a,t[33]=p,t[34]=S,t[35]=C):C=t[35],C}var Sj=`terminal-dock-panel`;function Cj(e){return`terminal-session-${e}`}function wj(e){e!==``&&document.querySelector(`[data-terminal-session="${e}"] .xterm-helper-textarea`)?.focus()}function Tj(e){let t=(0,$.c)(77),{bridge:n,children:r,visible:a,onVisibleChange:o,launch:s}=e,c=s===void 0?null:s,{_:l}=i(),{resolvedTheme:u}=Nr(),d=Tx(),f=(0,Q.useRef)(null),[p,m]=(0,Q.useState)(!a),h;t[0]!==c||t[1]!==a?(h=()=>a?[{id:Cj(1),launch:c}]:[],t[0]=c,t[1]=a,t[2]=h):h=t[2];let[g,_]=(0,Q.useState)(h),v;t[3]===a?v=t[4]:(v=()=>a?Cj(1):``,t[3]=a,t[4]=v);let[y,b]=(0,Q.useState)(v),x=(0,Q.useRef)(y),S=(0,Q.useRef)(g),C=(0,Q.useRef)(+!!a),w=(0,Q.useRef)(a&&c?c.nonce:null),T=(0,Q.useRef)(a),E;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=function(e){C.current+=1;let t=Cj(C.current);_(n=>[...n,{id:t,launch:e}]),b(t)},t[5]=E):E=t[5];let D=E,O=(0,Q.useRef)(D),k;t[6]!==y||t[7]!==o?(k=function(e){let t=S.current,n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t.filter(t=>t.id!==e);if(e===y){let e=(t[n-1]??t[n+1])?.id??``;b(e),e!==``&&queueMicrotask(()=>wj(e))}_(r),r.length===0&&(o(!1),f.current?.focus())},t[6]=y,t[7]=o,t[8]=k):k=t[8];let A=k,j=(0,Q.useRef)(Oj),M;t[9]!==y||t[10]!==A||t[11]!==g?(M=()=>{O.current=D,x.current=y,S.current=g,j.current=()=>{y!==``&&A(y)}},t[9]=y,t[10]=A,t[11]=g,t[12]=M):M=t[12],(0,Q.useEffect)(M);let[N]=(0,Q.useState)(Dj),P=(0,Q.useRef)(N),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(e){R.current!=null&&clearTimeout(R.current),R.current=setTimeout(()=>{fj(e),R.current=null},100)},t[13]=z):z=t[13];let B=z,V=(0,Q.useRef)(null),H,U;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>()=>{R.current!=null&&clearTimeout(R.current),V.current!=null&&(window.removeEventListener(`pointerup`,V.current),V.current=null)},U=[],t[14]=H,t[15]=U):(H=t[14],U=t[15]),(0,Q.useEffect)(H,U);let W,G;t[16]!==c||t[17]!==g.length||t[18]!==a?(W=()=>{let e=T.current;if(T.current=a,c!=null&&c.nonce!==w.current){w.current=c.nonce,O.current(c);return}a&&!e&&g.length===0&&O.current(null)},G=[a,c,g.length],t[16]=c,t[17]=g.length,t[18]=a,t[19]=W,t[20]=G):(W=t[19],G=t[20]),(0,Q.useEffect)(W,G);let K,q;t[21]===n?(K=t[22],q=t[23]):(K=()=>n.onMenuAction(e=>{e===`new-terminal`?O.current(null):e===`kill-terminal`&&j.current()}),q=[n],t[21]=n,t[22]=K,t[23]=q),(0,Q.useEffect)(K,q);let J,ee;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>{let e=function(e){if(!e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||!/^[1-9]$/.test(e.key)||!document.getElementById(Sj)?.contains(document.activeElement))return;let t=S.current[Number(e.key)-1];t!=null&&(e.preventDefault(),e.stopPropagation(),b(t.id),queueMicrotask(()=>wj(t.id)))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ee=[],t[24]=J,t[25]=ee):(J=t[24],ee=t[25]),(0,Q.useEffect)(J,ee);let Y;t[26]!==n.editor||t[27]!==g.length?(Y=()=>{n.editor.notifyViewMenuStateChanged({terminalLive:g.length>0})},t[26]=n.editor,t[27]=g.length,t[28]=Y):Y=t[28];let te;t[29]!==n||t[30]!==g.length?(te=[n,g.length],t[29]=n,t[30]=g.length,t[31]=te):te=t[31],(0,Q.useEffect)(Y,te);let ne,X;t[32]!==d||t[33]!==a?(ne=()=>{let e=d.current;e!=null&&(a?e.resize(`${P.current}px`):e.collapse())},X=[a,d],t[32]=d,t[33]=a,t[34]=ne,t[35]=X):(ne=t[34],X=t[35]),(0,Q.useEffect)(ne,X);let re,ie;t[36]===p?(re=t[37],ie=t[38]):(re=()=>{p&&document.getElementById(Sj)?.contains(document.activeElement)&&f.current?.focus()},ie=[p],t[36]=p,t[37]=re,t[38]=ie),(0,Q.useLayoutEffect)(re,ie);let ae,oe;t[39]===p?(ae=t[40],oe=t[41]):(ae=()=>{p||wj(x.current)},oe=[p],t[39]=p,t[40]=ae,t[41]=oe),(0,Q.useEffect)(ae,oe);let se;if(t[42]!==l||t[43]!==g){let e;t[45]===l?e=t[46]:(e=(e,t)=>({id:e.id,label:l({id:`OVjNeX`,values:{0:t+1}})}),t[45]=l,t[46]=e),se=g.map(e),t[42]=l,t[43]=g,t[44]=se}else se=t[44];let ce=se,le=F||void 0,ue;t[47]===r?ue=t[48]:(ue=(0,Z.jsx)(qC,{minSize:`5%`,className:`flex min-h-0 flex-col`,children:(0,Z.jsx)(`div`,{ref:f,tabIndex:-1,className:`flex h-full min-h-0 flex-col outline-none`,children:r})}),t[47]=r,t[48]=ue);let de;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(JC,{withHandle:!0,onPointerDown:()=>{I(!0),L.current=!0;let e=()=>{I(!1),L.current=!1,window.removeEventListener(`pointerup`,e),V.current=null};V.current=e,window.addEventListener(`pointerup`,e)}}),t[49]=de):de=t[49];let fe;t[50]===u?fe=t[51]:(fe=Lc(u),t[50]=u,t[51]=fe);let pe;t[52]===fe.background?pe=t[53]:(pe={backgroundColor:fe.background},t[52]=fe.background,t[53]=pe);let me=a?`${N}px`:0,he;t[54]!==o||t[55]!==a?(he=e=>{let t=e.asPercentage===0;m(t),L.current&&(t&&a?o(!1):!t&&!a&&o(!0),e.inPixels>0&&(P.current=e.inPixels,B(e.inPixels)))},t[54]=o,t[55]=a,t[56]=he):he=t[56];let ge=!F&&`transition-[flex-grow] duration-150 ease-out motion-reduce:transition-none motion-reduce:duration-0`,_e;t[57]===ge?_e=t[58]:(_e=oi(`flex flex-col`,ge),t[57]=ge,t[58]=_e);let ve;t[59]!==y||t[60]!==n||t[61]!==A||t[62]!==g||t[63]!==ce?(ve=g.length>0?(0,Z.jsx)(xj,{sessions:ce,activeSessionId:y,onSelect:b,onTabActivate:Ej,onNew:()=>D(null),onClose:A,className:`h-full`,children:g.map(e=>(0,Z.jsx)(aj,{value:e.id,forceMount:!0,"data-terminal-session":e.id,className:`m-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,Z.jsx)(hj,{bridge:n,launch:e.launch,onClose:()=>A(e.id)})},e.id))}):null,t[59]=y,t[60]=n,t[61]=A,t[62]=g,t[63]=ce,t[64]=ve):ve=t[64];let ye;t[65]!==p||t[66]!==d||t[67]!==pe||t[68]!==me||t[69]!==he||t[70]!==_e||t[71]!==ve?(ye=(0,Z.jsx)(qC,{id:Sj,style:pe,panelRef:d,defaultSize:me,minSize:`120px`,maxSize:`95%`,collapsible:!0,collapsedSize:0,onResize:he,inert:p,className:_e,children:ve}),t[65]=p,t[66]=d,t[67]=pe,t[68]=me,t[69]=he,t[70]=_e,t[71]=ve,t[72]=ye):ye=t[72];let be;return t[73]!==le||t[74]!==ue||t[75]!==ye?(be=(0,Z.jsxs)(KC,{orientation:`vertical`,className:`min-h-0 flex-1`,"data-dragging":le,children:[ue,de,ye]}),t[73]=le,t[74]=ue,t[75]=ye,t[76]=be):be=t[76],be}function Ej(e){return queueMicrotask(()=>wj(e))}function Dj(){return pj()}function Oj(){}var kj=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-DKpBhLuw.js`),__vite__mapDeps([36,1,2,37,38,39,23,40,41,42,43,44,45,46,47,14,6,8,9,22,3,24,4,12,10,11,48,49]),import.meta.url)).ActivityModeContent})),Aj=`300px`,jj=`600px`;function Mj(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(Pj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Nj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(Wt,{name:`editor-area`,children:(0,Z.jsxs)(AC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function Nj(){let e=(0,$.c)(5),t=Dg(),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)(VC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function Pj(e){let t=(0,$.c)(157),{editorMode:n,onModeChange:r,activeTab:a,onActiveTabChange:o,terminalBridge:c,terminalVisible:l,onTerminalVisibleChange:u,terminalLaunch:d}=e,f=l===void 0?!1:l,p=d===void 0?null:d,{_:m}=i(),{activeDocName:h,activeProvider:g,activeTarget:_,recycleDocument:v,docPanelMode:y,docPanelAgentId:b,docPanelExpandSignal:S}=mt(),{openDocumentTransition:C}=Dt(),{requestAddProperty:w}=MC(),T=gw(g,h),E=yw(h,n===`source`?`source`:`wysiwyg`),D=zw(g),O=D===`connected`||D===`synced`,k=vw(h)===`conflict`,[A,j]=(0,Q.useState)(!1),M,N;t[0]!==g||t[1]!==A?(M=()=>{g!=null&&!A&&j(!0)},N=[g,A],t[0]=g,t[1]=A,t[2]=M,t[3]=N):(M=t[2],N=t[3]),(0,Q.useEffect)(M,N);let P=(0,Q.useDeferredValue)(h),F=_?.kind===`missing`,I=!!h&&_?.kind!==`folder`,L;t[4]!==m||t[5]!==F?(L=F?m({id:`K-a33w`}):void 0,t[4]=m,t[5]=F,t[6]=L):L=t[6];let R=L,[z]=(0,Q.useState)(Lj),B=z!==null,V;t[7]===z?V=t[8]:(V=()=>Ow(z,window.innerWidth,`right`),t[7]=z,t[8]=V);let[H,U]=(0,Q.useState)(V),W=(0,Q.useRef)(H),G,K;t[9]===H?(G=t[10],K=t[11]):(G=()=>{W.current=H},K=[H],t[9]=H,t[10]=G,t[11]=K),(0,Q.useEffect)(G,K);let q=Tx(),J;t[12]===H?J=t[13]:(J=()=>Lw(`right`,H,Fw())===`collapsed`,t[12]=H,t[13]=J);let[ee]=(0,Q.useState)(J),[Y,te]=(0,Q.useState)(ee),ne=(0,Q.useRef)(Y),X,re;t[14]===Y?(X=t[15],re=t[16]):(X=()=>{ne.current=Y},re=[Y],t[14]=Y,t[15]=X,t[16]=re),(0,Q.useEffect)(X,re);let[ie,ae]=(0,Q.useState)(!1),oe=(0,Q.useRef)(!1),[se]=(0,Q.useState)(Ij),ce=(0,Q.useRef)(se),le=(0,Q.useRef)(null),ue;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ue=function(e){le.current!=null&&clearTimeout(le.current),le.current=setTimeout(()=>{Cw(e),le.current=null},100)},t[17]=ue):ue=t[17];let de=ue,fe,pe;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>()=>{le.current!=null&&clearTimeout(le.current)},pe=[],t[18]=fe,t[19]=pe):(fe=t[18],pe=t[19]),(0,Q.useEffect)(fe,pe);let[me,he]=(0,Q.useState)(null),ge;t[20]!==Y||t[21]!==q?(ge=function(){if(q.current==null)return;let e=W.current;Y?(Rw(`right`,e,`open`),q.current?.expand()):(Rw(`right`,e,`collapsed`),q.current?.collapse())},t[20]=Y,t[21]=q,t[22]=ge):ge=t[22];let _e=ge,ve,ye;t[23]!==z||t[24]!==q?(ve=()=>{let e=window.matchMedia(`(min-width: ${Ew}px)`),t=()=>{let e=Ow(z,window.innerWidth,`right`);U(e);let t=Lw(`right`,e,Fw())===`collapsed`;te(t),t?q.current?.collapse():q.current?.expand()};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},ye=[z,q],t[23]=z,t[24]=q,t[25]=ve,t[26]=ye):(ve=t[25],ye=t[26]),(0,Q.useEffect)(ve,ye);let be,xe;t[27]!==me||t[28]!==B||t[29]!==q?(be=()=>{if(me==null||B)return;let e=new ResizeObserver(()=>{ne.current||oe.current||q.current?.resize(`${ce.current}px`)});return e.observe(me),()=>e.disconnect()},xe=[me,B,q],t[27]=me,t[28]=B,t[29]=q,t[30]=be,t[31]=xe):(be=t[30],xe=t[31]),(0,Q.useEffect)(be,xe);let Se,Ce;t[32]!==o||t[33]!==q?(Se=()=>{let e=e=>{o(e),q.current?.expand()},t=Eh();return t&&e(t),Oh(t=>{Eh(),e(t)})},Ce=[o,q],t[32]=o,t[33]=q,t[34]=Se,t[35]=Ce):(Se=t[34],Ce=t[35]),(0,Q.useEffect)(Se,Ce);let we,Te;t[36]!==S||t[37]!==q?(we=()=>{S!==0&&q.current?.expand()},Te=[S,q],t[36]=S,t[37]=q,t[38]=we,t[39]=Te):(we=t[38],Te=t[39]),(0,Q.useEffect)(we,Te);let Ee,De;t[40]===Y?(Ee=t[41],De=t[42]):(Ee=()=>{if(!Y||!document.getElementById(`doc-panel`)?.contains(document.activeElement))return;let e=document.querySelector(`[data-doc-panel-toggle]`);if(e){e.focus();return}document.querySelector(`[data-sidebar="trigger"]`)?.focus()},De=[Y],t[40]=Y,t[41]=Ee,t[42]=De),(0,Q.useLayoutEffect)(Ee,De);let Oe,ke;t[43]===Y?(Oe=t[44],ke=t[45]):(Oe=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({docPanelVisible:!Y})},ke=[Y],t[43]=Y,t[44]=Oe,t[45]=ke),(0,Q.useEffect)(Oe,ke);let Ae,je;t[46]===_e?(Ae=t[47],je=t[48]):(Ae=()=>{if(window.okDesktop!=null)return window.okDesktop.onMenuAction(e=>{e===`toggle-doc-panel`&&_e()})},je=[_e],t[46]=_e,t[47]=Ae,t[48]=je),(0,Q.useEffect)(Ae,je);let Me,Ne;t[49]===_e?(Me=t[50],Ne=t[51]):(Me=()=>{if(window.okDesktop!=null)return;let e=e=>{nc(e,`toggle-document-panel`)&&(e.preventDefault(),_e())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},Ne=[_e],t[49]=_e,t[50]=Me,t[51]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=(0,Q.useRef)(null),[Fe,Ie]=(0,Q.useState)(null),Le=_?.kind===`large-file`?_.docName:h,Re,ze;t[52]===Le?(Re=t[53],ze=t[54]):(Re=()=>{if(Le&&Le!==Pe.current){let e=Pe.current;Pe.current=Le,Ie(e)}},ze=[Le],t[52]=Le,t[53]=Re,t[54]=ze),(0,Q.useEffect)(Re,ze);let Ve;t[55]===C?Ve=t[56]:(Ve=function(e){let t=Vo(e);window.location.hash===t?C(e):window.location.hash=t},t[55]=C,t[56]=Ve);let He=Ve,Ue,We=null;if(_?.kind===`large-file`){let e;t[57]!==He||t[58]!==Fe?(e=Fe?{previousDocName:Fe,onNavigateBack:He}:void 0,t[57]=He,t[58]=Fe,t[59]=e):e=t[59];let n;t[60]!==_.docName||t[61]!==_.limit||t[62]!==_.size||t[63]!==e?(n=(0,Z.jsx)(EC,{docName:_.docName,size:_.size,limit:_.limit,backNav:e}),t[60]=_.docName,t[61]=_.limit,t[62]=_.size,t[63]=e,t[64]=n):n=t[64],Ue=n}else if(_?.kind===`folder`){let e;if(t[65]===_.folderPath?e=t[66]:(e=(0,Z.jsx)(SC,{folderPath:_.folderPath}),t[65]=_.folderPath,t[66]=e),Ue=e,y===`agent`&&b!==null){let e;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(JC,{withHandle:!0}),t[67]=e):e=t[67];let n;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(Z.Fragment,{children:[e,(0,Z.jsx)(qC,{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)(s,{id:`ONPvOb`})}),children:(0,Z.jsx)(kj,{showBackButton:!1})})})]}),t[68]=n):n=t[68],We=n}}else if(_?.kind===`asset`){let e;t[69]!==_.assetPath||t[70]!==_.mediaKind?(e=(0,Z.jsx)(Rx,{assetPath:_.assetPath,mediaKind:_.mediaKind},_.assetPath),t[69]=_.assetPath,t[70]=_.mediaKind,t[71]=e):e=t[71],Ue=e}else if(!g||!h)if((typeof window<`u`?is(window.location.hash):null)!==null)if(c!=null&&A){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[72]=e):e=t[72],Ue=e;let n;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(JC,{withHandle:!0,disabled:!0}),t[73]=n):n=t[73];let r=ee?0:`${se}px`,i;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1`}),t[74]=i):i=t[74];let a;t[75]===r?a=t[76]:(a=(0,Z.jsxs)(Z.Fragment,{children:[n,(0,Z.jsx)(qC,{id:`doc-panel`,defaultSize:r,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,inert:!0,className:`flex flex-col bg-muted/20`,children:i})]}),t[75]=r,t[76]=a),We=a}else{let e;return t[77]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(zx,{}),t[77]=e):e=t[77],e}else{let e;t[78]===f?e=t[79]:(e=(0,Z.jsx)(HS,{terminalVisible:f}),t[78]=f,t[79]=e),Ue=e}else{let e=n===`source`,i=!O,s=Y,c;t[80]!==h||t[81]!==w?(c=function(){h&&w(h)},t[80]=h,t[81]=w,t[82]=c):c=t[82];let l=c,u=P??h,d=Fe??void 0,f;t[83]!==R||t[84]!==e||t[85]!==He||t[86]!==v||t[87]!==u||t[88]!==d?(f=(0,Z.jsx)(Wk,{activeDocName:u,isSourceMode:e,editorPlaceholder:R,previousDocName:d,onNavigateBack:He,onRecycle:v}),t[83]=R,t[84]=e,t[85]=He,t[86]=v,t[87]=u,t[88]=d,t[89]=f):f=t[89];let p;t[90]!==h||t[91]!==e?(p=(0,Z.jsx)(fw,{activeDocName:h,isSourceMode:e}),t[90]=h,t[91]=e,t[92]=p):p=t[92];let m;t[93]!==h||t[94]!==P?(m=ej({activeDocName:h,deferredActiveDocName:P,mountResolved:h!==null&&x(h),syncResolved:h!==null&&Be(h)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(zx,{}),h===null?null:(0,Z.jsx)(DC,{docName:h})]}):null,t[93]=h,t[94]=P,t[95]=m):m=t[95];let g;t[96]!==f||t[97]!==p||t[98]!==m?(g=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[f,p,m]}),t[96]=f,t[97]=p,t[98]=m,t[99]=g):g=t[99];let _;t[100]!==h||t[101]!==k||t[102]!==s||t[103]!==e||t[104]!==r||t[105]!==l||t[106]!==i||t[107]!==_e?(_=!k&&(0,Z.jsx)($A,{activeDocName:h,isSourceMode:e,sourceDisabled:i,onModeChange:r,showAddPropertyButton:!e,onAddProperty:l,isPanelCollapsed:s,onTogglePanel:_e}),t[100]=h,t[101]=k,t[102]=s,t[103]=e,t[104]=r,t[105]=l,t[106]=i,t[107]=_e,t[108]=_):_=t[108];let b;t[109]!==g||t[110]!==_?(b=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[g,_]}),t[109]=g,t[110]=_,t[111]=b):b=t[111];let S;t[112]!==E||t[113]!==I||t[114]!==T?(S=(0,Z.jsx)(LA,{stats:T,selectionStats:E,showStats:I}),t[112]=E,t[113]=I,t[114]=T,t[115]=S):S=t[115];let C;t[116]!==b||t[117]!==S?(C=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[b,S]}),t[116]=b,t[117]=S,t[118]=C):C=t[118],Ue=C;let D=B&&Y,A;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{ae(!0),oe.current=!0;let e=()=>{ae(!1),oe.current=!1,window.removeEventListener(`pointerup`,e)};window.addEventListener(`pointerup`,e)},t[119]=A):A=t[119];let j;t[120]===D?j=t[121]:(j=(0,Z.jsx)(JC,{withHandle:!0,disabled:D,onPointerDown:A}),t[120]=D,t[121]=j);let M=ee?0:`${se}px`,N;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{te(e.asPercentage===0),e.inPixels>0&&oe.current&&(ce.current=e.inPixels,de(e.inPixels))},t[122]=N):N=t[122];let F=!ie&&`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,L;t[123]===F?L=t[124]:(L=oi(`flex flex-col bg-muted/20`,F),t[123]=F,t[124]=L);let z;t[125]!==h||t[126]!==a||t[127]!==y||t[128]!==e||t[129]!==o?(z=(0,Z.jsx)(jy,{docName:h,isSourceMode:e,activeTab:a,onActiveTabChange:o,mode:y}),t[125]=h,t[126]=a,t[127]=y,t[128]=e,t[129]=o,t[130]=z):z=t[130];let V;t[131]!==Y||t[132]!==q||t[133]!==M||t[134]!==L||t[135]!==z?(V=(0,Z.jsx)(qC,{id:`doc-panel`,panelRef:q,defaultSize:M,minSize:Aj,maxSize:jj,collapsible:!0,collapsedSize:0,onResize:N,inert:Y,className:L,children:z}),t[131]=Y,t[132]=q,t[133]=M,t[134]=L,t[135]=z,t[136]=V):V=t[136];let H;t[137]!==j||t[138]!==V?(H=(0,Z.jsxs)(Z.Fragment,{children:[j,V]}),t[137]=j,t[138]=V,t[139]=H):H=t[139],We=H}let Ge;t[140]!==u||t[141]!==c||t[142]!==p||t[143]!==f||t[144]!==Ue?(Ge=c==null?Ue:(0,Z.jsx)(Tj,{bridge:c,visible:f,onVisibleChange:u??Fj,launch:p,children:Ue}),t[140]=u,t[141]=c,t[142]=p,t[143]=f,t[144]=Ue,t[145]=Ge):Ge=t[145];let Ke=Ge,qe=ie||void 0,Je;t[146]!==ee||t[147]!==We?(Je=We!=null&&!ee?{}:{defaultSize:`100%`},t[146]=ee,t[147]=We,t[148]=Je):Je=t[148];let Ye=ie?void 0:`transition-[flex-grow] duration-200 ease-out motion-reduce:transition-none motion-reduce:duration-0`,Xe;t[149]!==Ke||t[150]!==Je||t[151]!==Ye?(Xe=(0,Z.jsx)(qC,{minSize:`30%`,...Je,className:Ye,children:Ke}),t[149]=Ke,t[150]=Je,t[151]=Ye,t[152]=Xe):Xe=t[152];let Ze;return t[153]!==We||t[154]!==qe||t[155]!==Xe?(Ze=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,ref:he,children:(0,Z.jsxs)(KC,{orientation:`horizontal`,"data-dragging":qe,children:[Xe,We]})}),t[153]=We,t[154]=qe,t[155]=Xe,t[156]=Ze):Ze=t[156],Ze}function Fj(){}function Ij(){return ww()}function Lj(){return Or()}function Rj(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 zj(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 Bj=1e3,Vj=!1;function Hj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Uj(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:Si(i)?a=i:(a=void 0,Vj||(Vj=!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`&&(Hj({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=zj(i),{current:c,crossDoc:l}=a?_i(a,n,Date.now()):{current:[],crossDoc:[]},u=Wj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Rj(e.current,p)&&Rj(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,Bj);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 Wj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Gj=`sync-status`;function Kj(e,t){let n=(0,$.c)(6),{_:r}=i(),a=cm(),o=(0,Q.useRef)(!1),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(t),l,u;n[0]!==r||n[1]!==t||n[2]!==a||n[3]!==e?(l=()=>{if(c.current!==t&&(c.current=t,o.current=!1,s.current=!1),t)if(e===`synced`&&(o.current=!0),e===`disconnected`&&o.current){if(a){hs.dismiss(Gj);return}s.current=!0,hs.warning(r({id:`HGNCsl`}),{id:Gj,duration:1/0})}else s.current&&e===`synced`&&(s.current=!1,hs.success(r({id:`GhjUB_`}),{id:Gj,duration:3e3}))},u=[e,t,r,a],n[0]=r,n[1]=t,n[2]=a,n[3]=e,n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,Q.useEffect)(l,u)}var qj=4,Jj=3,Yj={Bird:tl,Cat:sl,Dog:ml,Fish:bl,Mouse:ql,Rabbit:Kl,Shrimp:$l,Snail:eu,Squirrel:iu,Turtle:fu};Object.freeze(Object.keys(Yj));function Xj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Yj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Zj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Qj(e){let t=(0,$.c)(28),{user:n,mode:r,tabCount:a}=e,{_:o}=i(),s=Xj(n),c=s.kind===`animal`?Yj[s.animal]:void 0,l;t[0]===n.name?l=t[1]:(l=er(n.name),t[0]=n.name,t[1]=l);let u=l,d;t[2]===n.color?d=t[3]:(d=Gr(n.color),t[2]=n.color,t[3]=d);let f=d,p=n.name,m;t[4]!==o||t[5]!==a||t[6]!==p?(m=a>1?o({id:`qAhFeg`,values:{userName:p,tabCount:a}}):p,t[4]=o,t[5]=a,t[6]=p,t[7]=m):m=t[7];let h=m,g;t[8]!==o||t[9]!==a||t[10]!==p?(g=a>1?o({id:`BEkF-P`,values:{userName:p,tabCount:a}}):p,t[8]=o,t[9]=a,t[10]=p,t[11]=g):g=t[11];let _=g,v;t[12]===n.color?v=t[13]:(v={backgroundColor:n.color},t[12]=n.color,t[13]=v);let y;t[14]!==c||t[15]!==f||t[16]!==u?(y=c?(0,Z.jsx)(c,{size:18,color:f,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:f},children:u}),t[14]=c,t[15]=f,t[16]=u,t[17]=y):y=t[17];let b;t[18]!==_||t[19]!==r||t[20]!==v||t[21]!==y?(b=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":_,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:v,children:y})}),t[18]=_,t[19]=r,t[20]=v,t[21]=y,t[22]=b):b=t[22];let x;t[23]===h?x=t[24]:(x=(0,Z.jsx)(Ns,{children:h}),t[23]=h,t[24]=x);let S;return t[25]!==b||t[26]!==x?(S=(0,Z.jsxs)(Is,{children:[b,x]}),t[25]=b,t[26]=x,t[27]=S):S=t[27],S}function $j(e){let t=Zj[e.icon];return e.displayName||t||ms._({id:`iEQQyu`})}function eM(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 tM(e){let t=(0,$.c)(33),{participant:n,crossDoc:r,scoped:a,onClickAgent:o}=e,{_:c}=i(),{activeDocName:l}=mt(),{presence:u,agentId:d}=n,f=$j(u),p=eM(u.mode),m=!r&&p,h=u.currentDoc&&u.currentDoc!==`(connected)`?u.currentDoc:null,g=l!==null||h!==null,_=g?`cursor-pointer`:`cursor-default opacity-50`,v=a?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,y=m&&!a?`ring-primary/40 animate-pulse`:``,b;t[0]!==_||t[1]!==v||t[2]!==y?(b=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2`,_,v,y].filter(Boolean),t[0]=_,t[1]=v,t[2]=y,t[3]=b):b=t[3];let x=b.join(` `),S=r?`true`:void 0,C=a?`true`:void 0,w=g?void 0:`true`,T;t[4]!==u.mode||t[5]!==S||t[6]!==C||t[7]!==w?(T={"data-presence-badge":`agent`,"data-presence-mode":u.mode,"data-presence-crossdoc":S,"data-presence-scoped":C,"data-presence-inert":w},t[4]=u.mode,t[5]=S,t[6]=C,t[7]=w,t[8]=T):T=t[8];let E=T,D=c(r&&h?{id:`b4AQFK`,values:{tooltipName:f,realCurrentDoc:h}}:{id:`RfHNf8`,values:{tooltipName:f}}),O;t[9]!==d||t[10]!==D||t[11]!==E||t[12]!==g||t[13]!==o||t[14]!==u.color||t[15]!==u.icon||t[16]!==h||t[17]!==x||t[18]!==f?(O=g?(0,Z.jsx)(`button`,{type:`button`,...E,"aria-label":D,className:x,style:{backgroundColor:u.color},onClick:()=>o(d,h),children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}):(0,Z.jsx)(`div`,{...E,role:`img`,"aria-label":f,className:x,style:{backgroundColor:u.color},children:(0,Z.jsx)(bi,{icon:u.icon,width:16,height:16,className:`text-white`,"aria-hidden":!0})}),t[9]=d,t[10]=D,t[11]=E,t[12]=g,t[13]=o,t[14]=u.color,t[15]=u.icon,t[16]=h,t[17]=x,t[18]=f,t[19]=O):O=t[19];let k=O,A;t[20]===k?A=t[21]:(A=(0,Z.jsx)(js,{asChild:!0,children:k}),t[20]=k,t[21]=A);let j;t[22]===f?j=t[23]:(j=(0,Z.jsx)(`span`,{className:`font-medium`,children:f}),t[22]=f,t[23]=j);let M;t[24]!==r||t[25]!==h?(M=r&&h?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`Wh0im4`,values:{realCurrentDoc:h}})}):null,t[24]=r,t[25]=h,t[26]=M):M=t[26];let N;t[27]!==j||t[28]!==M?(N=(0,Z.jsxs)(Ns,{className:`flex flex-col gap-0.5`,children:[j,M]}),t[27]=j,t[28]=M,t[29]=N):N=t[29];let P;return t[30]!==A||t[31]!==N?(P=(0,Z.jsxs)(Is,{children:[A,N]}),t[30]=A,t[31]=N,t[32]=P):P=t[32],P}function nM(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?ms._({id:`9euN0m`,values:{count:n}}):ms._({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)(J,{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)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[12]=i,t[13]=o,t[14]=a,t[15]=e):e=t[15],d=r.map(e),t[7]=i,t[8]=o,t[9]=r,t[10]=a,t[11]=d}else d=t[11];let f;t[16]===d?f=t[17]:(f=(0,Z.jsx)(b,{align:`end`,className:`w-auto max-w-xs p-2`,children:(0,Z.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:d})}),t[16]=d,t[17]=f);let p;return t[18]!==u||t[19]!==f?(p=(0,Z.jsxs)(fe,{children:[u,f]}),t[18]=u,t[19]=f,t[20]=p):p=t[20],p}function rM(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function iM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=mt(),{current:s,crossDoc:c}=Uj(t,r,n);if(Kj(zw(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,qj),n;e[6]===s?n=e[7]:(n=s.slice(qj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Jj),d;e[8]===c?d=e[9]:(d=c.slice(Jj),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=>rM(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)(nM,{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=>rM(e,p,!0,m)),f.length>0?(0,Z.jsx)(nM,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}var aM=new Set([`.md`,`.mdx`]);function oM(e){let t=e.lastIndexOf(`/`),n=t<0?e:e.slice(t+1),r=n.lastIndexOf(`.`);return r<=0?``:n.slice(r)}function sM(e,t){let n=e.lastIndexOf(`/`),r=n<0?``:e.slice(0,n+1),i=n<0?e:e.slice(n+1),a=i.lastIndexOf(`.`);return`${r}${a<=0?i:i.slice(0,a)}${t}`}function cM(e){return aM.has(oM(e).toLowerCase())}function lM(e,t,n){if(n)return{kind:`allow`,destinationPath:t};let r=oM(e);return r===``?{kind:`allow`,destinationPath:t}:{kind:`allow`,destinationPath:oM(t)?t:sM(t,r)}}var uM=`.md`,dM=/\.(md|mdx)$/i;function fM(e,t=uM){return`${e}${t}`}function pM(e){return BM(e).replace(dM,``)}function mM(e){return Zo(e)?_M(e.path):Ro(e)?e.path:fM(e.docName,e.docExt)}function hM(e){let t=BM(e).match(dM);return t?`.${t[1].toLowerCase()}`:void 0}function gM(e){return BM(e)}function _M(e){let t=BM(e.trim());return t?`${t}/`:``}function vM(e){return e.endsWith(`/`)?gM(e):pM(e)}function yM(e){return e.map(mM)}function bM(e){return[...e].sort().join(`\0`)}function xM(e){return bM(yM(e))}function SM(e){let t=new Set;for(let n of e){if(Zo(n)){let e=_M(n.path);e&&t.add(e)}let e=(Zo(n)||Ro(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Zo(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function CM(e){if(!e)return[];let t=BM(e.replace(dM,``)).split(`/`).filter(Boolean),n=[],r=e.endsWith(`/`)?t.length:t.length-1;for(let e=1;e<=r;e++)n.push(`${t.slice(0,e).join(`/`)}/`);return n}function wM(e,t,n){let r=hM(e);if(r)return r;let i=n.find(e=>fs(e)&&e.docName===t);return i?i.docExt??uM:zM(e).includes(`.`)?void 0:uM}function TM(e,t){let n=e.lastIndexOf(`/`),r=n===-1?``:e.slice(0,n+1),i=n===-1?e:e.slice(n+1),a=t.filter(e=>{if(!Ro(e)||!e.path.startsWith(r))return!1;let t=e.path.slice(r.length);return!t.includes(`/`)&&t.startsWith(`${i}.`)});return a.length===1?a[0].path:null}function EM(e,t,n){if(hM(e))return null;let r=n.find(e=>Ro(e)&&e.path===t);return r?r.path:zM(e).includes(`.`)?t:TM(t,n)}function DM(e,t){let n=e.kind===`directory`,r=n?gM(e.path):pM(e.path);if(n)return{kind:`folder`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!0)};let i=EM(e.path,r,t);if(i)return{kind:`asset`,name:BM(zM(i)),path:i,treePath:i};let a=wM(e.path,r,t);return{kind:`file`,name:BM(zM(e.path)).replace(dM,``),path:r,treePath:kM(e.path,!1),docExt:a}}function OM(e){return e.kind===`directory`?gM(e.path):e.path}function kM(e,t){return t?_M(e):dM.test(e)?e:`${e}${uM}`}function AM(e,t,n){let r=_M(t),i=new Set(n);for(let t=0;t<100;t++){let n=t===0?``:` ${t+1}`;if(e===`file`){let e=`${r}Untitled${n}${uM}`;if(!i.has(e))return{addPath:e,renamePath:e};continue}let a=`${r}New Folder${n}/`;if(!i.has(a))return{addPath:a,renamePath:a}}throw Error(`Could not allocate a unique tree placeholder`)}function jM(e,t){return e===`file`?kM(t,!1):`${gM(t)}/index${uM}`}function MM(e,t){return t.kind===`root`||t.directoryPath==null?zM(e):`${t.directoryPath}${zM(e)}`}function NM(e,t){if(t)return gM(_M(e));let n=pM(e),r=n.lastIndexOf(`/`);return r===-1?``:n.slice(0,r)}function PM(e,t){let n=gM(_M(e));return n?`${n}/${t}`:t}function FM(e,t){return(t.path??PM(e,t.src)).replace(/^\/+/,``)}function IM(e){let t=e.dataTransfer?.types;if(!t)return!1;let n=Array.from(t);return n.includes(`Files`)&&!n.includes(`application/x-open-knowledge-sidebar-item+json`)}function LM(e){return Array.from(e.dataTransfer?.files??[]).filter(e=>e.name.length>0||e.size>0)}function RM(e,t){let n=oM(e).toLowerCase();if(n===``)return null;let r=new Date().toISOString();if(n===`.md`||n===`.mdx`)return{kind:`document`,docName:pM(e),docExt:n,modified:r,size:t.size};let i=n.startsWith(`.`)?n.slice(1):n;return{kind:`asset`,path:e,assetExt:i,mediaKind:nr(i),modified:r,size:t.size}}function zM(e){let t=BM(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function BM(e){return e.endsWith(`/`)?e.slice(0,-1):e}function VM(e,t){return t.trim()}function HM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function UM(e,t){let n=VM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function WM(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(fs(e)){let t=s.get(fM(e.docName,e.docExt));if(t){let n=Bo(t);return{kind:`asset`,path:t,assetExt:n,mediaKind:nr(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(Zo(e))return{...e,path:ZM(e.path,n)};if(Ro(e)){let t=s.get(e.path);return t&&cM(t)?{kind:`document`,docName:pM(t),docExt:oM(t),size:e.size,modified:e.modified}:{...e,path:t??ZM(e.path,n)}}return e})}function GM(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=>fs(e)?!i.has(e.docName)&&!tN(e.docName,n):Zo(e)?!tN(e.path,n):Ro(e)?!a.has(e.path)&&!tN(e.path,n):!0)}function KM(e,t){if(e.kind!==`asset`||t.some(t=>Ro(t)&&t.path===e.path))return e;let n=TM(e.path,t);return n?{...e,path:n,name:n.split(`/`).pop()??n}:e}function qM(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>QM(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>fs(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=>Zo(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(fs(i)){let e=eN(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Zo(i)){let e=$M(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function JM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function YM(e,t,n){return e.flatMap(e=>t===e.toDocName||!n(e.toDocName)?[e.fromDocName]:[e.fromDocName,e.toDocName])}function XM(e,t){let n=e.kind===`file`?fM(e.path,e.docExt):e.path;return Qg(t.contentDir,n,t.pathSeparator)}function ZM(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 QM(e,t){return fs(e)&&fs(t)?e.docName===t.docName:Zo(e)&&Zo(t)||Ro(e)&&Ro(t)?e.path===t.path:!1}function $M(e,t,n){return e===t?n:eN(e,t,n)}function eN(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function tN(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function nN(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)(pd,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function rN(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=oi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(md,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iN(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)(_d,{"data-slot":`context-menu-group`,...n}),t[2]=n,t[3]=r),r}function aN(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)(Cd,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function oN(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=oi(`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)(hd,{children:(0,Z.jsx)(gd,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function sN(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=oi(`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)(yd,{"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 cN(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=oi(`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)(No,{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)(wd,{"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 lN(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=oi(`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)(Td,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uN(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=oi(`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)(xd,{children:(0,Z.jsx)(ko,{})})}),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)(bd,{"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 dN(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=oi(`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)(vd,{"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 fN(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=oi(`-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)(Sd,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pN=`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`,mN=`border-border bg-background text-foreground hover:bg-background focus-visible:bg-background`,hN={start:[Wi.Space],cancel:[Wi.Esc],end:[Wi.Space,Wi.Enter]};function gN(e){return oi(pN,e?`opacity-100`:`pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100`)}function _N(e){return e?void 0:-1}function vN({className:e,isDragging:t}){return oi(e,t&&mN)}function yN(e){return e.code===Wi.Enter&&e.target===e.currentTarget}function bN({event:e,hasKeyboardActivation:t,isDragging:n}){return e.defaultPrevented?`ignore`:!n&&t&&yN(e)?`activate-tab`:`delegate-sortable`}function xN({activeWidth:e,isDragging:t,outerStyle:n,transform:r,transition:i}){let a=t&&e?e:void 0;return{...n,transform:Na.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 SN(e){let t=e?.querySelectorAll(`[data-editor-tab-sortable]`)??[],n=1/0,r=-1/0;for(let e of t){let t=e.getBoundingClientRect();n=Math.min(n,t.left),r=Math.max(r,t.right)}return Number.isFinite(n)&&Number.isFinite(r)?{left:n,right:r}:null}function CN(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 wN=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 Sa(e)},TN=[`.md`,`.mdx`],EN=`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`,DN=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,ON=oi(DN,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),kN=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px]`;function AN(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function jN(e){let t=Vo(e);window.location.hash!==t&&(window.location.hash=t)}function MN(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function NN(e,t){let n=[t,...TN].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 PN(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:_}=Ri(u),v=p.current?.width,y;t[12]!==_||t[13]!==s||t[14]!==v||t[15]!==h||t[16]!==g?(y=xN({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=bN({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=vN({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 FN(e){let t=(0,$.c)(52),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:c,pinTab:l,pinnedTabIds:u,tabId:d,unpinTab:f}=e,p=a===void 0?!0:a;if(o!==void 0&&o)return n;let m;t[0]!==p||t[1]!==u||t[2]!==d?(m=p&&u.includes(d),t[0]=p,t[1]=u,t[2]=d,t[3]=m):m=t[3];let h=m,g;if(t[4]!==c||t[5]!==u||t[6]!==d){let e;t[8]===d?e=t[9]:(e=e=>e!==d,t[8]=d,t[9]=e),g=Je(c.filter(e),u),t[4]=c,t[5]=u,t[6]=d,t[7]=g}else g=t[7];let _=g,v;t[10]!==c||t[11]!==u?(v=Je(c,u),t[10]=c,t[11]=u,t[12]=v):v=t[12];let y=v,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(rN,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==d?(x=()=>r(d),t[15]=r,t[16]=d,t[17]=x):x=t[17];let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(s,{id:`yz7wBu`}),t[18]=S):S=t[18];let C;t[19]!==h||t[20]!==x?(C=(0,Z.jsx)(sN,{disabled:h,onSelect:x,children:S}),t[19]=h,t[20]=x,t[21]=C):C=t[21];let w=_.length===0,T;t[22]!==i||t[23]!==_?(T=()=>{i(_)},t[22]=i,t[23]=_,t[24]=T):T=t[24];let E;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(s,{id:`omXJcU`}),t[25]=E):E=t[25];let D;t[26]!==w||t[27]!==T?(D=(0,Z.jsx)(sN,{disabled:w,onSelect:T,children:E}),t[26]=w,t[27]=T,t[28]=D):D=t[28];let O=y.length===0,k;t[29]!==y||t[30]!==i?(k=()=>{i(y)},t[29]=y,t[30]=i,t[31]=k):k=t[31];let A;t[32]===u.length?A=t[33]:(A=u.length?(0,Z.jsx)(s,{id:`U2Kx6T`}):(0,Z.jsx)(s,{id:`WyXG7w`}),t[32]=u.length,t[33]=A);let j;t[34]!==O||t[35]!==k||t[36]!==A?(j=(0,Z.jsx)(sN,{disabled:O,"data-testid":`editor-tab-context-close-all`,onSelect:k,children:A}),t[34]=O,t[35]=k,t[36]=A,t[37]=j):j=t[37];let M;t[38]!==p||t[39]!==h||t[40]!==l||t[41]!==d||t[42]!==f?(M=p&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(fN,{}),(0,Z.jsx)(sN,{"data-testid":`editor-tab-context-pin-toggle`,onSelect:()=>h?f(d):l(d),children:h?(0,Z.jsx)(s,{id:`SYfHmN`}):(0,Z.jsx)(s,{id:`3pU8e-`})})]}),t[38]=p,t[39]=h,t[40]=l,t[41]=d,t[42]=f,t[43]=M):M=t[43];let N;t[44]!==D||t[45]!==j||t[46]!==M||t[47]!==C?(N=(0,Z.jsxs)(oN,{className:`min-w-40`,children:[C,D,j,M]}),t[44]=D,t[45]=j,t[46]=M,t[47]=C,t[48]=N):N=t[48];let P;return t[49]!==N||t[50]!==b?(P=(0,Z.jsxs)(nN,{children:[b,N]}),t[49]=N,t[50]=b,t[51]=P):P=t[51],P}function IN(e){let t=(0,$.c)(26),{accessibleLabel:n,closeTab:r,isActive:a,isPinned:o,tabId:s,unpinTab:c}=e,{_:l}=i();if(o){let e;t[0]!==l||t[1]!==n?(e=l({id:`t18QYR`,values:{accessibleLabel:n}}),t[0]=l,t[1]=n,t[2]=e):e=t[2];let r;t[3]!==s||t[4]!==c?(r=e=>{e.stopPropagation(),c(s)},t[3]=s,t[4]=c,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Gl,{"aria-hidden":`true`}),t[6]=i):i=t[6];let a;return t[7]!==e||t[8]!==r?(a=(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,"data-testid":`editor-tab-unpin-button`,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[7]=e,t[8]=r,t[9]=a):a=t[9],a}let u;t[10]!==l||t[11]!==n?(u=l({id:`JLzQi_`,values:{accessibleLabel:n}}),t[10]=l,t[11]=n,t[12]=u):u=t[12];let d;t[13]===a?d=t[14]:(d=gN(a),t[13]=a,t[14]=d);let f;t[15]===a?f=t[16]:(f=_N(a),t[15]=a,t[16]=f);let p;t[17]!==r||t[18]!==s?(p=e=>{e.stopPropagation(),r(s)},t[17]=r,t[18]=s,t[19]=p):p=t[19];let m;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(gs,{"aria-hidden":`true`}),t[20]=m):m=t[20];let h;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==p?(h=(0,Z.jsx)(ci,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":u,"data-testid":`editor-tab-close-button`,className:d,tabIndex:f,onClick:p,children:m}),t[21]=u,t[22]=d,t[23]=f,t[24]=p,t[25]=h):h=t[25],h}function LN(e){let t=(0,$.c)(1),{docName:n}=e;if(vw(n)!==`conflict`)return null;let r;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(Lo,{"aria-label":`Conflict`,"data-testid":`editor-tab-conflict-badge`,className:`mr-1 size-3.5 shrink-0 text-amber-500`}),t[0]=r):r=t[0],r}function RN(){let e=(0,$.c)(80),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:a,activateTab:o,activateNewTab:c,closeAndClearForRename:l,closeNewTab:u,closeTab:d,closeTabs:f,getPoolActiveDocName:p,poolHas:m,isNewTabActive:h,newTabIds:g,openNewTab:_,openTabs:v,pinTab:y,pinnedTabIds:b,remapTabsForRename:x,reorderTabs:S,unpinTab:C,visibleTabIds:w}=mt(),{_:T}=i(),{pageMeta:E}=rs(),D=(0,Q.useRef)(null),[O,k]=(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=(0,Q.useRef)(null),B=(0,Q.useRef)(!1),H=(0,Q.useRef)(!1),U=(0,Q.useRef)(null),W=(0,Q.useRef)(t),G;e[0]!==n||e[1]!==t||e[2]!==a?(G=n??(a?Xe(a):t?He(t):null),e[0]=n,e[1]=t,e[2]=a,e[3]=G):G=e[3];let K=G,q;e[4]!==r||e[5]!==K||e[6]!==h||e[7]!==g||e[8]!==v?(q=h?`${r??`__new-tab__`}\u0000${v.join(`\0`)}\u0000${g.join(`\0`)}`:K?`${K}\u0000${v.join(`\0`)}`:``,e[4]=r,e[5]=K,e[6]=h,e[7]=g,e[8]=v,e[9]=q):q=e[9];let J=q,ee,Y;e[10]===t?(ee=e[11],Y=e[12]):(ee=()=>{W.current=t},Y=[t],e[10]=t,e[11]=ee,e[12]=Y),(0,Q.useEffect)(ee,Y);let te,ne;e[13]===J?(te=e[14],ne=e[15]):(te=()=>{J&&(D.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},ne=[J],e[13]=J,e[14]=te,e[15]=ne),(0,Q.useEffect)(te,ne);let X,re;e[16]===j?(X=e[17],re=e[18]):(X=()=>{j&&(z.current?.focus(),z.current?.select())},re=[j],e[16]=j,e[17]=X,e[18]=re),(0,Q.useEffect)(X,re);let ie,ae;e[19]!==v||e[20]!==j?(ie=()=>{!j||v.includes(j.tabId)||(H.current=!0,U.current=null,M(null),P(``),I(null),R(!1))},ae=[v,j],e[19]=v,e[20]=j,e[21]=ie,e[22]=ae):(ie=e[21],ae=e[22]),(0,Q.useEffect)(ie,ae);let oe=function(e,t){let n=t.split(`/`);H.current=!1,U.current=null,M({docName:t,tabId:e}),P(n[n.length-1]),I(null)},se=function(){H.current=!0,U.current=null,M(null),P(``),I(null),R(!1)},ce=async function(){if(H.current){H.current=!1;return}if(B.current)return;let e=j?.docName;if(!e){se();return}let t=VM(`file`,NN(N,E.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===U.current){z.current?.focus();return}if(!HM(t)){I(T({id:`P8yDjG`})),z.current?.focus();return}let i=UM({kind:`file`,path:e,name:r},t);B.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(H.current){R(!1),B.current=!1;return}let r=await _e(n,`Server error (HTTP ${n.status})`);if(!r.ok){I(r.title),R(!1),B.current=!1,U.current=t,z.current?.focus();return}let a=A(Zr,r.body,`rename-path:tab`,{renamed:[],renamedAssets:[]}).renamed,o=W.current,s=JM(o,a);Bt(a);let c=!0;try{let e=YM(a,p(),m);await Promise.all(e.map(e=>l(e))),x(a),ss([`files`,`backlinks`,`graph`])}catch(n){let r=n;c=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),hs.error(T({id:`MUBR8r`}))}H.current=!0,M(null),P(``),I(null),R(!1),B.current=!1,U.current=null,c&&s&&s!==o&&jN(s)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),I(T({id:`HIb0vl`})),R(!1),B.current=!1,U.current=t,z.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===g?ue=e[24]:(ue=new Set(g),e[23]=g,e[24]=ue);let de=ue,fe;e[25]===O?fe=e[26]:(fe=CN(O),e[25]=O,e[26]=fe);let pe;e[27]===fe?pe=e[28]:(pe=[fe],e[27]=fe,e[28]=pe);let me=pe,he;e[29]!==u||e[30]!==f||e[31]!==de?(he=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&f(t);for(let e of n)u(e)},e[29]=u,e[30]=f,e[31]=de,e[32]=he):he=e[32];let ge=he,ve;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(ve={activationConstraint:{distance:8}},e[33]=ve):ve=e[33];let ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye={coordinateGetter:ga,keyboardCodes:hN},e[34]=ye):ye=e[34];let be=wi(ia(va,ve),ia(ba,ye)),xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=function(){k(SN(D.current))},e[35]=xe):xe=e[35];let Se=xe,Ce;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(){k(null)},e[36]=Ce):Ce=e[36];let we=Ce,Te;e[37]!==we||e[38]!==S||e[39]!==w?(Te=function(e){we();let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=w.indexOf(t),i=w.indexOf(n);r<0||i<0||r===i||S(Bi([...w],r,i),t)},e[37]=we,e[38]=S,e[39]=w,e[40]=Te):Te=e[40];let Ee=Te,De=le?``:void 0,Oe;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=oi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[41]=Oe):Oe=e[41];let ke=MN,Ae;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=oi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[42]=Ae):Ae=e[42];let Me=Xa,Ne=wN,Pe;e[43]===Symbol.for(`react.memo_cache_sentinel`)?(Pe={container:typeof document<`u`?document.body:void 0},e[43]=Pe):Pe=e[43];let Fe=ma,Ie;e[44]===w?Ie=e[45]:(Ie=[...w],e[44]=w,e[45]=Ie);let Le=fa,Re=w.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(FN,{tabId:e,canPin:!1,openTabs:w,closeTab:u,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>c(e),"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:oi(EN,t?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),u(e))},onClick:t=>{t.target===t.currentTarget&&c(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`zLak8b`}),"data-testid":`editor-new-tab-placeholder-button`,className:kN,onClick:()=>c(e),tabIndex:-1,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,Z.jsx)(s,{id:`3YvS-c`})})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":T({id:`xCdTnb`}),"data-testid":`editor-new-tab-placeholder-close`,className:gN(t),tabIndex:_N(t),onClick:t=>{t.stopPropagation(),u(e)},children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=pt(e),n=e===K,i=b.includes(e);if(t.kind===`folder`){let{baseName:r,label:a,prefix:s}=je(t.folderPath,`/`),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,title:c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s&&(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:oi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}if(t.kind===`asset`){let{baseName:r,label:a,prefix:s}=je(t.assetPath,``),c=`${s}${a}`;return(0,Z.jsx)(FN,{tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsxs)(PN,{tabId:e,activateFromKeyboard:()=>o(e),"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:kN,onClick:()=>{o(e)},tabIndex:-1,children:[s?(0,Z.jsx)(`span`,{className:oi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:oi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(IN,{accessibleLabel:c,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})},e)}let a=t.docName,l=E.get(a)?.docExt??`.md`,{baseName:f,extension:p,label:m,prefix:h}=je(a,l),g=`${h}${m}`,_=l===`.md`||l===`.mdx`,v=j?.tabId===e,x=`editor-tab-rename-error-${AN(a)}`;return(0,Z.jsx)(FN,{disabled:v,tabId:e,openTabs:w,closeTab:d,closeTabs:ge,pinTab:y,pinnedTabIds:b,unpinTab:C,children:(0,Z.jsx)(PN,{tabId:e,activateFromKeyboard:()=>o(e),disabled:v,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:oi(EN,n?DN:ON,v&&F&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&d(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:v?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(ew,{ref:z,value:N,disabled:L,"aria-label":T({id:`Dw1T_W`,values:{label:m}}),"data-testid":`editor-tab-rename-input`,"aria-invalid":F?!0:void 0,"aria-describedby":F?x:void 0,"aria-busy":L||void 0,title:F??a,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{P(NN(e.target.value,l)),I(null),U.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ZC,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)($C,{className:`text-muted-foreground/60 text-xs`,children:l})})]}),F?(0,Z.jsx)(`span`,{id:x,role:`alert`,className:`sr-only`,children:F}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":g,title:g,className:kN,onClick:()=>{o(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,a)},tabIndex:-1,children:[(0,Z.jsx)(LN,{docName:a}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),!_&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),(0,Z.jsx)(IN,{accessibleLabel:g,closeTab:d,isActive:n,isPinned:i,tabId:e,unpinTab:C})]})})},e)}),ze;e[46]!==Fe||e[47]!==Ie||e[48]!==Le||e[49]!==Re?(ze=(0,Z.jsx)(Fe,{items:Ie,strategy:Le,children:Re}),e[46]=Fe,e[47]=Ie,e[48]=Le,e[49]=Re,e[50]=ze):ze=e[50];let Be;e[51]!==Me||e[52]!==we||e[53]!==Ee||e[54]!==Se||e[55]!==be||e[56]!==!1||e[57]!==Ne||e[58]!==Pe||e[59]!==ze||e[60]!==me?(Be=(0,Z.jsx)(Me,{sensors:be,autoScroll:!1,collisionDetection:Ne,modifiers:me,onDragStart:Se,onDragEnd:Ee,onDragCancel:we,accessibility:Pe,children:ze}),e[51]=Me,e[52]=we,e[53]=Ee,e[54]=Se,e[55]=be,e[56]=!1,e[57]=Ne,e[58]=Pe,e[59]=ze,e[60]=me,e[61]=Be):Be=e[61];let Ve;e[62]===T?Ve=e[63]:(Ve=T({id:`3YvS-c`}),e[62]=T,e[63]=Ve);let Ue;e[64]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(V,{"aria-hidden":`true`}),e[64]=Ue):Ue=e[64];let We;e[65]!==_||e[66]!==Ve?(We=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":Ve,"data-testid":`editor-new-tab-button`,className:`first:mb-3 mb-1.5`,onClick:_,children:Ue})}),e[65]=_,e[66]=Ve,e[67]=We):We=e[67];let Ge;e[68]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`3YvS-c`})}),e[68]=Ge):Ge=e[68];let Ke;e[69]===We?Ke=e[70]:(Ke=(0,Z.jsxs)(Is,{children:[We,Ge]}),e[69]=We,e[70]=Ke);let qe;e[71]!==Ae||e[72]!==Be||e[73]!==Ke?(qe=(0,Z.jsxs)(`div`,{className:Ae,children:[Be,Ke]}),e[71]=Ae,e[72]=Be,e[73]=Ke,e[74]=qe):qe=e[74];let Je;return e[75]!==De||e[76]!==Oe||e[77]!==ke||e[78]!==qe?(Je=(0,Z.jsx)(`div`,{ref:D,"data-electron-drag":De,className:Oe,onWheel:ke,children:qe}),e[75]=De,e[76]=Oe,e[77]=ke,e[78]=qe,e[79]=Je):Je=e[79],Je}function zN(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 BN(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 VN=[{label:{id:`TvY_XA`},href:`https://openknowledge.ai/docs`,icon:St},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:wf},{label:{id:`On0aF2`},href:`https://openknowledge.ai/`,icon:Qo},{label:`Discord`,href:`https://discord.com/invite/YujKpFN49`,icon:zN},{label:`Twitter`,href:`https://x.com/inkeep`,icon:BN}],HN=()=>{let e=(0,$.c)(16),{_:t}=i(),[n,r]=(0,Q.useState)(!1),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Re,{className:`size-4`}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[a,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`s-MGs7`})})]})})}),e[1]=o):o=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Is,{children:[o,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`s-MGs7`})})]}),e[2]=c):c=e[2];let l;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:(0,Z.jsx)(s,{id:`s-MGs7`})}),e[3]=l):l=e[3];let u;e[4]===t?u=e[5]:(u=t({id:`s-MGs7`}),e[4]=t,e[5]=u);let d;e[6]===t?d=e[7]:(d=VN.map(e=>{let{label:n,href:r,icon:i}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>aa(e,r),onAuxClick:e=>aa(e,r),className:`flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-azure-900/5 dark:hover:bg-white/20 hover:text-primary`,children:[(0,Z.jsx)(i,{"aria-hidden":`true`,className:`size-4 shrink-0`}),typeof n==`string`?n:t(n)]})},r)}),e[6]=t,e[7]=d);let f;e[8]===d?f=e[9]:(f=(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:d}),e[8]=d,e[9]=f);let p;e[10]!==u||e[11]!==f?(p=(0,Z.jsxs)(b,{align:`end`,className:`w-64 p-3`,children:[l,(0,Z.jsx)(`nav`,{"aria-label":u,children:f})]}),e[10]=u,e[11]=f,e[12]=p):p=e[12];let m;return e[13]!==n||e[14]!==p?(m=(0,Z.jsxs)(fe,{open:n,onOpenChange:r,children:[c,p]}),e[13]=n,e[14]=p,e[15]=m):m=e[15],m};function UN(e){let t=(0,$.c)(19),{installStates:n,terminalLaunch:r,disabled:a,onPick:o,onLaunchTerminal:c}=e,{_:l}=i(),[u,d]=(0,Q.useState)(``),f;if(t[0]!==l||t[1]!==a||t[2]!==n||t[3]!==u||t[4]!==c||t[5]!==o||t[6]!==r){let e;t[8]===n?e=t[9]:(e=e=>n[e.id]?.installed===!0,t[8]=n,t[9]=e);let i=_g.filter(e),p=_g.some(e=>n[e.id]?.installed==null),m=i.length>0,h=r!==null,g=m||h,_;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>d(e.target.value),t[10]=_):_=t[10];let v;t[11]===l?v=t[12]:(v=l({id:`Rah7yq`}),t[11]=l,t[12]=v);let y;t[13]===l?y=t[14]:(y=l({id:`ZBt4rI`}),t[13]=l,t[14]=y);let b;t[15]!==u||t[16]!==v||t[17]!==y?(b=(0,Z.jsx)(`div`,{className:`px-2 pt-2 pb-1.5`,children:(0,Z.jsx)(jo,{value:u,onChange:_,placeholder:v,"aria-label":y,"data-testid":`open-in-agent-instruction`})}),t[15]=u,t[16]=v,t[17]=y,t[18]=b):b=t[18],f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[b,g?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[m?(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-desktop-label`,children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(e=>{let{displayName:t}=e;return(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-item-${e.id}`,"aria-label":l({id:`WqLq6M`,values:{displayName:t}}),onClick:()=>o(e,u),children:[(0,Z.jsx)(Wx,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]},e.id)})]}):null,h?(0,Z.jsxs)(Z.Fragment,{children:[m?(0,Z.jsx)(ta,{className:`my-1`}):null,(0,Z.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,Z.jsx)(`legend`,{className:`px-1.5 py-1 font-medium text-muted-foreground text-xs`,"data-testid":`open-in-agent-terminal-label`,children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(ci,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start gap-1.5 rounded-md px-1.5 py-1 font-normal text-foreground`,disabled:a,"data-testid":`open-in-agent-terminal`,"aria-label":l({id:`AcK_r0`}),onClick:()=>c(u),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(s,{id:`fcgvCA`})})]})]})]}):null]}):(0,Z.jsx)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`open-in-agent-empty`,"aria-live":`polite`,children:p?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})})]}),t[0]=l,t[1]=a,t[2]=n,t[3]=u,t[4]=c,t[5]=o,t[6]=r,t[7]=f}else f=t[7];return f}function WN(e){let t=(0,$.c)(44),{input:n,open:r,onOpenChange:a}=e,{_:o}=i(),{states:c,refresh:l}=O_(),{dispatch:u}=__(),d=qx(),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=mg(),g=r??f,_;t[0]===l?_=t[1]:(_=()=>{l()},t[0]=l,t[1]=_);let v=(0,Q.useEffectEvent)(_),y;t[2]!==g||t[3]!==v?(y=()=>{g&&v()},t[2]=g,t[3]=v,t[4]=y):y=t[4];let x;if(t[5]===g?x=t[6]:(x=[g],t[5]=g,t[6]=x),(0,Q.useEffect)(y,x),h)return null;let S=typeof window<`u`&&window.okDesktop!=null,C;t[7]!==a||t[8]!==r?(C=e=>{r===void 0&&p(e),a?.(e)},t[7]=a,t[8]=r,t[9]=C):C=t[9];let w=C,T=n===null,E;t[10]===n?E=t[11]:(E=e=>{if(n===null)return null;let t=e.trim();return t?{...n,instruction:t}:n},t[10]=n,t[11]=E);let D=E,O;t[12]!==u||t[13]!==w||t[14]!==D?(O=(e,t)=>{let n=D(t);n!==null&&(u(e.id,n),w(!1))},t[12]=u,t[13]=w,t[14]=D,t[15]=O):O=t[15];let k=O,A;t[16]!==w||t[17]!==D||t[18]!==d?(A=e=>{let t=D(e);t===null||d===null||(d.launchInTerminal(t),w(!1))},t[16]=w,t[17]=D,t[18]=d,t[19]=A):A=t[19];let j=A,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=S?()=>{m.current=!0}:void 0,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=S?()=>{if(m.current){m.current=!1;return}w(!0)}:void 0,t[21]=w,t[22]=N);let P,F;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(yi,{className:`size-3.5`,"aria-hidden":`true`}),F=(0,Z.jsx)(s,{id:`O7_W_a`}),t[23]=P,t[24]=F):(P=t[23],F=t[24]);let I;t[25]!==N||t[26]!==T?(I=(0,Z.jsx)(J,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,disabled:T,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`open-in-agent-trigger`,onPointerDown:M,onClick:N,children:[P,F]})}),t[25]=N,t[26]=T,t[27]=I):I=t[27];let L;t[28]===o?L=t[29]:(L=o({id:`O7_W_a`}),t[28]=o,t[29]=L);let R=n===null,z;t[30]!==j||t[31]!==k||t[32]!==c||t[33]!==R||t[34]!==d?(z=(0,Z.jsx)(UN,{installStates:c,terminalLaunch:d,disabled:R,onPick:k,onLaunchTerminal:j}),t[30]=j,t[31]=k,t[32]=c,t[33]=R,t[34]=d,t[35]=z):z=t[35];let B;t[36]!==L||t[37]!==z?(B=(0,Z.jsx)(b,{align:`end`,className:`p-1`,"aria-label":L,"data-testid":`open-in-agent-menu`,children:z}),t[36]=L,t[37]=z,t[38]=B):B=t[38];let V;return t[39]!==w||t[40]!==g||t[41]!==I||t[42]!==B?(V=(0,Z.jsxs)(fe,{open:g,onOpenChange:w,children:[I,B]}),t[39]=w,t[40]=g,t[41]=I,t[42]=B,t[43]=V):V=t[43],V}var GN=50,KN=()=>{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,PC.preload()},GN))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},c=[],e[2]=o,e[3]=c):(o=e[2],c=e[3]),(0,Q.useEffect)(o,c);let l,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Cg)},u=(0,Z.jsx)(Zl,{className:`size-4`}),e[4]=l,e[5]=u):(l=e[4],u=e[5]);let d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:l,children:[u,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]})}),e[6]=d):d=e[6];let f;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(Is,{children:[d,(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`Tz0i8g`})})]}),e[7]=f):f=e[7],f};function qN(e){let t=(0,$.c)(30),{input:n,onClickWhenNoRemote:r}=e,{_:a}=i(),{status:o}=Oa(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(null),f=(0,Q.useRef)(null),p,m;t[0]===u?(p=t[1],m=t[2]):(p=()=>{!u||!f.current||(f.current.focus(),f.current.select())},m=[u],t[0]=u,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=o?.hasRemote===!0,g=n===null,_;t[3]!==a||t[4]!==c||t[5]!==h||t[6]!==n||t[7]!==r?(_=async function(){if(!c&&n!==null){l(!0),d(null);try{let e=await ca({...n,hasRemote:h,onClickWhenNoRemote:r},{clipboardWrite:Pa,toastSuccess:$N,toastError:QN,logEvent:ZN});e.kind===`clipboard-failed`&&d(e.shareUrl)}catch{hs.error(a({id:`u3YnKw`}))}l(!1)}},t[3]=a,t[4]=c,t[5]=h,t[6]=n,t[7]=r,t[8]=_):_=t[8];let v=_,y=u!==null,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||d(null)},t[9]=x):x=t[9];let C;t[10]!==a||t[11]!==n?.kind?(C=n?.kind===`folder`?a({id:`WR0y2O`}):a({id:`F4IYWe`}),t[10]=a,t[11]=n?.kind,t[12]=C):C=t[12];let w=c||g,T,E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Ql,{className:`size-3.5`,"aria-hidden":!0}),E=(0,Z.jsx)(s,{id:`Z8lGw6`}),t[13]=T,t[14]=E):(T=t[13],E=t[14]);let D;t[15]!==v||t[16]!==C||t[17]!==w?(D=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsxs)(ci,{variant:`ghost`,size:`sm`,"aria-label":C,onClick:v,disabled:w,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[T,E]})}),t[15]=v,t[16]=C,t[17]=w,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(s,{id:`I1m158`})}),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(s,{id:`ndeI89`})}),t[20]=k):k=t[20];let A=u??``,j;t[21]===a?j=t[22]:(j=a({id:`5-FeN2`}),t[21]=a,t[22]=j);let M;t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(b,{className:`flex w-80 flex-col gap-2`,"data-testid":`share-button-fallback-popover`,children:[O,k,(0,Z.jsx)(jo,{ref:f,readOnly:!0,value:A,onFocus:XN,onClick:YN,onContextMenu:JN,className:`font-mono text-xs`,"data-testid":`share-button-fallback-url`,"aria-label":j})]}),t[23]=A,t[24]=j,t[25]=M):M=t[25];let N;return t[26]!==D||t[27]!==M||t[28]!==y?(N=(0,Z.jsxs)(fe,{open:y,onOpenChange:x,children:[D,M]}),t[26]=D,t[27]=M,t[28]=y,t[29]=N):N=t[29],N}function JN(e){return e.currentTarget.select()}function YN(e){return e.currentTarget.select()}function XN(e){return e.currentTarget.select()}function ZN(e){return console.log(e)}function QN(e){e!==`Link ready but could not copy to clipboard.`&&hs.error(e)}function $N(e){return hs.success(e)}function eP(e){let t=(0,$.c)(45),{onSignIn:n,onSetIdentity:r,onOpenSearch:a,openInAgentMenuOpen:o,openInAgentMenuInput:c,onOpenInAgentMenuOpenChange:l}=e,{_:u}=i(),{activeDocName:d,activeTarget:f}=mt(),{state:p,isDraggingRail:m}=hA(),h=Sg(),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=tc(`toggle-files-sidebar`),t[0]=g):g=t[0];let _=g,v=tc(`command-palette`),y=po(),[b,x]=(0,Q.useState)(!1),S;bb0:{if(f===null){let e;t[1]===y?e=t[2]:(e=t_({workspace:y}),t[1]=y,t[2]=e),S=e;break bb0}if(f.kind===`folder`){if(!y){S=null;break bb0}let e;t[3]!==f.folderPath||t[4]!==y?(e=i_({folderRelativePath:f.folderPath,workspace:y}),t[3]=f.folderPath,t[4]=y,t[5]=e):e=t[5],S=e;break bb0}let e;t[6]!==d||t[7]!==y?(e=e_({docName:d,workspace:y}),t[6]=d,t[7]=y,t[8]=e):e=t[8],S=e}let C=c??S,w;bb1:{if(f?.kind===`folder`){let e;t[9]===f.folderPath?e=t[10]:(e=fo(f.folderPath),t[9]=f.folderPath,t[10]=e),w=e;break bb1}if(d){let e;t[11]===d?e=t[12]:(e=Da(d),t[11]=d,t[12]=e),w=e;break bb1}w=null}let E=w,D=typeof window<`u`&&window.okDesktop!=null,O=p===`collapsed`,k=D?``:void 0,A=D&&O&&`pl-[var(--ok-titlebar-reserve-left,1rem)]`,j=D&&!m&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`,M;t[13]!==A||t[14]!==j?(M=oi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,D&&`[-webkit-app-region:drag]`,A,j),t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(bA,{className:oi(`-ml-1 shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`)})}),(0,Z.jsx)(Ns,{children:p===`expanded`?(0,Z.jsx)(s,{id:`ZxXhLY`,values:{sidebarShortcut:_}}):(0,Z.jsx)(s,{id:`Zz25kq`,values:{sidebarShortcut:_}})})]}),O&&a&&(0,Z.jsxs)(Is,{children:[(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-sm`,onClick:a,"aria-label":u({id:`IN4UX8`,values:{searchShortcut:v}}),"data-telemetry-event":`ok.editor_header.search.click`,className:oi(`shrink-0 text-muted-foreground`,D&&`[-webkit-app-region:no-drag]`),children:(0,Z.jsx)(T,{"aria-hidden":`true`})})}),(0,Z.jsx)(Ns,{children:(0,Z.jsx)(s,{id:`IN4UX8`,values:{searchShortcut:v}})})]}),(0,Z.jsx)(ta,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),(0,Z.jsx)(RN,{})]}),P;t[16]===N?P=t[17]:(P=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:N}),t[16]=N,t[17]=P);let F;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=oi(`flex shrink-0 items-center justify-end gap-2 px-3`,D&&`[&>*]:[-webkit-app-region:no-drag]`),t[18]=F):F=t[18];let I;t[19]!==C||t[20]!==l||t[21]!==o||t[22]!==b||t[23]!==x||t[24]!==E||t[25]!==h?(I=!h&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(WN,{input:C,open:o,onOpenChange:l}),(0,Z.jsx)(qN,{input:E,onClickWhenNoRemote:()=>x(!0)}),(0,Z.jsx)(mo,{open:b,onOpenChange:x})]}),t[19]=C,t[20]=l,t[21]=o,t[22]=b,t[23]=x,t[24]=E,t[25]=h,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==n?(L=(0,Z.jsx)(Ua,{onSignIn:n,onSetIdentity:r}),t[27]=r,t[28]=n,t[29]=L):L=t[29];let R,z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(iM,{}),z=(0,Z.jsx)(ta,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),B=(0,Z.jsx)(qd,{}),t[30]=R,t[31]=z,t[32]=B):(R=t[30],z=t[31],B=t[32]);let V;t[33]===h?V=t[34]:(V=!h&&(0,Z.jsx)(KN,{}),t[33]=h,t[34]=V);let H;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(HN,{}),t[35]=H):H=t[35];let U;t[36]!==I||t[37]!==L||t[38]!==V?(U=(0,Z.jsxs)(`div`,{className:F,children:[I,L,R,z,B,V,H]}),t[36]=I,t[37]=L,t[38]=V,t[39]=U):U=t[39];let W;return t[40]!==P||t[41]!==U||t[42]!==k||t[43]!==M?(W=(0,Z.jsxs)(`header`,{"data-electron-drag":k,className:M,children:[P,U]}),t[40]=P,t[41]=U,t[42]=k,t[43]=M,t[44]=W):W=t[44],W}var tP=`open-knowledge:terminal-launch`;function nP(e,t=typeof window>`u`?new EventTarget:window){t.dispatchEvent(new CustomEvent(tP,{detail:{prompt:e}}))}function rP(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail?.prompt:void 0;typeof n==`string`&&e(n)};return t.addEventListener(tP,n),()=>t.removeEventListener(tP,n)}function iP(e){let t=(0,$.c)(63),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onOpenSearch:r}=n,{_:a}=i(),[o,s]=lv(),[c,l]=(0,Q.useState)(o),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(Ey[0].id),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`?window.okDesktop??null:null,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(null),D=(0,Q.useRef)(0),O=ho(),{projectConfig:k,projectLocalConfig:A,projectLocalSynced:j,projectSynced:M}=ae(),N=po(),{activeDocName:P}=mt(),F=O?.hasRemote,I=O?.pushPermission?.checkStatus,L;t[2]!==g||t[3]!==k||t[4]!==A||t[5]!==j||t[6]!==M||t[7]!==F||t[8]!==I?(L=pv({autoSyncOnboardingDismissed:g,hasRemote:F,projectLocalSynced:j,projectSynced:M,projectLocalConfig:A,projectConfig:k,pushPermissionCheckStatus:I}),t[2]=g,t[3]=k,t[4]=A,t[5]=j,t[6]=M,t[7]=F,t[8]=I,t[9]=L):L=t[9];let R=L,z,B;t[10]===P?(z=t[11],B=t[12]):(z=()=>{let e=function(e){let t=e.detail;t&&P&&Oc(P,{kind:`raw-mdx`,detail:t}),l(`source`)};return window.addEventListener(tv,e),()=>window.removeEventListener(tv,e)},B=[P],t[10]=P,t[11]=z,t[12]=B),(0,Q.useEffect)(z,B);let V,H;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{let e=window.okDesktop;if(e!=null)return e.onMenuAction(e=>{e===`toggle-terminal`?w(oP):e===`new-terminal`&&w(!0)})},H=[],t[13]=V,t[14]=H):(V=t[13],H=t[14]),(0,Q.useEffect)(V,H);let U,W;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>{if(window.okDesktop!=null)return;let e=function(e){nc(e,`toggle-terminal-panel`)&&(e.preventDefault(),w(aP))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},U=[],t[15]=U,t[16]=W):(U=t[15],W=t[16]),(0,Q.useEffect)(W,U);let G,K;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>rP(e=>{w(!0),D.current+=1,E({prompt:e,nonce:D.current})}),K=[],t[17]=G,t[18]=K):(G=t[17],K=t[18]),(0,Q.useEffect)(G,K);let q,J;t[19]===C?(q=t[20],J=t[21]):(q=()=>{C||E(null)},J=[C],t[19]=C,t[20]=q,t[21]=J),(0,Q.useEffect)(q,J);let ee,Y;t[22]===C?(ee=t[23],Y=t[24]):(ee=()=>{window.okDesktop!=null&&window.okDesktop.editor.notifyViewMenuStateChanged({terminalVisible:C})},Y=[C],t[22]=C,t[23]=ee,t[24]=Y),(0,Q.useEffect)(ee,Y);let te,ne;t[25]===C?(te=t[26],ne=t[27]):(te=()=>{window.okDesktop!=null&&C&&co()},ne=[C],t[25]=C,t[26]=te,t[27]=ne),(0,Q.useEffect)(te,ne),uv(O?.pausedReason);let X;t[28]===s?X=t[29]:(X=function(e){l(e),s(e)},t[28]=s,t[29]=X);let re=X,ie;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e){y(e),e||x(null)},t[30]=ie):ie=t[30];let oe=ie,se;t[31]!==a||t[32]!==P||t[33]!==N?(se={openSelection(e){let t=o_({docName:e.docName??P,workspace:N,instruction:e.instruction,selectionMarkdown:e.selectionMarkdown});return t===null?(hs.error(a({id:`_VRtd7`})),!1):(x(t),y(!0),!0)}},t[31]=a,t[32]=P,t[33]=N,t[34]=se):se=t[34];let ce,le;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{p(`auth`),d(!0)},le=()=>{p(`identity`),d(!0)},t[35]=ce,t[36]=le):(ce=t[35],le=t[36]);let ue;t[37]!==r||t[38]!==b||t[39]!==v?(ue=(0,Z.jsx)(eP,{onSignIn:ce,onSetIdentity:le,onOpenSearch:r,openInAgentMenuOpen:v,openInAgentMenuInput:b,onOpenInAgentMenuOpenChange:oe}),t[37]=r,t[38]=b,t[39]=v,t[40]=ue):ue=t[40];let de;t[41]!==m||t[42]!==c||t[43]!==re||t[44]!==T||t[45]!==C?(de=(0,Z.jsx)(Mj,{editorMode:c,onModeChange:re,activeTab:m,onActiveTabChange:h,terminalBridge:S,terminalVisible:C,onTerminalVisibleChange:w,terminalLaunch:T}),t[41]=m,t[42]=c,t[43]=re,t[44]=T,t[45]=C,t[46]=de):de=t[46];let fe;t[47]!==se||t[48]!==ue||t[49]!==de?(fe=(0,Z.jsxs)(Pc,{value:se,children:[ue,de]}),t[47]=se,t[48]=ue,t[49]=de,t[50]=fe):fe=t[50];let pe=f===`identity`,me;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(me=()=>{d(!1)},t[51]=me):me=t[51];let he;t[52]!==u||t[53]!==pe?(he=(0,Z.jsx)(ra,{open:u,onOpenChange:d,identityPrompt:pe,onSuccess:me}),t[52]=u,t[53]=pe,t[54]=he):he=t[54];let ge;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>_(!0),t[55]=ge):ge=t[55];let _e;t[56]===R?_e=t[57]:(_e=(0,Z.jsx)(dv,{open:R,onResolved:ge}),t[56]=R,t[57]=_e);let ve;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Z.jsx)(Q_,{}),t[58]=ve):ve=t[58];let ye;return t[59]!==fe||t[60]!==he||t[61]!==_e?(ye=(0,Z.jsxs)(Z.Fragment,{children:[fe,he,_e,ve]}),t[59]=fe,t[60]=he,t[61]=_e,t[62]=ye):ye=t[62],ye}function aP(e){return!e}function oP(e){return!e}function sP(e){let t=Vo(Ko(e));typeof window>`u`||window.location.hash!==t&&(window.location.hash=t)}function cP(){let e=(0,$.c)(11),{conflicts:t,loading:n,error:r}=Pi();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)(Lo,{"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)(Lo,{"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(lP),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 lP(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(ci,{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:()=>sP(e.file),children:[(0,Z.jsx)(Lo,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.file})]})},e.file)}var uP=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
30
30
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
31
31
  <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"/>
32
32
  </symbol>
@@ -1938,10 +1938,10 @@ Error generating stack: `+e.message+`
1938
1938
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z'/></svg>") center / contain no-repeat;
1939
1939
  pointer-events: none;
1940
1940
  }
1941
- `;function iG(e){sG(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=oM(r);cM(r)&&aG(i),!t.hasAttribute($W)&&(cG(t),t.setAttribute($W,``))}function aG(e){eG=e,tG!==null&&clearTimeout(tG),tG=setTimeout(oG,nG)}function oG(){eG=null,tG!==null&&(clearTimeout(tG),tG=null)}function sG(e){let t=e.querySelectorAll(`[${QW}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(QW);if(!t){e.removeAttribute(QW);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(QW);continue}let r=oM(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(QW)}if(eG===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||oM(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==eG&&e.setAttribute(QW,eG))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&oG()}function cG(e){let t=oM(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function lG(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function uG(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function dG(e,t,n={}){if(!e)return uG(t);let r=es(e);if(t&&r!==t)return uG(t);switch(e.kind){case`doc`:return uG(t??e.docName);case`large-file`:return uG(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?uG(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fG(e,t){if(!e)return{kind:`none`};let n=t.find(t=>mM(t)===e);if(n&&Ro(n))return{kind:`asset`,path:n.path,hash:Jo(n.path),mediaKind:n.mediaKind};let r=vM(e);return e.endsWith(`/`)?t.some(e=>Zo(e)?e.path===r||e.path.startsWith(`${r}/`):(Ro(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>fs(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var pG=`You can restore this file from the Trash.`;function mG(e){let t=pG,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function hG(e,t){return e===`web`?null:mG(t)}function gG(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function _G(e,t,n){let r=fG(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>fs(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var vG=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function yG(e){return typeof e==`string`&&vG.includes(e)?e:`system-error`}function bG(e){switch(e){case`not-found`:return ms._({id:`v41fCm`});case`permission-denied`:return ms._({id:`sJK6pq`});case`system-error`:return ms._({id:`Jqqevv`});case`path-escape`:return ms._({id:`WL6puM`})}}function xG(e){let t=bG(e.reason),n=e.detail;return n?ms._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):ms._({id:`dTaauv`,values:{reason:t}})}function SG(e){return e.kind===`folder`?`${e.name}/`:e.name}function CG(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?SG(l):``;d=c?ms._({id:`5qNxOe`,values:{count:u}}):l?`${ms._({id:`E_BHoD`,values:{targetName:e}})}\n${xG(l)}`:ms._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Do,{children:[p,(0,Z.jsx)(So,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let g;t[7]!==n||t[8]!==c?(g=c?(0,Z.jsx)(To,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(wG)})}):null,t[7]=n,t[8]=c,t[9]=g):g=t[9];let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=_):_=t[10];let v;t[11]!==r||t[12]!==o?(v=(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:_}),t[11]=r,t[12]=o,t[13]=v):v=t[13];let y;t[14]===r?y=t[15]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=y);let b;t[16]!==r||t[17]!==a||t[18]!==y?(b=(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:y}),t[16]=r,t[17]=a,t[18]=y,t[19]=b):b=t[19];let x;t[20]===r?x=t[21]:(x=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=x);let S;t[22]!==r||t[23]!==i||t[24]!==x?(S=(0,Z.jsx)(ci,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:x}),t[22]=r,t[23]=i,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==v||t[28]!==b?(C=(0,Z.jsxs)(Eo,{children:[v,b,S]}),t[26]=S,t[27]=v,t[28]=b,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==m||t[32]!==g?(w=(0,Z.jsxs)(wo,{className:`sm:max-w-md`,children:[m,g,C]}),t[30]=C,t[31]=m,t[32]=g,t[33]=w):w=t[33],w}function wG(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:SG(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:xG(e)})]},e.path)}function TG(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Va(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Mh(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function EG(e){return e?.isDirectory()?e:null}function DG(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function OG(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=EG(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}DG(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var kG=`open-knowledge:file-tree-menu-action-delete`,AG=`open-knowledge:file-tree-menu-action-rename`,jG=`open-knowledge:file-tree-menu-action-duplicate`;function MG(e){window.dispatchEvent(new CustomEvent(kG,{detail:{target:e}}))}function NG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(kG,t),()=>window.removeEventListener(kG,t)}function PG(e){window.dispatchEvent(new CustomEvent(AG,{detail:{target:e}}))}function FG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(AG,t),()=>window.removeEventListener(AG,t)}function IG(e){window.dispatchEvent(new CustomEvent(jG,{detail:{target:e}}))}function LG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(jG,t),()=>window.removeEventListener(jG,t)}function RG(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var zG={Accept:`application/x-ndjson, application/json`};function BG(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var VG=class extends Error{};function HG(e){return typeof e==`object`&&!!e&&`type`in e}async function UG(e){let t=e.body;if(!t)throw new VG(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(HG(n)){if(n.type===`error`)throw new VG(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=kn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
1941
+ `;function iG(e){sG(e);let t=e.querySelector(`[data-item-rename-input]`);if(!t)return;let n=t.closest(`[data-type="item"]`);if(!n)return;let r=n.dataset.itemPath??``;if(r.endsWith(`/`))return;let i=oM(r);cM(r)&&aG(i),!t.hasAttribute($W)&&(cG(t),t.setAttribute($W,``))}function aG(e){eG=e,tG!==null&&clearTimeout(tG),tG=setTimeout(oG,nG)}function oG(){eG=null,tG!==null&&(clearTimeout(tG),tG=null)}function sG(e){let t=e.querySelectorAll(`[${QW}]`);for(let e of t){if(e.querySelector(`[data-item-rename-input]`))continue;let t=e.getAttribute(QW);if(!t){e.removeAttribute(QW);continue}let n=e.dataset.itemPath??``;if(n.toLowerCase().endsWith(t.toLowerCase())){e.removeAttribute(QW);continue}let r=oM(n);r&&r.toLowerCase()!==t.toLowerCase()&&e.removeAttribute(QW)}if(eG===null)return;let n=e.querySelectorAll(`[data-type="item"][data-item-path]`),r=!1;for(let e of n){let t=e.dataset.itemPath??``;!t||t.endsWith(`/`)||oM(t)||(r=!0,e.getAttribute(`data-item-selected`)===`true`&&e.getAttribute(`data-ok-renaming`)!==eG&&e.setAttribute(QW,eG))}let i=!!e.querySelector(`[data-item-rename-input]`);!r&&!i&&oG()}function cG(e){let t=oM(e.value),n=t?e.value.length-t.length:e.value.length;e.setSelectionRange(0,n)}function lG(e){let t=e.getFocusedPath();t&&e.scrollToPath(t,{offset:`nearest`,focus:!1})}function uG(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function dG(e,t,n={}){if(!e)return uG(t);let r=es(e);if(t&&r!==t)return uG(t);switch(e.kind){case`doc`:return uG(t??e.docName);case`large-file`:return uG(e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?uG(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function fG(e,t){if(!e)return{kind:`none`};let n=t.find(t=>mM(t)===e);if(n&&Ro(n))return{kind:`asset`,path:n.path,hash:Jo(n.path),mediaKind:n.mediaKind};let r=vM(e);return e.endsWith(`/`)?t.some(e=>Zo(e)?e.path===r||e.path.startsWith(`${r}/`):(Ro(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>fs(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}var pG=`You can restore this file from the Trash.`;function mG(e){let t=pG,n=`Move to Trash`,r=`Moving`;if(e.length===0)return{title:`Are you sure you want to delete the selected items?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r};if(e.length===1){let i=e[0];return i?i.kind===`folder`?{title:`Are you sure you want to delete '${i.name}' and its contents?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete '${i.name}'?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the selected item?`,detail:t,listedTargets:null,confirmLabel:n,confirmLabelBusy:r}}let i=e.some(e=>e.kind===`folder`),a=e.some(e=>e.kind!==`folder`);return i&&a?{title:`Are you sure you want to delete the following ${e.length} files/directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:i?{title:`Are you sure you want to delete the following ${e.length} directories and their contents?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}:{title:`Are you sure you want to delete the following ${e.length} files?`,detail:t,listedTargets:e,confirmLabel:n,confirmLabelBusy:r}}function hG(e,t){return e===`web`?null:mG(t)}function gG(e){return e.kind===`folder`?`${e.name}/`:e.kind===`asset`?e.name:e.docExt?`${e.name}${e.docExt}`:e.name}function _G(e,t,n){let r=fG(e,t);if(r.kind===`none`)return null;if(r.kind===`asset`)return{v:1,kind:`asset`,assetPath:r.path,mediaKind:r.mediaKind};if(r.kind===`folder`)return{v:1,kind:`folder`,folderPath:r.path};let i=t.find(e=>fs(e)&&e.docName===r.path);return{v:1,kind:`doc`,docName:r.path,size:i?.size??n?.get(r.path)?.size??null}}var vG=[`not-found`,`permission-denied`,`system-error`,`path-escape`];function yG(e){return typeof e==`string`&&vG.includes(e)?e:`system-error`}function bG(e){switch(e){case`not-found`:return ms._({id:`v41fCm`});case`permission-denied`:return ms._({id:`sJK6pq`});case`system-error`:return ms._({id:`Jqqevv`});case`path-escape`:return ms._({id:`WL6puM`})}}function xG(e){let t=bG(e.reason),n=e.detail;return n?ms._({id:`Z2M5XM`,values:{reason:t,osDetail:n}}):ms._({id:`dTaauv`,values:{reason:t}})}function SG(e){return e.kind===`folder`?`${e.name}/`:e.name}function CG(e){let t=(0,$.c)(34),{failedTargets:n,isSubmitting:r,onDeletePermanently:i,onRetry:a,onCancel:o}=e,c=n.length>1,l=n[0],u=n.length,d;if(t[0]!==u||t[1]!==c||t[2]!==l){let e=l?SG(l):``;d=c?ms._({id:`5qNxOe`,values:{count:u}}):l?`${ms._({id:`E_BHoD`,values:{targetName:e}})}\n${xG(l)}`:ms._({id:`kolRU1`}),t[0]=u,t[1]=c,t[2]=l,t[3]=d}else d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`aOp3hw`})}),t[4]=p):p=t[4];let m;t[5]===f?m=t[6]:(m=(0,Z.jsxs)(Do,{children:[p,(0,Z.jsx)(So,{className:`whitespace-pre-wrap`,children:f})]}),t[5]=f,t[6]=m);let g;t[7]!==n||t[8]!==c?(g=c?(0,Z.jsx)(To,{children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 text-xs`,children:n.map(wG)})}):null,t[7]=n,t[8]=c,t[9]=g):g=t[9];let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(s,{id:`dEgA5A`}),t[10]=_):_=t[10];let v;t[11]!==r||t[12]!==o?(v=(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:o,disabled:r,"data-testid":`trash-failure-modal-cancel`,children:_}),t[11]=r,t[12]=o,t[13]=v):v=t[13];let y;t[14]===r?y=t[15]:(y=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`mf37rL`})]}):(0,Z.jsx)(s,{id:`6gRgw8`}),t[14]=r,t[15]=y);let b;t[16]!==r||t[17]!==a||t[18]!==y?(b=(0,Z.jsx)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:a,disabled:r,"data-testid":`trash-failure-modal-retry`,children:y}),t[16]=r,t[17]=a,t[18]=y,t[19]=b):b=t[19];let x;t[20]===r?x=t[21]:(x=r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-4 animate-spin`}),` `,(0,Z.jsx)(s,{id:`s3caR3`})]}):(0,Z.jsx)(s,{id:`UBv8UK`}),t[20]=r,t[21]=x);let S;t[22]!==r||t[23]!==i||t[24]!==x?(S=(0,Z.jsx)(ci,{variant:`destructive`,onClick:i,disabled:r,"data-testid":`trash-failure-modal-delete-permanently`,children:x}),t[22]=r,t[23]=i,t[24]=x,t[25]=S):S=t[25];let C;t[26]!==S||t[27]!==v||t[28]!==b?(C=(0,Z.jsxs)(Eo,{children:[v,b,S]}),t[26]=S,t[27]=v,t[28]=b,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==m||t[32]!==g?(w=(0,Z.jsxs)(wo,{className:`sm:max-w-md`,children:[m,g,C]}),t[30]=C,t[31]=m,t[32]=g,t[33]=w):w=t[33],w}function wG(e){return(0,Z.jsxs)(`li`,{"data-testid":`trash-failure-modal-target`,children:[(0,Z.jsx)(`div`,{className:`font-mono text-foreground`,children:SG(e)}),(0,Z.jsx)(`div`,{className:`text-muted-foreground`,children:xG(e)})]},e.path)}function TG(e){let t=(0,$.c)(21),{parentDir:n,onSelectTemplate:r,ItemComponent:i}=e,{state:a}=Di(n);if(a.status===`idle`||a.status===`loading`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`Hl89Qd`}),t[0]=e):e=t[0];let n;return t[1]===i?n=t[2]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[1]=i,t[2]=n),n}if(a.status===`error`){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`AQ-Lfg`}),t[3]=e):e=t[3];let n;return t[4]===i?n=t[5]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[4]=i,t[5]=n),n}let o,c;if(t[6]!==i||t[7]!==r||t[8]!==a.data.folder.templates_available){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[11]===a.data.folder.templates_available?e=t[12]:(e=a.data.folder.templates_available??[],t[11]=a.data.folder.templates_available,t[12]=e);let n=Mh(e);if(n.length===0){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(s,{id:`iGCs04`}),t[13]=e):e=t[13];let n;t[14]===i?n=t[15]:(n=(0,Z.jsx)(i,{disabled:!0,className:`text-muted-foreground`,children:e}),t[14]=i,t[15]=n),c=n;break bb0}let l;t[16]!==i||t[17]!==r?(l=e=>(0,Z.jsx)(i,{onSelect:()=>r(e.name),children:e.title??e.name},`${e.scope}:${e.source_folder}:${e.name}`),t[16]=i,t[17]=r,t[18]=l):l=t[18],o=n.map(l)}t[6]=i,t[7]=r,t[8]=a.data.folder.templates_available,t[9]=o,t[10]=c}else o=t[9],c=t[10];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[19]===o?l=t[20]:(l=(0,Z.jsx)(Z.Fragment,{children:o}),t[19]=o,t[20]=l),l}function EG(e){return e?.isDirectory()?e:null}function DG(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function OG(e,t,n,r,i){let a=(0,$.c)(11),o;a[0]!==n||a[1]!==t||a[2]!==e||a[3]!==r?(o=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=EG(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}if(e.getSelectedPaths().length>1&&o.isSelected()){o.focus(),i();return}DG(e,o),o.focus(),i()},a[0]=n,a[1]=t,a[2]=e,a[3]=r,a[4]=o):o=a[4];let s;a[5]!==n||a[6]!==t||a[7]!==e||a[8]!==r||a[9]!==i?(s=[n,t,e,r,i],a[5]=n,a[6]=t,a[7]=e,a[8]=r,a[9]=i,a[10]=s):s=a[10],(0,Q.useEffect)(o,s)}var kG=`open-knowledge:file-tree-menu-action-delete`,AG=`open-knowledge:file-tree-menu-action-rename`,jG=`open-knowledge:file-tree-menu-action-duplicate`;function MG(e){window.dispatchEvent(new CustomEvent(kG,{detail:{target:e}}))}function NG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(kG,t),()=>window.removeEventListener(kG,t)}function PG(e){window.dispatchEvent(new CustomEvent(AG,{detail:{target:e}}))}function FG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(AG,t),()=>window.removeEventListener(AG,t)}function IG(e){window.dispatchEvent(new CustomEvent(jG,{detail:{target:e}}))}function LG(e){let t=t=>{let n=t.detail;n?.target&&e(n.target)};return window.addEventListener(jG,t),()=>window.removeEventListener(jG,t)}function RG(e,t){let n=!1,r=!1,i=!1;async function a(){if(!i){n=!0;try{await e()}finally{n=!1,i?r=!1:r&&(r=!1,a())}}}return{request(){if(!i){if(n){r=!0,t?.();return}a()}},dispose(){i=!0,r=!1,t?.()}}}var zG={Accept:`application/x-ndjson, application/json`};function BG(e){return!e.ok||!e.body?!1:(e.headers.get(`content-type`)??``).includes(`application/x-ndjson`)}var VG=class extends Error{};function HG(e){return typeof e==`object`&&!!e&&`type`in e}async function UG(e){let t=e.body;if(!t)throw new VG(`Show All Files stream had no response body.`);let n=t.getReader(),r=new TextDecoder,i=[],a=!1,o=``,s=e=>{let t=e.trim();if(t.length===0)return!1;let n;try{n=JSON.parse(t)}catch{return console.warn(`[show-all-stream] dropping unparseable NDJSON line:`,t.slice(0,200)),!1}if(HG(n)){if(n.type===`error`)throw new VG(typeof n.problem?.title==`string`?n.problem.title:`Show All Files stream failed.`);return a=n.truncated===!0,!0}let r=kn.safeParse(n);return r.success?i.push(r.data):console.warn(`[show-all-stream] dropping schema-divergent entry line:`,r.error.issues),!1};try{let e=!1;for(;!e;){let t=await n.read();if(t.done)break;o+=r.decode(t.value,{stream:!0});let i=o.indexOf(`
1942
1942
  `);for(;i!==-1;){let t=s(o.slice(0,i));if(o=o.slice(i+1),t){e=!0;break}i=o.indexOf(`
1943
1943
  `)}}o+=r.decode(),o.includes(`
1944
- `)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function WG(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>mM(e))),a=[];for(let e of t){let t=mM(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function GG(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>mM(e)===t))return[...e];let a=[],o=[];for(let n of e)KG(t,mM(n))?a.push(n):o.push(n);let s=WG(n,a,r,i),c=new Set(s.map(e=>mM(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=mM(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function KG(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}function qG(e){return e?ms._({id:`wTcjov`}):null}function JG(e){let t=(0,$.c)(29),{_:n}=i(),r=mg(),a=qx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){let e=qG(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=_g.filter(r),_;t[14]===c?_=t[15]:(_=_g.some(e=>c[e.id]?.installed==null),t[14]=c,t[15]=_);let v=_,y=i.length>0,b=a!==null,x=!y&&!b;f=ka,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(yi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[16]=g):g=t[16],d=Ha,p=y?(0,Z.jsxs)(La,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(Ya,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(Ea,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Wx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,t[17]!==v||t[18]!==x?(m=x?(0,Z.jsx)(Ea,{disabled:!0,"data-testid":`file-tree-open-in-empty`,children:v?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[17]=v,t[18]=x,t[19]=m):m=t[19],h=b?(0,Z.jsxs)(Z.Fragment,{children:[y?(0,Z.jsx)(no,{}):null,(0,Z.jsxs)(La,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Ya,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Ea,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`file-tree-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null,t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];let _;t[20]!==d||t[21]!==p||t[22]!==m||t[23]!==h?(_=(0,Z.jsxs)(d,{children:[p,m,h]}),t[20]=d,t[21]=p,t[22]=m,t[23]=h,t[24]=_):_=t[24];let v;return t[25]!==f||t[26]!==g||t[27]!==_?(v=(0,Z.jsxs)(f,{children:[g,_]}),t[25]=f,t[26]=g,t[27]=_,t[28]=v):v=t[28],v}var YG=v(`HOVER_INTENT_MS`,80),XG=3,ZG=20,QG=new Map,$G=new Set,eK=[],tK=new Map;function nK(e){for(tK.delete(e),tK.set(e,!0);tK.size>ZG;){let e=tK.keys().next().value;if(e===void 0)break;tK.delete(e)}}function rK(e){$G.delete(e),aK()}function iK(e,t){let n=Date.now();le(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),g(e,t,n)}function aK(){for(;$G.size<XG&&eK.length>0;){let e=eK.shift();if(!e)break;if(!tK.has(e.docName)){$G.add(e.docName),nK(e.docName);try{let t=e.prewarm(e.docName);t&&iK(e.docName,t)}catch(t){le(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{rK(e.docName)}}}}function oK(e,t){if(Ke(e)||tK.has(e))return;let n=QG.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(QG.delete(e),$G.size>=XG){eK.push({docName:e,prewarm:t});return}nK(e),$G.add(e);try{let n=t(e);n&&iK(e,n)}catch(t){le(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{rK(e)}},YG);QG.set(e,{timer:r,prewarm:t})}function sK(e){let t=QG.get(e);t&&(clearTimeout(t.timer),QG.delete(e))}var cK=/\.(md|mdx)$/i;function lK(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function uK(e){let t=e.match(cK);return t?t[0]:null}function dK(e){window.requestAnimationFrame(()=>{let t=q(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function fK(e){let t=e.current;t.row?.removeAttribute(TK),t.root?.removeAttribute(EK),e.current={row:null,root:null}}function pK(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(fK(e),t.row?.setAttribute(TK,`true`),t.root?.setAttribute(EK,`true`),e.current={row:t.row,root:t.root})}async function mK(e,t){try{await navigator.clipboard.writeText(e),hs.success(t===`full`?ms._({id:`6_ZOw4`}):ms._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),hs.error(t===`full`?ms._({id:`vfRlCI`}):ms._({id:`5QGTaA`}))}}var hK=new Set([`agents`,`agent`,`claude`,`skill`]),gK=`ok-file-tree-link-decoration`,_K=`ok-file-tree-agent-decoration`,vK=`ok-file-tree-markdown`,yK=`0 0 32 32`,bK=`<symbol id="${vK}" viewBox="${yK}" fill="currentColor"><path d="M26.7075 10.2925L19.7075 3.2925C19.6146 3.19967 19.5042 3.12605 19.3829 3.07586C19.2615 3.02568 19.1314 2.9999 19 3H7C6.46957 3 5.96086 3.21071 5.58579 3.58579C5.21071 3.96086 5 4.46957 5 5V14C5 14.2652 5.10536 14.5196 5.29289 14.7071C5.48043 14.8946 5.73478 15 6 15C6.26522 15 6.51957 14.8946 6.70711 14.7071C6.89464 14.5196 7 14.2652 7 14V5H18V11C18 11.2652 18.1054 11.5196 18.2929 11.7071C18.4804 11.8946 18.7348 12 19 12H25V28C25 28.2652 25.1054 28.5196 25.2929 28.7071C25.4804 28.8946 25.7348 29 26 29C26.2652 29 26.5196 28.8946 26.7071 28.7071C26.8946 28.5196 27 28.2652 27 28V11C27.0001 10.8686 26.9743 10.7385 26.9241 10.6172C26.8739 10.4958 26.8003 10.3854 26.7075 10.2925ZM20 6.41375L23.5863 10H20V6.41375ZM18 18H16C15.7348 18 15.4804 18.1054 15.2929 18.2929C15.1054 18.4804 15 18.7348 15 19V26C15 26.2652 15.1054 26.5196 15.2929 26.7071C15.4804 26.8946 15.7348 27 16 27H18C19.1935 27 20.3381 26.5259 21.182 25.682C22.0259 24.8381 22.5 23.6935 22.5 22.5C22.5 21.3065 22.0259 20.1619 21.182 19.318C20.3381 18.4741 19.1935 18 18 18ZM18 25H17V20H18C18.663 20 19.2989 20.2634 19.7678 20.7322C20.2366 21.2011 20.5 21.837 20.5 22.5C20.5 23.163 20.2366 23.7989 19.7678 24.2678C19.2989 24.7366 18.663 25 18 25ZM13 19V26C13 26.2652 12.8946 26.5196 12.7071 26.7071C12.5196 26.8946 12.2652 27 12 27C11.7348 27 11.4804 26.8946 11.2929 26.7071C11.1054 26.5196 11 26.2652 11 26V22.1725L9.31875 24.5737C9.22652 24.7053 9.10396 24.8126 8.96144 24.8868C8.81892 24.9609 8.66064 24.9996 8.5 24.9996C8.33936 24.9996 8.18108 24.9609 8.03856 24.8868C7.89604 24.8126 7.77348 24.7053 7.68125 24.5737L6 22.1725V26C6 26.2652 5.89464 26.5196 5.70711 26.7071C5.51957 26.8946 5.26522 27 5 27C4.73478 27 4.48043 26.8946 4.29289 26.7071C4.10536 26.5196 4 26.2652 4 26V19C4.00009 18.7874 4.06791 18.5804 4.19363 18.409C4.31935 18.2376 4.49642 18.1107 4.69915 18.0467C4.90188 17.9828 5.11971 17.9851 5.32104 18.0533C5.52236 18.1216 5.6967 18.2522 5.81875 18.4263L8.5 22.2563L11.1812 18.4263C11.3033 18.2522 11.4776 18.1216 11.679 18.0533C11.8803 17.9851 12.0981 17.9828 12.3008 18.0467C12.5036 18.1107 12.6807 18.2376 12.8064 18.409C12.9321 18.5804 12.9999 18.7874 13 19Z"/></symbol>`;function xK(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function SK(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${xK(t)}</symbol>`}var CK=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1944
+ `)||s(o)}finally{n.releaseLock()}return{entries:i,truncated:a}}function WG(e,t,n,r=Date.now()){if(n.size===0)return[...e];let i=new Set(e.map(e=>mM(e))),a=[];for(let e of t){let t=mM(e);if(i.has(t)){n.delete(t);continue}let o=n.get(t);if(o!==void 0){if(r-o>5e3){n.delete(t);continue}a.push(e)}}return a.length===0?[...e]:[...e,...a]}function GG(e,t,n,r,i=Date.now()){if(t!==``&&!e.some(e=>mM(e)===t))return[...e];let a=[],o=[];for(let n of e)KG(t,mM(n))?a.push(n):o.push(n);let s=WG(n,a,r,i),c=new Set(s.map(e=>mM(e)).filter(e=>e.endsWith(`/`)));return[...o.filter(e=>{let n=mM(e);if(!n.startsWith(t))return!0;let r=n.slice(t.length),i=r.indexOf(`/`);return i===-1?!0:c.has(t+r.slice(0,i+1))}),...s]}function KG(e,t){if(!t.startsWith(e))return!1;let n=t.slice(e.length);if(n===``)return!1;let r=n.endsWith(`/`)?n.slice(0,-1):n;return r!==``&&!r.includes(`/`)}function qG(e){return e?ms._({id:`wTcjov`}):null}function JG(e){let t=(0,$.c)(29),{_:n}=i(),r=mg(),a=qx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){let e=qG(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=_g.filter(r),_;t[14]===c?_=t[15]:(_=_g.some(e=>c[e.id]?.installed==null),t[14]=c,t[15]=_);let v=_,y=i.length>0,b=a!==null,x=!y&&!b;f=Aa,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(so,{children:[(0,Z.jsx)(yi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[16]=g):g=t[16],d=Ha,p=y?(0,Z.jsxs)(La,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(Ea,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Wx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,t[17]!==v||t[18]!==x?(m=x?(0,Z.jsx)(Ea,{disabled:!0,"data-testid":`file-tree-open-in-empty`,children:v?(0,Z.jsx)(s,{id:`EcR0fl`}):(0,Z.jsx)(s,{id:`l6OXqI`})}):null,t[17]=v,t[18]=x,t[19]=m):m=t[19],h=b?(0,Z.jsxs)(Z.Fragment,{children:[y?(0,Z.jsx)(no,{}):null,(0,Z.jsxs)(La,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(Ja,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(Ea,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`file-tree-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null,t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];let _;t[20]!==d||t[21]!==p||t[22]!==m||t[23]!==h?(_=(0,Z.jsxs)(d,{children:[p,m,h]}),t[20]=d,t[21]=p,t[22]=m,t[23]=h,t[24]=_):_=t[24];let v;return t[25]!==f||t[26]!==g||t[27]!==_?(v=(0,Z.jsxs)(f,{children:[g,_]}),t[25]=f,t[26]=g,t[27]=_,t[28]=v):v=t[28],v}var YG=v(`HOVER_INTENT_MS`,80),XG=3,ZG=20,QG=new Map,$G=new Set,eK=[],tK=new Map;function nK(e){for(tK.delete(e),tK.set(e,!0);tK.size>ZG;){let e=tK.keys().next().value;if(e===void 0)break;tK.delete(e)}}function rK(e){$G.delete(e),aK()}function iK(e,t){let n=Date.now();le(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),g(e,t,n)}function aK(){for(;$G.size<XG&&eK.length>0;){let e=eK.shift();if(!e)break;if(!tK.has(e.docName)){$G.add(e.docName),nK(e.docName);try{let t=e.prewarm(e.docName);t&&iK(e.docName,t)}catch(t){le(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{rK(e.docName)}}}}function oK(e,t){if(Ke(e)||tK.has(e))return;let n=QG.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(QG.delete(e),$G.size>=XG){eK.push({docName:e,prewarm:t});return}nK(e),$G.add(e);try{let n=t(e);n&&iK(e,n)}catch(t){le(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{rK(e)}},YG);QG.set(e,{timer:r,prewarm:t})}function sK(e){let t=QG.get(e);t&&(clearTimeout(t.timer),QG.delete(e))}var cK=/\.(md|mdx)$/i;function lK(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function uK(e){let t=e.match(cK);return t?t[0]:null}function dK(e){window.requestAnimationFrame(()=>{let t=q(e);if(!(!t||t.isDestroyed))try{t.commands.focus()}catch{}})}function fK(e){let t=e.current;t.row?.removeAttribute(TK),t.root?.removeAttribute(EK),e.current={row:null,root:null}}function pK(e,t){let n=e.current;n.row===t.row&&n.root===t.root||(fK(e),t.row?.setAttribute(TK,`true`),t.root?.setAttribute(EK,`true`),e.current={row:t.row,root:t.root})}async function mK(e,t){try{await navigator.clipboard.writeText(e),hs.success(t===`full`?ms._({id:`6_ZOw4`}):ms._({id:`haHgQj`}),{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),hs.error(t===`full`?ms._({id:`vfRlCI`}):ms._({id:`5QGTaA`}))}}var hK=new Set([`agents`,`agent`,`claude`,`skill`]),gK=`ok-file-tree-link-decoration`,_K=`ok-file-tree-agent-decoration`,vK=`ok-file-tree-markdown`,yK=`0 0 32 32`,bK=`<symbol id="${vK}" viewBox="${yK}" fill="currentColor"><path d="M26.7075 10.2925L19.7075 3.2925C19.6146 3.19967 19.5042 3.12605 19.3829 3.07586C19.2615 3.02568 19.1314 2.9999 19 3H7C6.46957 3 5.96086 3.21071 5.58579 3.58579C5.21071 3.96086 5 4.46957 5 5V14C5 14.2652 5.10536 14.5196 5.29289 14.7071C5.48043 14.8946 5.73478 15 6 15C6.26522 15 6.51957 14.8946 6.70711 14.7071C6.89464 14.5196 7 14.2652 7 14V5H18V11C18 11.2652 18.1054 11.5196 18.2929 11.7071C18.4804 11.8946 18.7348 12 19 12H25V28C25 28.2652 25.1054 28.5196 25.2929 28.7071C25.4804 28.8946 25.7348 29 26 29C26.2652 29 26.5196 28.8946 26.7071 28.7071C26.8946 28.5196 27 28.2652 27 28V11C27.0001 10.8686 26.9743 10.7385 26.9241 10.6172C26.8739 10.4958 26.8003 10.3854 26.7075 10.2925ZM20 6.41375L23.5863 10H20V6.41375ZM18 18H16C15.7348 18 15.4804 18.1054 15.2929 18.2929C15.1054 18.4804 15 18.7348 15 19V26C15 26.2652 15.1054 26.5196 15.2929 26.7071C15.4804 26.8946 15.7348 27 16 27H18C19.1935 27 20.3381 26.5259 21.182 25.682C22.0259 24.8381 22.5 23.6935 22.5 22.5C22.5 21.3065 22.0259 20.1619 21.182 19.318C20.3381 18.4741 19.1935 18 18 18ZM18 25H17V20H18C18.663 20 19.2989 20.2634 19.7678 20.7322C20.2366 21.2011 20.5 21.837 20.5 22.5C20.5 23.163 20.2366 23.7989 19.7678 24.2678C19.2989 24.7366 18.663 25 18 25ZM13 19V26C13 26.2652 12.8946 26.5196 12.7071 26.7071C12.5196 26.8946 12.2652 27 12 27C11.7348 27 11.4804 26.8946 11.2929 26.7071C11.1054 26.5196 11 26.2652 11 26V22.1725L9.31875 24.5737C9.22652 24.7053 9.10396 24.8126 8.96144 24.8868C8.81892 24.9609 8.66064 24.9996 8.5 24.9996C8.33936 24.9996 8.18108 24.9609 8.03856 24.8868C7.89604 24.8126 7.77348 24.7053 7.68125 24.5737L6 22.1725V26C6 26.2652 5.89464 26.5196 5.70711 26.7071C5.51957 26.8946 5.26522 27 5 27C4.73478 27 4.48043 26.8946 4.29289 26.7071C4.10536 26.5196 4 26.2652 4 26V19C4.00009 18.7874 4.06791 18.5804 4.19363 18.409C4.31935 18.2376 4.49642 18.1107 4.69915 18.0467C4.90188 17.9828 5.11971 17.9851 5.32104 18.0533C5.52236 18.1216 5.6967 18.2522 5.81875 18.4263L8.5 22.2563L11.1812 18.4263C11.3033 18.2522 11.4776 18.1216 11.679 18.0533C11.8803 17.9851 12.0981 17.9828 12.3008 18.0467C12.5036 18.1107 12.6807 18.2376 12.8064 18.409C12.9321 18.5804 12.9999 18.7874 13 19Z"/></symbol>`;function xK(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function SK(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${xK(t)}</symbol>`}var CK=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1945
1945
  ${SK(gK,D)}
1946
1946
  ${SK(_K,al)}
1947
1947
  ${bK}
@@ -1999,4 +1999,4 @@ Error generating stack: `+e.message+`
1999
1999
  :host([${AK}]) [data-item-focused="true"] {
2000
2000
  --trees-focus-ring-color: transparent;
2001
2001
  }
2002
- `}\n${NW}\n${PW}`;function MK(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&hK.has(t)}function NK(e){return e===`darwin`?ms._({id:`LtSYdi`}):e===`win32`?ms._({id:`qi1F96`}):ms._({id:`e1Rn_k`})}function PK(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=NK(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`zUhPuR`,values:{hint:d}}:{id:`e1Rn_k`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=Qg(r.contentDir,OM(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(re,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(Ea,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function FK(e,t){return DM({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function IK(e,t){return e!==t&&e.startsWith(t)}function LK(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>IK(e,t))).map(e=>FK(e,t))}function RK(e,t){return e===t||e.startsWith(`${t}/`)}function zK(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function BK(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)fs(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Ro(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=gM(e);RK(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function VK(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:RK(t.createdPath,e.path)}function HK(e){let t=(0,$.c)(55),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C=DM(n,x),w=n.kind===`directory`,T=C.kind===`asset`?null:C,E=T!==null&&u!==null,D;t[0]!==S||t[1]!==w?(D=S(w?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=S,t[1]=w,t[2]=D):D=t[2];let O=D,k=f?.appearance?.sidebar?.showHiddenFiles??!1,A=d!==null,j;t[3]!==w||t[4]!==n.path?(j=w?gM(n.path):null,t[3]=w,t[4]=n.path,t[5]=j):j=t[5];let M=Va(j),N=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,P=l.getSelectedPaths(),F=P.includes(C.treePath)?LK(P,x):[],I=F.length>1?F:[C],L=I.length,R=ms._({id:`djjdjr`,values:{deleteCount:L}}),z;t[6]!==b||t[7]!==w||t[8]!==n||t[9]!==o?(z=b?null:w?i_({folderRelativePath:OM(n),workspace:o}):e_({docName:pM(n.path),workspace:o}),t[6]=b,t[7]=w,t[8]=n,t[9]=o,t[10]=z):z=t[10];let B=z,V;t[11]===r?V=t[12]:(V=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=V);let H=V,U;t[13]===r?U=t[14]:(U=()=>r.close(),t[13]=r,t[14]=U);let W=U,G;t[15]!==S||t[16]!==d?(G=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Br(t.error)),hs.error(S({id:`P47EWZ`}),{description:Br(t.error)}))},t[15]=S,t[16]=d,t[17]=G):G=t[17];let q=G,J=0,ee=0;if(w){let e=_M(n.path);for(let t of y)(t===e||t.startsWith(e))&&(J++,EG(l.getItem(t))?.isExpanded()&&ee++)}let Y=w&&ee<J,te=w&&ee>0,ne;t[18]===W?ne=t[19]:(ne=e=>{e||W()},t[18]=W,t[19]=ne);let X;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[20]=X):X=t[20];let re;t[21]!==S||t[22]!==a||t[23]!==E||t[24]!==A||t[25]!==W||t[26]!==H||t[27]!==R||t[28]!==I||t[29]!==N||t[30]!==q||t[31]!==c||t[32]!==B||t[33]!==O||t[34]!==b||t[35]!==w||t[36]!==n||t[37]!==l||t[38]!==u||t[39]!==T||t[40]!==v||t[41]!==m||t[42]!==g||t[43]!==h||t[44]!==_||t[45]!==p||t[46]!==k||t[47]!==te||t[48]!==Y||t[49]!==C||t[50]!==o?(re=(0,Z.jsx)(eo,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),p(`file`,gM(n.path))},children:[(0,Z.jsx)(nu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`HdkSiO`})]}),N?(0,Z.jsxs)(ka,{children:[(0,Z.jsxs)(so,{disabled:a,children:[(0,Z.jsx)(Ia,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ha,{children:(0,Z.jsx)(TG,{parentDir:gM(n.path),onSelectTemplate:e=>{H(),m(gM(n.path),e)},ItemComponent:Ea})})]}):null,(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),p(`folder`,gM(n.path))},children:[(0,Z.jsx)(Cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`96G6Re`})]}),(0,Z.jsx)(no,{}),(0,Z.jsx)(PK,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(JG,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(ka,{children:[(0,Z.jsxs)(so,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ha,{children:[(0,Z.jsx)(Ea,{disabled:!o,onSelect:()=>{o&&(W(),mK(Qg(o.contentDir,OM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Ea,{onSelect:()=>{W(),mK(OM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(no,{}),(0,Z.jsx)(Ka,{checked:k,onCheckedChange:q,disabled:!A,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`XcGbim`})}),Y||te?(0,Z.jsx)(no,{}):null,Y?(0,Z.jsxs)(Ea,{onSelect:()=>{W(),_(n.path)},children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,te?(0,Z.jsxs)(Ea,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,(0,Z.jsx)(no,{}),(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{C.kind!==`asset`&&(W(),h(C))},children:[(0,Z.jsx)(Pe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(oe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(Ea,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u||!T)return;W();let e=ZW(T),t=oo(u.current()),n=qa(t,e);if(n===t)return;u.patch(Xa(n));let r=T.path.split(`/`).pop()||T.path;hs.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(gt,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(Ea,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(I)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),R]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(PK,{item:n,workspace:o,onClose:W}),!b&&(0,Z.jsx)(JG,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(ka,{children:[(0,Z.jsxs)(so,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ha,{children:[(0,Z.jsx)(Ea,{disabled:!o,onSelect:()=>{o&&(W(),mK(Qg(o.contentDir,OM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Ea,{onSelect:()=>{W(),mK(OM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(no,{}),b?null:(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{W(),h(C)},children:[(0,Z.jsx)(Pe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(oe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),T?(0,Z.jsxs)(Ea,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u)return;W();let e=ZW(T),t=oo(u.current()),n=qa(t,e);if(n===t)return;u.patch(Xa(n));let r=T.path.split(`/`).pop()||T.path;hs.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(gt,{"aria-hidden":`true`}),O]}):null,(0,Z.jsxs)(Ea,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(I)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),R]})]})}),t[21]=S,t[22]=a,t[23]=E,t[24]=A,t[25]=W,t[26]=H,t[27]=R,t[28]=I,t[29]=N,t[30]=q,t[31]=c,t[32]=B,t[33]=O,t[34]=b,t[35]=w,t[36]=n,t[37]=l,t[38]=u,t[39]=T,t[40]=v,t[41]=m,t[42]=g,t[43]=h,t[44]=_,t[45]=p,t[46]=k,t[47]=te,t[48]=Y,t[49]=C,t[50]=o,t[51]=re):re=t[51];let ie;return t[52]!==ne||t[53]!==re?(ie=(0,Z.jsxs)(ao,{open:!0,modal:!1,onOpenChange:ne,children:[X,re]}),t[52]=ne,t[53]=re,t[54]=ie):ie=t[54],ie}async function UK(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:zG});if(BG(i)){let e=await UG(i);return{kind:`entries`,entries:zo(e.entries),truncated:e.truncated}}let a=await _e(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Ar.safeParse(a.body);return o.success?{kind:`entries`,entries:zo(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof VG?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function WK(e){let t=(0,$.c)(352),{ref:n}=e,{_:r,i18n:a}=i(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=mt(),{notifySidebarFileSelected:v}=hA(),{resolvedTheme:y}=Nr(),{addPage:b,pageMeta:x}=rs(),S;t[0]===x?S=t[1]:(S=function(e,t){return us(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),Yo(Vo(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=Uo(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),Yo(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=cm(),z=(0,Q.useRef)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),{conflicts:J}=Pi(),[ee,Y]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),[X,re]=(0,Q.useState)(!1),ie=(0,Q.useRef)(X),oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=new Set,t[10]=oe):oe=t[10];let se=(0,Q.useRef)(oe),ce=(0,Q.useRef)(k),le=(0,Q.useRef)(x),ue;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(ue=function(e,t){let n=t===void 0?k:t,r=fG(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,vM(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Yo(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>fs(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=ue):ue=t[16];let de=ue,fe;t[17]!==v||t[18]!==h?(fe=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??ce.current).find(t=>Ro(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),Yo(Jo(e)),v()},t[17]=v,t[18]=h,t[19]=fe):fe=t[19];let pe=fe,me=(0,Q.useRef)(o),he;t[20]===k?he=t[21]:(he=new Set(k.filter(Ro).map(_q)),t[20]=k,t[21]=he);let ge=he,ve=(0,Q.useRef)(ge),ye;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=[],t[22]=ye):ye=t[22];let be=(0,Q.useRef)(ye),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(gq),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(!1),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(null),Oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Oe={row:null,root:null},t[23]=Oe):Oe=t[23];let ke=(0,Q.useRef)(Oe),Ae=(0,Q.useRef)(hq),je=(0,Q.useRef)(null),Me;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Me=new Map,t[24]=Me):Me=t[24];let Ne=(0,Q.useRef)(Me),Pe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=new Set,t[25]=Pe):Pe=t[25];let Fe=(0,Q.useRef)(Pe),Ie;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[26]=Ie):Ie=t[26];let Le=(0,Q.useRef)(Ie),Re=(0,Q.useRef)(0),ze;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ze=new Set,t[27]=ze):ze=t[27];let Be=(0,Q.useRef)(ze),Ve=(0,Q.useRef)(mq),He=(0,Q.useRef)(pq),Ue=(0,Q.useRef)(!1),We=(0,Q.useRef)(null),Ge=(0,Q.useRef)(null),Ke=(0,Q.useRef)(fq),qe=(0,Q.useRef)(dq),Je=(0,Q.useRef)(uq),Ye=(0,Q.useRef)(lq),Xe=(0,Q.useRef)(c),[Ze,Qe]=(0,Q.useState)(!1),et;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(et=function(){z.current!==null&&(clearTimeout(z.current),z.current=null)},t[28]=et):et=t[28];let tt=et,nt;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(nt=function(){tt(),L(!1)},t[29]=nt):nt=t[29];let rt=nt,it;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(e){rt(),F(e)},t[30]=it):it=t[30];let at=it,ot;t[31]===r?ot=t[32]:(ot=function(){if(tt(),im()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,We.current?.()},OK);return}L(!1),F(r({id:`34qyH5`}))},t[31]=r,t[32]=ot);let st=ot,ct=(0,Q.useRef)(!0),lt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{if(ct.current){ct.current=!1;return}We.current?.()},t[33]=lt):lt=t[33];let ut;t[34]===R?ut=t[35]:(ut=[R],t[34]=R,t[35]=ut),(0,Q.useEffect)(lt,ut);let dt,ft;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(dt=()=>tt,ft=[],t[36]=dt,t[37]=ft):(dt=t[36],ft=t[37]),(0,Q.useEffect)(dt,ft);let pt,ht;t[38]!==k.length||t[39]!==M?(pt=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=e,n=function(){De.current!==null&&clearTimeout(De.current),De.current=setTimeout(()=>{Ee.current=!1,De.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=yq(e),n=t?.dataset.itemPath;if(!n)return;let r=_G(t.dataset.itemType===`folder`?_M(n):n,ce.current,le.current);r&&(De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!0,e.dataTransfer?.setData(WE,KE(r)))},i=function(e){if(!(e instanceof DragEvent)||!IM(e))return;let t=xq(e);if(!t){fK(ke);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),pK(ke,t)},a=function(e){if(!(e instanceof DragEvent)||!IM(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||fK(ke)},o=function(e){if(!(e instanceof DragEvent)||!IM(e))return;let t=xq(e),n=LM(e);if(!t||n.length===0){fK(ke);return}e.preventDefault(),e.stopPropagation(),fK(ke),Ae.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),fK(ke),De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!1}},ht=[k.length,M],t[38]=k.length,t[39]=M,t[40]=pt,t[41]=ht):(pt=t[40],ht=t[41]),(0,Q.useEffect)(pt,ht);let{selectedFilePath:gt,selectedFolderPath:_t,navigationPath:vt}=dG(c,m?null:o),yt=gt?fM(gt,k.find(e=>fs(e)&&e.docName===gt)?.docExt):_t?_M(_t):c?.kind===`asset`?c.assetPath:null,bt=X?null:yt,xt=O_().states,{dispatch:St}=__(),wt;t[42]!==St||t[43]!==xt?(wt={installStates:xt,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:St},t[42]=St,t[43]=xt,t[44]=wt):wt=t[44];let Tt=wt,{okignoreBinding:Et,projectLocalBinding:Dt,merged:Ot}=ae(),kt=Ot?.appearance?.sidebar?.showHiddenFiles??!1,At;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>je.current===null,t[45]=At):At=t[45];let jt=At,Mt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=[],t[46]=Mt):Mt=t[46];let Nt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Nt={set:`complete`,spriteSheet:CK,byFileExtension:{md:{name:vK,viewBox:yK},mdx:{name:vK,viewBox:yK}}},t[47]=Nt):Nt=t[47];let Pt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Pt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Pt):Pt=t[48];let Ft;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ft={canDrag:jt,canDrop:jt,onDropComplete:e=>Ye.current(e),onDropError:cq},t[49]=Ft):Ft=t[49];let It,Lt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(It={canRename:jt,onRename:e=>qe.current(e),onError:e=>Je.current(e)},Lt=e=>Ke.current(e),t[50]=It,t[51]=Lt):(It=t[50],Lt=t[51]);let Rt;t[52]===r?Rt=t[53]:(Rt={paths:Mt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...jW,icons:Nt,unsafeCSS:jK,composition:Pt,dragAndDrop:Ft,renaming:It,onSelectionChange:Lt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=ce.current.find(e=>fs(e)&&fM(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:gK,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return MK(t.path)?{icon:_K,title:r({id:`i9toLO`})}:null}let n=ce.current.find(e=>Zo(e)&&_M(e.path)===_M(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:gK,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=r,t[53]=Rt);let{model:zt}=AW(Rt),Vt;t[54]===zt?Vt=t[55]:(Vt=function(e){let t=zt.getItem(e)??zt.getItem(_M(e));return t?.isDirectory()?_M(gM(t.getPath())):e},t[54]=zt,t[55]=Vt);let Ht=Vt,Ut,Wt;t[56]===k?(Ut=t[57],Wt=t[58]):(Wt=yM(k),Ut=bM(Wt),t[56]=k,t[57]=Ut,t[58]=Wt);let Gt=Ut,Kt=(0,Q.useRef)(Wt),qt;t[59]===k?qt=t[60]:(qt=SM(k),t[59]=k,t[60]=qt);let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt=_t?CM(_M(_t)).slice(0,-1):CM(bt??vt),Zt=Xt.join(`\0`),Qt;t[61]===zt?Qt=t[62]:(Qt=()=>{let e=new Set;for(let t of Yt.current)EG(zt.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=zt,t[62]=Qt);let $t=Qt,en;t[63]===$t?en=t[64]:(en=e=>{let t=new Set(SM(e??ce.current)),n=$t();for(let e of be.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=$t,t[64]=en);let tn=en,nn;t[65]!==tn||t[66]!==zt?(nn=e=>{let t=yM(e??ce.current);zt.resetPaths(t,{initialExpandedPaths:tn(e)})},t[65]=tn,t[66]=zt,t[67]=nn):nn=t[67];let rn=nn,an;t[68]!==r||t[69]!==st?(an=async function(e){let t=Re.current,n=new AbortController;Le.current.set(e,n);let i=await UK(gM(e),n.signal,r({id:`8RtNI0`}),r({id:`HlmZBk`}));if(Le.current.get(e)===n&&Le.current.delete(e),n.signal.aborted||t!==Re.current)return;if(i.kind===`network-error`){st(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,i.cause);return}if(i.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,i.title),at(i.title);return}let a=Ue.current,o=Xo(i.entries,a);Fe.current.add(e),j(t=>GG(t,e,o,Ne.current)),F(null),rt(),i.truncated&&V(i.entries.length)},t[68]=r,t[69]=st,t[70]=an):an=t[70];let on=an,sn;t[71]!==$t||t[72]!==on?(sn=()=>{let e=$t(),t=Be.current;Be.current=e;for(let n of e){if(t.has(n)||Fe.current.has(n)||Le.current.has(n))continue;let e=gM(n);ce.current.find(t=>Zo(t)&&t.path===e)?.hasChildren!==!1&&on(n)}},t[71]=$t,t[72]=on,t[73]=sn):sn=t[73];let cn=sn,ln;t[74]!==$t||t[75]!==on?(ln=()=>{for(let e of $t())Fe.current.has(e)||Le.current.has(e)||on(e)},t[74]=$t,t[75]=on,t[76]=ln):ln=t[76];let un=ln,dn;t[77]!==zt||t[78]!==rn?(dn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>fs(e)&&e.docName===r);if(n==null||zt.getItem(i)==null)continue;let s=fM(i,t.find(e=>fs(e)&&e.docName===i)?.docExt??n.docExt);zt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=oM(e);if(t===``)continue;let n=e.slice(0,-t.length);zt.getItem(n)!=null&&(zt.getItem(e)??zt.move(n,e),o=e,a+=1)}a!==0&&(rn(t),o!=null&&zt.focusPath(o))},t[77]=zt,t[78]=rn,t[79]=dn):dn=t[79];let fn=dn,pn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(pn=e=>{Ce.current=xM(e)},t[80]=pn):pn=t[80];let mn=pn,hn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>ve.current.has(e),t[81]=hn):hn=t[81];let gn=hn,_n;t[82]!==r||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==rn?(_n=async function(e){if(e.kind===`asset`||je.current!==null)return;let t=()=>{U(null),je.current=null};je.current=e.path,U(e.path),F(null);try{let n=await _e(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){hs.error(n.title),rn(),t();return}let i=A(Kn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});hs.error(e),F(e),ss([`files`,`backlinks`,`graph`]),rn(),t();return}for(let e of i.duplicatedDocNames)b(e);j(t=>{let n=qM(t,e,i);return rn(n),mn(n),n}),ss([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?D(i.path):T(i.path)),hs.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),hs.error(r({id:`EBVbtP`}),{description:i}),rn(),t()}},t[82]=r,t[83]=b,t[84]=D,t[85]=T,t[86]=rn,t[87]=_n):_n=t[87];let vn=_n,yn=(0,Q.useRef)(vn),bn;t[88]===vn?bn=t[89]:(bn=()=>{yn.current=vn},t[88]=vn,t[89]=bn),(0,Q.useEffect)(bn);let xn=function(e){let t=lK(e);if(!t||uK(t))return!1;let n=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||gn(n))return!1;let r=uK(n);if(!r)return!1;let i=_M(t);if(!Yt.current.includes(i))return!1;let a=`${t}${r}`;return Kt.current.includes(a)?!1:(nr({sourcePath:n,destinationPath:a,isFolder:!1}),zt.move(n,a),!0)},Sn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=e=>{let t=e??xe.current;!t||xe.current!==t||(t.disposeCommitListener(),xe.current=null)},t[90]=Sn):Sn=t[90];let Cn=Sn,wn;t[91]!==r||t[92]!==Cn||t[93]!==u||t[94]!==l||t[95]!==rn?(wn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Cn(e),i&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await _e(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?hs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(U(null),rn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;hs.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(U(null),rn());return}i&&(e.kind===`file`?u(e.createdPath):l([Ct(e.createdPath)],{force:!0})),i&&j(t=>{let n=GM(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return mn(n),n}),ss([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&U(null)},t[91]=r,t[92]=Cn,t[93]=u,t[94]=l,t[95]=rn,t[96]=wn):wn=t[96];let Tn=wn,En,Dn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(En=()=>()=>{let e=xe.current;e&&Se.current(e,{restoreLocation:!1,updateUi:!1}).catch(sq)},Dn=[],t[97]=En,t[98]=Dn):(En=t[97],Dn=t[98]),(0,Q.useEffect)(En,Dn);let On;t[99]!==r||t[100]!==st?(On=()=>{let e=!0,t=null,n=RG(async function(){t?.abort();let n=new AbortController;t=n,Re.current+=1;for(let e of Le.current.values())e.abort();Le.current.clear(),Fe.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:zG});if(BG(t)){let{entries:n,truncated:r}=await UG(t);if(!e)return;let i=Ue.current,a=Xo(zo(n),i);j(e=>GG(e,``,a,Ne.current)),F(null),rt(),V(r?n.length:null),He.current()}else{let n=await _e(t,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)at(n.title),V(null);else{let e=Ar.safeParse(n.body);if(!e.success)at(r({id:`HlmZBk`})),V(null);else{let t=Ue.current,n=Xo(zo(e.data.documents),t);j(e=>GG(e,``,n,Ne.current)),F(null),rt(),V(e.data.truncated===!0?e.data.documents.length:null),He.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof VG?at(r.message):st()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());We.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=$o(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,We.current=null,n.dispose();for(let e of Le.current.values())e.abort();Le.current.clear(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},t[99]=r,t[100]=st,t[101]=On):On=t[101];let kn;t[102]===r?kn=t[103]:(kn=[r],t[102]=r,t[103]=kn),(0,Q.useEffect)(On,kn);let An=(0,Q.useRef)(!0),jn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(jn=()=>{if(An.current){An.current=!1;return}We.current?.()},t[104]=jn):jn=t[104];let Mn;t[105]===kt?Mn=t[106]:(Mn=[kt],t[105]=kt,t[106]=Mn),(0,Q.useEffect)(jn,Mn);let Nn,Fn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=A(In,n,`workspace`,null);r&&ne({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(oq),()=>{e=!1}},Fn=[],t[107]=Nn,t[108]=Fn):(Nn=t[107],Fn=t[108]),(0,Q.useEffect)(Nn,Fn);let Ln;t[109]!==tn||t[110]!==zt||t[111]!==Gt?(Ln=()=>{if(Ce.current===Gt){Ce.current=null;return}zt.resetPaths(Kt.current,{initialExpandedPaths:tn()})},t[109]=tn,t[110]=zt,t[111]=Gt,t[112]=Ln):Ln=t[112];let Rn;t[113]!==zt||t[114]!==Gt?(Rn=[zt,Gt],t[113]=zt,t[114]=Gt,t[115]=Rn):Rn=t[115],(0,Q.useEffect)(Ln,Rn),OG(zt,bt,Zt,Te,Gt);let zn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(zn=()=>{re(!1)},t[116]=zn):zn=t[116];let Bn;t[117]===yt?Bn=t[118]:(Bn=[yt],t[117]=yt,t[118]=Bn),(0,Q.useEffect)(zn,Bn);let Vn,Hn;t[119]===X?(Vn=t[120],Hn=t[121]):(Vn=()=>{ie.current=X;for(let e of se.current)e()},Hn=[X],t[119]=X,t[120]=Vn,t[121]=Hn),(0,Q.useEffect)(Vn,Hn);let Un;t[122]!==bt||t[123]!==M||t[124]!==zt?(Un=()=>{M||!bt||lG(zt)},t[122]=bt,t[123]=M,t[124]=zt,t[125]=Un):Un=t[125];let Wn;t[126]!==Zt||t[127]!==bt||t[128]!==M||t[129]!==zt||t[130]!==Gt?(Wn=[bt,Zt,Gt,M,zt],t[126]=Zt,t[127]=bt,t[128]=M,t[129]=zt,t[130]=Gt,t[131]=Wn):Wn=t[131],(0,Q.useEffect)(Un,Wn);let Gn,qn;t[132]===zt?(Gn=t[133],qn=t[134]):(Gn=()=>zt.subscribe(()=>{if(!zt.isSearchOpen())for(let e of be.current){let t=EG(zt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),qn=[zt],t[132]=zt,t[133]=Gn,t[134]=qn),(0,Q.useEffect)(Gn,qn);let Jn,Yn;t[135]===zt?(Jn=t[136],Yn=t[137]):(Jn=()=>zt.subscribe(()=>Ve.current()),Yn=[zt],t[135]=zt,t[136]=Jn,t[137]=Yn),(0,Q.useEffect)(Jn,Yn);let Xn,Qn;t[138]===zt?(Xn=t[139],Qn=t[140]):(Xn=()=>zt.onMutation(`remove`,e=>{let t=xe.current;!t||e.path!==t.renamePath||Se.current(t)}),Qn=[zt],t[138]=zt,t[139]=Xn,t[140]=Qn),(0,Q.useEffect)(Xn,Qn);let $n;t[141]!==b||t[142]!==d||t[143]!==f||t[144]!==pe||t[145]!==D||t[146]!==T||t[147]!==p||t[148]!==fn||t[149]!==_?($n=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??me.current,l=new Map,u=new Map;for(let e of ce.current){if(fs(e)){let t=o.find(t=>t.fromPath===fM(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Ro(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&cM(t)&&u.set(e.path,pM(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(Xe.current?.kind===`folder`?Xe.current.folderPath:null),g=h?$e(h,a):null,v=r?.assetPath??(Xe.current?.kind===`asset`?Xe.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??JM(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??$e(v,a):null);Bt(e);let C=[...YM(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;j(t=>{let n=WM(t,e,a,o,s);return w=n,fn(t,n,e,o),mn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),dK(x)):S&&(m||S!==v)&&pe(S,w??ce.current),ss([`files`,`backlinks`,`graph`])},t[141]=b,t[142]=d,t[143]=f,t[144]=pe,t[145]=D,t[146]=T,t[147]=p,t[148]=fn,t[149]=_,t[150]=$n):$n=t[150];let er=$n;async function nr(e){let t=!e.isFolder&&gn(e.sourcePath),n=t?e.sourcePath:kM(e.sourcePath,e.isFolder);U(n),F(null);try{let i=lM(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!cM(i.destinationPath),o=t||a?i.destinationPath:kM(i.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:gM(n),toPath:gM(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:pM(n),toPath:o},c={docName:me.current,folderPath:Xe.current?.kind===`folder`?Xe.current.folderPath:null,assetPath:Xe.current?.kind===`asset`?Xe.current.assetPath:null},l=await _e(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`gijbne`}));if(!l.ok){hs.error(l.title),rn();let e=xe.current;e&&e.renamePath===n?await Tn(e):Cn(),U(null);return}let u=A(Zr,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await er(u.renamed,e.isFolder?[{fromPath:gM(n),toPath:gM(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=oM(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),hs.error(r({id:`dDpCOp`}))}Cn(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});hs.error(t),F(t),rn();let i=xe.current;i&&i.renamePath===n?await Tn(i):Cn(),U(null)}}let rr;t[151]!==r||t[152]!==er||t[153]!==rn?(rr=async function(e){let t=e.draggedPaths.map(t=>{let n=MM(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(aq);if(t.length!==0){U(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],i=[],a={docName:me.current,folderPath:Xe.current?.kind===`folder`?Xe.current.folderPath:null,assetPath:Xe.current?.kind===`asset`?Xe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&gn(a.sourcePath),s=t?{kind:`folder`,fromPath:gM(a.sourcePath),toPath:gM(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:pM(a.sourcePath),toPath:pM(a.destinationTreePath)},c=await _e(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){hs.error(c.title),rn(),U(null);return}let l=A(Zr,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:gM(a.sourcePath),toPath:gM(a.destinationTreePath)})}try{await er(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),hs.error(r({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),hs.error(r({id:`HIb0vl`})),rn(),U(null)}}},t[151]=r,t[152]=er,t[153]=rn,t[154]=rr):rr=t[154];let ir=rr,ar;t[155]!==r||t[156]!==b||t[157]!==rn?(ar=async function(e,t,n){if(e.length===0||je.current!==null)return;let i=()=>{je.current=null,U(null)};je.current=n,U(n),F(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),e.append(`parentDocName`,PM(t,n.name||`upload`));try{let i=await _e(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){s+=1,hs.error(i.title,{description:n.name});continue}let c=A(tr,i.body,`upload:drop`,null);if(c===null){s+=1,hs.error(r({id:`4Gz2wC`}),{description:n.name});continue}let l=FM(t,c);if(c.deduped===!0){s+=1,hs.error(r({id:`4sKwf6`}),{description:l});continue}o+=1;let u=RM(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),hs.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)fs(e)&&b(e.docName);j(e=>{let t=new Set(e.map(mM)),n=!1,r=[...e];for(let e of a){let i=mM(e);Ne.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(rn(r),mn(r),r):e})}o>0&&(ss([`files`,`backlinks`,`graph`]),We.current?.(),hs.success(ms._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||r({id:`RSqaSd`})})),s>0&&F(o>0?ms._({id:`yH7T4q`,values:{failedCount:s}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),hs.error(n),F(n),i()}},t[155]=r,t[156]=b,t[157]=rn,t[158]=ar):ar=t[158];let or=ar,sr;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(sr=function(e){Y({parentDir:e})},t[159]=sr):sr=t[159];let cr=sr,lr;t[160]!==r||t[161]!==b||t[162]!==Tn||t[163]!==Cn||t[164]!==zt||t[165]!==D||t[166]!==T||t[167]!==rn||t[168]!==Wt?(lr=async function(e,t,n){if(je.current)return;let i=xe.current;i&&Cn(i);try{let i=AM(e,t,[...Wt,...Yt.current]);U(i.renamePath),je.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=jM(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await _e(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){hs.error(a.title),U(null),je.current=null;return}let s=pM(e),c=A($r,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),j(e=>{if(e.some(e=>fs(e)&&e.docName===c))return e;let t=[...e,l];return mn(t),Ne.current.set(mM(l),Date.now()),t}),ss([`files`,`backlinks`,`graph`]),T(c)}else{let e=gM(i.addPath),t=await _e(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){hs.error(t.title),U(null),je.current=null;return}o=A(Pn,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};j(e=>{if(e.some(e=>Zo(e)&&e.path===o))return e;let t=[...e,n];return mn(t),Ne.current.set(mM(n),Date.now()),t}),ss([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=xe.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Cn(t))};document.addEventListener(`keydown`,c,!0),xe.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},U(null),je.current=null,zt.add(i.addPath),zt.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),hs.error(r({id:`S6l5dv`}));let t=xe.current;t?await Tn(t):Cn(),U(null),je.current=null,rn()}},t[160]=r,t[161]=b,t[162]=Tn,t[163]=Cn,t[164]=zt,t[165]=D,t[166]=T,t[167]=rn,t[168]=Wt,t[169]=lr):lr=t[169];let ur=lr,dr;t[170]===zt?dr=t[171]:(dr=function(e){let t=_M(e);(0,Q.startTransition)(()=>{for(let e of Yt.current)if(e===t||e.startsWith(t)){let t=EG(zt.getItem(e));t&&t.expand()}})},t[170]=zt,t[171]=dr);let fr=dr,pr;t[172]===zt?pr=t[173]:(pr=function(e){let t=_M(e),n=new Set(be.current);(0,Q.startTransition)(()=>{for(let e of[...Yt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=EG(zt.getItem(e));t&&t.collapse()}})},t[172]=zt,t[173]=pr);let mr=pr,hr;t[174]!==de||t[175]!==Xt||t[176]!==o||t[177]!==c||t[178]!==ge||t[179]!==H||t[180]!==Tn||t[181]!==cn||t[182]!==k||t[183]!==Jt||t[184]!==ir||t[185]!==nr||t[186]!==Ht||t[187]!==x||t[188]!==xn||t[189]!==un||t[190]!==kt||t[191]!==Wt||t[192]!==or?(hr=()=>{ce.current=k,le.current=x,me.current=o,Xe.current=c,ve.current=ge,je.current=H,Ue.current=kt,Kt.current=Wt,Yt.current=Jt,be.current=Xt,Ve.current=cn,He.current=un,Se.current=Tn,Ae.current=(e,t,n)=>{or(e,t,n)},Ke.current=e=>{if(Te.current||Ee.current||e.length!==1)return;let t=e[0];t&&(re(!1),de(Ht(t),k))},Je.current=e=>{xn(e)||hs.error(e)},qe.current=nr,Ye.current=ir},t[174]=de,t[175]=Xt,t[176]=o,t[177]=c,t[178]=ge,t[179]=H,t[180]=Tn,t[181]=cn,t[182]=k,t[183]=Jt,t[184]=ir,t[185]=nr,t[186]=Ht,t[187]=x,t[188]=xn,t[189]=un,t[190]=kt,t[191]=Wt,t[192]=or,t[193]=hr):hr=t[193],(0,Q.useLayoutEffect)(hr);let gr,_r;t[194]===zt?(gr=t[195],_r=t[196]):(gr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||zK(e.target))return;let a=Ge.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!t)return;let n=zt.getItem(t)??zt.getItem(_M(t)),r=n?.isDirectory()?_M(gM(n.getPath())):t;if(ve.current.has(r))return;yn.current(FK(r,ce.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Yt.current,...Kt.current]);Te.current=!0;for(let e of u)e&&zt.getItem(e)?.select();queueMicrotask(()=>{Te.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},_r=[zt],t[194]=zt,t[195]=gr,t[196]=_r),(0,Q.useEffect)(gr,_r);let vr,yr;t[197]!==k.length||t[198]!==M?(vr=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=iq,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},yr=[M,k.length],t[197]=k.length,t[198]=M,t[199]=vr,t[200]=yr):(vr=t[199],yr=t[200]),(0,Q.useEffect)(vr,yr);let br,xr;t[201]!==k.length||t[202]!==M?(br=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=()=>BW(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},xr=[M,k.length],t[201]=k.length,t[202]=M,t[203]=br,t[204]=xr):(br=t[203],xr=t[204]),(0,Q.useEffect)(br,xr);let Sr,Cr;t[205]!==k.length||t[206]!==M?(Sr=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=()=>iG(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Cr=[M,k.length],t[205]=k.length,t[206]=M,t[207]=Sr,t[208]=Cr):(Sr=t[207],Cr=t[208]),(0,Q.useEffect)(Sr,Cr);let wr;t[209]===Symbol.for(`react.memo_cache_sentinel`)?(wr={folderCount:0,expandedCount:0},t[209]=wr):wr=t[209];let Tr=(0,Q.useRef)(wr),Er=(0,Q.useRef)(ur),Dr=(0,Q.useRef)(cr),Or;t[210]===ur?Or=t[211]:(Or=()=>{Er.current=ur,Dr.current=cr},t[210]=ur,t[211]=Or),(0,Q.useEffect)(Or);let kr,Mr;t[212]===zt?(kr=t[213],Mr=t[214]):(kr=()=>({startCreating(e,t){Er.current(e,t)},startCreatingFromTemplate(e){Dr.current(e)},createFromTemplate(e,t){Er.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Yt.current){let t=EG(zt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(be.current);(0,Q.startTransition)(()=>{for(let t of[...Yt.current].reverse()){if(e.has(t))continue;let n=EG(zt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Yt.current,t=0;for(let n of e)EG(zt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Tr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Tr.current=i,i},isCreationTargetCleared(){return ie.current},subscribe(e){se.current.add(e);let t=zt.subscribe(e);return()=>{se.current.delete(e),t()}}}),Mr=[zt],t[212]=zt,t[213]=kr,t[214]=Mr),(0,Q.useImperativeHandle)(n,kr,Mr);let Pr;t[215]!==Cn||t[216]!==d||t[217]!==l||t[218]!==zt?(Pr=async function(e,t,n){let r=BK(e,ce.current,Yt.current),i=xe.current;i&&e.some(e=>VK(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Cn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(rq).map(nq)]);l([...[...a].map(tq),...[...o].map(eq),...[...s].map($K)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?_M(t.path):t.kind===`asset`?t.path:fM(t.path,t.docExt);zt.getItem(e)&&zt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}j(e=>{let t=GM(e,[...a],void 0,[...s]);for(let e of o)t=GM(t,[],e);return mn(t),t}),ss([`files`,`backlinks`,`graph`])},t[215]=Cn,t[216]=d,t[217]=l,t[218]=zt,t[219]=Pr):Pr=t[219];let Fr=Pr,Ir;t[220]!==r||t[221]!==Fr?(Ir=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;U(a.path);let o=await _e(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Fr(i,t,n),hs.error(o.title),!1;let s=A(Zn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Fr(i,t,n),!0},t[220]=r,t[221]=Fr,t[222]=Ir):Ir=t[222];let Lr=Ir,Rr;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(Rr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=XM(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:yG(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[223]=Rr):Rr=t[223];let zr=Rr,Br;t[224]===r?Br=t[225]:(Br=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await _e(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=A(ti,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;hs.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[224]=r,t[225]=Br);let Vr=Br,Hr;t[226]!==r||t[227]!==J||t[228]!==Fr||t[229]!==Lr||t[230]!==Vr||t[231]!==rn||t[232]!==te?(Hr=async function(e){let t=e.map(e=>KM(e,ce.current)),n=t[0];if(!n)return;let i=J.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(QK),t=i.length>e.length?`, +${i.length-e.length} more`:``;hs.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&te){let{trashed:e,failed:n}=await zr(t,a,te);if(e.length>0){let t=await Vr(e);t?await Fr(e,t.deletedDocNames,t.deletedFolderPaths):await Fr(e,e.filter(ZK).map(XK),e.filter(YK).map(JK))}n.length>0&&q({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Lr(t);U(null),e||rn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),hs.error(r({id:`0eHrMb`}),{description:n}),U(null),rn()}},t[226]=r,t[227]=J,t[228]=Fr,t[229]=Lr,t[230]=Vr,t[231]=rn,t[232]=te,t[233]=Hr):Hr=t[233];let Ur=Hr,Wr;t[234]!==r||t[235]!==Lr||t[236]!==rn||t[237]!==K?(Wr=async function(){if(!K)return;let e=new Set(K.failed.map(qK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(q(null),t.length!==0){U(t[0]?.path??null);try{let e=await Lr(t);U(null),e||rn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),hs.error(r({id:`0eHrMb`}),{description:n}),U(null),rn()}}},t[234]=r,t[235]=Lr,t[236]=rn,t[237]=K,t[238]=Wr):Wr=t[238];let Gr=Wr,Kr;t[239]!==Ur||t[240]!==K?(Kr=async function(){if(!K)return;let e=new Set(K.failed.map(KK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));q(null),await Ur(t)},t[239]=Ur,t[240]=K,t[241]=Kr):Kr=t[241];let qr=Kr,Jr=(0,Q.useRef)(Ur),Yr;t[242]===Ur?Yr=t[243]:(Yr=()=>{Jr.current=Ur},t[242]=Ur,t[243]=Yr),(0,Q.useEffect)(Yr);let Xr,Qr;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(Xr=()=>NG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>fs(e)&&e.docName===t);Jr.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Jr.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Jr.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),Qr=[],t[244]=Xr,t[245]=Qr):(Xr=t[244],Qr=t[245]),(0,Q.useEffect)(Xr,Qr);let ei,ni;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(ei=()=>LG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>fs(e)&&e.docName===t);yn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){yn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),ni=[],t[246]=ei,t[247]=ni):(ei=t[246],ni=t[247]),(0,Q.useEffect)(ei,ni);let ri,ii;t[248]===zt?(ri=t[249],ii=t[250]):(ri=()=>FG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=fM(t,ce.current.find(e=>fs(e)&&e.docName===t)?.docExt);zt.startRenaming(n);return}if(e.kind===`folder`){zt.startRenaming(e.folderPath);return}if(e.kind===`asset`){zt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),ii=[zt],t[248]=zt,t[249]=ri,t[250]=ii),(0,Q.useEffect)(ri,ii);let ai;t[251]===Symbol.for(`react.memo_cache_sentinel`)?(ai=function(){let e=we.current;e&&sK(e),we.current=null},t[251]=ai):ai=t[251];let si=ai,li;t[252]===g?li=t[253]:(li=function(e){let t=vq(e.nativeEvent);if(!t||t.endsWith(`/`)){si();return}let n=pM(t),r=ce.current.find(e=>mM(e)===t);if(r&&Ro(r)){si();return}if(r&&fs(r)&&jr(r.size)){si();return}we.current!==n&&(si(),we.current=n,oK(n,e=>g(e)))},t[252]=g,t[253]=li);let ui=li,di;t[254]!==de||t[255]!==zt||t[256]!==D?(di=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=yq(e.nativeEvent);if(!t){Sq(e.nativeEvent)&&re(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?_M(n):n;if(zt.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=gM(r);if(window.location.hash===Uo(e))return;queueMicrotask(()=>D(e));return}let i=pM(r);window.location.hash!==Vo(i)&&queueMicrotask(()=>de(r))},t[254]=de,t[255]=zt,t[256]=D,t[257]=di):di=t[257];let fi=di,pi;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(pi=function(e){IM(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,Qe(!0))},t[258]=pi):pi=t[258];let mi=pi,hi;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(hi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||Qe(!1)},t[259]=hi):hi=t[259];let gi=hi,_i;t[260]===or?_i=t[261]:(_i=function(e){if(!IM(e.nativeEvent))return;let t=LM(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),Qe(!1),or(t,``,DK))},t[260]=or,t[261]=_i);let vi=_i;if(M){let e;return t[262]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wq,{}),t[262]=e):e=t[262],e}let yi;t[263]!==r||t[264]!==I||t[265]!==R?(yi=I?r(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[263]=r,t[264]=I,t[265]=R,t[266]=yi):yi=t[266];let bi=yi;if(k.length===0){if(bi!==null){let e;return t[267]===bi?e=t[268]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:bi})}),t[267]=bi,t[268]=e),e}if(P){let e;return t[269]===P?e=t[270]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:P})}),t[269]=P,t[270]=e),e}let e;t[271]===r?e=t[272]:(e=r({id:`5ZB7XC`}),t[271]=r,t[272]=e);let n=Ze&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[273]===n?i=t[274]:(i=oi(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[273]=n,t[274]=i);let a;t[275]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[275]=a):a=t[275];let o;t[276]===ur?o=t[277]:(o=()=>ur(`file`,``),t[276]=ur,t[277]=o);let c;t[278]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`6ibbCg`}),t[278]=c):c=t[278];let l;t[279]===o?l=t[280]:(l=(0,Z.jsx)(ci,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:c}),t[279]=o,t[280]=l);let u;return t[281]!==vi||t[282]!==e||t[283]!==i||t[284]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:mi,onDragLeave:gi,onDrop:vi,children:[a,l]}),t[281]=vi,t[282]=e,t[283]=i,t[284]=l,t[285]=u):u=t[285],u}let xi=H!==null,Si=W?.targets[0]??null,Ci=null;if(B!==null){let e;if(t[286]!==a.locale||t[287]!==B){let n=new Intl.NumberFormat(a.locale).format(B);e=ms._({id:`LuoJWu`,values:{truncatedShownCount:B,formattedCount:n}}),t[286]=a.locale,t[287]=B,t[288]=e}else e=t[288];Ci=e}let wi;t[289]!==P||t[290]!==bi||t[291]!==Ci?(wi=(P||bi!==null||Ci!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[bi===null?P&&(0,Z.jsx)(Eq,{kind:`error`,children:P}):(0,Z.jsx)(Eq,{kind:`reconnecting`,children:bi}),Ci!==null&&(0,Z.jsx)(Eq,{kind:`info`,children:Ci})]}),t[289]=P,t[290]=bi,t[291]=Ci,t[292]=wi):wi=t[292];let Ti;t[293]===y?Ti=t[294]:(Ti=FW(y),t[293]=y,t[294]=Ti);let Ei=X?``:void 0,Di;t[295]===Ei?Di=t[296]:(Di={[AK]:Ei},t[295]=Ei,t[296]=Di);let Oi;t[297]!==xi||t[298]!==ge||t[299]!==mr||t[300]!==k||t[301]!==fr||t[302]!==Jt||t[303]!==vn||t[304]!==Tt||t[305]!==Ot||t[306]!==zt||t[307]!==Et||t[308]!==Dt||t[309]!==ur||t[310]!==te?(Oi=(e,t)=>(0,Z.jsx)(HK,{item:e,context:t,anyActionBusy:xi,workspace:te,handoff:Tt,model:zt,okignoreBinding:Et,projectLocalBinding:Dt,mergedConfig:Ot,onStartCreating:ur,onCreateFromTemplate:(e,t)=>ur(`file`,e,{template:t}),onDuplicate:vn,onDelete:e=>G({targets:e}),onExpandSubtree:fr,onCollapseSubtree:mr,folderTreePaths:Jt,isAsset:ge.has(e.path),documents:k}),t[297]=xi,t[298]=ge,t[299]=mr,t[300]=k,t[301]=fr,t[302]=Jt,t[303]=vn,t[304]=Tt,t[305]=Ot,t[306]=zt,t[307]=Et,t[308]=Dt,t[309]=ur,t[310]=te,t[311]=Oi):Oi=t[311];let ki;t[312]!==fi||t[313]!==ui||t[314]!==zt||t[315]!==wi||t[316]!==Ti||t[317]!==Di||t[318]!==Oi?(ki=(0,Z.jsx)(`div`,{ref:Ge,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(kW,{header:wi,model:zt,style:Ti,...Di,onClickCapture:fi,onMouseMove:ui,onMouseLeave:si,renderContextMenu:Oi})}),t[312]=fi,t[313]=ui,t[314]=zt,t[315]=wi,t[316]=Ti,t[317]=Di,t[318]=Oi,t[319]=ki):ki=t[319];let Ai=!!W,ji;t[320]===H?ji=t[321]:(ji=e=>{!e&&!H&&G(null)},t[320]=H,t[321]=ji);let Mi;t[322]!==r||t[323]!==H||t[324]!==W||t[325]!==Ur||t[326]!==Si?(Mi=W&&Si&&(0,Z.jsx)(Ra,{...(()=>{let e=hG(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(GK)}):null};let t=W.targets.length,n=Si.name;return{itemName:t===1?Si.kind===`folder`?`${Si.name}/`:Si.kind===`file`?`${Si.name}${Si.docExt??`.md`}`:Si.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):Si.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>Ur(W.targets)}),t[322]=r,t[323]=H,t[324]=W,t[325]=Ur,t[326]=Si,t[327]=Mi):Mi=t[327];let Ni;t[328]!==Ai||t[329]!==ji||t[330]!==Mi?(Ni=(0,Z.jsx)(Oo,{open:Ai,onOpenChange:ji,children:Mi}),t[328]=Ai,t[329]=ji,t[330]=Mi,t[331]=Ni):Ni=t[331];let Fi=!!K,Ii;t[332]===H?Ii=t[333]:(Ii=e=>{!e&&!H&&q(null)},t[332]=H,t[333]=Ii);let Li;t[334]!==H||t[335]!==Gr||t[336]!==qr||t[337]!==K?(Li=K&&(0,Z.jsx)(CG,{failedTargets:K.failed,isSubmitting:H!==null,onDeletePermanently:Gr,onRetry:qr,onCancel:()=>q(null)}),t[334]=H,t[335]=Gr,t[336]=qr,t[337]=K,t[338]=Li):Li=t[338];let Ri;t[339]!==Fi||t[340]!==Ii||t[341]!==Li?(Ri=(0,Z.jsx)(Oo,{open:Fi,onOpenChange:Ii,children:Li}),t[339]=Fi,t[340]=Ii,t[341]=Li,t[342]=Ri):Ri=t[342];let zi=ee!==null,Bi;t[343]===Symbol.for(`react.memo_cache_sentinel`)?(Bi=e=>{e||Y(null)},t[343]=Bi):Bi=t[343];let Vi=ee?.parentDir??``,Hi;t[344]!==zi||t[345]!==Vi?(Hi=(0,Z.jsx)(zh,{open:zi,onOpenChange:Bi,kind:`file`,initialDir:Vi,defaultToTemplate:!0}),t[344]=zi,t[345]=Vi,t[346]=Hi):Hi=t[346];let Ui;return t[347]!==ki||t[348]!==Ni||t[349]!==Ri||t[350]!==Hi?(Ui=(0,Z.jsxs)(Z.Fragment,{children:[ki,Ni,Ri,Hi]}),t[347]=ki,t[348]=Ni,t[349]=Ri,t[350]=Hi,t[351]=Ui):Ui=t[351],Ui}function GK(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:gG(e)},`${e.kind}:${e.path}`)}function KK(e){return`${e.kind}:${e.path}`}function qK(e){return`${e.kind}:${e.path}`}function JK(e){return e.path}function YK(e){return e.kind===`folder`}function XK(e){return e.path}function ZK(e){return e.kind===`file`}function QK(e){return e.file}function $K(e){return Lt(e)}function eq(e){return Ct(e)}function tq(e){return He(e)}function nq(e){return e.path}function rq(e){return e.kind===`asset`}function iq(e){return e.endsWith(`/`)?e.slice(0,-1):e}function aq(e){return!!e}function oq(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function sq(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function cq(e){hs.error(e)}function lq(){}function uq(e){return hs.error(e)}function dq(){}function fq(){}function pq(){}function mq(){}function hq(){}async function gq(){}function _q(e){return mM(e)}function vq(e){return yq(e)?.dataset.itemPath??null}function yq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function bq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function xq(e){let t=yq(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=NM(e,n);return{parentDir:r,row:t,root:null,busyPath:n?_M(r):e}}return Sq(e)?{parentDir:``,row:null,root:bq(e),busyPath:DK}:null}function Sq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var Cq=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function wq(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=Cq.map(Tq),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function Tq(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Di,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Di,{className:`h-3 ${e}`})]},t)}function Eq(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?Lo:n===`reconnecting`?Ga:Ao,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=oi(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=oi(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Dq(e){return e?ms._({id:`wTcjov`}):null}function Oq(e){let t=(0,$.c)(23),{_:n}=i(),r=mg(),a=qx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Dq(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=_g.filter(r),_=i.length>0,v=a!==null;if(!_&&!v){g=null;break bb0}f=aN,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(cN,{children:[(0,Z.jsx)(yi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[14]=h):h=t[14],d=lN,p=_?(0,Z.jsxs)(iN,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(dN,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(sN,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Wx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,m=v?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(fN,{}):null,(0,Z.jsxs)(iN,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(dN,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(sN,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`empty-space-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null}t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[15]!==d||t[16]!==p||t[17]!==m?(_=(0,Z.jsxs)(d,{children:[p,m]}),t[15]=d,t[16]=p,t[17]=m,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==h||t[21]!==_?(v=(0,Z.jsxs)(f,{children:[h,_]}),t[19]=f,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}var kq=(e,t,n)=>yu(e,t,n,`ProjectSwitcher`);function Aq(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=FA(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return kq(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),kq(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),kq(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let E=w,D;t[17]!==r||t[18]!==n.navigator?(D=()=>{u(!1),kq(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=D):D=t[19];let O=D,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(!1),m(!0)},t[20]=k):k=t[20];let A=k,j=n.config.projectPath,M,N,P,F,I,L,z,B,H,U,W;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=ao,z=l,B=y,H=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=oi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let E;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(cl,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=E):E=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(U=(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsxs)(kA,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,E]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=U):U=t[63],M=eo,W=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(Ya,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YC,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(ew,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:jq,"data-testid":`project-switcher-search`}),(0,Z.jsx)(ZC,{children:(0,Z.jsx)(T,{"aria-hidden":`true`})})]}),(0,Z.jsx)(no,{}),c.length===0?(0,Z.jsx)(Ya,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(Ea,{disabled:e.missing,onSelect:()=>C(e.path),className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=z,t[37]=B,t[38]=H,t[39]=U,t[40]=W}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],z=t[36],B=t[37],H=t[38],U=t[39],W=t[40];let G;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(no,{}),t[64]=G):G=t[64];let K,q;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(re,{"aria-hidden":`true`,className:`text-muted-foreground`}),q=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=K,t[66]=q):(K=t[65],q=t[66]);let J;t[67]===E?J=t[68]:(J=(0,Z.jsxs)(Ea,{onSelect:E,"data-testid":`project-switcher-open-folder`,children:[K,q]}),t[67]=E,t[68]=J);let ee,Y;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(R,{"aria-hidden":`true`,className:`text-muted-foreground`}),Y=(0,Z.jsx)(s,{id:`xaDWAI`}),t[69]=ee,t[70]=Y):(ee=t[69],Y=t[70]);let te;t[71]===O?te=t[72]:(te=(0,Z.jsxs)(Ea,{onSelect:O,"data-testid":`project-switcher-switch-project`,children:[ee,Y]}),t[71]=O,t[72]=te);let ne;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsxs)(Ea,{onSelect:A,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=ne):ne=t[73];let X;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==J||t[80]!==te||t[81]!==W?(X=(0,Z.jsxs)(M,{align:W,side:P,className:F,"data-testid":I,children:[L,G,J,te,ne]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=J,t[80]=te,t[81]=W,t[82]=X):X=t[82];let ie;t[83]!==N||t[84]!==z||t[85]!==B||t[86]!==H||t[87]!==U||t[88]!==X?(ie=(0,Z.jsxs)(N,{open:z,onOpenChange:B,modal:H,children:[U,X]}),t[83]=N,t[84]=z,t[85]=B,t[86]=H,t[87]=U,t[88]=X,t[89]=ie):ie=t[89];let ae;t[90]!==n||t[91]!==p?(ae=(0,Z.jsx)(hf,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=ae):ae=t[92];let oe;return t[93]!==ie||t[94]!==ae?(oe=(0,Z.jsxs)(Z.Fragment,{children:[ie,ae]}),t[93]=ie,t[94]=ae,t[95]=oe):oe=t[95],oe}function jq(e){return e.stopPropagation()}function Mq(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Fn(`sidebarSearchPill`)}function Nq(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=oi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(T,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Jt,{className:`text-foreground/70`,children:tc(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(ci,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function Pq(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function Fq(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function Iq(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Hm,Vm,Vm),n;e[0]===t?n=e[1]:(n=Fq(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),Bm(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(Pq,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function Lq(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Qg(n.contentDir,$g(t),n.pathSeparator):e?.kind===`folder`?Qg(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Qg(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function Rq(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?$g(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function zq(e,t,n){return e===null?t_({workspace:n}):e.kind===`folder`?n?i_({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?e_({docName:t,workspace:n}):null}var Bq={folderCount:0,expandedCount:0},Vq=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function Hq(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(Vq)!==null}function Uq(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Wt,{name:`file-sidebar`,children:(0,Z.jsx)(Gq,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var Wq=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Ns,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Is,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function Gq(e){let t=(0,$.c)(178),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=mt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:ps(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=hA(),v=mg(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(Bq),C,w;t[3]===a?(C=t[4],w=t[5]):(C=()=>{if(a===null)return;let e=()=>{S(a.getFolderState()),p(a.isCreationTargetCleared())};return e(),a.subscribe(e)},w=[a],t[3]=a,t[4]=C,t[5]=w),(0,Q.useEffect)(C,w);let T,E;t[6]===a?(T=t[7],E=t[8]):(T=()=>{if(a!==null)return IS(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},E=[a],t[6]=a,t[7]=T,t[8]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=Va(``),j=Va(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=Oa(),L=O_().states,{dispatch:R}=__(),z;t[9]===I?z=t[10]:(z=t_({workspace:I}),t[9]=I,t[10]=z);let B=z,{projectLocalBinding:V,merged:H}=ae(),U=H?.appearance?.sidebar?.showHiddenFiles??!1,W=D&&!O,G=D&&!k,K=W||G,q=qq,J;t[11]!==a||t[12]!==I?(J=()=>{I&&a?.startCreating(`file`,``)},t[11]=a,t[12]=I,t[13]=J):J=t[13];let ee=J,Y;t[14]!==a||t[15]!==I?(Y=e=>{I&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=I,t[16]=Y):Y=t[16];let te=Y,ne;t[17]!==a||t[18]!==I?(ne=()=>{I&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=I,t[19]=ne):ne=t[19];let X=ne,ie;t[20]===I?ie=t[21]:(ie=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[20]=I,t[21]=ie);let oe=ie,se;t[22]!==r||t[23]!==I?(se=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),hs.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))}},t[22]=r,t[23]=I,t[24]=se):se=t[24];let le=se,ue;t[25]!==r||t[26]!==V?(ue=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Br(t.error)),hs.error(r({id:`P47EWZ`}),{description:Br(t.error)}))},t[25]=r,t[26]=V,t[27]=ue):ue=t[27];let de=ue,fe;t[28]===a?fe=t[29]:(fe=()=>{a?.expandAll()},t[28]=a,t[29]=fe);let pe=fe,me;t[30]===a?me=t[31]:(me=()=>{a?.collapseAll()},t[30]=a,t[31]=me);let he=me,ge,_e;t[32]!==G||t[33]!==W||t[34]!==U||t[35]!==g?(ge=()=>{F&&F.editor.notifyViewMenuStateChanged({showHiddenFiles:U,canExpandAll:W,canCollapseAll:G,sidebarVisible:g===`expanded`})},_e=[F,U,W,G,g],t[32]=G,t[33]=W,t[34]=U,t[35]=g,t[36]=ge,t[37]=_e):(ge=t[36],_e=t[37]),(0,Q.useEffect)(ge,_e);let ve,ye;t[38]!==r||t[39]!==c||t[40]!==l||t[41]!==R||t[42]!==L||t[43]!==m||t[44]!==V||t[45]!==U||t[46]!==_||t[47]!==a||t[48]!==I?(ve=()=>{if(F)return F.onMenuAction(e=>{switch(e){case`new-doc`:if(!I||!a)return;a.startCreating(`file`,m);return;case`new-folder`:if(!I||!a)return;a.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!a)return;a.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;PG(l);return;case`duplicate`:if(!l)return;IG(l);return;case`move-to-trash`:if(!l)return;MG(l);return;case`reveal-in-finder`:{if(!F||!I)return;let e=Lq(l,c,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=_g.filter(e=>L[e.id]?.installed===!0);if(e.length===0){hs.error(r({id:`LKOLNn`}));return}let t=zq(l,c,I);if(!t)return;let[n]=e;if(!n)return;R(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=Lq(l,c,I);navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=Rq(l,c);if(e===``){hs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showHiddenFiles:!U}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Br(e.error)),hs.error(r({id:`P47EWZ`}),{description:Br(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:_();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},ye=[F,a,I,l,c,m,V,U,L,R,_,r],t[38]=r,t[39]=c,t[40]=l,t[41]=R,t[42]=L,t[43]=m,t[44]=V,t[45]=U,t[46]=_,t[47]=a,t[48]=I,t[49]=ve,t[50]=ye):(ve=t[49],ye=t[50]),(0,Q.useEffect)(ve,ye);let be=h&&y&&`motion-safe:delay-100`,xe=b&&`opacity-0`,Se;t[51]!==be||t[52]!==xe?(Se=oi(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,be,xe,h&&`[-webkit-app-region:drag]`),t[51]=be,t[52]=xe,t[53]=Se):Se=t[53];let Ce;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[54]=Ce):Ce=t[54];let we;t[55]===y?we=t[56]:(we=y&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[55]=y,t[56]=we);let Te;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Te=oi(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[57]=Te):Te=t[57];let Ee;t[58]!==r||t[59]!==O||t[60]!==D||t[61]!==k||t[62]!==a?(Ee=D?(0,Z.jsxs)(ao,{children:[(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsx)(Wq,{icon:Ml,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(eo,{align:`end`,children:[O?null:(0,Z.jsxs)(Ea,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}),k?null:(0,Z.jsxs)(Ea,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]})]})]}):null,t[58]=r,t[59]=O,t[60]=D,t[61]=k,t[62]=a,t[63]=Ee):Ee=t[63];let De;t[64]===r?De=t[65]:(De=r({id:`HdkSiO`}),t[64]=r,t[65]=De);let Oe;t[66]!==m||t[67]!==a?(Oe=()=>a?.startCreating(`file`,m),t[66]=m,t[67]=a,t[68]=Oe):Oe=t[68];let ke;t[69]!==De||t[70]!==Oe?(ke=(0,Z.jsx)(Wq,{icon:nu,label:De,onClick:Oe}),t[69]=De,t[70]=Oe,t[71]=ke):ke=t[71];let Ae;t[72]!==r||t[73]!==P||t[74]!==m||t[75]!==a?(Ae=P?(0,Z.jsxs)(ao,{children:[(0,Z.jsx)(Aa,{asChild:!0,children:(0,Z.jsx)(Wq,{icon:Ia,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(eo,{align:`end`,children:(0,Z.jsx)(TG,{parentDir:m,onSelectTemplate:e=>a?.createFromTemplate(m,e),ItemComponent:Ea})})]}):null,t[72]=r,t[73]=P,t[74]=m,t[75]=a,t[76]=Ae):Ae=t[76];let je;t[77]===r?je=t[78]:(je=r({id:`96G6Re`}),t[77]=r,t[78]=je);let Me;t[79]!==m||t[80]!==a?(Me=()=>a?.startCreating(`folder`,m),t[79]=m,t[80]=a,t[81]=Me):Me=t[81];let Ne;t[82]!==je||t[83]!==Me?(Ne=(0,Z.jsx)(Wq,{icon:Cl,label:je,onClick:Me}),t[82]=je,t[83]=Me,t[84]=Ne):Ne=t[84];let Pe;t[85]!==Ee||t[86]!==ke||t[87]!==Ae||t[88]!==Ne?(Pe=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Te,children:[Ee,ke,Ae,Ne]}),t[85]=Ee,t[86]=ke,t[87]=Ae,t[88]=Ne,t[89]=Pe):Pe=t[89];let Fe;t[90]!==Se||t[91]!==we||t[92]!==Pe?(Fe=(0,Z.jsxs)(CA,{"data-electron-drag":h?``:void 0,className:Se,children:[Ce,we,Pe]}),t[90]=Se,t[91]=we,t[92]=Pe,t[93]=Fe):Fe=t[93];let Ie=h&&y&&`motion-safe:delay-100`,Le=b&&`opacity-0`,Re;t[94]!==Ie||t[95]!==Le?(Re=oi(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ie,Le),t[94]=Ie,t[95]=Le,t[96]=Re):Re=t[96];let ze;t[97]===g?ze=t[98]:(ze=[g],t[97]=g,t[98]=ze);let Be;t[99]===n?Be=t[100]:(Be=(0,Z.jsx)(Nq,{onClick:n}),t[99]=n,t[100]=Be);let Ve;t[101]!==ze||t[102]!==Be?(Ve=(0,Z.jsx)(ce,{fallbackRender:Kq,onError:Mq,resetKeys:ze,children:Be}),t[101]=ze,t[102]=Be,t[103]=Ve):Ve=t[103];let He;t[104]!==Re||t[105]!==Ve?(He=(0,Z.jsx)(`div`,{className:Re,children:Ve}),t[104]=Re,t[105]=Ve,t[106]=He):He=t[106];let Ue;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsxs)(TA,{children:[(0,Z.jsx)(cP,{}),(0,Z.jsx)(WK,{ref:o})]}),t[107]=Ue):Ue=t[107];let We;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsxs)(wA,{className:`px-0`,children:[(0,Z.jsx)(Iq,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(EA,{children:(0,Z.jsx)(DA,{children:(0,Z.jsx)(Aq,{bridge:window.okDesktop})})}):null]}),t[108]=We):We=t[108];let Ge=!(v&&g===`collapsed`),Ke;t[109]===Ge?Ke=t[110]:(Ke=(0,Z.jsx)(xA,{enableToggle:!1,enableDrag:Ge}),t[109]=Ge,t[110]=Ke);let qe;t[111]!==Fe||t[112]!==He||t[113]!==Ke?(qe=(0,Z.jsx)(rN,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:q,children:[Fe,He,Ue,We,Ke]})}),t[111]=Fe,t[112]=He,t[113]=Ke,t[114]=qe):qe=t[114];let Je=!I,Ye,Xe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(nu,{"aria-hidden":`true`}),Xe=(0,Z.jsx)(s,{id:`HdkSiO`}),t[115]=Ye,t[116]=Xe):(Ye=t[115],Xe=t[116]);let Ze;t[117]!==ee||t[118]!==Je?(Ze=(0,Z.jsxs)(sN,{disabled:Je,onSelect:ee,"data-testid":`empty-space-menu-new-file`,children:[Ye,Xe]}),t[117]=ee,t[118]=Je,t[119]=Ze):Ze=t[119];let Qe;t[120]!==te||t[121]!==N||t[122]!==I?(Qe=N?(0,Z.jsxs)(aN,{children:[(0,Z.jsxs)(cN,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Ia,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(lN,{children:(0,Z.jsx)(TG,{parentDir:``,onSelectTemplate:te,ItemComponent:sN})})]}):null,t[120]=te,t[121]=N,t[122]=I,t[123]=Qe):Qe=t[123];let $e=!I,et,nt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(Cl,{"aria-hidden":`true`}),nt=(0,Z.jsx)(s,{id:`96G6Re`}),t[124]=et,t[125]=nt):(et=t[124],nt=t[125]);let rt;t[126]!==X||t[127]!==$e?(rt=(0,Z.jsxs)(sN,{disabled:$e,onSelect:X,"data-testid":`empty-space-menu-new-folder`,children:[et,nt]}),t[126]=X,t[127]=$e,t[128]=rt):rt=t[128];let it;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(fN,{}),t[129]=it):it=t[129];let at;t[130]!==r||t[131]!==oe||t[132]!==I?(at=F?(0,Z.jsxs)(sN,{disabled:!I,onSelect:oe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(I?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[130]=r,t[131]=oe,t[132]=I,t[133]=at):at=t[133];let ot;t[134]!==R||t[135]!==B||t[136]!==L?(ot=(0,Z.jsx)(Oq,{input:B,installStates:L,dispatch:R}),t[134]=R,t[135]=B,t[136]=L,t[137]=ot):ot=t[137];let st=!I,ct;t[138]!==r||t[139]!==I?(ct=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[138]=r,t[139]=I,t[140]=ct):ct=t[140];let lt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(tt,{"aria-hidden":`true`}),t[141]=lt):lt=t[141];let ut;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[142]=ut):ut=t[142];let dt;t[143]===I?dt=t[144]:(dt=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[143]=I,t[144]=dt);let ft;t[145]!==le||t[146]!==st||t[147]!==ct||t[148]!==dt?(ft=(0,Z.jsxs)(sN,{disabled:st,onSelect:le,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ct,children:[lt,ut,dt]}),t[145]=le,t[146]=st,t[147]=ct,t[148]=dt,t[149]=ft):ft=t[149];let pt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(fN,{}),t[150]=pt):pt=t[150];let ht=V===null,gt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(s,{id:`XcGbim`}),t[151]=gt):gt=t[151];let _t;t[152]!==de||t[153]!==U||t[154]!==ht?(_t=(0,Z.jsx)(uN,{checked:U,onCheckedChange:de,disabled:ht,"data-testid":`empty-space-menu-show-hidden-files`,children:gt}),t[152]=de,t[153]=U,t[154]=ht,t[155]=_t):_t=t[155];let vt;t[156]===K?vt=t[157]:(vt=K?(0,Z.jsx)(fN,{}):null,t[156]=K,t[157]=vt);let yt;t[158]!==pe||t[159]!==W?(yt=W?(0,Z.jsxs)(sN,{onSelect:pe,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[158]=pe,t[159]=W,t[160]=yt):yt=t[160];let bt;t[161]!==he||t[162]!==G?(bt=G?(0,Z.jsxs)(sN,{onSelect:he,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[161]=he,t[162]=G,t[163]=bt):bt=t[163];let xt;t[164]!==Ze||t[165]!==Qe||t[166]!==rt||t[167]!==at||t[168]!==ot||t[169]!==ft||t[170]!==_t||t[171]!==vt||t[172]!==yt||t[173]!==bt?(xt=(0,Z.jsxs)(oN,{children:[Ze,Qe,rt,it,at,ot,ft,pt,_t,vt,yt,bt]}),t[164]=Ze,t[165]=Qe,t[166]=rt,t[167]=at,t[168]=ot,t[169]=ft,t[170]=_t,t[171]=vt,t[172]=yt,t[173]=bt,t[174]=xt):xt=t[174];let St;return t[175]!==qe||t[176]!==xt?(St=(0,Z.jsx)(yA,{variant:`inset`,children:(0,Z.jsxs)(nN,{children:[qe,xt]})}),t[175]=qe,t[176]=xt,t[177]=St):St=t[177],St}function Kq(){return null}function qq(e){Hq(e.target)&&(e.preventDefault(),e.stopPropagation())}function Jq(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function Yq(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function Xq(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var Zq={phase:`loading`};function Qq(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function $q(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function eJ(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=Xq(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function tJ(e){return e!==null&&e.kind===`project-branch-switch`}function nJ(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?zf:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,cJ),[l,u]=(0,Q.useState)(Zq),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),m;t[0]===c?m=t[1]:(m=tJ(c)?c:null,t[0]=c,t[1]=m);let g=m,_;t[2]!==o||t[3]!==g?.share.target.kind?(_=g?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=g?.share.target.kind,t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{u(Zq),d.current=!1,f.current=!1},t[5]=y):y=t[5];let b;t[6]===c?b=t[7]:(b=[c],t[6]=c,t[7]=b),(0,Q.useEffect)(y,b);let x;t[8]!==g||t[9]!==n?(x=()=>{g&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:g.projectPath,branch:g.share.branch,kind:g.share.target.kind,path:p(g.share.target)}).then(e=>{u(t=>Qq(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(sJ)})))},t[8]=g,t[9]=n,t[10]=x):x=t[10];let S;t[11]===g?S=t[12]:(S=[g],t[11]=g,t[12]=S),(0,Q.useEffect)(x,S);let C;t[13]!==o||t[14]!==g||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==v?(C=()=>{if(l.phase!==`awaiting-cc1-recycle`||!g)return;let e=g.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:g.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(wu({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:g.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:g.share.target.kind,path:p(g.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),hs.error(o({id:`gQV-9w`,values:{targetNoun:v}}))}),a.dismiss();return}console.log(wu({branch_dialog_action:`branch-switch-timeout`,branch:e})),hs.error(o({id:`LBwUR6`,values:{targetNoun:v}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),hs.error(o({id:`Jw6EC4`,values:{targetNoun:v}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=g,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=v,t[19]=C):C=t[19];let w;if(t[20]!==g||t[21]!==l.phase?(w=[l.phase,g],t[20]=g,t[21]=l.phase,t[22]=w):w=t[22],(0,Q.useEffect)(C,w),!g)return null;let{share:T,projectPath:E,currentBranch:D}=g,O=T.branch,k;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==E||t[28]!==T.target||t[29]!==O||t[30]!==a?(k=function(){l.phase===`ready`&&Jq(l.info).switchEnabled&&(console.log(wu({branch_dialog_action:`switch`,branch_action:`switch`,branch:O})),u(e=>$q(e,p(T.target))),n.project.runCheckout({projectPath:E,branch:O}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=eJ(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?hs.error(o({id:`NJyQi_`,values:{shareBranch:O}})):t===`fetch-failed`?hs.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&hs.error(o({id:`c863eW`,values:{shareBranch:O}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(oJ),hs.error(o({id:`c863eW`,values:{shareBranch:O}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=E,t[28]=T.target,t[29]=O,t[30]=a,t[31]=k):k=t[31];let A=k,j;t[32]!==o||t[33]!==n.project||t[34]!==E||t[35]!==T.target||t[36]!==O||t[37]!==a||t[38]!==v?(j=function(){console.log(wu({branch_dialog_action:`open-current`,branch:O})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),hs.error(o({id:`b5aNbi`,values:{targetNoun:v}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=E,t[35]=T.target,t[36]=O,t[37]=a,t[38]=v,t[39]=j):j=t[39];let M=j,N;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==T.target||t[45]!==O||t[46]!==a?(N=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(wu({branch_dialog_action:`pivot-to-other-worktree`,branch:O})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)},pendingBranch:O}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),hs.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=T.target,t[45]=O,t[46]=a,t[47]=N):N=t[47];let P=N,F;t[48]===a?F=t[49]:(F=function(){console.log(wu({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=F);let I=F,L,R,z,B,V,H,U,W,G,K,q,J,ee,Y,te,ne,X;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==I||t[55]!==D||t[56]!==T.branch||t[57]!==T.owner||t[58]!==T.repo||t[59]!==T.target||t[60]!==O||t[61]!==v){X=l.phase===`ready`||l.phase===`switching`?Jq(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==D?(e=l.phase===`ready`||l.phase===`switching`?Yq(l.info):D??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=D,t[82]=e):e=t[82];let n=e;H=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),B=r;let i;t[85]!==o||t[86]!==O?(i=o({id:`_BthEY`,values:{shareBranch:O}}),t[85]=o,t[86]=O,t[87]=i):i=t[87],V=i;let a=l.phase===`loading`,c=l.phase===`error`;z=Oo,te=!0,t[88]===I?ne=t[89]:(ne=e=>{e||I()},t[88]=I,t[89]=ne),R=wo,K=`sm:max-w-xl`,q=`share-branch-switch-dialog`,J=aJ,ee=iJ;let u;t[90]===v?u=t[91]:(u=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:v}})}),t[90]=v,t[91]=u);let d=T.owner,f=T.repo,m;t[92]===T.target?m=t[93]:(m=p(T.target),t[92]=T.target,t[93]=m);let g;t[94]!==T.owner||t[95]!==T.repo||t[96]!==m?(g=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:m}})}),t[94]=T.owner,t[95]=T.repo,t[96]=m,t[97]=g):g=t[97],t[98]!==u||t[99]!==g?(Y=(0,Z.jsxs)(Do,{children:[u,g]}),t[98]=u,t[99]=g,t[100]=Y):Y=t[100],L=To;let _=T.owner,y=T.repo,b;t[101]===T.target?b=t[102]:(b=p(T.target),t[101]=T.target,t[102]=b),t[103]!==T.branch||t[104]!==T.owner||t[105]!==T.repo||t[106]!==T.target.kind||t[107]!==b?(U=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(jf,{owner:_,repo:y,path:b,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=T.branch,t[104]=T.owner,t[105]=T.repo,t[106]=T.target.kind,t[107]=b,t[108]=U):U=t[108],W=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):X?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:v,shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):X?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),G=X&&!X.switchEnabled&&X.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:X.conflictingFiles.map(rJ)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=I,t[55]=D,t[56]=T.branch,t[57]=T.owner,t[58]=T.repo,t[59]=T.target,t[60]=O,t[61]=v,t[62]=L,t[63]=R,t[64]=z,t[65]=B,t[66]=V,t[67]=H,t[68]=U,t[69]=W,t[70]=G,t[71]=K,t[72]=q,t[73]=J,t[74]=ee,t[75]=Y,t[76]=te,t[77]=ne,t[78]=X}else L=t[62],R=t[63],z=t[64],B=t[65],V=t[66],H=t[67],U=t[68],W=t[69],G=t[70],K=t[71],q=t[72],J=t[73],ee=t[74],Y=t[75],te=t[76],ne=t[77],X=t[78];let re;t[109]===H?re=t[110]:(re=H?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=H,t[110]=re);let ie;t[111]!==L||t[112]!==U||t[113]!==W||t[114]!==G||t[115]!==re?(ie=(0,Z.jsxs)(L,{children:[U,W,G,re]}),t[111]=L,t[112]=U,t[113]=W,t[114]=G,t[115]=re,t[116]=ie):ie=t[116];let ae;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=ae):ae=t[117];let oe;t[118]===I?oe=t[119]:(oe=(0,Z.jsx)(ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:I,"data-testid":`share-branch-switch-cancel`,children:ae}),t[118]=I,t[119]=oe);let se;t[120]!==l.phase||t[121]!==M||t[122]!==P||t[123]!==A||t[124]!==B||t[125]!==V||t[126]!==H||t[127]!==X?(se=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(ci,{onClick:P,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[X?.openCurrentEnabled?(0,Z.jsxs)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:M,disabled:H,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Il,{className:`size-3.5`,"aria-hidden":!0}),B]}):null,(0,Z.jsx)(ci,{onClick:A,disabled:!X?.switchEnabled||H,"aria-disabled":!X?.switchEnabled||H,"aria-describedby":X&&!X.switchEnabled&&X.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:H?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),V]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),V]})})]}),t[120]=l.phase,t[121]=M,t[122]=P,t[123]=A,t[124]=B,t[125]=V,t[126]=H,t[127]=X,t[128]=se):se=t[128];let ce;t[129]!==oe||t[130]!==se?(ce=(0,Z.jsxs)(Eo,{className:`sm:justify-between`,children:[oe,se]}),t[129]=oe,t[130]=se,t[131]=ce):ce=t[131];let le;t[132]!==R||t[133]!==K||t[134]!==q||t[135]!==J||t[136]!==ee||t[137]!==Y||t[138]!==ie||t[139]!==ce?(le=(0,Z.jsxs)(R,{className:K,"data-testid":q,onInteractOutside:J,onPointerDownOutside:ee,children:[Y,ie,ce]}),t[132]=R,t[133]=K,t[134]=q,t[135]=J,t[136]=ee,t[137]=Y,t[138]=ie,t[139]=ce,t[140]=le):le=t[140];let ue;return t[141]!==z||t[142]!==te||t[143]!==ne||t[144]!==le?(ue=(0,Z.jsx)(z,{open:te,onOpenChange:ne,children:le}),t[141]=z,t[142]=te,t[143]=ne,t[144]=le,t[145]=ue):ue=t[145],ue}function rJ(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function iJ(e){e.preventDefault()}function aJ(e){e.preventDefault()}function oJ(e){return eJ(e,null).state}function sJ(e){return Qq(e,null)}function cJ(){return null}function lJ(){let e=(0,$.c)(17),t=Cn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=mt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Ne,i=new ut({url:n,name:Ur,document:e,onStateless:e=>{let{payload:t}=e;H(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:hJ,onConfigValidationRejected:mJ,onConfigIgnoreNestedError:pJ,onUnknown:fJ})},onClose:dJ,onDisconnect:uJ}),a=$o(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=Xt(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{ss([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function uJ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function dJ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function fJ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function pJ(e){$a(e)}function mJ(e){ro(e)}function hJ(e){ss([e.ch])}var gJ=`#install-claude-desktop`;function _J(e){return e===`#settings`||e===gJ}function vJ(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function yJ(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=mt(),{openTargetTransition:i}=Dt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=rs(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=vJ(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(_J(window.location.hash))return;let e=Io(window.location.hash);if(e){let t=nr(e.split(`.`).pop()??``);le(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(Wo(window.location.hash)){le(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=is(window.location.hash);if(!n){le(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){le(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=ts(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){le(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=os(ls(r),c);le(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function bJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(xJ,t),null}function xJ(){let e=wJ;if(!e(window.location.hash))return;let t=new AbortController;return se(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(CJ))}).catch(SJ),()=>t.abort()}function SJ(){}function CJ(){}function wJ(e){return!_J(e)&&!Io(e)&&!is(e)&&(e===``||e===`#`||e===`#/`)}function TJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(EJ,t),null}function EJ(){let e=function(e){let t=e.target;wg({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Cg))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function DJ(){let e=(0,$.c)(4),{activeTarget:t}=mt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function OJ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=mt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:ps(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Lh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(zh,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function kJ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=mt(),i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(B,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function AJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Wt,{name:`app`,children:(0,Z.jsx)(Mt,{children:(0,Z.jsx)(kJ,{children:(0,Z.jsx)(yg,{children:(0,Z.jsx)(jJ,{})})})})}),e[0]=t):t=e[0],t}function jJ(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Sg(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:MJ}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Y_,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(lJ,{}),u=(0,Z.jsx)(yJ,{}),d=(0,Z.jsx)(bJ,{}),f=(0,Z.jsx)(DJ,{}),p=(0,Z.jsx)(OJ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(TJ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(X_,{bridge:t}):null,h=(0,Z.jsx)(Df,{}),g=t?(0,Z.jsx)(nJ,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(V_,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(Uq,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(SA,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(iP,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(Kx,{value:s,children:(0,Z.jsxs)(gA,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(cs,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function MJ(e){nP(f_(e))}Rc(),sp({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),bp(),Kp()&&Qp(),Um(),sm(),typeof window<`u`&&Sp({bridge:window.okDesktop}),typeof window<`u`&&Np({bridge:window.okDesktop}),typeof window<`u`&&$s({bridge:window.okDesktop}),typeof window<`u`&&Js({bridge:window.okDesktop}),typeof window<`u`&&Tp({bridge:window.okDesktop}),typeof window<`u`&&Bf({bridge:window.okDesktop}),dm();var NJ=new qc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),PJ=document.getElementById(`root`);if(!PJ)throw Error(`Root element not found`);var FJ=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,il.createRoot)(PJ).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:ms,children:(0,Z.jsx)(hn,{client:NJ,children:(0,Z.jsxs)(vr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Fs,{children:FJ&&window.okDesktop?(0,Z.jsx)(ep,{bridge:window.okDesktop}):(0,Z.jsx)(AJ,{})}),(0,Z.jsx)(ap,{richColors:!0,closeButton:!0})]})})})}));
2002
+ `}\n${NW}\n${PW}`;function MK(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&hK.has(t)}function NK(e){return e===`darwin`?ms._({id:`LtSYdi`}):e===`win32`?ms._({id:`qi1F96`}):ms._({id:`e1Rn_k`})}function PK(e){let t=(0,$.c)(18),{item:n,workspace:r,onClose:a}=e,{_:o}=i(),s=typeof window<`u`?window.okDesktop:void 0;if(!s)return null;let c=s.platform,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=NK(c),t[0]=l):l=t[0];let u=l,d,f;t[1]!==o||t[2]!==r?(d=r?null:o({id:`wTcjov`}),f=o(c===`darwin`?d?{id:`FvpFSZ`,values:{hint:d}}:{id:`LtSYdi`}:c===`win32`?d?{id:`o4dcAf`,values:{hint:d}}:{id:`qi1F96`}:d?{id:`zUhPuR`,values:{hint:d}}:{id:`e1Rn_k`}),t[1]=o,t[2]=r,t[3]=d,t[4]=f):(d=t[3],f=t[4]);let p=f,m=!r,h;t[5]!==n||t[6]!==a||t[7]!==r?(h=()=>{if(!r)return;a();let e=Qg(r.contentDir,OM(n),r.pathSeparator);s.shell.showItemInFolder(e)},t[5]=n,t[6]=a,t[7]=r,t[8]=h):h=t[8];let g,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(re,{"aria-hidden":`true`}),_=(0,Z.jsx)(`span`,{className:`flex-1`,children:u}),t[9]=g,t[10]=_):(g=t[9],_=t[10]);let v;t[11]===d?v=t[12]:(v=d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null,t[11]=d,t[12]=v);let y;return t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==v?(y=(0,Z.jsxs)(Ea,{disabled:m,onSelect:h,"aria-label":p,children:[g,_,v]}),t[13]=p,t[14]=m,t[15]=h,t[16]=v,t[17]=y):y=t[17],y}function FK(e,t){return DM({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e},t)}function IK(e,t){return e!==t&&e.startsWith(t)}function LK(e,t){let n=[...new Set(e)],r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>IK(e,t))).map(e=>FK(e,t))}function RK(e,t){return e===t||e.startsWith(`${t}/`)}function zK(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function BK(e,t,n){let r=new Set,i=new Set,a=new Set;for(let o of e){if(o.kind===`file`){r.add(o.path);continue}if(o.kind===`asset`){a.add(o.path);continue}i.add(o.path);for(let e of t)fs(e)&&e.docName.startsWith(`${o.path}/`)?r.add(e.docName):Ro(e)&&e.path.startsWith(`${o.path}/`)&&a.add(e.path);for(let e of n){let t=gM(e);RK(t,o.path)&&i.add(t)}}return{docNames:r,folderPaths:i,assetPaths:a}}function VK(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:e.kind===`asset`?!1:RK(t.createdPath,e.path)}function HK(e){let t=(0,$.c)(55),{item:n,context:r,anyActionBusy:a,workspace:o,handoff:c,model:l,okignoreBinding:u,projectLocalBinding:d,mergedConfig:f,onStartCreating:p,onCreateFromTemplate:m,onDuplicate:h,onDelete:g,onExpandSubtree:_,onCollapseSubtree:v,folderTreePaths:y,isAsset:b,documents:x}=e,{_:S}=i(),C=DM(n,x),w=n.kind===`directory`,T=C.kind===`asset`?null:C,E=T!==null&&u!==null,D;t[0]!==S||t[1]!==w?(D=S(w?{id:`5D3Ior`}:{id:`dbhUX1`}),t[0]=S,t[1]=w,t[2]=D):D=t[2];let O=D,k=f?.appearance?.sidebar?.showHiddenFiles??!1,A=d!==null,j;t[3]!==w||t[4]!==n.path?(j=w?gM(n.path):null,t[3]=w,t[4]=n.path,t[5]=j):j=t[5];let M=Di(j),N=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,P=l.getSelectedPaths(),F=P.includes(C.treePath)?LK(P,x):[],I=F.length>1?F:[C],L=I.length,R=ms._({id:`djjdjr`,values:{deleteCount:L}}),z;t[6]!==b||t[7]!==w||t[8]!==n||t[9]!==o?(z=b?null:w?i_({folderRelativePath:OM(n),workspace:o}):e_({docName:pM(n.path),workspace:o}),t[6]=b,t[7]=w,t[8]=n,t[9]=o,t[10]=z):z=t[10];let B=z,V;t[11]===r?V=t[12]:(V=()=>r.close({restoreFocus:!1}),t[11]=r,t[12]=V);let H=V,U;t[13]===r?U=t[14]:(U=()=>r.close(),t[13]=r,t[14]=U);let W=U,G;t[15]!==S||t[16]!==d?(G=e=>{if(d===null)return;let t=d.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileTree] showHiddenFiles toggle rejected:`,Br(t.error)),hs.error(S({id:`P47EWZ`}),{description:Br(t.error)}))},t[15]=S,t[16]=d,t[17]=G):G=t[17];let q=G,J=0,ee=0;if(w){let e=_M(n.path);for(let t of y)(t===e||t.startsWith(e))&&(J++,EG(l.getItem(t))?.isExpanded()&&ee++)}let Y=w&&ee<J,te=w&&ee>0,ne;t[18]===W?ne=t[19]:(ne=e=>{e||W()},t[18]=W,t[19]=ne);let X;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[20]=X):X=t[20];let re;t[21]!==S||t[22]!==a||t[23]!==E||t[24]!==A||t[25]!==W||t[26]!==H||t[27]!==R||t[28]!==I||t[29]!==N||t[30]!==q||t[31]!==c||t[32]!==B||t[33]!==O||t[34]!==b||t[35]!==w||t[36]!==n||t[37]!==l||t[38]!==u||t[39]!==T||t[40]!==v||t[41]!==m||t[42]!==g||t[43]!==h||t[44]!==_||t[45]!==p||t[46]!==k||t[47]!==te||t[48]!==Y||t[49]!==C||t[50]!==o?(re=(0,Z.jsx)(eo,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),p(`file`,gM(n.path))},children:[(0,Z.jsx)(nu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`HdkSiO`})]}),N?(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(so,{disabled:a,children:[(0,Z.jsx)(Ta,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(Ha,{children:(0,Z.jsx)(TG,{parentDir:gM(n.path),onSelectTemplate:e=>{H(),m(gM(n.path),e)},ItemComponent:Ea})})]}):null,(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),p(`folder`,gM(n.path))},children:[(0,Z.jsx)(Cl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`96G6Re`})]}),(0,Z.jsx)(no,{}),(0,Z.jsx)(PK,{item:n,workspace:o,onClose:W}),(0,Z.jsx)(JG,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(so,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ha,{children:[(0,Z.jsx)(Ea,{disabled:!o,onSelect:()=>{o&&(W(),mK(Qg(o.contentDir,OM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Ea,{onSelect:()=>{W(),mK(OM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(no,{}),(0,Z.jsx)(Ga,{checked:k,onCheckedChange:q,disabled:!A,"data-testid":`file-tree-menu-show-hidden-files`,children:(0,Z.jsx)(s,{id:`XcGbim`})}),Y||te?(0,Z.jsx)(no,{}):null,Y?(0,Z.jsxs)(Ea,{onSelect:()=>{W(),_(n.path)},children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,te?(0,Z.jsxs)(Ea,{onSelect:()=>{W(),v(n.path)},children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,(0,Z.jsx)(no,{}),(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{C.kind!==`asset`&&(W(),h(C))},children:[(0,Z.jsx)(Pe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(oe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),(0,Z.jsxs)(Ea,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u||!T)return;W();let e=ZW(T),t=oo(u.current()),n=Ka(t,e);if(n===t)return;u.patch(Ya(n));let r=T.path.split(`/`).pop()||T.path;hs.success(S({id:`4xtLTl`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(gt,{"aria-hidden":`true`}),O]}),(0,Z.jsxs)(Ea,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(I)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),R]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(PK,{item:n,workspace:o,onClose:W}),!b&&(0,Z.jsx)(JG,{input:B,installStates:c.installStates,isElectronHost:c.isElectronHost,dispatch:c.dispatch}),(0,Z.jsxs)(Aa,{children:[(0,Z.jsxs)(so,{children:[(0,Z.jsx)(tt,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`oCZkaG`})]}),(0,Z.jsxs)(Ha,{children:[(0,Z.jsx)(Ea,{disabled:!o,onSelect:()=>{o&&(W(),mK(Qg(o.contentDir,OM(n),o.pathSeparator),`full`))},children:(0,Z.jsx)(s,{id:`oQA-cA`})}),(0,Z.jsx)(Ea,{onSelect:()=>{W(),mK(OM(n),`relative`)},children:(0,Z.jsx)(s,{id:`s061i4`})})]})]}),(0,Z.jsx)(no,{}),b?null:(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{W(),h(C)},children:[(0,Z.jsx)(Pe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`euc6Ns`})]}),(0,Z.jsxs)(Ea,{disabled:a,onSelect:()=>{H(),l.startRenaming(n.path)},children:[(0,Z.jsx)(oe,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`2wxgft`})]}),T?(0,Z.jsxs)(Ea,{"data-testid":`file-tree-menu-hide`,disabled:!E,onSelect:()=>{if(!u)return;W();let e=ZW(T),t=oo(u.current()),n=Ka(t,e);if(n===t)return;u.patch(Ya(n));let r=T.path.split(`/`).pop()||T.path;hs.success(S({id:`OD0FCX`,values:{basename:r}}),{description:S({id:`nWv1ja`}),duration:5e3})},children:[(0,Z.jsx)(gt,{"aria-hidden":`true`}),O]}):null,(0,Z.jsxs)(Ea,{variant:`destructive`,disabled:a,onSelect:()=>{W(),g(I)},children:[(0,Z.jsx)(K,{"aria-hidden":`true`}),R]})]})}),t[21]=S,t[22]=a,t[23]=E,t[24]=A,t[25]=W,t[26]=H,t[27]=R,t[28]=I,t[29]=N,t[30]=q,t[31]=c,t[32]=B,t[33]=O,t[34]=b,t[35]=w,t[36]=n,t[37]=l,t[38]=u,t[39]=T,t[40]=v,t[41]=m,t[42]=g,t[43]=h,t[44]=_,t[45]=p,t[46]=k,t[47]=te,t[48]=Y,t[49]=C,t[50]=o,t[51]=re):re=t[51];let ie;return t[52]!==ne||t[53]!==re?(ie=(0,Z.jsxs)(ao,{open:!0,modal:!1,onOpenChange:ne,children:[X,re]}),t[52]=ne,t[53]=re,t[54]=ie):ie=t[54],ie}async function UK(e,t,n,r){try{let i=await fetch(`/api/documents?showAll=true&dir=${encodeURIComponent(e)}&depth=1`,{signal:t,headers:zG});if(BG(i)){let e=await UG(i);return{kind:`entries`,entries:zo(e.entries),truncated:e.truncated}}let a=await _e(i,n);if(!a.ok)return{kind:`http-error`,title:a.title};let o=Ar.safeParse(a.body);return o.success?{kind:`entries`,entries:zo(o.data.documents),truncated:o.data.truncated===!0}:{kind:`http-error`,title:r}}catch(e){return e instanceof VG?{kind:`http-error`,title:e.message}:{kind:`network-error`,cause:e}}}function WK(e){let t=(0,$.c)(352),{ref:n}=e,{_:r,i18n:a}=i(),{activeDocName:o,activeTarget:c,closeTabs:l,closeDocument:u,closeAndClearForRename:d,getPoolActiveDocName:f,poolHas:p,isNewTabActive:m,openTarget:h,prewarm:g,remapTabsForRename:_}=mt(),{notifySidebarFileSelected:v}=hA(),{resolvedTheme:y}=Nr(),{addPage:b,pageMeta:x}=rs(),S;t[0]===x?S=t[1]:(S=function(e,t){return us(e,t??x.get(e)?.size)??{kind:`doc`,target:e,docName:e}},t[0]=x,t[1]=S);let C=S,w;t[2]!==C||t[3]!==v||t[4]!==h?(w=function(e,t){h(C(e,t),{tabBehavior:`replace-active`}),Yo(Vo(e)),v()},t[2]=C,t[3]=v,t[4]=h,t[5]=w):w=t[5];let T=w,E;t[6]!==v||t[7]!==h?(E=function(e){let t=Uo(e);h({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),Yo(t),v()},t[6]=v,t[7]=h,t[8]=E):E=t[8];let D=E,O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[9]=O):O=t[9];let[k,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(!0),[P,F]=(0,Q.useState)(null),[I,L]=(0,Q.useState)(!1),R=cm(),z=(0,Q.useRef)(null),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(null),[K,q]=(0,Q.useState)(null),{conflicts:J}=Pi(),[ee,Y]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),[X,re]=(0,Q.useState)(!1),ie=(0,Q.useRef)(X),oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=new Set,t[10]=oe):oe=t[10];let se=(0,Q.useRef)(oe),ce=(0,Q.useRef)(k),le=(0,Q.useRef)(x),ue;t[11]!==k||t[12]!==D||t[13]!==T||t[14]!==v||t[15]!==h?(ue=function(e,t){let n=t===void 0?k:t,r=fG(e,n);if(r.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,vM(e));return}if(r.kind===`asset`){h({kind:`asset`,target:r.path,assetPath:r.path,mediaKind:r.mediaKind},{tabBehavior:`replace-active`}),Yo(r.hash),v();return}if(r.kind===`folder`){D(r.path);return}let i=n.find(e=>fs(e)&&e.docName===r.path);T(r.path,i?.size)},t[11]=k,t[12]=D,t[13]=T,t[14]=v,t[15]=h,t[16]=ue):ue=t[16];let de=ue,fe;t[17]!==v||t[18]!==h?(fe=function(e,t){h({kind:`asset`,target:e,assetPath:e,mediaKind:(t??ce.current).find(t=>Ro(t)&&t.path===e)?.mediaKind??null},{tabBehavior:`replace-active`}),Yo(Jo(e)),v()},t[17]=v,t[18]=h,t[19]=fe):fe=t[19];let pe=fe,me=(0,Q.useRef)(o),he;t[20]===k?he=t[21]:(he=new Set(k.filter(Ro).map(_q)),t[20]=k,t[21]=he);let ge=he,ve=(0,Q.useRef)(ge),ye;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ye=[],t[22]=ye):ye=t[22];let be=(0,Q.useRef)(ye),xe=(0,Q.useRef)(null),Se=(0,Q.useRef)(gq),Ce=(0,Q.useRef)(null),we=(0,Q.useRef)(null),Te=(0,Q.useRef)(!1),Ee=(0,Q.useRef)(!1),De=(0,Q.useRef)(null),Oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Oe={row:null,root:null},t[23]=Oe):Oe=t[23];let ke=(0,Q.useRef)(Oe),Ae=(0,Q.useRef)(hq),je=(0,Q.useRef)(null),Me;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(Me=new Map,t[24]=Me):Me=t[24];let Ne=(0,Q.useRef)(Me),Pe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=new Set,t[25]=Pe):Pe=t[25];let Fe=(0,Q.useRef)(Pe),Ie;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=new Map,t[26]=Ie):Ie=t[26];let Le=(0,Q.useRef)(Ie),Re=(0,Q.useRef)(0),ze;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(ze=new Set,t[27]=ze):ze=t[27];let Be=(0,Q.useRef)(ze),Ve=(0,Q.useRef)(mq),He=(0,Q.useRef)(pq),Ue=(0,Q.useRef)(!1),We=(0,Q.useRef)(null),Ge=(0,Q.useRef)(null),Ke=(0,Q.useRef)(fq),qe=(0,Q.useRef)(dq),Je=(0,Q.useRef)(uq),Ye=(0,Q.useRef)(lq),Xe=(0,Q.useRef)(c),[Ze,Qe]=(0,Q.useState)(!1),et;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(et=function(){z.current!==null&&(clearTimeout(z.current),z.current=null)},t[28]=et):et=t[28];let tt=et,nt;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(nt=function(){tt(),L(!1)},t[29]=nt):nt=t[29];let rt=nt,it;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(it=function(e){rt(),F(e)},t[30]=it):it=t[30];let at=it,ot;t[31]===r?ot=t[32]:(ot=function(){if(tt(),im()){F(null),L(!0),z.current=setTimeout(()=>{z.current=null,We.current?.()},OK);return}L(!1),F(r({id:`34qyH5`}))},t[31]=r,t[32]=ot);let st=ot,ct=(0,Q.useRef)(!0),lt;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(lt=()=>{if(ct.current){ct.current=!1;return}We.current?.()},t[33]=lt):lt=t[33];let ut;t[34]===R?ut=t[35]:(ut=[R],t[34]=R,t[35]=ut),(0,Q.useEffect)(lt,ut);let dt,ft;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(dt=()=>tt,ft=[],t[36]=dt,t[37]=ft):(dt=t[36],ft=t[37]),(0,Q.useEffect)(dt,ft);let pt,ht;t[38]!==k.length||t[39]!==M?(pt=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=e,n=function(){De.current!==null&&clearTimeout(De.current),De.current=setTimeout(()=>{Ee.current=!1,De.current=null},0)},r=function(e){if(!(e instanceof DragEvent))return;let t=yq(e),n=t?.dataset.itemPath;if(!n)return;let r=_G(t.dataset.itemType===`folder`?_M(n):n,ce.current,le.current);r&&(De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!0,e.dataTransfer?.setData(WE,KE(r)))},i=function(e){if(!(e instanceof DragEvent)||!IM(e))return;let t=xq(e);if(!t){fK(ke);return}e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`),pK(ke,t)},a=function(e){if(!(e instanceof DragEvent)||!IM(e))return;let n=e.relatedTarget;n instanceof Node&&t.contains(n)||fK(ke)},o=function(e){if(!(e instanceof DragEvent)||!IM(e))return;let t=xq(e),n=LM(e);if(!t||n.length===0){fK(ke);return}e.preventDefault(),e.stopPropagation(),fK(ke),Ae.current(n,t.parentDir,t.busyPath)};return e.addEventListener(`dragstart`,r,{capture:!0}),e.addEventListener(`dragover`,i,{capture:!0}),e.addEventListener(`dragleave`,a,{capture:!0}),e.addEventListener(`drop`,o,{capture:!0}),e.addEventListener(`dragend`,n,{capture:!0}),window.addEventListener(`drop`,n,!0),window.addEventListener(`dragend`,n,!0),()=>{e.removeEventListener(`dragstart`,r,{capture:!0}),e.removeEventListener(`dragover`,i,{capture:!0}),e.removeEventListener(`dragleave`,a,{capture:!0}),e.removeEventListener(`drop`,o,{capture:!0}),e.removeEventListener(`dragend`,n,{capture:!0}),window.removeEventListener(`drop`,n,!0),window.removeEventListener(`dragend`,n,!0),fK(ke),De.current!==null&&(clearTimeout(De.current),De.current=null),Ee.current=!1}},ht=[k.length,M],t[38]=k.length,t[39]=M,t[40]=pt,t[41]=ht):(pt=t[40],ht=t[41]),(0,Q.useEffect)(pt,ht);let{selectedFilePath:gt,selectedFolderPath:_t,navigationPath:vt}=dG(c,m?null:o),yt=gt?fM(gt,k.find(e=>fs(e)&&e.docName===gt)?.docExt):_t?_M(_t):c?.kind===`asset`?c.assetPath:null,bt=X?null:yt,xt=O_().states,{dispatch:St}=__(),wt;t[42]!==St||t[43]!==xt?(wt={installStates:xt,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:St},t[42]=St,t[43]=xt,t[44]=wt):wt=t[44];let Tt=wt,{okignoreBinding:Et,projectLocalBinding:Dt,merged:Ot}=ae(),kt=Ot?.appearance?.sidebar?.showHiddenFiles??!1,At;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>je.current===null,t[45]=At):At=t[45];let jt=At,Mt;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(Mt=[],t[46]=Mt):Mt=t[46];let Nt;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Nt={set:`complete`,spriteSheet:CK,byFileExtension:{md:{name:vK,viewBox:yK},mdx:{name:vK,viewBox:yK}}},t[47]=Nt):Nt=t[47];let Pt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Pt={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[48]=Pt):Pt=t[48];let Ft;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ft={canDrag:jt,canDrop:jt,onDropComplete:e=>Ye.current(e),onDropError:cq},t[49]=Ft):Ft=t[49];let It,Lt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(It={canRename:jt,onRename:e=>qe.current(e),onError:e=>Je.current(e)},Lt=e=>Ke.current(e),t[50]=It,t[51]=Lt):(It=t[50],Lt=t[51]);let Rt;t[52]===r?Rt=t[53]:(Rt={paths:Mt,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,...jW,icons:Nt,unsafeCSS:jK,composition:Pt,dragAndDrop:Ft,renaming:It,onSelectionChange:Lt,renderRowDecoration:e=>{let{item:t}=e;if(t.kind===`file`){let e=ce.current.find(e=>fs(e)&&fM(e.docName,e.docExt)===t.path);if(e?.isSymlink){let t=e.targetPath;return{icon:gK,title:r(t?{id:`JE21eh`,values:{targetPath:t}}:{id:`BQu9Pg`})}}return MK(t.path)?{icon:_K,title:r({id:`i9toLO`})}:null}let n=ce.current.find(e=>Zo(e)&&_M(e.path)===_M(t.path));if(n?.isSymlink){let e=n.targetPath;return{icon:gK,title:r(e?{id:`JE21eh`,values:{targetPath:e}}:{id:`BQu9Pg`})}}return null}},t[52]=r,t[53]=Rt);let{model:zt}=AW(Rt),Vt;t[54]===zt?Vt=t[55]:(Vt=function(e){let t=zt.getItem(e)??zt.getItem(_M(e));return t?.isDirectory()?_M(gM(t.getPath())):e},t[54]=zt,t[55]=Vt);let Ht=Vt,Ut,Wt;t[56]===k?(Ut=t[57],Wt=t[58]):(Wt=yM(k),Ut=bM(Wt),t[56]=k,t[57]=Ut,t[58]=Wt);let Gt=Ut,Kt=(0,Q.useRef)(Wt),qt;t[59]===k?qt=t[60]:(qt=SM(k),t[59]=k,t[60]=qt);let Jt=qt,Yt=(0,Q.useRef)(Jt),Xt=_t?CM(_M(_t)).slice(0,-1):CM(bt??vt),Zt=Xt.join(`\0`),Qt;t[61]===zt?Qt=t[62]:(Qt=()=>{let e=new Set;for(let t of Yt.current)EG(zt.getItem(t))?.isExpanded()&&e.add(t);return e},t[61]=zt,t[62]=Qt);let $t=Qt,en;t[63]===$t?en=t[64]:(en=e=>{let t=new Set(SM(e??ce.current)),n=$t();for(let e of be.current)n.add(e);return[...n].filter(e=>t.has(e))},t[63]=$t,t[64]=en);let tn=en,nn;t[65]!==tn||t[66]!==zt?(nn=e=>{let t=yM(e??ce.current);zt.resetPaths(t,{initialExpandedPaths:tn(e)})},t[65]=tn,t[66]=zt,t[67]=nn):nn=t[67];let rn=nn,an;t[68]!==r||t[69]!==st?(an=async function(e){let t=Re.current,n=new AbortController;Le.current.set(e,n);let i=await UK(gM(e),n.signal,r({id:`8RtNI0`}),r({id:`HlmZBk`}));if(Le.current.get(e)===n&&Le.current.delete(e),n.signal.aborted||t!==Re.current)return;if(i.kind===`network-error`){st(),console.warn(`[FileTree] lazy folder children fetch failed:`,e,i.cause);return}if(i.kind===`http-error`){console.warn(`[FileTree] lazy folder children http error:`,e,i.title),at(i.title);return}let a=Ue.current,o=Xo(i.entries,a);Fe.current.add(e),j(t=>GG(t,e,o,Ne.current)),F(null),rt(),i.truncated&&V(i.entries.length)},t[68]=r,t[69]=st,t[70]=an):an=t[70];let on=an,sn;t[71]!==$t||t[72]!==on?(sn=()=>{let e=$t(),t=Be.current;Be.current=e;for(let n of e){if(t.has(n)||Fe.current.has(n)||Le.current.has(n))continue;let e=gM(n);ce.current.find(t=>Zo(t)&&t.path===e)?.hasChildren!==!1&&on(n)}},t[71]=$t,t[72]=on,t[73]=sn):sn=t[73];let cn=sn,ln;t[74]!==$t||t[75]!==on?(ln=()=>{for(let e of $t())Fe.current.has(e)||Le.current.has(e)||on(e)},t[74]=$t,t[75]=on,t[76]=ln):ln=t[76];let un=ln,dn;t[77]!==zt||t[78]!==rn?(dn=(e,t,n,r)=>{let i=r===void 0?[]:r,a=0,o=null;for(let{fromDocName:r,toDocName:i}of n){let n=e.find(e=>fs(e)&&e.docName===r);if(n==null||zt.getItem(i)==null)continue;let s=fM(i,t.find(e=>fs(e)&&e.docName===i)?.docExt??n.docExt);zt.move(i,s),o=s,a+=1}for(let{toPath:e}of i){let t=oM(e);if(t===``)continue;let n=e.slice(0,-t.length);zt.getItem(n)!=null&&(zt.getItem(e)??zt.move(n,e),o=e,a+=1)}a!==0&&(rn(t),o!=null&&zt.focusPath(o))},t[77]=zt,t[78]=rn,t[79]=dn):dn=t[79];let fn=dn,pn;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(pn=e=>{Ce.current=xM(e)},t[80]=pn):pn=t[80];let mn=pn,hn;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(hn=e=>ve.current.has(e),t[81]=hn):hn=t[81];let gn=hn,_n;t[82]!==r||t[83]!==b||t[84]!==D||t[85]!==T||t[86]!==rn?(_n=async function(e){if(e.kind===`asset`||je.current!==null)return;let t=()=>{U(null),je.current=null};je.current=e.path,U(e.path),F(null);try{let n=await _e(await fetch(`/api/duplicate-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.path})}),r({id:`dw_dUJ`}));if(!n.ok){hs.error(n.title),rn(),t();return}let i=A(Kn,n.body,`duplicate-path`,null);if(i===null){let e=r({id:`67f-3g`});hs.error(e),F(e),ss([`files`,`backlinks`,`graph`]),rn(),t();return}for(let e of i.duplicatedDocNames)b(e);j(t=>{let n=qM(t,e,i);return rn(n),mn(n),n}),ss([`files`,`backlinks`,`graph`]),i.path!==e.path&&(i.kind===`folder`?D(i.path):T(i.path)),hs.success(i.kind===`folder`?r({id:`iilQXA`}):r({id:`A6h5b-`}),{description:i.path}),t()}catch(e){let n=e,i=n instanceof Error?n.message:String(n);console.warn(`[FileTree] duplicate failed:`,n),hs.error(r({id:`EBVbtP`}),{description:i}),rn(),t()}},t[82]=r,t[83]=b,t[84]=D,t[85]=T,t[86]=rn,t[87]=_n):_n=t[87];let vn=_n,yn=(0,Q.useRef)(vn),bn;t[88]===vn?bn=t[89]:(bn=()=>{yn.current=vn},t[88]=vn,t[89]=bn),(0,Q.useEffect)(bn);let xn=function(e){let t=lK(e);if(!t||uK(t))return!1;let n=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||gn(n))return!1;let r=uK(n);if(!r)return!1;let i=_M(t);if(!Yt.current.includes(i))return!1;let a=`${t}${r}`;return Kt.current.includes(a)?!1:(nr({sourcePath:n,destinationPath:a,isFolder:!1}),zt.move(n,a),!0)},Sn;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Sn=e=>{let t=e??xe.current;!t||xe.current!==t||(t.disposeCommitListener(),xe.current=null)},t[90]=Sn):Sn=t[90];let Cn=Sn,wn;t[91]!==r||t[92]!==Cn||t[93]!==u||t[94]!==l||t[95]!==rn?(wn=async function(e,t){let n=t===void 0?{}:t,i=n.updateUi??!0,a=n.restoreLocation??i;Cn(e),i&&U(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=e.kind,a=e.createdPath,o=await _e(t,r({id:`EcM3k7`,values:{kind:n}}));if(o.ok)return;let s=o.title,c=r({id:`YPFBfr`,values:{detail:s,kind:n,createdPath:a}});i?hs.error(c):console.warn(`[FileTree] cleanup pending create failed: ${c}`),i&&(U(null),rn());return}}catch(t){if(console.warn(`[FileTree] cleanup pending create failed:`,t),i){let t=e.kind,n=e.createdPath;hs.error(r({id:`_TDESN`,values:{kind:t,createdPath:n}}))}i&&(U(null),rn());return}i&&(e.kind===`file`?u(e.createdPath):l([Ct(e.createdPath)],{force:!0})),i&&j(t=>{let n=GM(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return mn(n),n}),ss([`files`,`backlinks`,`graph`]),a&&(window.location.hash=e.previousHash),i&&U(null)},t[91]=r,t[92]=Cn,t[93]=u,t[94]=l,t[95]=rn,t[96]=wn):wn=t[96];let Tn=wn,En,Dn;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(En=()=>()=>{let e=xe.current;e&&Se.current(e,{restoreLocation:!1,updateUi:!1}).catch(sq)},Dn=[],t[97]=En,t[98]=Dn):(En=t[97],Dn=t[98]),(0,Q.useEffect)(En,Dn);let On;t[99]!==r||t[100]!==st?(On=()=>{let e=!0,t=null,n=RG(async function(){t?.abort();let n=new AbortController;t=n,Re.current+=1;for(let e of Le.current.values())e.abort();Le.current.clear(),Fe.current.clear();try{let t=await fetch(`/api/documents?showAll=true&dir=&depth=1`,{signal:n.signal,headers:zG});if(BG(t)){let{entries:n,truncated:r}=await UG(t);if(!e)return;let i=Ue.current,a=Xo(zo(n),i);j(e=>GG(e,``,a,Ne.current)),F(null),rt(),V(r?n.length:null),He.current()}else{let n=await _e(t,r({id:`8RtNI0`}));if(!e)return;if(!n.ok)at(n.title),V(null);else{let e=Ar.safeParse(n.body);if(!e.success)at(r({id:`HlmZBk`})),V(null);else{let t=Ue.current,n=Xo(zo(e.data.documents),t);j(e=>GG(e,``,n,Ne.current)),F(null),rt(),V(e.data.truncated===!0?e.data.documents.length:null),He.current()}}}}catch(t){let r=t;if(n.signal.aborted)return;e&&(r instanceof VG?at(r.message):st()),console.warn(`[FileTree] fetch failed:`,r)}e&&N(!1)},()=>t?.abort());We.current=()=>n.request(),n.request();let i=()=>{document.visibilityState===`visible`&&n.request()};window.addEventListener(`focus`,i),window.addEventListener(`visibilitychange`,i);let a=$o(e=>{e.includes(`files`)&&n.request()});return()=>{e=!1,We.current=null,n.dispose();for(let e of Le.current.values())e.abort();Le.current.clear(),window.removeEventListener(`focus`,i),window.removeEventListener(`visibilitychange`,i),a()}},t[99]=r,t[100]=st,t[101]=On):On=t[101];let kn;t[102]===r?kn=t[103]:(kn=[r],t[102]=r,t[103]=kn),(0,Q.useEffect)(On,kn);let An=(0,Q.useRef)(!0),jn;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(jn=()=>{if(An.current){An.current=!1;return}We.current?.()},t[104]=jn):jn=t[104];let Mn;t[105]===kt?Mn=t[106]:(Mn=[kt],t[105]=kt,t[106]=Mn),(0,Q.useEffect)(jn,Mn);let Nn,Fn;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Nn=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=A(In,n,`workspace`,null);r&&ne({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(oq),()=>{e=!1}},Fn=[],t[107]=Nn,t[108]=Fn):(Nn=t[107],Fn=t[108]),(0,Q.useEffect)(Nn,Fn);let Ln;t[109]!==tn||t[110]!==zt||t[111]!==Gt?(Ln=()=>{if(Ce.current===Gt){Ce.current=null;return}zt.resetPaths(Kt.current,{initialExpandedPaths:tn()})},t[109]=tn,t[110]=zt,t[111]=Gt,t[112]=Ln):Ln=t[112];let Rn;t[113]!==zt||t[114]!==Gt?(Rn=[zt,Gt],t[113]=zt,t[114]=Gt,t[115]=Rn):Rn=t[115],(0,Q.useEffect)(Ln,Rn),OG(zt,bt,Zt,Te,Gt);let zn;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(zn=()=>{re(!1)},t[116]=zn):zn=t[116];let Bn;t[117]===yt?Bn=t[118]:(Bn=[yt],t[117]=yt,t[118]=Bn),(0,Q.useEffect)(zn,Bn);let Vn,Hn;t[119]===X?(Vn=t[120],Hn=t[121]):(Vn=()=>{ie.current=X;for(let e of se.current)e()},Hn=[X],t[119]=X,t[120]=Vn,t[121]=Hn),(0,Q.useEffect)(Vn,Hn);let Un;t[122]!==bt||t[123]!==M||t[124]!==zt?(Un=()=>{M||!bt||lG(zt)},t[122]=bt,t[123]=M,t[124]=zt,t[125]=Un):Un=t[125];let Wn;t[126]!==Zt||t[127]!==bt||t[128]!==M||t[129]!==zt||t[130]!==Gt?(Wn=[bt,Zt,Gt,M,zt],t[126]=Zt,t[127]=bt,t[128]=M,t[129]=zt,t[130]=Gt,t[131]=Wn):Wn=t[131],(0,Q.useEffect)(Un,Wn);let Gn,qn;t[132]===zt?(Gn=t[133],qn=t[134]):(Gn=()=>zt.subscribe(()=>{if(!zt.isSearchOpen())for(let e of be.current){let t=EG(zt.getItem(e));t&&!t.isExpanded()&&t.expand()}}),qn=[zt],t[132]=zt,t[133]=Gn,t[134]=qn),(0,Q.useEffect)(Gn,qn);let Jn,Yn;t[135]===zt?(Jn=t[136],Yn=t[137]):(Jn=()=>zt.subscribe(()=>Ve.current()),Yn=[zt],t[135]=zt,t[136]=Jn,t[137]=Yn),(0,Q.useEffect)(Jn,Yn);let Xn,Qn;t[138]===zt?(Xn=t[139],Qn=t[140]):(Xn=()=>zt.onMutation(`remove`,e=>{let t=xe.current;!t||e.path!==t.renamePath||Se.current(t)}),Qn=[zt],t[138]=zt,t[139]=Xn,t[140]=Qn),(0,Q.useEffect)(Xn,Qn);let $n;t[141]!==b||t[142]!==d||t[143]!==f||t[144]!==pe||t[145]!==D||t[146]!==T||t[147]!==p||t[148]!==fn||t[149]!==_?($n=async(e,t,n,r,i)=>{let a=t===void 0?[]:t,o=n===void 0?[]:n,s=i===void 0?[]:i,c=r?.docName??me.current,l=new Map,u=new Map;for(let e of ce.current){if(fs(e)){let t=o.find(t=>t.fromPath===fM(e.docName,e.docExt))?.toPath;t&&l.set(e.docName,t);continue}if(Ro(e)){let t=o.find(t=>t.fromPath===e.path)?.toPath;t&&cM(t)&&u.set(e.path,pM(t))}}let m=c?l.get(c)??null:null,h=r?.folderPath??(Xe.current?.kind===`folder`?Xe.current.folderPath:null),g=h?$e(h,a):null,v=r?.assetPath??(Xe.current?.kind===`asset`?Xe.current.assetPath:null),y=v?u.get(v)??null:null,x=m?null:y??JM(c,e),S=m??(v?y?null:o.find(e=>e.fromPath===v)?.toPath??$e(v,a):null);Bt(e);let C=[...YM(e,f(),p),...l.keys()];await Promise.all(C.map(e=>d(e)));for(let t of e)b(t.toDocName);for(let e of u.values())b(e);_(e,a,o);let w=null;j(t=>{let n=WM(t,e,a,o,s);return w=n,fn(t,n,e,o),mn(n),n}),h&&g&&g!==h?D(g):x&&x!==c?(T(x),dK(x)):S&&(m||S!==v)&&pe(S,w??ce.current),ss([`files`,`backlinks`,`graph`])},t[141]=b,t[142]=d,t[143]=f,t[144]=pe,t[145]=D,t[146]=T,t[147]=p,t[148]=fn,t[149]=_,t[150]=$n):$n=t[150];let er=$n;async function nr(e){let t=!e.isFolder&&gn(e.sourcePath),n=t?e.sourcePath:kM(e.sourcePath,e.isFolder);U(n),F(null);try{let i=lM(e.sourcePath,e.destinationPath,e.isFolder),a=!e.isFolder&&!t&&!cM(i.destinationPath),o=t||a?i.destinationPath:kM(i.destinationPath,e.isFolder),s=e.isFolder?{kind:`folder`,fromPath:gM(n),toPath:gM(o)}:t||a?{kind:`asset`,fromPath:n,toPath:o}:{kind:`file`,fromPath:pM(n),toPath:o},c={docName:me.current,folderPath:Xe.current?.kind===`folder`?Xe.current.folderPath:null,assetPath:Xe.current?.kind===`asset`?Xe.current.assetPath:null},l=await _e(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`gijbne`}));if(!l.ok){hs.error(l.title),rn();let e=xe.current;e&&e.renamePath===n?await Tn(e):Cn(),U(null);return}let u=A(Zr,l.body,`rename-path`,{renamed:[],renamedAssets:[]});try{await er(u.renamed,e.isFolder?[{fromPath:gM(n),toPath:gM(o)}]:[],u.renamedAssets,c,!e.isFolder&&!t&&!a?u.renamed.flatMap(e=>{let t=oM(o);return t?[{toDocName:e.toDocName,docExt:t}]:[]}):[])}catch(e){console.warn(`[FileTree] post-rename reconciliation failed`,{err:e,sourceTreePath:n,destinationTreePath:o,renamedCount:u.renamed.length,renamedAssetCount:u.renamedAssets.length}),hs.error(r({id:`dDpCOp`}))}Cn(),U(null)}catch(e){console.warn(`[FileTree] rename failed:`,e);let t=r({id:`HIb0vl`});hs.error(t),F(t),rn();let i=xe.current;i&&i.renamePath===n?await Tn(i):Cn(),U(null)}}let rr;t[151]!==r||t[152]!==er||t[153]!==rn?(rr=async function(e){let t=e.draggedPaths.map(t=>{let n=MM(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(aq);if(t.length!==0){U(t[0]?.sourcePath??null),F(null);try{let e=[],n=[],i=[],a={docName:me.current,folderPath:Xe.current?.kind===`folder`?Xe.current.folderPath:null,assetPath:Xe.current?.kind===`asset`?Xe.current.assetPath:null};for(let a of t){let t=a.sourcePath.endsWith(`/`),o=!t&&gn(a.sourcePath),s=t?{kind:`folder`,fromPath:gM(a.sourcePath),toPath:gM(a.destinationTreePath)}:o?{kind:`asset`,fromPath:a.sourcePath,toPath:a.destinationTreePath}:{kind:`file`,fromPath:pM(a.sourcePath),toPath:pM(a.destinationTreePath)},c=await _e(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(s)}),r({id:`dOHMA0`}));if(!c.ok){hs.error(c.title),rn(),U(null);return}let l=A(Zr,c.body,`rename-path:drop`,{renamed:[],renamedAssets:[]});e=e.concat(l.renamed),n=n.concat(l.renamedAssets),t&&i.push({fromPath:gM(a.sourcePath),toPath:gM(a.destinationTreePath)})}try{await er(e,i,n,a)}catch(i){console.warn(`[FileTree] post-move reconciliation failed`,{err:i,operationCount:t.length,renamedCount:e.length,renamedAssetCount:n.length}),hs.error(r({id:`8OxKZy`}))}U(null)}catch(e){console.warn(`[FileTree] move failed:`,e),hs.error(r({id:`HIb0vl`})),rn(),U(null)}}},t[151]=r,t[152]=er,t[153]=rn,t[154]=rr):rr=t[154];let ir=rr,ar;t[155]!==r||t[156]!==b||t[157]!==rn?(ar=async function(e,t,n){if(e.length===0||je.current!==null)return;let i=()=>{je.current=null,U(null)};je.current=n,U(n),F(null);let a=[],o=0,s=0;for(let n of e){let e=new FormData;e.append(`file`,n),e.append(`parentDocName`,PM(t,n.name||`upload`));try{let i=await _e(await fetch(`/api/upload`,{method:`POST`,body:e}),r({id:`4Gz2wC`}));if(!i.ok){s+=1,hs.error(i.title,{description:n.name});continue}let c=A(tr,i.body,`upload:drop`,null);if(c===null){s+=1,hs.error(r({id:`4Gz2wC`}),{description:n.name});continue}let l=FM(t,c);if(c.deduped===!0){s+=1,hs.error(r({id:`4sKwf6`}),{description:l});continue}o+=1;let u=RM(l,n);u&&a.push(u)}catch(e){let t=e;s+=1,console.warn(`[FileTree] external file upload failed:`,t),hs.error(t instanceof TypeError?r({id:`HIb0vl`}):r({id:`4Gz2wC`}),{description:n.name})}}try{if(a.length>0){for(let e of a)fs(e)&&b(e.docName);j(e=>{let t=new Set(e.map(mM)),n=!1,r=[...e];for(let e of a){let i=mM(e);Ne.current.set(i,Date.now()),!t.has(i)&&(t.add(i),r.push(e),n=!0)}return n?(rn(r),mn(r),r):e})}o>0&&(ss([`files`,`backlinks`,`graph`]),We.current?.(),hs.success(ms._({id:`v75Em9`,values:{uploadedCount:o}}),{description:t||r({id:`RSqaSd`})})),s>0&&F(o>0?ms._({id:`yH7T4q`,values:{failedCount:s}}):r({id:`4Gz2wC`})),i()}catch(e){let t=e,n=r({id:`VcqWBy`});console.warn(`[FileTree] upload post-upload reconciliation failed:`,t),hs.error(n),F(n),i()}},t[155]=r,t[156]=b,t[157]=rn,t[158]=ar):ar=t[158];let or=ar,sr;t[159]===Symbol.for(`react.memo_cache_sentinel`)?(sr=function(e){Y({parentDir:e})},t[159]=sr):sr=t[159];let cr=sr,lr;t[160]!==r||t[161]!==b||t[162]!==Tn||t[163]!==Cn||t[164]!==zt||t[165]!==D||t[166]!==T||t[167]!==rn||t[168]!==Wt?(lr=async function(e,t,n){if(je.current)return;let i=xe.current;i&&Cn(i);try{let i=AM(e,t,[...Wt,...Yt.current]);U(i.renamePath),je.current=i.renamePath;let a=window.location.hash,o;if(e===`file`){let e=jM(`file`,i.addPath),t={path:e};n?.template&&(t.template=n.template);let a=await _e(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r({id:`fJgQHX`}));if(!a.ok){hs.error(a.title),U(null),je.current=null;return}let s=pM(e),c=A($r,a.body,`create-page`,{docName:s}).docName;o=c;let l={kind:`document`,docName:c,docExt:e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`,modified:new Date().toISOString(),size:0};b(c),j(e=>{if(e.some(e=>fs(e)&&e.docName===c))return e;let t=[...e,l];return mn(t),Ne.current.set(mM(l),Date.now()),t}),ss([`files`,`backlinks`,`graph`]),T(c)}else{let e=gM(i.addPath),t=await _e(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),r({id:`K1ckLX`}));if(!t.ok){hs.error(t.title),U(null),je.current=null;return}o=A(Pn,t.body,`create-folder`,{path:e}).path;let n={kind:`folder`,path:o,modified:new Date().toISOString(),size:0};j(e=>{if(e.some(e=>Zo(e)&&e.path===o))return e;let t=[...e,n];return mn(t),Ne.current.set(mM(n),Date.now()),t}),ss([`files`]),D(o)}let s=!1,c=e=>{if(e.key!==`Enter`)return;let t=xe.current;!t||t.renamePath!==i.renamePath||queueMicrotask(()=>Cn(t))};document.addEventListener(`keydown`,c,!0),xe.current={kind:e,renamePath:i.renamePath,createdPath:o,previousHash:a,disposeCommitListener:()=>{s||(s=!0,document.removeEventListener(`keydown`,c,!0))}},U(null),je.current=null,zt.add(i.addPath),zt.startRenaming(i.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),hs.error(r({id:`S6l5dv`}));let t=xe.current;t?await Tn(t):Cn(),U(null),je.current=null,rn()}},t[160]=r,t[161]=b,t[162]=Tn,t[163]=Cn,t[164]=zt,t[165]=D,t[166]=T,t[167]=rn,t[168]=Wt,t[169]=lr):lr=t[169];let ur=lr,dr;t[170]===zt?dr=t[171]:(dr=function(e){let t=_M(e);(0,Q.startTransition)(()=>{for(let e of Yt.current)if(e===t||e.startsWith(t)){let t=EG(zt.getItem(e));t&&t.expand()}})},t[170]=zt,t[171]=dr);let fr=dr,pr;t[172]===zt?pr=t[173]:(pr=function(e){let t=_M(e),n=new Set(be.current);(0,Q.startTransition)(()=>{for(let e of[...Yt.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=EG(zt.getItem(e));t&&t.collapse()}})},t[172]=zt,t[173]=pr);let mr=pr,hr;t[174]!==de||t[175]!==Xt||t[176]!==o||t[177]!==c||t[178]!==ge||t[179]!==H||t[180]!==Tn||t[181]!==cn||t[182]!==k||t[183]!==Jt||t[184]!==ir||t[185]!==nr||t[186]!==Ht||t[187]!==x||t[188]!==xn||t[189]!==un||t[190]!==kt||t[191]!==Wt||t[192]!==or?(hr=()=>{ce.current=k,le.current=x,me.current=o,Xe.current=c,ve.current=ge,je.current=H,Ue.current=kt,Kt.current=Wt,Yt.current=Jt,be.current=Xt,Ve.current=cn,He.current=un,Se.current=Tn,Ae.current=(e,t,n)=>{or(e,t,n)},Ke.current=e=>{if(Te.current||Ee.current||e.length!==1)return;let t=e[0];t&&(re(!1),de(Ht(t),k))},Je.current=e=>{xn(e)||hs.error(e)},qe.current=nr,Ye.current=ir},t[174]=de,t[175]=Xt,t[176]=o,t[177]=c,t[178]=ge,t[179]=H,t[180]=Tn,t[181]=cn,t[182]=k,t[183]=Jt,t[184]=ir,t[185]=nr,t[186]=Ht,t[187]=x,t[188]=xn,t[189]=un,t[190]=kt,t[191]=Wt,t[192]=or,t[193]=hr):hr=t[193],(0,Q.useLayoutEffect)(hr);let gr,_r;t[194]===zt?(gr=t[195],_r=t[196]):(gr=()=>{let e=e=>{let t=(e.metaKey||e.ctrlKey)&&!e.altKey,n=e.key.toLowerCase(),r=t&&n===`a`,i=t&&!e.shiftKey&&n===`d`;if(!r&&!i||zK(e.target))return;let a=Ge.current,o=e.target,s=document.activeElement,c=o instanceof Node&&a?.contains(o),l=s instanceof Node&&a?.contains(s);if(!c&&!l)return;if(i){let t=zt.getFocusedPath()??zt.getSelectedPaths()[0]??null;if(!t)return;let n=zt.getItem(t)??zt.getItem(_M(t)),r=n?.isDirectory()?_M(gM(n.getPath())):t;if(ve.current.has(r))return;yn.current(FK(r,ce.current)),e.preventDefault(),e.stopPropagation();return}let u=new Set([...Yt.current,...Kt.current]);Te.current=!0;for(let e of u)e&&zt.getItem(e)?.select();queueMicrotask(()=>{Te.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},_r=[zt],t[194]=zt,t[195]=gr,t[196]=_r),(0,Q.useEffect)(gr,_r);let vr,yr;t[197]!==k.length||t[198]!==M?(vr=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=iq,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},yr=[M,k.length],t[197]=k.length,t[198]=M,t[199]=vr,t[200]=yr):(vr=t[199],yr=t[200]),(0,Q.useEffect)(vr,yr);let br,xr;t[201]!==k.length||t[202]!==M?(br=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=()=>BW(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},xr=[M,k.length],t[201]=k.length,t[202]=M,t[203]=br,t[204]=xr):(br=t[203],xr=t[204]),(0,Q.useEffect)(br,xr);let Sr,Cr;t[205]!==k.length||t[206]!==M?(Sr=()=>{if(M||k.length===0)return;let e=Ge.current?.querySelector(CF)?.shadowRoot;if(!e)return;let t=()=>iG(e);t();let n=new MutationObserver(t);return n.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`]}),()=>n.disconnect()},Cr=[M,k.length],t[205]=k.length,t[206]=M,t[207]=Sr,t[208]=Cr):(Sr=t[207],Cr=t[208]),(0,Q.useEffect)(Sr,Cr);let wr;t[209]===Symbol.for(`react.memo_cache_sentinel`)?(wr={folderCount:0,expandedCount:0},t[209]=wr):wr=t[209];let Tr=(0,Q.useRef)(wr),Er=(0,Q.useRef)(ur),Dr=(0,Q.useRef)(cr),Or;t[210]===ur?Or=t[211]:(Or=()=>{Er.current=ur,Dr.current=cr},t[210]=ur,t[211]=Or),(0,Q.useEffect)(Or);let kr,Mr;t[212]===zt?(kr=t[213],Mr=t[214]):(kr=()=>({startCreating(e,t){Er.current(e,t)},startCreatingFromTemplate(e){Dr.current(e)},createFromTemplate(e,t){Er.current(`file`,e,{template:t})},expandAll(){(0,Q.startTransition)(()=>{for(let e of Yt.current){let t=EG(zt.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(be.current);(0,Q.startTransition)(()=>{for(let t of[...Yt.current].reverse()){if(e.has(t))continue;let n=EG(zt.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Yt.current,t=0;for(let n of e)EG(zt.getItem(n))?.isExpanded()&&t++;let n=e.length,r=Tr.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return Tr.current=i,i},isCreationTargetCleared(){return ie.current},subscribe(e){se.current.add(e);let t=zt.subscribe(e);return()=>{se.current.delete(e),t()}}}),Mr=[zt],t[212]=zt,t[213]=kr,t[214]=Mr),(0,Q.useImperativeHandle)(n,kr,Mr);let Pr;t[215]!==Cn||t[216]!==d||t[217]!==l||t[218]!==zt?(Pr=async function(e,t,n){let r=BK(e,ce.current,Yt.current),i=xe.current;i&&e.some(e=>VK(e,i))&&(i.kind===`file`?r.docNames.add(i.createdPath):r.folderPaths.add(i.createdPath),Cn(i));let a=new Set([...r.docNames,...t]),o=new Set([...r.folderPaths,...n]),s=new Set([...r.assetPaths,...e.filter(rq).map(nq)]);l([...[...a].map(tq),...[...o].map(eq),...[...s].map($K)],{force:!0}),await Promise.all([...a].map(e=>d(e)));for(let t of e){let e=t.kind===`folder`?_M(t.path):t.kind===`asset`?t.path:fM(t.path,t.docExt);zt.getItem(e)&&zt.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}j(e=>{let t=GM(e,[...a],void 0,[...s]);for(let e of o)t=GM(t,[],e);return mn(t),t}),ss([`files`,`backlinks`,`graph`])},t[215]=Cn,t[216]=d,t[217]=l,t[218]=zt,t[219]=Pr):Pr=t[219];let Fr=Pr,Ir;t[220]!==r||t[221]!==Fr?(Ir=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;U(a.path);let o=await _e(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`7JtSLi`}));if(!o.ok)return i.length>0&&await Fr(i,t,n),hs.error(o.title),!1;let s=A(Zn,o.body,`delete-path`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path),i.push(a)}return await Fr(i,t,n),!0},t[220]=r,t[221]=Fr,t[222]=Ir):Ir=t[222];let Lr=Ir,Rr;t[223]===Symbol.for(`react.memo_cache_sentinel`)?(Rr=async function(e,t,n){let r=[],i=[];for(let a of e){U(a.path);let e=XM(a,n),o=await t.shell.trashItem(e);o.ok?r.push(a):i.push({kind:a.kind,path:a.path,name:a.name,reason:yG(o.reason),detail:o.detail})}return{trashed:r,failed:i}},t[223]=Rr):Rr=t[223];let zr=Rr,Br;t[224]===r?Br=t[225]:(Br=async function(e){let t=[],n=[],i=[];for(let a of e){let e=a.kind;try{let o=await _e(await fetch(`/api/trash/cleanup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,path:a.path})}),r({id:`DVh_Tb`}));if(!o.ok){console.warn(`[FileTree] trash-cleanup failed`,{target:`${a.kind}:${a.path}`,reason:o.title}),i.push({target:a,reason:o.title});continue}let s=A(ti,o.body,`trash-cleanup`,{deletedDocNames:[]});t.push(...s.deletedDocNames),e===`folder`&&n.push(a.path)}catch(e){let t=e;console.warn(`[FileTree] trash-cleanup threw`,{target:`${a.kind}:${a.path}`,err:t}),i.push({target:a,reason:r({id:`r4R7AZ`})})}}if(i.length>0){let e=i.length;hs.error(r({id:`IrB5AK`,values:{failedCount:e}}),{description:r({id:`vEJDlt`})})}return i.length===e.length&&e.length>0?null:{deletedDocNames:t,deletedFolderPaths:n}},t[224]=r,t[225]=Br);let Vr=Br,Hr;t[226]!==r||t[227]!==J||t[228]!==Fr||t[229]!==Lr||t[230]!==Vr||t[231]!==rn||t[232]!==te?(Hr=async function(e){let t=e.map(e=>KM(e,ce.current)),n=t[0];if(!n)return;let i=J.filter(e=>t.some(t=>{if(t.kind===`file`){let n=`${t.path}${t.docExt??`.md`}`;return e.file===n}return t.kind===`folder`?e.file.startsWith(`${t.path}/`):!1}));if(i.length>0){let e=i.slice(0,3).map(QK),t=i.length>e.length?`, +${i.length-e.length} more`:``;hs.error(`Cannot delete files with unresolved conflicts`,{description:`Resolve the conflict on ${e.join(`, `)}${t} before deleting.`});return}U(n.path),G(null);let a=typeof window<`u`?window.okDesktop:void 0;try{if(a&&te){let{trashed:e,failed:n}=await zr(t,a,te);if(e.length>0){let t=await Vr(e);t?await Fr(e,t.deletedDocNames,t.deletedFolderPaths):await Fr(e,e.filter(ZK).map(XK),e.filter(YK).map(JK))}n.length>0&&q({failed:n,originalTargets:[...t]}),U(null)}else{let e=await Lr(t);U(null),e||rn()}}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] delete failed:`,t),hs.error(r({id:`0eHrMb`}),{description:n}),U(null),rn()}},t[226]=r,t[227]=J,t[228]=Fr,t[229]=Lr,t[230]=Vr,t[231]=rn,t[232]=te,t[233]=Hr):Hr=t[233];let Ur=Hr,Wr;t[234]!==r||t[235]!==Lr||t[236]!==rn||t[237]!==K?(Wr=async function(){if(!K)return;let e=new Set(K.failed.map(qK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));if(q(null),t.length!==0){U(t[0]?.path??null);try{let e=await Lr(t);U(null),e||rn()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);console.warn(`[FileTree] hard-delete fallback failed:`,t),hs.error(r({id:`0eHrMb`}),{description:n}),U(null),rn()}}},t[234]=r,t[235]=Lr,t[236]=rn,t[237]=K,t[238]=Wr):Wr=t[238];let Gr=Wr,Kr;t[239]!==Ur||t[240]!==K?(Kr=async function(){if(!K)return;let e=new Set(K.failed.map(KK)),t=K.originalTargets.filter(t=>e.has(`${t.kind}:${t.path}`));q(null),await Ur(t)},t[239]=Ur,t[240]=K,t[241]=Kr):Kr=t[241];let qr=Kr,Jr=(0,Q.useRef)(Ur),Yr;t[242]===Ur?Yr=t[243]:(Yr=()=>{Jr.current=Ur},t[242]=Ur,t[243]=Yr),(0,Q.useEffect)(Yr);let Xr,Qr;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(Xr=()=>NG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>fs(e)&&e.docName===t);Jr.current([{kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt}]);return}if(e.kind===`folder`){Jr.current([{kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath}]);return}if(e.kind===`asset`){Jr.current([{kind:`asset`,path:e.assetPath,name:e.assetPath.split(`/`).pop()??e.assetPath}]);return}console.warn(JSON.stringify({event:`file-tree-menu-action-delete-unsupported-kind`,kind:e.kind}))}),Qr=[],t[244]=Xr,t[245]=Qr):(Xr=t[244],Qr=t[245]),(0,Q.useEffect)(Xr,Qr);let ei,ni;t[246]===Symbol.for(`react.memo_cache_sentinel`)?(ei=()=>LG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=ce.current.find(e=>fs(e)&&e.docName===t);yn.current({kind:`file`,path:t,name:t.split(`/`).pop()??t,docExt:n?.docExt});return}if(e.kind===`folder`){yn.current({kind:`folder`,path:e.folderPath,name:e.folderPath.split(`/`).pop()??e.folderPath});return}console.warn(JSON.stringify({event:`file-tree-menu-action-duplicate-unsupported-kind`,kind:e.kind}))}),ni=[],t[246]=ei,t[247]=ni):(ei=t[246],ni=t[247]),(0,Q.useEffect)(ei,ni);let ri,ii;t[248]===zt?(ri=t[249],ii=t[250]):(ri=()=>FG(e=>{if(e.kind===`doc`||e.kind===`folder-index`){let t=e.docName,n=fM(t,ce.current.find(e=>fs(e)&&e.docName===t)?.docExt);zt.startRenaming(n);return}if(e.kind===`folder`){zt.startRenaming(e.folderPath);return}if(e.kind===`asset`){zt.startRenaming(e.assetPath);return}console.warn(JSON.stringify({event:`file-tree-menu-action-rename-unsupported-kind`,kind:e.kind}))}),ii=[zt],t[248]=zt,t[249]=ri,t[250]=ii),(0,Q.useEffect)(ri,ii);let ai;t[251]===Symbol.for(`react.memo_cache_sentinel`)?(ai=function(){let e=we.current;e&&sK(e),we.current=null},t[251]=ai):ai=t[251];let si=ai,li;t[252]===g?li=t[253]:(li=function(e){let t=vq(e.nativeEvent);if(!t||t.endsWith(`/`)){si();return}let n=pM(t),r=ce.current.find(e=>mM(e)===t);if(r&&Ro(r)){si();return}if(r&&fs(r)&&jr(r.size)){si();return}we.current!==n&&(si(),we.current=n,oK(n,e=>g(e)))},t[252]=g,t[253]=li);let ui=li,di;t[254]!==de||t[255]!==zt||t[256]!==D?(di=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=yq(e.nativeEvent);if(!t){Sq(e.nativeEvent)&&re(!0);return}if(t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?_M(n):n;if(zt.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=gM(r);if(window.location.hash===Uo(e))return;queueMicrotask(()=>D(e));return}let i=pM(r);window.location.hash!==Vo(i)&&queueMicrotask(()=>de(r))},t[254]=de,t[255]=zt,t[256]=D,t[257]=di):di=t[257];let fi=di,pi;t[258]===Symbol.for(`react.memo_cache_sentinel`)?(pi=function(e){IM(e.nativeEvent)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,Qe(!0))},t[258]=pi):pi=t[258];let mi=pi,hi;t[259]===Symbol.for(`react.memo_cache_sentinel`)?(hi=function(e){let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||Qe(!1)},t[259]=hi):hi=t[259];let gi=hi,_i;t[260]===or?_i=t[261]:(_i=function(e){if(!IM(e.nativeEvent))return;let t=LM(e.nativeEvent);t.length!==0&&(e.preventDefault(),e.stopPropagation(),Qe(!1),or(t,``,DK))},t[260]=or,t[261]=_i);let vi=_i;if(M){let e;return t[262]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(wq,{}),t[262]=e):e=t[262],e}let yi;t[263]!==r||t[264]!==I||t[265]!==R?(yi=I?r(R?{id:`H-vDm3`}:{id:`09Tv5j`}):null,t[263]=r,t[264]=I,t[265]=R,t[266]=yi):yi=t[266];let bi=yi;if(k.length===0){if(bi!==null){let e;return t[267]===bi?e=t[268]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`status`,className:`select-none text-sidebar-foreground/50 text-sm`,children:bi})}),t[267]=bi,t[268]=e),e}if(P){let e;return t[269]===P?e=t[270]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{role:`alert`,className:`select-none text-sidebar-foreground/50 text-sm`,children:P})}),t[269]=P,t[270]=e),e}let e;t[271]===r?e=t[272]:(e=r({id:`5ZB7XC`}),t[271]=r,t[272]=e);let n=Ze&&`bg-primary/5 ring-2 ring-primary/70 ring-inset`,i;t[273]===n?i=t[274]:(i=oi(`flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8`,n),t[273]=n,t[274]=i);let a;t[275]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:(0,Z.jsx)(s,{id:`xiv-dW`})}),t[275]=a):a=t[275];let o;t[276]===ur?o=t[277]:(o=()=>ur(`file`,``),t[276]=ur,t[277]=o);let c;t[278]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(s,{id:`6ibbCg`}),t[278]=c):c=t[278];let l;t[279]===o?l=t[280]:(l=(0,Z.jsx)(ci,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:o,children:c}),t[279]=o,t[280]=l);let u;return t[281]!==vi||t[282]!==e||t[283]!==i||t[284]!==l?(u=(0,Z.jsxs)(`section`,{"aria-label":e,className:i,onDragOver:mi,onDragLeave:gi,onDrop:vi,children:[a,l]}),t[281]=vi,t[282]=e,t[283]=i,t[284]=l,t[285]=u):u=t[285],u}let xi=H!==null,Si=W?.targets[0]??null,Ci=null;if(B!==null){let e;if(t[286]!==a.locale||t[287]!==B){let n=new Intl.NumberFormat(a.locale).format(B);e=ms._({id:`LuoJWu`,values:{truncatedShownCount:B,formattedCount:n}}),t[286]=a.locale,t[287]=B,t[288]=e}else e=t[288];Ci=e}let wi;t[289]!==P||t[290]!==bi||t[291]!==Ci?(wi=(P||bi!==null||Ci!==null)&&(0,Z.jsxs)(Z.Fragment,{children:[bi===null?P&&(0,Z.jsx)(Eq,{kind:`error`,children:P}):(0,Z.jsx)(Eq,{kind:`reconnecting`,children:bi}),Ci!==null&&(0,Z.jsx)(Eq,{kind:`info`,children:Ci})]}),t[289]=P,t[290]=bi,t[291]=Ci,t[292]=wi):wi=t[292];let Ti;t[293]===y?Ti=t[294]:(Ti=FW(y),t[293]=y,t[294]=Ti);let Ei=X?``:void 0,Di;t[295]===Ei?Di=t[296]:(Di={[AK]:Ei},t[295]=Ei,t[296]=Di);let Oi;t[297]!==xi||t[298]!==ge||t[299]!==mr||t[300]!==k||t[301]!==fr||t[302]!==Jt||t[303]!==vn||t[304]!==Tt||t[305]!==Ot||t[306]!==zt||t[307]!==Et||t[308]!==Dt||t[309]!==ur||t[310]!==te?(Oi=(e,t)=>(0,Z.jsx)(HK,{item:e,context:t,anyActionBusy:xi,workspace:te,handoff:Tt,model:zt,okignoreBinding:Et,projectLocalBinding:Dt,mergedConfig:Ot,onStartCreating:ur,onCreateFromTemplate:(e,t)=>ur(`file`,e,{template:t}),onDuplicate:vn,onDelete:e=>G({targets:e}),onExpandSubtree:fr,onCollapseSubtree:mr,folderTreePaths:Jt,isAsset:ge.has(e.path),documents:k}),t[297]=xi,t[298]=ge,t[299]=mr,t[300]=k,t[301]=fr,t[302]=Jt,t[303]=vn,t[304]=Tt,t[305]=Ot,t[306]=zt,t[307]=Et,t[308]=Dt,t[309]=ur,t[310]=te,t[311]=Oi):Oi=t[311];let ki;t[312]!==fi||t[313]!==ui||t[314]!==zt||t[315]!==wi||t[316]!==Ti||t[317]!==Di||t[318]!==Oi?(ki=(0,Z.jsx)(`div`,{ref:Ge,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(kW,{header:wi,model:zt,style:Ti,...Di,onClickCapture:fi,onMouseMove:ui,onMouseLeave:si,renderContextMenu:Oi})}),t[312]=fi,t[313]=ui,t[314]=zt,t[315]=wi,t[316]=Ti,t[317]=Di,t[318]=Oi,t[319]=ki):ki=t[319];let Ai=!!W,ji;t[320]===H?ji=t[321]:(ji=e=>{!e&&!H&&G(null)},t[320]=H,t[321]=ji);let Mi;t[322]!==r||t[323]!==H||t[324]!==W||t[325]!==Ur||t[326]!==Si?(Mi=W&&Si&&(0,Z.jsx)(Ra,{...(()=>{let e=hG(typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,W.targets);if(e)return{customTitle:e.title,customDescription:``,customDetail:e.detail,customConfirmLabel:e.confirmLabel,customConfirmLabelBusy:e.confirmLabelBusy,children:e.listedTargets?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 font-mono text-foreground text-xs`,children:e.listedTargets.map(GK)}):null};let t=W.targets.length,n=Si.name;return{itemName:t===1?Si.kind===`folder`?`${Si.name}/`:Si.kind===`file`?`${Si.name}${Si.docExt??`.md`}`:Si.name:void 0,customTitle:t>1?r({id:`abiHje`}):void 0,customDescription:t>1?r({id:`WMIKXK`,values:{targetCount:t}}):Si.kind===`folder`?r({id:`a5W0q0`,values:{folderName:n}}):void 0}})(),isSubmitting:H!==null,onDelete:()=>Ur(W.targets)}),t[322]=r,t[323]=H,t[324]=W,t[325]=Ur,t[326]=Si,t[327]=Mi):Mi=t[327];let Ni;t[328]!==Ai||t[329]!==ji||t[330]!==Mi?(Ni=(0,Z.jsx)(Oo,{open:Ai,onOpenChange:ji,children:Mi}),t[328]=Ai,t[329]=ji,t[330]=Mi,t[331]=Ni):Ni=t[331];let Fi=!!K,Ii;t[332]===H?Ii=t[333]:(Ii=e=>{!e&&!H&&q(null)},t[332]=H,t[333]=Ii);let Li;t[334]!==H||t[335]!==Gr||t[336]!==qr||t[337]!==K?(Li=K&&(0,Z.jsx)(CG,{failedTargets:K.failed,isSubmitting:H!==null,onDeletePermanently:Gr,onRetry:qr,onCancel:()=>q(null)}),t[334]=H,t[335]=Gr,t[336]=qr,t[337]=K,t[338]=Li):Li=t[338];let Ri;t[339]!==Fi||t[340]!==Ii||t[341]!==Li?(Ri=(0,Z.jsx)(Oo,{open:Fi,onOpenChange:Ii,children:Li}),t[339]=Fi,t[340]=Ii,t[341]=Li,t[342]=Ri):Ri=t[342];let zi=ee!==null,Bi;t[343]===Symbol.for(`react.memo_cache_sentinel`)?(Bi=e=>{e||Y(null)},t[343]=Bi):Bi=t[343];let Vi=ee?.parentDir??``,Hi;t[344]!==zi||t[345]!==Vi?(Hi=(0,Z.jsx)(zh,{open:zi,onOpenChange:Bi,kind:`file`,initialDir:Vi,defaultToTemplate:!0}),t[344]=zi,t[345]=Vi,t[346]=Hi):Hi=t[346];let Ui;return t[347]!==ki||t[348]!==Ni||t[349]!==Ri||t[350]!==Hi?(Ui=(0,Z.jsxs)(Z.Fragment,{children:[ki,Ni,Ri,Hi]}),t[347]=ki,t[348]=Ni,t[349]=Ri,t[350]=Hi,t[351]=Ui):Ui=t[351],Ui}function GK(e){return(0,Z.jsx)(`li`,{"data-testid":`delete-target-row`,children:gG(e)},`${e.kind}:${e.path}`)}function KK(e){return`${e.kind}:${e.path}`}function qK(e){return`${e.kind}:${e.path}`}function JK(e){return e.path}function YK(e){return e.kind===`folder`}function XK(e){return e.path}function ZK(e){return e.kind===`file`}function QK(e){return e.file}function $K(e){return Lt(e)}function eq(e){return Ct(e)}function tq(e){return He(e)}function nq(e){return e.path}function rq(e){return e.kind===`asset`}function iq(e){return e.endsWith(`/`)?e.slice(0,-1):e}function aq(e){return!!e}function oq(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function sq(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function cq(e){hs.error(e)}function lq(){}function uq(e){return hs.error(e)}function dq(){}function fq(){}function pq(){}function mq(){}function hq(){}async function gq(){}function _q(e){return mM(e)}function vq(e){return yq(e)?.dataset.itemPath??null}function yq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}function bq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-root]`))return t;return null}function xq(e){let t=yq(e);if(t){let e=t.dataset.itemPath;if(!e)return null;let n=t.dataset.itemType===`folder`,r=NM(e,n);return{parentDir:r,row:t,root:null,busyPath:n?_M(r):e}}return Sq(e)?{parentDir:``,row:null,root:bq(e),busyPath:DK}:null}function Sq(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.matches(`[data-file-tree-virtualized-scroll]`))return!0;return!1}var Cq=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function wq(){let e=(0,$.c)(5),{_:t}=i(),n;e[0]===t?n=e[1]:(n=t({id:`5Tk8Fb`}),e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=Cq.map(Tq),e[2]=r):r=e[2];let a;return e[3]===n?a=e[4]:(a=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":n,children:r}),e[3]=n,e[4]=a),a}function Tq(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(za,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(za,{className:`h-3 ${e}`})]},t)}function Eq(e){let t=(0,$.c)(14),{kind:n,children:r}=e,i=n===`error`?Lo:n===`reconnecting`?$a:Ao,a=n===`error`?`alert`:`status`,o=n===`error`?`text-destructive`:`text-muted-foreground`,s;t[0]===o?s=t[1]:(s=oi(`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug`,o),t[0]=o,t[1]=s);let c=n===`reconnecting`&&`animate-spin motion-reduce:animate-none`,l;t[2]===c?l=t[3]:(l=oi(`mt-0.5 size-3.5 shrink-0`,c),t[2]=c,t[3]=l);let u;t[4]!==i||t[5]!==l?(u=(0,Z.jsx)(i,{"aria-hidden":`true`,className:l}),t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=(0,Z.jsx)(`span`,{className:`min-w-0`,children:r}),t[7]=r,t[8]=d);let f;return t[9]!==a||t[10]!==s||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`span`,{role:a,className:s,children:[u,d]}),t[9]=a,t[10]=s,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Dq(e){return e?ms._({id:`wTcjov`}):null}function Oq(e){let t=(0,$.c)(23),{_:n}=i(),r=mg(),a=qx();if(r)return null;let{input:o,installStates:c,dispatch:l}=e,u=o===null,d,f,p,m,h,g;if(t[0]!==n||t[1]!==l||t[2]!==o||t[3]!==u||t[4]!==c||t[5]!==a){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Dq(u),r;t[12]===c?r=t[13]:(r=e=>c[e.id]?.installed===!0,t[12]=c,t[13]=r);let i=_g.filter(r),_=i.length>0,v=a!==null;if(!_&&!v){g=null;break bb0}f=aN,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsxs)(cN,{children:[(0,Z.jsx)(yi,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`O7_W_a`})]}),t[14]=h):h=t[14],d=lN,p=_?(0,Z.jsxs)(iN,{"aria-label":n({id:`BBqGS9`}),children:[(0,Z.jsx)(dN,{children:(0,Z.jsx)(s,{id:`BBqGS9`})}),i.map(t=>{let r=!u,{displayName:i}=t,a=n(e?{id:`1ZpfyB`,values:{displayName:i,hint:e}}:{id:`WqLq6M`,values:{displayName:i}});return(0,Z.jsxs)(sN,{disabled:!r,onSelect:()=>{o&&l(t.id,o)},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Z.jsx)(Wx,{id:t.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:t.displayName}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]}):null,m=v?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(fN,{}):null,(0,Z.jsxs)(iN,{"aria-label":n({id:`ALhMYW`}),children:[(0,Z.jsx)(dN,{children:(0,Z.jsx)(s,{id:`ALhMYW`})}),(0,Z.jsxs)(sN,{onSelect:()=>{o!==null&&a.launchInTerminal(o)},disabled:u,"data-testid":`empty-space-open-in-terminal`,"aria-label":n(e?{id:`LtVw4J`,values:{hint:e}}:{id:`AcK_r0`}),children:[(0,Z.jsx)(ru,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`fcgvCA`})}),e?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]})]})]}):null}t[0]=n,t[1]=l,t[2]=o,t[3]=u,t[4]=c,t[5]=a,t[6]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g}else d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[15]!==d||t[16]!==p||t[17]!==m?(_=(0,Z.jsxs)(d,{children:[p,m]}),t[15]=d,t[16]=p,t[17]=m,t[18]=_):_=t[18];let v;return t[19]!==f||t[20]!==h||t[21]!==_?(v=(0,Z.jsxs)(f,{children:[h,_]}),t[19]=f,t[20]=h,t[21]=_,t[22]=v):v=t[22],v}var kq=(e,t,n)=>yu(e,t,n,`ProjectSwitcher`);function Aq(e){let t=(0,$.c)(96),{bridge:n}=e,{_:r}=i(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[0]=a):a=t[0];let[o,c]=(0,Q.useState)(a),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),h=FA(),g=typeof window<`u`&&window.okDesktop!=null,_=(0,Q.useRef)(!1),v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e),e||f(``)},t[1]=v):v=t[1];let y=v,b;t[2]!==r||t[3]!==n.project||t[4]!==l?(b=()=>{if(!l)return;let e=!1;return kq(async()=>{let t=await n.project.listRecent();e||c(t)},r({id:`fYKgzG`})),()=>{e=!0}},t[2]=r,t[3]=n.project,t[4]=l,t[5]=b):b=t[5];let x;t[6]!==r||t[7]!==n||t[8]!==l?(x=[l,n,r],t[6]=r,t[7]=n,t[8]=l,t[9]=x):x=t[9],(0,Q.useEffect)(b,x);let S;t[10]!==r||t[11]!==n.project?(S=e=>{u(!1),kq(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),r({id:`SUOoXn`}))},t[10]=r,t[11]=n.project,t[12]=S):S=t[12];let C=S,w;t[13]!==r||t[14]!==n.dialog||t[15]!==n.project?(w=()=>{u(!1),kq(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},r({id:`gmJ0An`}))},t[13]=r,t[14]=n.dialog,t[15]=n.project,t[16]=w):w=t[16];let E=w,D;t[17]!==r||t[18]!==n.navigator?(D=()=>{u(!1),kq(()=>n.navigator.open(),r({id:`jol95m`}))},t[17]=r,t[18]=n.navigator,t[19]=D):D=t[19];let O=D,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(!1),m(!0)},t[20]=k):k=t[20];let A=k,j=n.config.projectPath,M,N,P,F,I,L,z,B,H,U,W;if(t[21]!==r||t[22]!==h||t[23]!==n.config.projectName||t[24]!==n.config.projectPath||t[25]!==j||t[26]!==l||t[27]!==C||t[28]!==o||t[29]!==d){let e;t[41]===j?e=t[42]:(e=e=>e.path!==j,t[41]=j,t[42]=e);let i=o.filter(e),a=d.trim().toLowerCase(),c=a?i.filter(e=>e.name.toLowerCase().includes(a)||e.path.toLowerCase().includes(a)):i;N=ao,z=l,B=y,H=!1;let u=h!==null&&`h-auto py-1.5`,p;t[43]===u?p=t[44]:(p=oi(`justify-between text-sidebar-foreground/70 hover:text-sidebar-foreground! data-open:hover:text-sidebar-foreground!`,u),t[43]=u,t[44]=p);let m;t[45]===r?m=t[46]:(m=r({id:`zZ_I5K`}),t[45]=r,t[46]=m);let v;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(v=g?()=>{_.current=!0}:void 0,t[47]=v):v=t[47];let b;t[48]===l?b=t[49]:(b=g?()=>{if(_.current){_.current=!1;return}y(!l)}:void 0,t[48]=l,t[49]=b);let x;t[50]===n.config.projectName?x=t[51]:(x=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[50]=n.config.projectName,t[51]=x);let S;t[52]===h?S=t[53]:(S=h===null?null:(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-sidebar-foreground/50 group-hover/menu-button:text-sidebar-foreground`,"data-testid":`project-switcher-branch`,children:[(0,Z.jsx)(Oe,{"aria-hidden":`true`,className:`size-3! shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:h})]}),t[52]=h,t[53]=S);let w;t[54]!==x||t[55]!==S?(w=(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[x,S]}),t[54]=x,t[55]=S,t[56]=w):w=t[56];let E;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(cl,{"aria-hidden":`true`,className:`opacity-60`}),t[57]=E):E=t[57],t[58]!==n.config.projectPath||t[59]!==p||t[60]!==m||t[61]!==b||t[62]!==w?(U=(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsxs)(kA,{className:p,"data-testid":`project-switcher-trigger`,"aria-label":m,title:n.config.projectPath,onPointerDown:v,onClick:b,children:[w,E]})}),t[58]=n.config.projectPath,t[59]=p,t[60]=m,t[61]=b,t[62]=w,t[63]=U):U=t[63],M=eo,W=`start`,P=`top`,F=`min-w-[260px]`,I=`project-switcher-menu`,L=i.length===0?(0,Z.jsx)(Ja,{className:`font-normal text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`HNnVG1`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(YC,{className:`mb-1 h-8 border-0 shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,Z.jsx)(ew,{"aria-label":r({id:`H8Ng4Z`}),placeholder:r({id:`8S1E33`}),value:d,onChange:e=>f(e.target.value),onKeyDown:jq,"data-testid":`project-switcher-search`}),(0,Z.jsx)(ZC,{children:(0,Z.jsx)(T,{"aria-hidden":`true`})})]}),(0,Z.jsx)(no,{}),c.length===0?(0,Z.jsx)(Ja,{className:`font-normal text-muted-foreground text-xs`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(s,{id:`pEQFsW`})}):(0,Z.jsx)(`div`,{className:`max-h-64 overflow-x-hidden overflow-y-auto overscroll-contain subtle-scrollbar scroll-fade-mask`,children:c.slice(0,10).map(e=>(0,Z.jsxs)(Ea,{disabled:e.missing,onSelect:()=>C(e.path),className:`flex w-full min-w-0 flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,title:e.name,children:e.name}),(0,Z.jsxs)(`span`,{className:`w-full truncate text-muted-foreground text-xs`,title:e.path,children:[e.path,e.missing?r({id:`2Znqb1`}):``]})]},e.path))})]}),t[21]=r,t[22]=h,t[23]=n.config.projectName,t[24]=n.config.projectPath,t[25]=j,t[26]=l,t[27]=C,t[28]=o,t[29]=d,t[30]=M,t[31]=N,t[32]=P,t[33]=F,t[34]=I,t[35]=L,t[36]=z,t[37]=B,t[38]=H,t[39]=U,t[40]=W}else M=t[30],N=t[31],P=t[32],F=t[33],I=t[34],L=t[35],z=t[36],B=t[37],H=t[38],U=t[39],W=t[40];let G;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(no,{}),t[64]=G):G=t[64];let K,q;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Z.jsx)(re,{"aria-hidden":`true`,className:`text-muted-foreground`}),q=(0,Z.jsx)(s,{id:`PVUn_c`}),t[65]=K,t[66]=q):(K=t[65],q=t[66]);let J;t[67]===E?J=t[68]:(J=(0,Z.jsxs)(Ea,{onSelect:E,"data-testid":`project-switcher-open-folder`,children:[K,q]}),t[67]=E,t[68]=J);let ee,Y;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(R,{"aria-hidden":`true`,className:`text-muted-foreground`}),Y=(0,Z.jsx)(s,{id:`xaDWAI`}),t[69]=ee,t[70]=Y):(ee=t[69],Y=t[70]);let te;t[71]===O?te=t[72]:(te=(0,Z.jsxs)(Ea,{onSelect:O,"data-testid":`project-switcher-switch-project`,children:[ee,Y]}),t[71]=O,t[72]=te);let ne;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsxs)(Ea,{onSelect:A,"data-testid":`project-switcher-new-project`,children:[(0,Z.jsx)(V,{"aria-hidden":`true`,className:`text-muted-foreground`}),(0,Z.jsx)(s,{id:`gKi-a_`})]}),t[73]=ne):ne=t[73];let X;t[74]!==M||t[75]!==P||t[76]!==F||t[77]!==I||t[78]!==L||t[79]!==J||t[80]!==te||t[81]!==W?(X=(0,Z.jsxs)(M,{align:W,side:P,className:F,"data-testid":I,children:[L,G,J,te,ne]}),t[74]=M,t[75]=P,t[76]=F,t[77]=I,t[78]=L,t[79]=J,t[80]=te,t[81]=W,t[82]=X):X=t[82];let ie;t[83]!==N||t[84]!==z||t[85]!==B||t[86]!==H||t[87]!==U||t[88]!==X?(ie=(0,Z.jsxs)(N,{open:z,onOpenChange:B,modal:H,children:[U,X]}),t[83]=N,t[84]=z,t[85]=B,t[86]=H,t[87]=U,t[88]=X,t[89]=ie):ie=t[89];let ae;t[90]!==n||t[91]!==p?(ae=(0,Z.jsx)(hf,{open:p,onOpenChange:m,bridge:n}),t[90]=n,t[91]=p,t[92]=ae):ae=t[92];let oe;return t[93]!==ie||t[94]!==ae?(oe=(0,Z.jsxs)(Z.Fragment,{children:[ie,ae]}),t[93]=ie,t[94]=ae,t[95]=oe):oe=t[95],oe}function jq(e){return e.stopPropagation()}function Mq(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),Fn(`sidebarSearchPill`)}function Nq(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=oi(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(T,{"aria-hidden":`true`}),t[2]=a):a=t[2];let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:(0,Z.jsx)(s,{id:`A1taO8`})}),t[3]=o):o=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Jt,{className:`text-foreground/70`,children:tc(`command-palette`)}),t[4]=c):c=t[4];let l;return t[5]!==n||t[6]!==i?(l=(0,Z.jsxs)(ci,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,c]}),t[5]=n,t[6]=i,t[7]=l):l=t[7],l}function Pq(e){let t=(0,$.c)(37),{notice:n,onDismiss:r}=e,{_:a}=i(),o=n.variant===`error`?`border-destructive/60 bg-sidebar-accent/30 text-muted-foreground`:n.variant===`success`?`border-emerald-500/40 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground`,s;t[0]!==a||t[1]!==n.dismissible||t[2]!==r?(s=n.dismissible===!1?null:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":a({id:`GUYwCr`}),onClick:r,children:(0,Z.jsx)(gs,{"aria-hidden":`true`,className:`size-3`})}),t[0]=a,t[1]=n.dismissible,t[2]=r,t[3]=s):s=t[3];let c=s,l=`shrink-0 text-xs font-medium underline underline-offset-2 ${n.variant===`success`?`decoration-emerald-500/40`:`decoration-muted-foreground/40`} hover:text-sidebar-foreground hover:decoration-sidebar-foreground`;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border px-2 py-2 text-xs ${o}`,i;t[4]===n.body?i=t[5]:(i=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[4]=n.body,t[5]=i);let a;t[6]!==c||t[7]!==i?(a=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[i,c]}),t[6]=c,t[7]=i,t[8]=a):a=t[8];let s;t[9]!==l||t[10]!==n.action?(s=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[9]=l,t[10]=n.action,t[11]=s):s=t[11];let u;t[12]===n.secondaryAction?u=t[13]:(u=()=>{n.secondaryAction?.onClick()},t[12]=n.secondaryAction,t[13]=u);let d;t[14]!==l||t[15]!==n.secondaryAction.label||t[16]!==u?(d=(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:u,children:n.secondaryAction.label}),t[14]=l,t[15]=n.secondaryAction.label,t[16]=u,t[17]=d):d=t[17];let f;t[18]!==s||t[19]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[s,d]}),t[18]=s,t[19]=d,t[20]=f):f=t[20];let p;return t[21]!==e||t[22]!==r||t[23]!==a||t[24]!==f?(p=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[a,f]}),t[21]=e,t[22]=r,t[23]=a,t[24]=f,t[25]=p):p=t[25],p}let u=`update-notice-${n.id}`,d=`flex items-center gap-2 rounded-md border px-2 py-1.5 text-xs ${o}`,f;t[26]===n.body?f=t[27]:(f=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[26]=n.body,t[27]=f);let p;t[28]!==l||t[29]!==n.action?(p=n.action?(0,Z.jsx)(`button`,{type:`button`,className:l,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[28]=l,t[29]=n.action,t[30]=p):p=t[30];let m;return t[31]!==c||t[32]!==u||t[33]!==d||t[34]!==f||t[35]!==p?(m=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":u,className:d,children:[f,p,c]}),t[31]=c,t[32]=u,t[33]=d,t[34]=f,t[35]=p,t[36]=m):m=t[36],m}function Fq(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function Iq(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Hm,Vm,Vm),n;e[0]===t?n=e[1]:(n=Fq(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r?i=e[3]:(i=()=>{r.onDismiss?.(),Bm(r.id)},e[2]=r,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(Pq,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function Lq(e,t,n){return e?.kind===`doc`&&t||e?.kind===`folder-index`&&t?Qg(n.contentDir,$g(t),n.pathSeparator):e?.kind===`folder`?Qg(n.contentDir,e.folderPath,n.pathSeparator):e?.kind===`asset`?Qg(n.contentDir,e.assetPath,n.pathSeparator):n.contentDir}function Rq(e,t){return(e?.kind===`doc`||e?.kind===`folder-index`)&&t?$g(t):e?.kind===`folder`?e.folderPath:e?.kind===`asset`?e.assetPath:``}function zq(e,t,n){return e===null?t_({workspace:n}):e.kind===`folder`?n?i_({folderRelativePath:e.folderPath,workspace:n}):null:e.kind===`doc`||e.kind===`folder-index`?e_({docName:t,workspace:n}):null}var Bq={folderCount:0,expandedCount:0},Vq=`button, [role="button"], [role="menuitem"], input, textarea, select, a[href]`;function Hq(e){return typeof Element>`u`||!(e instanceof Element)?!1:e.closest(Vq)!==null}function Uq(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(Wt,{name:`file-sidebar`,children:(0,Z.jsx)(Gq,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var Wq=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(js,{asChild:!0,children:(0,Z.jsx)(ci,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(Ns,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(Is,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function Gq(e){let t=(0,$.c)(178),{onOpenSearch:n}=e,{_:r}=i(),[a,o]=(0,Q.useState)(null),{activeDocName:c,activeTarget:l}=mt(),u;t[0]!==c||t[1]!==l?(u=l?.kind===`folder`||l?.kind===`folder-index`?l.folderPath:ps(c),t[0]=c,t[1]=l,t[2]=u):u=t[2];let d=u,[f,p]=(0,Q.useState)(!1),m=f?``:d,h=typeof window<`u`&&window.okDesktop!=null,{state:g,toggleSidebar:_}=hA(),v=mg(),y=g===`expanded`,b=h&&g===`collapsed`,[x,S]=(0,Q.useState)(Bq),C,w;t[3]===a?(C=t[4],w=t[5]):(C=()=>{if(a===null)return;let e=()=>{S(a.getFolderState()),p(a.isCreationTargetCleared())};return e(),a.subscribe(e)},w=[a],t[3]=a,t[4]=C,t[5]=w),(0,Q.useEffect)(C,w);let T,E;t[6]===a?(T=t[7],E=t[8]):(T=()=>{if(a!==null)return IS(e=>{let t=e.initialDir??``;if(e.template){a.createFromTemplate(e.template.folder,e.template.name);return}a.startCreating(`file`,t)})},E=[a],t[6]=a,t[7]=T,t[8]=E),(0,Q.useEffect)(T,E);let D=x.folderCount>0,O=D&&x.expandedCount===x.folderCount,k=x.expandedCount===0,A=Di(``),j=Di(m===``?null:m),M=m===``?A:j,N=A.state.status===`ready`?(A.state.data.folder.templates_available?.length??0)>0:!0,P=M.state.status===`ready`?(M.state.data.folder.templates_available?.length??0)>0:!0,F=typeof window<`u`?window.okDesktop:void 0,I=po(),L=O_().states,{dispatch:R}=__(),z;t[9]===I?z=t[10]:(z=t_({workspace:I}),t[9]=I,t[10]=z);let B=z,{projectLocalBinding:V,merged:H}=ae(),U=H?.appearance?.sidebar?.showHiddenFiles??!1,W=D&&!O,G=D&&!k,K=W||G,q=qq,J;t[11]!==a||t[12]!==I?(J=()=>{I&&a?.startCreating(`file`,``)},t[11]=a,t[12]=I,t[13]=J):J=t[13];let ee=J,Y;t[14]!==a||t[15]!==I?(Y=e=>{I&&a?.createFromTemplate(``,e)},t[14]=a,t[15]=I,t[16]=Y):Y=t[16];let te=Y,ne;t[17]!==a||t[18]!==I?(ne=()=>{I&&a?.startCreating(`folder`,``)},t[17]=a,t[18]=I,t[19]=ne):ne=t[19];let X=ne,ie;t[20]===I?ie=t[21]:(ie=()=>{!I||!F||F.shell.showItemInFolder(I.contentDir)},t[20]=I,t[21]=ie);let oe=ie,se;t[22]!==r||t[23]!==I?(se=async()=>{if(I)try{await navigator.clipboard.writeText(I.contentDir),hs.success(r({id:`6_ZOw4`}),{description:I.contentDir})}catch(e){console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))}},t[22]=r,t[23]=I,t[24]=se):se=t[24];let le=se,ue;t[25]!==r||t[26]!==V?(ue=e=>{if(V===null)return;let t=V.patch({appearance:{sidebar:{showHiddenFiles:e}}});t.ok||(console.warn(`[FileSidebar] showHiddenFiles toggle rejected:`,Br(t.error)),hs.error(r({id:`P47EWZ`}),{description:Br(t.error)}))},t[25]=r,t[26]=V,t[27]=ue):ue=t[27];let de=ue,fe;t[28]===a?fe=t[29]:(fe=()=>{a?.expandAll()},t[28]=a,t[29]=fe);let pe=fe,me;t[30]===a?me=t[31]:(me=()=>{a?.collapseAll()},t[30]=a,t[31]=me);let he=me,ge,_e;t[32]!==G||t[33]!==W||t[34]!==U||t[35]!==g?(ge=()=>{F&&F.editor.notifyViewMenuStateChanged({showHiddenFiles:U,canExpandAll:W,canCollapseAll:G,sidebarVisible:g===`expanded`})},_e=[F,U,W,G,g],t[32]=G,t[33]=W,t[34]=U,t[35]=g,t[36]=ge,t[37]=_e):(ge=t[36],_e=t[37]),(0,Q.useEffect)(ge,_e);let ve,ye;t[38]!==r||t[39]!==c||t[40]!==l||t[41]!==R||t[42]!==L||t[43]!==m||t[44]!==V||t[45]!==U||t[46]!==_||t[47]!==a||t[48]!==I?(ve=()=>{if(F)return F.onMenuAction(e=>{switch(e){case`new-doc`:if(!I||!a)return;a.startCreating(`file`,m);return;case`new-folder`:if(!I||!a)return;a.startCreating(`folder`,m);return;case`new-from-template`:if(!I||!a)return;a.startCreatingFromTemplate(m);return;case`rename`:if(!l)return;PG(l);return;case`duplicate`:if(!l)return;IG(l);return;case`move-to-trash`:if(!l)return;MG(l);return;case`reveal-in-finder`:{if(!F||!I)return;let e=Lq(l,c,I);F.shell.showItemInFolder(e);return}case`send-to-ai`:{let e=_g.filter(e=>L[e.id]?.installed===!0);if(e.length===0){hs.error(r({id:`LKOLNn`}));return}let t=zq(l,c,I);if(!t)return;let[n]=e;if(!n)return;R(n.id,t);return}case`copy-full-path`:{if(!I)return;let e=Lq(l,c,I);navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`6_ZOw4`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`vfRlCI`}))});return}case`copy-relative-path`:{let e=Rq(l,c);if(e===``){hs.error(r({id:`74eHt-`}));return}navigator.clipboard.writeText(e).then(()=>hs.success(r({id:`haHgQj`}),{description:e})).catch(e=>{console.warn(`[FileSidebar] clipboard write failed:`,e),hs.error(r({id:`5QGTaA`}))});return}case`toggle-show-hidden-files`:{if(V===null)return;let e=V.patch({appearance:{sidebar:{showHiddenFiles:!U}}});e.ok||(console.warn(`[FileSidebar] toggle-show-hidden-files rejected:`,Br(e.error)),hs.error(r({id:`P47EWZ`}),{description:Br(e.error)}));return}case`expand-all-tree`:a?.expandAll();return;case`collapse-all-tree`:a?.collapseAll();return;case`toggle-sidebar`:_();return;case`delete`:case`toggle-source`:case`save-version`:case`version-history`:case`focus-search`:case`focus-command-palette`:case`close-active-tab-or-window`:case`toggle-doc-panel`:return}})},ye=[F,a,I,l,c,m,V,U,L,R,_,r],t[38]=r,t[39]=c,t[40]=l,t[41]=R,t[42]=L,t[43]=m,t[44]=V,t[45]=U,t[46]=_,t[47]=a,t[48]=I,t[49]=ve,t[50]=ye):(ve=t[49],ye=t[50]),(0,Q.useEffect)(ve,ye);let be=h&&y&&`motion-safe:delay-100`,xe=b&&`opacity-0`,Se;t[51]!==be||t[52]!==xe?(Se=oi(`flex-row h-12 items-center py-0 px-3`,`justify-between`,h&&`overflow-x-clip`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,be,xe,h&&`[-webkit-app-region:drag]`),t[51]=be,t[52]=xe,t[53]=Se):Se=t[53];let Ce;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=h?(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`sidebar-traffic-light-reserve`,className:`w-[var(--ok-titlebar-reserve-left,0px)] shrink-0 self-stretch`}):null,t[54]=Ce):Ce=t[54];let we;t[55]===y?we=t[56]:(we=y&&!h?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:(0,Z.jsx)(s,{id:`sER-bs`})}):null,t[55]=y,t[56]=we);let Te;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Te=oi(`flex items-center gap-1`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[57]=Te):Te=t[57];let Ee;t[58]!==r||t[59]!==O||t[60]!==D||t[61]!==k||t[62]!==a?(Ee=D?(0,Z.jsxs)(ao,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(Wq,{icon:Ml,label:r({id:`Rq1vFD`})})}),(0,Z.jsxs)(eo,{align:`end`,children:[O?null:(0,Z.jsxs)(Ea,{onSelect:()=>a?.expandAll(),children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}),k?null:(0,Z.jsxs)(Ea,{onSelect:()=>a?.collapseAll(),children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]})]})]}):null,t[58]=r,t[59]=O,t[60]=D,t[61]=k,t[62]=a,t[63]=Ee):Ee=t[63];let De;t[64]===r?De=t[65]:(De=r({id:`HdkSiO`}),t[64]=r,t[65]=De);let Oe;t[66]!==m||t[67]!==a?(Oe=()=>a?.startCreating(`file`,m),t[66]=m,t[67]=a,t[68]=Oe):Oe=t[68];let ke;t[69]!==De||t[70]!==Oe?(ke=(0,Z.jsx)(Wq,{icon:nu,label:De,onClick:Oe}),t[69]=De,t[70]=Oe,t[71]=ke):ke=t[71];let Ae;t[72]!==r||t[73]!==P||t[74]!==m||t[75]!==a?(Ae=P?(0,Z.jsxs)(ao,{children:[(0,Z.jsx)(ja,{asChild:!0,children:(0,Z.jsx)(Wq,{icon:Ta,label:r({id:`Uuj_R4`})})}),(0,Z.jsx)(eo,{align:`end`,children:(0,Z.jsx)(TG,{parentDir:m,onSelectTemplate:e=>a?.createFromTemplate(m,e),ItemComponent:Ea})})]}):null,t[72]=r,t[73]=P,t[74]=m,t[75]=a,t[76]=Ae):Ae=t[76];let je;t[77]===r?je=t[78]:(je=r({id:`96G6Re`}),t[77]=r,t[78]=je);let Me;t[79]!==m||t[80]!==a?(Me=()=>a?.startCreating(`folder`,m),t[79]=m,t[80]=a,t[81]=Me):Me=t[81];let Ne;t[82]!==je||t[83]!==Me?(Ne=(0,Z.jsx)(Wq,{icon:Cl,label:je,onClick:Me}),t[82]=je,t[83]=Me,t[84]=Ne):Ne=t[84];let Pe;t[85]!==Ee||t[86]!==ke||t[87]!==Ae||t[88]!==Ne?(Pe=(0,Z.jsxs)(`div`,{"data-testid":`sidebar-toolbar`,className:Te,children:[Ee,ke,Ae,Ne]}),t[85]=Ee,t[86]=ke,t[87]=Ae,t[88]=Ne,t[89]=Pe):Pe=t[89];let Fe;t[90]!==Se||t[91]!==we||t[92]!==Pe?(Fe=(0,Z.jsxs)(CA,{"data-electron-drag":h?``:void 0,className:Se,children:[Ce,we,Pe]}),t[90]=Se,t[91]=we,t[92]=Pe,t[93]=Fe):Fe=t[93];let Ie=h&&y&&`motion-safe:delay-100`,Le=b&&`opacity-0`,Re;t[94]!==Ie||t[95]!==Le?(Re=oi(`px-2 pb-2`,h&&`[-webkit-app-region:no-drag]`,h&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,Ie,Le),t[94]=Ie,t[95]=Le,t[96]=Re):Re=t[96];let ze;t[97]===g?ze=t[98]:(ze=[g],t[97]=g,t[98]=ze);let Be;t[99]===n?Be=t[100]:(Be=(0,Z.jsx)(Nq,{onClick:n}),t[99]=n,t[100]=Be);let Ve;t[101]!==ze||t[102]!==Be?(Ve=(0,Z.jsx)(ce,{fallbackRender:Kq,onError:Mq,resetKeys:ze,children:Be}),t[101]=ze,t[102]=Be,t[103]=Ve):Ve=t[103];let He;t[104]!==Re||t[105]!==Ve?(He=(0,Z.jsx)(`div`,{className:Re,children:Ve}),t[104]=Re,t[105]=Ve,t[106]=He):He=t[106];let Ue;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsxs)(TA,{children:[(0,Z.jsx)(cP,{}),(0,Z.jsx)(WK,{ref:o})]}),t[107]=Ue):Ue=t[107];let We;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,Z.jsxs)(wA,{className:`px-0`,children:[(0,Z.jsx)(Iq,{}),typeof window<`u`&&window.okDesktop?(0,Z.jsx)(EA,{children:(0,Z.jsx)(DA,{children:(0,Z.jsx)(Aq,{bridge:window.okDesktop})})}):null]}),t[108]=We):We=t[108];let Ge=!(v&&g===`collapsed`),Ke;t[109]===Ge?Ke=t[110]:(Ke=(0,Z.jsx)(xA,{enableToggle:!1,enableDrag:Ge}),t[109]=Ge,t[110]=Ke);let qe;t[111]!==Fe||t[112]!==He||t[113]!==Ke?(qe=(0,Z.jsx)(rN,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`contents`,onContextMenu:q,children:[Fe,He,Ue,We,Ke]})}),t[111]=Fe,t[112]=He,t[113]=Ke,t[114]=qe):qe=t[114];let Je=!I,Ye,Xe;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(nu,{"aria-hidden":`true`}),Xe=(0,Z.jsx)(s,{id:`HdkSiO`}),t[115]=Ye,t[116]=Xe):(Ye=t[115],Xe=t[116]);let Ze;t[117]!==ee||t[118]!==Je?(Ze=(0,Z.jsxs)(sN,{disabled:Je,onSelect:ee,"data-testid":`empty-space-menu-new-file`,children:[Ye,Xe]}),t[117]=ee,t[118]=Je,t[119]=Ze):Ze=t[119];let Qe;t[120]!==te||t[121]!==N||t[122]!==I?(Qe=N?(0,Z.jsxs)(aN,{children:[(0,Z.jsxs)(cN,{disabled:!I,"data-testid":`empty-space-menu-new-from-template`,children:[(0,Z.jsx)(Ta,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`Uuj_R4`})]}),(0,Z.jsx)(lN,{children:(0,Z.jsx)(TG,{parentDir:``,onSelectTemplate:te,ItemComponent:sN})})]}):null,t[120]=te,t[121]=N,t[122]=I,t[123]=Qe):Qe=t[123];let $e=!I,et,nt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,Z.jsx)(Cl,{"aria-hidden":`true`}),nt=(0,Z.jsx)(s,{id:`96G6Re`}),t[124]=et,t[125]=nt):(et=t[124],nt=t[125]);let rt;t[126]!==X||t[127]!==$e?(rt=(0,Z.jsxs)(sN,{disabled:$e,onSelect:X,"data-testid":`empty-space-menu-new-folder`,children:[et,nt]}),t[126]=X,t[127]=$e,t[128]=rt):rt=t[128];let it;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(fN,{}),t[129]=it):it=t[129];let at;t[130]!==r||t[131]!==oe||t[132]!==I?(at=F?(0,Z.jsxs)(sN,{disabled:!I,onSelect:oe,"data-testid":`empty-space-menu-reveal-in-finder`,"aria-label":r(I?{id:`LtSYdi`}:{id:`o2yoFu`}),children:[(0,Z.jsx)(re,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`LtSYdi`})}),I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})})]}):null,t[130]=r,t[131]=oe,t[132]=I,t[133]=at):at=t[133];let ot;t[134]!==R||t[135]!==B||t[136]!==L?(ot=(0,Z.jsx)(Oq,{input:B,installStates:L,dispatch:R}),t[134]=R,t[135]=B,t[136]=L,t[137]=ot):ot=t[137];let st=!I,ct;t[138]!==r||t[139]!==I?(ct=r(I?{id:`Up2_7p`}:{id:`U8CD-l`}),t[138]=r,t[139]=I,t[140]=ct):ct=t[140];let lt;t[141]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,Z.jsx)(tt,{"aria-hidden":`true`}),t[141]=lt):lt=t[141];let ut;t[142]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(s,{id:`Up2_7p`})}),t[142]=ut):ut=t[142];let dt;t[143]===I?dt=t[144]:(dt=I?null:(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:(0,Z.jsx)(s,{id:`wTcjov`})}),t[143]=I,t[144]=dt);let ft;t[145]!==le||t[146]!==st||t[147]!==ct||t[148]!==dt?(ft=(0,Z.jsxs)(sN,{disabled:st,onSelect:le,"data-testid":`empty-space-menu-copy-full-path`,"aria-label":ct,children:[lt,ut,dt]}),t[145]=le,t[146]=st,t[147]=ct,t[148]=dt,t[149]=ft):ft=t[149];let pt;t[150]===Symbol.for(`react.memo_cache_sentinel`)?(pt=(0,Z.jsx)(fN,{}),t[150]=pt):pt=t[150];let ht=V===null,gt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Z.jsx)(s,{id:`XcGbim`}),t[151]=gt):gt=t[151];let _t;t[152]!==de||t[153]!==U||t[154]!==ht?(_t=(0,Z.jsx)(uN,{checked:U,onCheckedChange:de,disabled:ht,"data-testid":`empty-space-menu-show-hidden-files`,children:gt}),t[152]=de,t[153]=U,t[154]=ht,t[155]=_t):_t=t[155];let vt;t[156]===K?vt=t[157]:(vt=K?(0,Z.jsx)(fN,{}):null,t[156]=K,t[157]=vt);let yt;t[158]!==pe||t[159]!==W?(yt=W?(0,Z.jsxs)(sN,{onSelect:pe,"data-testid":`empty-space-menu-expand-all`,children:[(0,Z.jsx)(mu,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`OlAl5i`})]}):null,t[158]=pe,t[159]=W,t[160]=yt):yt=t[160];let bt;t[161]!==he||t[162]!==G?(bt=G?(0,Z.jsxs)(sN,{onSelect:he,"data-testid":`empty-space-menu-collapse-all`,children:[(0,Z.jsx)(xl,{"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`qvWGzP`})]}):null,t[161]=he,t[162]=G,t[163]=bt):bt=t[163];let xt;t[164]!==Ze||t[165]!==Qe||t[166]!==rt||t[167]!==at||t[168]!==ot||t[169]!==ft||t[170]!==_t||t[171]!==vt||t[172]!==yt||t[173]!==bt?(xt=(0,Z.jsxs)(oN,{children:[Ze,Qe,rt,it,at,ot,ft,pt,_t,vt,yt,bt]}),t[164]=Ze,t[165]=Qe,t[166]=rt,t[167]=at,t[168]=ot,t[169]=ft,t[170]=_t,t[171]=vt,t[172]=yt,t[173]=bt,t[174]=xt):xt=t[174];let St;return t[175]!==qe||t[176]!==xt?(St=(0,Z.jsx)(yA,{variant:`inset`,children:(0,Z.jsxs)(nN,{children:[qe,xt]})}),t[175]=qe,t[176]=xt,t[177]=St):St=t[177],St}function Kq(){return null}function qq(e){Hq(e.target)&&(e.preventDefault(),e.stopPropagation())}function Jq(e){let t=e.shareTargetExists,n=e.dirtyConflicts.conflicts,r=e.dirtyConflicts.files;return t&&!n?{kind:`A`,openCurrentEnabled:!0,switchEnabled:!0,conflictingFiles:r}:!t&&!n?{kind:`B`,openCurrentEnabled:!1,switchEnabled:!0,conflictingFiles:r}:t&&n?{kind:`C`,openCurrentEnabled:!0,switchEnabled:!1,conflictingFiles:r}:{kind:`D`,openCurrentEnabled:!1,switchEnabled:!1,conflictingFiles:r}}function Yq(e){return e.detached?e.currentHeadSha:e.currentBranch??`HEAD`}function Xq(e){if(e.ok)return{action:`await-cc1`};switch(e.reason){case`dirty-conflict`:return{action:`rerender-conflict`,files:e.files??[]};case`branch-not-found`:return{action:`dismiss-with-toast`,reason:`branch-not-found`};case`fetch-failed`:case`checkout-failed`:return{action:`stay-with-toast`,reason:e.reason};case`branch-in-other-worktree`:{let t=e.otherWorktreePath;return t===void 0||t.length===0?{action:`stay-with-toast`,reason:`checkout-failed`}:{action:`pivot-to-other-worktree`,otherWorktreePath:t}}default:{let t=e.reason;throw Error(`Unhandled CheckoutFailureReason: ${String(t)}`)}}}var Zq={phase:`loading`};function Qq(e,t){return e.phase===`loading`?t===null?{phase:`error`}:{phase:`ready`,info:t}:e}function $q(e,t){return e.phase===`ready`?{phase:`switching`,info:e.info,pendingDoc:t}:e}function eJ(e,t){if(e.phase!==`switching`)return{state:e};if(t===null)return{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:`proxy-null`}};let n=Xq(t);return n.action===`await-cc1`?{state:{phase:`awaiting-cc1-recycle`,pendingDoc:e.pendingDoc}}:n.action===`rerender-conflict`?{state:{phase:`ready`,info:{...e.info,dirtyConflicts:{conflicts:!0,files:n.files.slice()}}}}:n.action===`pivot-to-other-worktree`?{state:{phase:`branch-in-other-worktree`,info:e.info,otherWorktreePath:n.otherWorktreePath,pendingDoc:e.pendingDoc}}:n.action===`dismiss-with-toast`?{state:{phase:`dismissed`,reason:n.reason},sideEffect:{kind:`toast`,reason:n.reason}}:{state:{phase:`ready`,info:e.info},sideEffect:{kind:`toast`,reason:n.reason}}}function tJ(e){return e!==null&&e.kind===`project-branch-switch`}function nJ(e){let t=(0,$.c)(146),{bridge:n,store:r}=e,a=r===void 0?zf:r,{_:o}=i(),c=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,cJ),[l,u]=(0,Q.useState)(Zq),d=(0,Q.useRef)(!1),f=(0,Q.useRef)(!1),m;t[0]===c?m=t[1]:(m=tJ(c)?c:null,t[0]=c,t[1]=m);let g=m,_;t[2]!==o||t[3]!==g?.share.target.kind?(_=g?.share.target.kind===`folder`?o({id:`ugoTXs`}):o({id:`XH30C4`}),t[2]=o,t[3]=g?.share.target.kind,t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{u(Zq),d.current=!1,f.current=!1},t[5]=y):y=t[5];let b;t[6]===c?b=t[7]:(b=[c],t[6]=c,t[7]=b),(0,Q.useEffect)(y,b);let x;t[8]!==g||t[9]!==n?(x=()=>{g&&(d.current||(d.current=!0,n.project.fetchBranchInfo({projectPath:g.projectPath,branch:g.share.branch,kind:g.share.target.kind,path:p(g.share.target)}).then(e=>{u(t=>Qq(t,e))}).catch(e=>{console.warn(`[receive] branch-info-fetch-failed`,e instanceof Error?e.message:e),u(sJ)})))},t[8]=g,t[9]=n,t[10]=x):x=t[10];let S;t[11]===g?S=t[12]:(S=[g],t[11]=g,t[12]=S),(0,Q.useEffect)(x,S);let C;t[13]!==o||t[14]!==g||t[15]!==l.phase||t[16]!==n||t[17]!==a||t[18]!==v?(C=()=>{if(l.phase!==`awaiting-cc1-recycle`||!g)return;let e=g.share.branch;if(!e){a.dismiss();return}if(f.current)return;f.current=!0;let t=!1;return n.project.awaitBranchSwitched({projectPath:g.projectPath,branch:e,timeoutMs:3e4}).then(r=>{if(!t){if(r.ok){console.log(wu({branch_dialog_action:`branch-switch-complete`,branch:e})),n.project.open({path:g.projectPath,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:g.share.target.kind,path:p(g.share.target)},pendingBranch:e}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=switch`,e instanceof Error?e.message:e),hs.error(o({id:`gQV-9w`,values:{targetNoun:v}}))}),a.dismiss();return}console.log(wu({branch_dialog_action:`branch-switch-timeout`,branch:e})),hs.error(o({id:`LBwUR6`,values:{targetNoun:v}})),a.dismiss()}}).catch(e=>{t||(console.warn(`[receive] awaitBranchSwitched rejected`,e instanceof Error?e.message:e),hs.error(o({id:`Jw6EC4`,values:{targetNoun:v}})),a.dismiss())}),()=>{t=!0}},t[13]=o,t[14]=g,t[15]=l.phase,t[16]=n,t[17]=a,t[18]=v,t[19]=C):C=t[19];let w;if(t[20]!==g||t[21]!==l.phase?(w=[l.phase,g],t[20]=g,t[21]=l.phase,t[22]=w):w=t[22],(0,Q.useEffect)(C,w),!g)return null;let{share:T,projectPath:E,currentBranch:D}=g,O=T.branch,k;t[23]!==o||t[24]!==l.info||t[25]!==l.phase||t[26]!==n.project||t[27]!==E||t[28]!==T.target||t[29]!==O||t[30]!==a?(k=function(){l.phase===`ready`&&Jq(l.info).switchEnabled&&(console.log(wu({branch_dialog_action:`switch`,branch_action:`switch`,branch:O})),u(e=>$q(e,p(T.target))),n.project.runCheckout({projectPath:E,branch:O}).then(e=>{let t=null,n=!1;u(r=>{let{state:i,sideEffect:a}=eJ(r,e);return a&&(t=a.reason,n=i.phase===`dismissed`),i}),t===`branch-not-found`?hs.error(o({id:`NJyQi_`,values:{shareBranch:O}})):t===`fetch-failed`?hs.error(o({id:`bWLmRK`})):(t===`checkout-failed`||t===`proxy-null`)&&hs.error(o({id:`c863eW`,values:{shareBranch:O}})),n&&a.dismiss()}).catch(e=>{console.warn(`[receive] runCheckout rejected branch_action=switch`,e instanceof Error?e.message:e),u(oJ),hs.error(o({id:`c863eW`,values:{shareBranch:O}}))}))},t[23]=o,t[24]=l.info,t[25]=l.phase,t[26]=n.project,t[27]=E,t[28]=T.target,t[29]=O,t[30]=a,t[31]=k):k=t[31];let A=k,j;t[32]!==o||t[33]!==n.project||t[34]!==E||t[35]!==T.target||t[36]!==O||t[37]!==a||t[38]!==v?(j=function(){console.log(wu({branch_dialog_action:`open-current`,branch:O})),n.project.open({path:E,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)}}).catch(e=>{console.warn(`[receive] warm-focus-dispatch-failed branch_action=open-current`,e instanceof Error?e.message:e),hs.error(o({id:`b5aNbi`,values:{targetNoun:v}}))}),a.dismiss()},t[32]=o,t[33]=n.project,t[34]=E,t[35]=T.target,t[36]=O,t[37]=a,t[38]=v,t[39]=j):j=t[39];let M=j,N;t[40]!==o||t[41]!==l.otherWorktreePath||t[42]!==l.phase||t[43]!==n.project||t[44]!==T.target||t[45]!==O||t[46]!==a?(N=function(){if(l.phase!==`branch-in-other-worktree`)return;let e=l.otherWorktreePath;console.log(wu({branch_dialog_action:`pivot-to-other-worktree`,branch:O})),n.project.open({path:e,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkTarget:{kind:T.target.kind,path:p(T.target)},pendingBranch:O}).catch(t=>{console.warn(`[receive] pivot-open-failed branch_action=pivot-to-other-worktree`,t instanceof Error?t.message:t),hs.error(o({id:`LdABLa`,values:{target:e}}))}),a.dismiss()},t[40]=o,t[41]=l.otherWorktreePath,t[42]=l.phase,t[43]=n.project,t[44]=T.target,t[45]=O,t[46]=a,t[47]=N):N=t[47];let P=N,F;t[48]===a?F=t[49]:(F=function(){console.log(wu({branch_dialog_action:`cancel`})),a.dismiss()},t[48]=a,t[49]=F);let I=F,L,R,z,B,V,H,U,W,G,K,q,J,ee,Y,te,ne,X;if(t[50]!==o||t[51]!==l.info||t[52]!==l.otherWorktreePath||t[53]!==l.phase||t[54]!==I||t[55]!==D||t[56]!==T.branch||t[57]!==T.owner||t[58]!==T.repo||t[59]!==T.target||t[60]!==O||t[61]!==v){X=l.phase===`ready`||l.phase===`switching`?Jq(l.info):null;let e;t[79]!==l.info||t[80]!==l.phase||t[81]!==D?(e=l.phase===`ready`||l.phase===`switching`?Yq(l.info):D??`HEAD`,t[79]=l.info,t[80]=l.phase,t[81]=D,t[82]=e):e=t[82];let n=e;H=l.phase===`switching`||l.phase===`awaiting-cc1-recycle`;let r;t[83]===o?r=t[84]:(r=o({id:`OuY8t9`}),t[83]=o,t[84]=r),B=r;let i;t[85]!==o||t[86]!==O?(i=o({id:`_BthEY`,values:{shareBranch:O}}),t[85]=o,t[86]=O,t[87]=i):i=t[87],V=i;let a=l.phase===`loading`,c=l.phase===`error`;z=Oo,te=!0,t[88]===I?ne=t[89]:(ne=e=>{e||I()},t[88]=I,t[89]=ne),R=wo,K=`sm:max-w-xl`,q=`share-branch-switch-dialog`,J=aJ,ee=iJ;let u;t[90]===v?u=t[91]:(u=(0,Z.jsx)(Co,{children:(0,Z.jsx)(s,{id:`RY6Bq1`,values:{targetNoun:v}})}),t[90]=v,t[91]=u);let d=T.owner,f=T.repo,m;t[92]===T.target?m=t[93]:(m=p(T.target),t[92]=T.target,t[93]=m);let g;t[94]!==T.owner||t[95]!==T.repo||t[96]!==m?(g=(0,Z.jsx)(So,{className:`sr-only`,children:(0,Z.jsx)(s,{id:`f8jU-L`,values:{0:d,1:f,2:m}})}),t[94]=T.owner,t[95]=T.repo,t[96]=m,t[97]=g):g=t[97],t[98]!==u||t[99]!==g?(Y=(0,Z.jsxs)(Do,{children:[u,g]}),t[98]=u,t[99]=g,t[100]=Y):Y=t[100],L=To;let _=T.owner,y=T.repo,b;t[101]===T.target?b=t[102]:(b=p(T.target),t[101]=T.target,t[102]=b),t[103]!==T.branch||t[104]!==T.owner||t[105]!==T.repo||t[106]!==T.target.kind||t[107]!==b?(U=(0,Z.jsx)(`div`,{className:`mb-4`,children:(0,Z.jsx)(jf,{owner:_,repo:y,path:b,kind:T.target.kind,branch:T.branch,testId:`share-branch-switch-metadata`,branchTestId:`share-branch-switch-metadata-branch`})}),t[103]=T.branch,t[104]=T.owner,t[105]=T.repo,t[106]=T.target.kind,t[107]=b,t[108]=U):U=t[108],W=l.phase===`branch-in-other-worktree`?(0,Z.jsxs)(`div`,{className:`text-sm text-muted-foreground`,"data-testid":`share-branch-switch-in-other-worktree`,children:[(0,Z.jsx)(`p`,{className:`leading-6`,children:(0,Z.jsx)(s,{id:`yjExfe`,values:{shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),(0,Z.jsx)(`p`,{className:`mt-2 break-all rounded bg-muted px-2 py-1 font-mono text-xs text-foreground/80`,"data-testid":`share-branch-switch-in-other-worktree-path`,children:l.otherWorktreePath})]}):a?(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-loading`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`jerqF0`})]}):c?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(s,{id:`w4hMYl`})}):X?.kind===`D`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`XnoA1k`,values:{targetNoun:v,shareBranch:O},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):X?.kind===`B`?(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`sZ2IOu`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}):(0,Z.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:(0,Z.jsx)(s,{id:`_902BE`,values:{targetNoun:v,shareBranch:O,currentLabel:n},components:{0:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`}),1:(0,Z.jsx)(`code`,{className:`rounded-sm bg-muted px-1 py-0.5 text-foreground/80`})}})}),G=X&&!X.switchEnabled&&X.conflictingFiles.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 rounded-md border border-border bg-muted/30 p-3 text-1sm`,"data-testid":`share-branch-switch-conflict`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground/90`,children:(0,Z.jsx)(s,{id:`n2lRue`})}),(0,Z.jsx)(`ul`,{id:`share-receive-branch-conflict-files`,className:`mt-1 list-disc space-y-0.5 pl-5 text-muted-foreground`,children:X.conflictingFiles.map(rJ)})]}):null,t[50]=o,t[51]=l.info,t[52]=l.otherWorktreePath,t[53]=l.phase,t[54]=I,t[55]=D,t[56]=T.branch,t[57]=T.owner,t[58]=T.repo,t[59]=T.target,t[60]=O,t[61]=v,t[62]=L,t[63]=R,t[64]=z,t[65]=B,t[66]=V,t[67]=H,t[68]=U,t[69]=W,t[70]=G,t[71]=K,t[72]=q,t[73]=J,t[74]=ee,t[75]=Y,t[76]=te,t[77]=ne,t[78]=X}else L=t[62],R=t[63],z=t[64],B=t[65],V=t[66],H=t[67],U=t[68],W=t[69],G=t[70],K=t[71],q=t[72],J=t[73],ee=t[74],Y=t[75],te=t[76],ne=t[77],X=t[78];let re;t[109]===H?re=t[110]:(re=H?(0,Z.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-sm text-muted-foreground`,"data-testid":`share-branch-switch-switching`,role:`status`,"aria-live":`polite`,children:[(0,Z.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(s,{id:`CU3AiE`})]}):null,t[109]=H,t[110]=re);let ie;t[111]!==L||t[112]!==U||t[113]!==W||t[114]!==G||t[115]!==re?(ie=(0,Z.jsxs)(L,{children:[U,W,G,re]}),t[111]=L,t[112]=U,t[113]=W,t[114]=G,t[115]=re,t[116]=ie):ie=t[116];let ae;t[117]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(s,{id:`dEgA5A`}),t[117]=ae):ae=t[117];let oe;t[118]===I?oe=t[119]:(oe=(0,Z.jsx)(ci,{variant:`ghost`,className:`font-mono uppercase`,onClick:I,"data-testid":`share-branch-switch-cancel`,children:ae}),t[118]=I,t[119]=oe);let se;t[120]!==l.phase||t[121]!==M||t[122]!==P||t[123]!==A||t[124]!==B||t[125]!==V||t[126]!==H||t[127]!==X?(se=l.phase===`branch-in-other-worktree`?(0,Z.jsx)(ci,{onClick:P,"data-testid":`share-branch-switch-in-other-worktree-pivot`,children:(0,Z.jsx)(s,{id:`hyCxJY`})}):(0,Z.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:gap-2`,children:[X?.openCurrentEnabled?(0,Z.jsxs)(ci,{variant:`outline`,className:`font-mono uppercase`,onClick:M,disabled:H,"data-testid":`share-branch-switch-open-current`,children:[(0,Z.jsx)(Il,{className:`size-3.5`,"aria-hidden":!0}),B]}):null,(0,Z.jsx)(ci,{onClick:A,disabled:!X?.switchEnabled||H,"aria-disabled":!X?.switchEnabled||H,"aria-describedby":X&&!X.switchEnabled&&X.conflictingFiles.length>0?`share-receive-branch-conflict-files`:void 0,"data-testid":`share-branch-switch-switch`,children:H?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(h,{className:`size-3.5 animate-spin`,"aria-hidden":`true`}),V]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Oe,{className:`size-3.5`,"aria-hidden":!0}),V]})})]}),t[120]=l.phase,t[121]=M,t[122]=P,t[123]=A,t[124]=B,t[125]=V,t[126]=H,t[127]=X,t[128]=se):se=t[128];let ce;t[129]!==oe||t[130]!==se?(ce=(0,Z.jsxs)(Eo,{className:`sm:justify-between`,children:[oe,se]}),t[129]=oe,t[130]=se,t[131]=ce):ce=t[131];let le;t[132]!==R||t[133]!==K||t[134]!==q||t[135]!==J||t[136]!==ee||t[137]!==Y||t[138]!==ie||t[139]!==ce?(le=(0,Z.jsxs)(R,{className:K,"data-testid":q,onInteractOutside:J,onPointerDownOutside:ee,children:[Y,ie,ce]}),t[132]=R,t[133]=K,t[134]=q,t[135]=J,t[136]=ee,t[137]=Y,t[138]=ie,t[139]=ce,t[140]=le):le=t[140];let ue;return t[141]!==z||t[142]!==te||t[143]!==ne||t[144]!==le?(ue=(0,Z.jsx)(z,{open:te,onOpenChange:ne,children:le}),t[141]=z,t[142]=te,t[143]=ne,t[144]=le,t[145]=ue):ue=t[145],ue}function rJ(e){return(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`text-foreground/80`,children:e})},e)}function iJ(e){e.preventDefault()}function aJ(e){e.preventDefault()}function oJ(e){return eJ(e,null).state}function sJ(e){return Qq(e,null)}function cJ(){return null}function lJ(){let e=(0,$.c)(17),t=Cn(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=mt(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new Ne,i=new ut({url:n,name:Ur,document:e,onStateless:e=>{let{payload:t}=e;H(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:hJ,onConfigValidationRejected:mJ,onConfigIgnoreNestedError:pJ,onUnknown:fJ})},onClose:dJ,onDisconnect:uJ}),a=$o(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=Xt(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{ss([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function uJ(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function dJ(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function fJ(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function pJ(e){Qa(e)}function mJ(e){ro(e)}function hJ(e){ss([e.ch])}var gJ=`#install-claude-desktop`;function _J(e){return e===`#settings`||e===gJ}function vJ(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function yJ(){let e=(0,$.c)(23),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=mt(),{openTargetTransition:i}=Dt(),{assetPaths:a,folderPaths:o,loading:s,pageMeta:c,pages:l,pagesBySlug:u,pagesByBasename:d}=rs(),f=(0,Q.useRef)(null),p;e[0]!==a||e[1]!==o||e[2]!==l?(p=vJ(l,o,a),e[0]=a,e[1]=o,e[2]=l,e[3]=p):p=e[3];let m=p,h,g;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==l||e[8]!==n||e[9]!==r||e[10]!==m?(h=()=>{s||!r||f.current===m||(f.current=m,n({pages:l,folderPaths:o,assetPaths:a}))},g=[a,o,s,l,n,r,m],e[4]=a,e[5]=o,e[6]=s,e[7]=l,e[8]=n,e[9]=r,e[10]=m,e[11]=h,e[12]=g):(h=e[11],g=e[12]),(0,Q.useEffect)(h,g);let _,v;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c||e[18]!==l||e[19]!==d||e[20]!==u?(_=()=>{e();function e(){if(_J(window.location.hash))return;let e=Io(window.location.hash);if(e){let t=nr(e.split(`.`).pop()??``);le(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}if(Wo(window.location.hash)){le(`ok/nav/hash-change`,{docName:null,kind:`folder`}),i({kind:`folder`,target:``,folderPath:``});return}let n=is(window.location.hash);if(!n){le(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){le(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=ts(n,{pages:l,folderPaths:o,pagesBySlug:u,pagesByBasename:d});if(r.kind===`missing`&&/\/+$/.test(n.trim())){le(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}let a=os(ls(r),c);le(`ok/nav/hash-change`,{docName:n,kind:a.kind}),i(a)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},v=[t,o,s,i,c,l,u,d],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=l,e[19]=d,e[20]=u,e[21]=_,e[22]=v):(_=e[21],v=e[22]),(0,Q.useEffect)(_,v),null}function bJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(xJ,t),null}function xJ(){let e=wJ;if(!e(window.location.hash))return;let t=new AbortController;return se(t.signal).then(n=>{if(t.signal.aborted||n.status!==`ok`)return;let r=n.config.paneTarget;r?.startsWith(`#/`)&&e(window.location.hash)&&(window.location.hash=r,fetch(`/api/config`,{method:`DELETE`}).catch(CJ))}).catch(SJ),()=>t.abort()}function SJ(){}function CJ(){}function wJ(e){return!_J(e)&&!Io(e)&&!is(e)&&(e===``||e===`#`||e===`#/`)}function TJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(EJ,t),null}function EJ(){let e=function(e){let t=e.target;wg({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Cg))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function DJ(){let e=(0,$.c)(4),{activeTarget:t}=mt(),n=typeof window<`u`?window.okDesktop??null:null,r=t?.kind===`doc`||t?.kind===`folder`||t?.kind===`asset`?t.kind:null,i=t?.kind===`doc`?t.docName:t?.kind===`folder`?t.folderPath:t?.kind===`asset`?t.assetPath:null,a,o;return e[0]!==i||e[1]!==r?(a=()=>{if(n){if(r===null){n.editor.notifyActiveTargetChanged({kind:null});return}i!==null&&n.editor.notifyActiveTargetChanged({kind:r,identifier:i})}},o=[n,r,i],e[0]=i,e[1]=r,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,Q.useEffect)(a,o),null}function OJ(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=mt(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:ps(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Lh({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(zh,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function kJ(e){let t=(0,$.c)(3),{children:n}=e,{collabUrl:r}=mt(),i;return t[0]!==n||t[1]!==r?(i=(0,Z.jsx)(B,{collabUrl:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function AJ(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Wt,{name:`app`,children:(0,Z.jsx)(Mt,{children:(0,Z.jsx)(kJ,{children:(0,Z.jsx)(yg,{children:(0,Z.jsx)(jJ,{})})})})}),e[0]=t):t=e[0],t}function jJ(){let e=(0,$.c)(25),t=typeof window<`u`?window.okDesktop??null:null,n=typeof window<`u`&&window.okDesktop!=null,[r,i]=(0,Q.useState)(!1),a=Sg(),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=t?{launchInTerminal:MJ}:null,e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Y_,{}),e[1]=c):c=e[1];let l,u,d,f,p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(lJ,{}),u=(0,Z.jsx)(yJ,{}),d=(0,Z.jsx)(bJ,{}),f=(0,Z.jsx)(DJ,{}),p=(0,Z.jsx)(OJ,{}),e[2]=l,e[3]=u,e[4]=d,e[5]=f,e[6]=p):(l=e[2],u=e[3],d=e[4],f=e[5],p=e[6]);let m;e[7]===a?m=e[8]:(m=!a&&(0,Z.jsx)(TJ,{}),e[7]=a,e[8]=m);let h,g,_,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=!1,v=t?(0,Z.jsx)(X_,{bridge:t}):null,h=(0,Z.jsx)(Df,{}),g=t?(0,Z.jsx)(nJ,{bridge:t}):null,e[9]=h,e[10]=g,e[11]=_,e[12]=v):(h=e[9],g=e[10],_=e[11],v=e[12]);let y;e[13]===r?y=e[14]:(y=(0,Z.jsx)(V_,{bridge:t,open:r,onOpenChange:i}),e[13]=r,e[14]=y);let b;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=n&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`editor-window-chrome-drag-strip`,"data-electron-drag":``,className:`pointer-events-none fixed inset-x-0 top-0 z-50 h-2 [-webkit-app-region:drag]`}),e[15]=b):b=e[15];let x;e[16]===a?x=e[17]:(x=!a&&(0,Z.jsx)(Uq,{onOpenSearch:()=>i(!0)}),e[16]=a,e[17]=x);let S;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(SA,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(iP,{onOpenSearch:()=>i(!0)})}),e[18]=S):S=e[18];let C;e[19]===x?C=e[20]:(C=(0,Z.jsx)(Kx,{value:s,children:(0,Z.jsxs)(gA,{className:`h-screen overflow-hidden`,children:[x,S]})}),e[19]=x,e[20]=C);let w;return e[21]!==y||e[22]!==C||e[23]!==m?(w=(0,Z.jsxs)(Z.Fragment,{children:[c,(0,Z.jsxs)(cs,{children:[l,u,d,f,p,m,_,v,h,g,y,b,C]})]}),e[21]=y,e[22]=C,e[23]=m,e[24]=w):w=e[24],w}function MJ(e){nP(f_(e))}Rc(),sp({apiOrigin:typeof window<`u`?window.okDesktop?.config.apiOrigin:void 0}),bp(),Kp()&&Qp(),Um(),sm(),typeof window<`u`&&Sp({bridge:window.okDesktop}),typeof window<`u`&&Np({bridge:window.okDesktop}),typeof window<`u`&&$s({bridge:window.okDesktop}),typeof window<`u`&&Js({bridge:window.okDesktop}),typeof window<`u`&&Tp({bridge:window.okDesktop}),typeof window<`u`&&Bf({bridge:window.okDesktop}),dm();var NJ=new qc({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),PJ=document.getElementById(`root`);if(!PJ)throw Error(`Root element not found`);var FJ=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,il.createRoot)(PJ).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(a,{i18n:ms,children:(0,Z.jsx)(hn,{client:NJ,children:(0,Z.jsxs)(vr,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(Fs,{children:FJ&&window.okDesktop?(0,Z.jsx)(ep,{bridge:window.okDesktop}):(0,Z.jsx)(AJ,{})}),(0,Z.jsx)(ap,{richColors:!0,closeButton:!0})]})})})}));