@inkeep/open-knowledge 0.6.0-beta.7 → 0.6.0-beta.8

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DPRMO_b_.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-Y-YFxY-Y.js","./dialog-B6QxSuMP.js","./button-JrGyO3-P.js","./compiler-runtime-CVnuRdak.js","./checkbox-BLSL0WqH.js","./collapsible-CYwJ8q8x.js","./textarea-CQGiqhkV.js","./project-paths-DKT5BePl.js","./McpConsentDialogBody-CR1y0qI_.js","./label-Bdsqm1CY.js","./mcp-consent-store-BPw6Zd40.js","./ActivityPanelDiffView-d4ec9M69.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-Btq3W8xK.js","./doc-hash-BUfOgpiD.js","./w3c-keyname-B5t0fahT.js","./toggle-group-BvHaWPjZ.js","./panel-CxlToFCs.js","./min-CHzARyU6.js","./src-Dz70a8sm.js","./colors-CuFmRbNJ.js","./ordinal-Dk6d5Y-0.js","./init-D-V7N9g_.js","./isObjectLike-HLvQwJYx.js","./now-BN_Nj6nz.js","./isSymbol-BKUBGC2u.js","./target-navigation-intent-Bg_vCLDN.js","./ActivityModeContent-Dgodq1_3.js","./DocumentContext-CqL0pPxh.js","./dist-DllAuqQQ.js","./dist-D3YXABda.js","./dist-D-oqC0-R.js","./dist-DXgyWuz5.js","./dist-DQ1oWohr.js","./stex-ChE_gMQ6.js","./DocumentContext-B0sQn39F.css","./agent-presence-DUe_PdKt.js","./SettingsDialogBody-Dr2p2Reu.js","./config-validation-events-CXyf_fVy.js","./SourceEditor-BBghYkCg.js","./typing-burst-detector-xohyxOCA.js"])))=>i.map(i=>d[i]);
2
- import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$ as o,$n as s,An as c,At as l,B as u,Bn as d,Bt as f,C as p,Cn as m,Ct as h,D as g,Dn as _,Dt as v,E as y,En as b,Et as x,F as S,Fn as C,Ft as w,Gn as T,Gt as E,H as D,Hn as O,Ht as k,I as A,In as j,It as M,J as N,Jn as P,Jt as F,K as I,Kn as L,Kt as R,L as z,Ln as B,Lt as V,M as H,Mn as U,Mt as W,N as G,Nn as ee,Nt as te,On as ne,Ot as re,P as ie,Pn as ae,Pt as oe,Q as se,Qn as ce,Qt as le,R as ue,Rn as de,Rt as K,S as fe,Sn as pe,St as me,T as he,Tn as ge,Tt as _e,U as ve,Un as ye,Ut as be,V as xe,Vn as Se,Vt as Ce,W as we,Wn as Te,Wt as Ee,X as De,Xn as Oe,Xt as ke,Y as Ae,Yn as je,Yt as Me,Z as Ne,Zn as Pe,_ as Fe,_n as Ie,_t as Le,a as Re,ar as ze,at as q,bn as Be,bt as Ve,c as He,ct as Ue,d as We,dn as Ge,dt as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,hn as $e,i as et,ir as tt,it as nt,jn as rt,jt as it,kn as at,kt as ot,l as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nr as pt,nt as mt,o as ht,or as gt,ot as _t,p as vt,pn as yt,pt as bt,q as xt,qn as St,qt as Ct,r as wt,rr as Tt,rt as Et,s as Dt,st as Ot,t as kt,tr as At,tt as jt,u as Mt,un as Nt,ut as Pt,vn as Ft,vt as It,w as Lt,wn as Rt,wt as zt,x as Bt,xn as Vt,xt as Ht,yn as Ut,yt as Wt,z as Gt,zn as Kt,zt as qt}from"./DocumentContext-CqL0pPxh.js";import{C as Jt,E as Yt,S as Xt,T as J,a as Zt,b as Qt,c as $t,d as en,f as tn,h as nn,i as rn,l as an,m as on,n as sn,o as cn,p as ln,s as un,t as dn,u as fn,w as pn,x as Y}from"./dialog-B6QxSuMP.js";import{A as mn,C as hn,D as gn,E as _n,O as vn,S as yn,T as bn,_ as xn,a as Sn,b as Cn,c as wn,d as Tn,f as En,g as Dn,h as On,i as kn,k as An,l as jn,m as Mn,n as Nn,p as Pn,r as Fn,s as In,t as Ln,u as Rn,v as zn,w as Bn,x as Vn,y as Hn}from"./panel-CxlToFCs.js";import{$t as Un,A as Wn,B as Gn,Bn as Kn,Br as qn,C as Jn,D as Yn,Dn as Xn,Dr as Zn,Dt as Qn,E as $n,En as er,Er as tr,Et as nr,Fn as rr,Fr as ir,G as ar,H as or,Hr as sr,I as cr,Ir as lr,Jr as ur,Jt as dr,K as fr,Kr as pr,Kt as mr,L as hr,Ln as gr,Nn as _r,O as vr,On as yr,Pr as br,Pt as xr,Qn as Sr,R as Cr,S as wr,Sn as Tr,Sr as Er,St as Dr,T as Or,Tn as kr,Tr as Ar,U as jr,Ut as Mr,V as Nr,Vt as Pr,W as Fr,X as Ir,Xr as Lr,Xt as Rr,Y as zr,Yn as Br,Yr as Vr,Yt as Hr,Z as Ur,Zt as Wr,_ as Gr,_r as Kr,a as qr,an as Jr,bn as Yr,bt as Xr,c as Zr,cn as Qr,d as $r,di as ei,dn as ti,fi as ni,fn as ri,fr as ii,ft as ai,gr as oi,gt as si,h as ci,hi as li,hr as ui,ht as di,i as fi,jn as pi,k as mi,l as hi,mi as gi,n as _i,o as vi,or as yi,p as bi,pi as xi,pn as Si,pr as Ci,r as wi,s as Ti,t as Ei,tt as Di,u as Oi,un as ki,vn as Ai,vr as ji,w as Mi,wr as Ni,wt as Pi,x as Fi,xn as Ii,xt as Li,yn as Ri,yr as zi,yt as Bi,z as Vi,zn as Hi,zr as Ui}from"./doc-hash-BUfOgpiD.js";import{C as Wi,S as Gi,b as Ki,c as qi,d as Ji,g as Yi,l as Xi,m as Zi,o as Qi,p as $i,r as ea,t as X,w as ta,x as na}from"./button-JrGyO3-P.js";import{a as ra,c as ia,d as aa,f as oa,i as sa,l as ca,m as la,n as ua,o as da,p as fa,r as pa,s as ma,t as ha,u as ga}from"./agent-presence-DUe_PdKt.js";import{$ as _a,A as va,At as ya,B as ba,C as xa,Ct as Sa,D as Ca,Dt as wa,E as Ta,Et as Ea,F as Da,G as Oa,H as ka,I as Aa,J as ja,K as Ma,L as Na,M as Pa,Mt as Fa,N as Ia,O as La,Ot as Ra,P as za,Q as Ba,R as Va,S as Ha,St as Ua,T as Wa,Tt as Ga,U as Ka,V as qa,W as Ja,X as Ya,Y as Xa,Z as Za,_ as Qa,_t as $a,a as eo,at as to,b as no,bt as ro,ct as io,dt as ao,et as oo,ft as so,g as co,gt as lo,h as uo,ht as fo,it as po,j as mo,jt as ho,k as go,lt as _o,m as vo,mt as yo,nt as bo,o as xo,ot as So,p as Co,pt as wo,q as To,r as Eo,rt as Do,st as Oo,t as ko,tt as Ao,u as jo,ut as Mo,v as No,vt as Po,w as Fo,wt as Io,x as Lo,xt as Ro,y as zo,yt as Bo,z as Vo}from"./config-validation-events-CXyf_fVy.js";import{n as Ho,t as Uo}from"./target-navigation-intent-Bg_vCLDN.js";import{a as Wo,i as Go,n as Ko,r as qo,t as Jo}from"./collapsible-CYwJ8q8x.js";import{t as Yo}from"./checkbox-BLSL0WqH.js";import{a as Xo,i as Zo,n as Qo,o as $o,r as es,t as ts}from"./toggle-group-BvHaWPjZ.js";import{t as ns}from"./label-Bdsqm1CY.js";import{i as rs,n as is,r as as}from"./project-paths-DKT5BePl.js";import{n as os,t as ss}from"./mcp-consent-store-BPw6Zd40.js";import{$ as cs,At as ls,Ct as us,Dt as ds,Ft as fs,I as ps,It as ms,J as hs,Mt as gs,Ot as _s,Pt as vs,Q as ys,Tt as bs,X as xs,Z as Ss,at as Cs,bt as ws,c as Ts,jt as Es,k as Ds,w as Os}from"./dist-D3YXABda.js";import{n as ks}from"./dist-D-oqC0-R.js";import{n as As,o as js,r as Ms,t as Ns}from"./typing-burst-detector-xohyxOCA.js";import{t as Ps}from"./textarea-CQGiqhkV.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 Fs(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DPRMO_b_.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Is(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=Hn(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?zn:xn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Rs:Ls,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:Ls(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 Ls(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 Rs(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var zs=class extends En{#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||Bs(),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=Pn({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),On.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Bs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Vs=class extends mn{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 zs({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=Hs(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=Hs(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=Hs(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=Hs(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){On.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=>hn(t,e))}findAll(e={}){return this.getAll().filter(t=>hn(e,t))}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return On.batch(()=>Promise.all(e.map(e=>e.continue().catch(bn))))}};function Hs(e){return e.options.scope?.id}var Us=class extends mn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??yn(r,t),a=this.get(i);return a||(a=new Tn({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(){On.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=>Bn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Bn(e,t)):t}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){On.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){On.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ws=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Us,this.#t=e.mutationCache||new Vs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=An.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Mn.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(gn(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=Cn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return On.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;On.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return On.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=On.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(bn).catch(bn)}invalidateQueries(e,t={}){return On.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=On.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(bn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(bn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(gn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bn).catch(bn)}fetchInfiniteQuery(e){return e.behavior=Is(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bn).catch(bn)}ensureInfiniteQueryData(e){return e.behavior=Is(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mn.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(Vn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{_n(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Vn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{_n(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||=yn(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===vn&&(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()}},Gs=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}}}})),Ks=t(((e,t)=>{t.exports=Gs()})),qs=t((e=>{var t=Ks(),n=r(),i=ta();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 ee(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 te(){B(H),B(U),B(W)}function ne(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 re(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ie,ae;function oe(e){if(ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||``,ae=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-DPRMO_b_.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-Y-YFxY-Y.js","./dialog-B6QxSuMP.js","./button-JrGyO3-P.js","./compiler-runtime-CVnuRdak.js","./checkbox-BLSL0WqH.js","./collapsible-CYwJ8q8x.js","./textarea-CQGiqhkV.js","./project-paths-DKT5BePl.js","./McpConsentDialogBody-CR1y0qI_.js","./label-Bdsqm1CY.js","./mcp-consent-store-BPw6Zd40.js","./ActivityPanelDiffView-d4ec9M69.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-Btq3W8xK.js","./doc-hash-BUfOgpiD.js","./w3c-keyname-B5t0fahT.js","./toggle-group-BvHaWPjZ.js","./panel-CxlToFCs.js","./min-CHzARyU6.js","./src-Dz70a8sm.js","./colors-CuFmRbNJ.js","./ordinal-Dk6d5Y-0.js","./init-D-V7N9g_.js","./isObjectLike-HLvQwJYx.js","./now-BN_Nj6nz.js","./isSymbol-BKUBGC2u.js","./target-navigation-intent-Bg_vCLDN.js","./ActivityModeContent-Dgodq1_3.js","./DocumentContext-CqL0pPxh.js","./dist-DllAuqQQ.js","./dist-D3YXABda.js","./dist-D-oqC0-R.js","./dist-DXgyWuz5.js","./dist-DQ1oWohr.js","./stex-ChE_gMQ6.js","./DocumentContext-B0sQn39F.css","./agent-presence-DUe_PdKt.js","./SettingsDialogBody-E4CxiCsR.js","./config-validation-events-BAWD3yoI.js","./SourceEditor-BBghYkCg.js","./typing-burst-detector-xohyxOCA.js"])))=>i.map(i=>d[i]);
2
+ import{o as e,t}from"./chunk-CFjPhJqf.js";import{t as n}from"./preload-helper-2ej06EnG.js";import{n as r,r as i,t as a}from"./compiler-runtime-CVnuRdak.js";import{$ as o,$n as s,An as c,At as l,B as u,Bn as d,Bt as f,C as p,Cn as m,Ct as h,D as g,Dn as _,Dt as v,E as y,En as b,Et as x,F as S,Fn as C,Ft as w,Gn as T,Gt as E,H as D,Hn as O,Ht as k,I as A,In as j,It as M,J as N,Jn as P,Jt as F,K as I,Kn as L,Kt as R,L as z,Ln as B,Lt as V,M as H,Mn as U,Mt as W,N as G,Nn as ee,Nt as te,On as ne,Ot as re,P as ie,Pn as ae,Pt as oe,Q as se,Qn as ce,Qt as le,R as ue,Rn as de,Rt as K,S as fe,Sn as pe,St as me,T as he,Tn as ge,Tt as _e,U as ve,Un as ye,Ut as be,V as xe,Vn as Se,Vt as Ce,W as we,Wn as Te,Wt as Ee,X as De,Xn as Oe,Xt as ke,Y as Ae,Yn as je,Yt as Me,Z as Ne,Zn as Pe,_ as Fe,_n as Ie,_t as Le,a as Re,ar as ze,at as q,bn as Be,bt as Ve,c as He,ct as Ue,d as We,dn as Ge,dt as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,hn as $e,i as et,ir as tt,it as nt,jn as rt,jt as it,kn as at,kt as ot,l as st,lt as ct,m as lt,mn as ut,mt as dt,n as ft,nr as pt,nt as mt,o as ht,or as gt,ot as _t,p as vt,pn as yt,pt as bt,q as xt,qn as St,qt as Ct,r as wt,rr as Tt,rt as Et,s as Dt,st as Ot,t as kt,tr as At,tt as jt,u as Mt,un as Nt,ut as Pt,vn as Ft,vt as It,w as Lt,wn as Rt,wt as zt,x as Bt,xn as Vt,xt as Ht,yn as Ut,yt as Wt,z as Gt,zn as Kt,zt as qt}from"./DocumentContext-CqL0pPxh.js";import{C as Jt,E as Yt,S as Xt,T as J,a as Zt,b as Qt,c as $t,d as en,f as tn,h as nn,i as rn,l as an,m as on,n as sn,o as cn,p as ln,s as un,t as dn,u as fn,w as pn,x as Y}from"./dialog-B6QxSuMP.js";import{A as mn,C as hn,D as gn,E as _n,O as vn,S as yn,T as bn,_ as xn,a as Sn,b as Cn,c as wn,d as Tn,f as En,g as Dn,h as On,i as kn,k as An,l as jn,m as Mn,n as Nn,p as Pn,r as Fn,s as In,t as Ln,u as Rn,v as zn,w as Bn,x as Vn,y as Hn}from"./panel-CxlToFCs.js";import{$t as Un,A as Wn,B as Gn,Bn as Kn,Br as qn,C as Jn,D as Yn,Dn as Xn,Dr as Zn,Dt as Qn,E as $n,En as er,Er as tr,Et as nr,Fn as rr,Fr as ir,G as ar,H as or,Hr as sr,I as cr,Ir as lr,Jr as ur,Jt as dr,K as fr,Kr as pr,Kt as mr,L as hr,Ln as gr,Nn as _r,O as vr,On as yr,Pr as br,Pt as xr,Qn as Sr,R as Cr,S as wr,Sn as Tr,Sr as Er,St as Dr,T as Or,Tn as kr,Tr as Ar,U as jr,Ut as Mr,V as Nr,Vt as Pr,W as Fr,X as Ir,Xr as Lr,Xt as Rr,Y as zr,Yn as Br,Yr as Vr,Yt as Hr,Z as Ur,Zt as Wr,_ as Gr,_r as Kr,a as qr,an as Jr,bn as Yr,bt as Xr,c as Zr,cn as Qr,d as $r,di as ei,dn as ti,fi as ni,fn as ri,fr as ii,ft as ai,gr as oi,gt as si,h as ci,hi as li,hr as ui,ht as di,i as fi,jn as pi,k as mi,l as hi,mi as gi,n as _i,o as vi,or as yi,p as bi,pi as xi,pn as Si,pr as Ci,r as wi,s as Ti,t as Ei,tt as Di,u as Oi,un as ki,vn as Ai,vr as ji,w as Mi,wr as Ni,wt as Pi,x as Fi,xn as Ii,xt as Li,yn as Ri,yr as zi,yt as Bi,z as Vi,zn as Hi,zr as Ui}from"./doc-hash-BUfOgpiD.js";import{C as Wi,S as Gi,b as Ki,c as qi,d as Ji,g as Yi,l as Xi,m as Zi,o as Qi,p as $i,r as ea,t as X,w as ta,x as na}from"./button-JrGyO3-P.js";import{a as ra,c as ia,d as aa,f as oa,i as sa,l as ca,m as la,n as ua,o as da,p as fa,r as pa,s as ma,t as ha,u as ga}from"./agent-presence-DUe_PdKt.js";import{$ as _a,A as va,At as ya,B as ba,C as xa,Ct as Sa,D as Ca,Dt as wa,E as Ta,Et as Ea,F as Da,G as Oa,H as ka,I as Aa,J as ja,K as Ma,L as Na,M as Pa,Mt as Fa,N as Ia,O as La,Ot as Ra,P as za,Q as Ba,R as Va,S as Ha,St as Ua,T as Wa,Tt as Ga,U as Ka,V as qa,W as Ja,X as Ya,Y as Xa,Z as Za,_ as Qa,_t as $a,a as eo,at as to,b as no,bt as ro,ct as io,dt as ao,et as oo,ft as so,g as co,gt as lo,h as uo,ht as fo,it as po,j as mo,jt as ho,k as go,lt as _o,m as vo,mt as yo,nt as bo,o as xo,ot as So,p as Co,pt as wo,q as To,r as Eo,rt as Do,st as Oo,t as ko,tt as Ao,u as jo,ut as Mo,v as No,vt as Po,w as Fo,wt as Io,x as Lo,xt as Ro,y as zo,yt as Bo,z as Vo}from"./config-validation-events-BAWD3yoI.js";import{n as Ho,t as Uo}from"./target-navigation-intent-Bg_vCLDN.js";import{a as Wo,i as Go,n as Ko,r as qo,t as Jo}from"./collapsible-CYwJ8q8x.js";import{t as Yo}from"./checkbox-BLSL0WqH.js";import{a as Xo,i as Zo,n as Qo,o as $o,r as es,t as ts}from"./toggle-group-BvHaWPjZ.js";import{t as ns}from"./label-Bdsqm1CY.js";import{i as rs,n as is,r as as}from"./project-paths-DKT5BePl.js";import{n as os,t as ss}from"./mcp-consent-store-BPw6Zd40.js";import{$ as cs,At as ls,Ct as us,Dt as ds,Ft as fs,I as ps,It as ms,J as hs,Mt as gs,Ot as _s,Pt as vs,Q as ys,Tt as bs,X as xs,Z as Ss,at as Cs,bt as ws,c as Ts,jt as Es,k as Ds,w as Os}from"./dist-D3YXABda.js";import{n as ks}from"./dist-D-oqC0-R.js";import{n as As,o as js,r as Ms,t as Ns}from"./typing-burst-detector-xohyxOCA.js";import{t as Ps}from"./textarea-CQGiqhkV.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 Fs(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&n(()=>import(`./telemetry-impl-DPRMO_b_.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Is(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=Hn(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?zn:xn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Rs:Ls,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:Ls(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 Ls(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 Rs(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var zs=class extends En{#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||Bs(),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=Pn({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),On.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Bs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Vs=class extends mn{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 zs({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=Hs(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=Hs(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=Hs(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=Hs(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){On.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=>hn(t,e))}findAll(e={}){return this.getAll().filter(t=>hn(e,t))}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return On.batch(()=>Promise.all(e.map(e=>e.continue().catch(bn))))}};function Hs(e){return e.options.scope?.id}var Us=class extends mn{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??yn(r,t),a=this.get(i);return a||(a=new Tn({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(){On.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=>Bn(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Bn(e,t)):t}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){On.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){On.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ws=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Us,this.#t=e.mutationCache||new Vs,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=An.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Mn.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(gn(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=Cn(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return On.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;On.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return On.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=On.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(bn).catch(bn)}invalidateQueries(e,t={}){return On.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=On.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(bn)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(bn)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(gn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bn).catch(bn)}fetchInfiniteQuery(e){return e.behavior=Is(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bn).catch(bn)}ensureInfiniteQueryData(e){return e.behavior=Is(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Mn.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(Vn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{_n(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Vn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{_n(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||=yn(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===vn&&(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()}},Gs=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}}}})),Ks=t(((e,t)=>{t.exports=Gs()})),qs=t((e=>{var t=Ks(),n=r(),i=ta();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 ee(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 te(){B(H),B(U),B(W)}function ne(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 re(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ie,ae;function oe(e){if(ie===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ie=t&&t[1]||``,ae=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ie+e+ae}var se=!1;function ce(e,t){if(!e||se)return``;se=!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(`
@@ -10,7 +10,7 @@ Error generating stack: `+e.message+`
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===``||Pt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Pt(e,``+r);break;case`className`:vt(e,`class`,r);break;case`tabIndex`:vt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:vt(e,n,r);break;case`style`:Lt(e,r,o);break;case`data`:if(t!==`object`){vt(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=Vt(``+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=Vt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Ht);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=Vt(``+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),_t(e,`popover`,r);break;case`xlinkActuate`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:_t(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=zt.get(n)||n,_t(e,n,r))}}function Nd(e,t,n,r,i,o){switch(n){case`style`:Lt(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`?Pt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Pt(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=Ht);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ut.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[Xe]||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,``):_t(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)}}kt(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&&jt(e,!!r,n,!0):jt(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)}Nt(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(Rt(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)}}Ot(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?jt(e,!!n,n?[]:``,!1):jt(e,!!n,t,!0)):jt(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)}Mt(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(Rt(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[nt]||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),rt(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[nt])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]);rt(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=at(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=Dt(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),ct(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="`+Dt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Dt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Dt(n.imageSizes)+`"]`)):i+=`[href="`+Dt(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),ct(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="`+Dt(r)+`"][href="`+Dt(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),ct(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=st(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`);ct(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=st(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`),ct(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=st(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`),ct(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=st(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=st(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=st(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="`+Dt(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),ct(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Dt(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~="`+Dt(n.href)+`"]`);if(r)return t.instance=r,ct(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`),ct(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,ct(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),ct(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,ct(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),ct(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[nt]||a[Ye]||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,ct(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ct(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=ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ze(0),this.hiddenUpdates=ze(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=Yr(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=qr,e):qr}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=Wr(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=We(t);var n=Wr(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=at(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Pe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-De(o);s.entanglements[1]|=c,o&=~c}td(a),!(jl&6)&&(Ql=he()+500,nd(0,!1))}}break;case 31:case 13:s=Wr(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=Wt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=it(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(ge()){case _e:return 2;case ve:return 8;case ye:case be:return 32;case xe: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=at(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=it(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,qe(e.priority,function(){op(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,qe(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);Ut=r,n.target.dispatchEvent(r),Ut=null}else return t=at(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=at(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[Xe]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Xe]||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[Ze]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ke();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{we=zp.inject(Rp),Te=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[Ze]=t.current,xd(e),new Fp(t)}})),Js=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=qs()})),Ys=Wi(`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`}]]),Xs=Wi(`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`}]]),Zs=Wi(`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`}]]),Qs=Wi(`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=i(),Q=e(r(),1),$s=e(ta(),1),ec=Js(),$=a(),tc=[[`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`}]];Wi(`bot`,tc);var nc=Wi(`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`}]]),rc=Wi(`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`}]]),ic=Wi(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ac=Wi(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),oc=Wi(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),sc=Wi(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),cc=Wi(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),lc=Wi(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),uc=Wi(`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`}]]),dc=Wi(`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`}]]),fc=Wi(`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`}]]),pc=Wi(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),mc=Wi(`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`}]]),hc=Wi(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),gc=Wi(`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`}]]),_c=Wi(`file-plus`,[[`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 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),vc=Wi(`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`}]]),yc=Wi(`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`}]]),bc=Wi(`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`}]]),xc=Wi(`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`}]]),Sc=Wi(`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`}]]),Cc=Wi(`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`}]]),wc=Wi(`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`}]]),Tc=Wi(`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`}]]),Ec=Wi(`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`}]]),Dc=Wi(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Oc=Wi(`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`}]]),kc=Wi(`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`}]]),Ac=Wi(`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`}]]),jc=Wi(`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`}]]),Mc=Wi(`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`}]]),Nc=Wi(`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`}]]),Pc=Wi(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Fc=Wi(`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`}]]),Ic=Wi(`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`}]]),Lc=Wi(`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`}]]),Rc=Wi(`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`}]]),zc=Wi(`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`}]]),Bc=Wi(`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`}]]),Vc=Wi(`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`}]]),Hc=Wi(`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`}]]),Uc=Wi(`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`}]]),Wc=Wi(`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`}]]),Gc=Wi(`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`}]]),Kc=Wi(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),qc=Wi(`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`}]]),Jc=Wi(`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`}]]),Yc=Wi(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),Xc=Wi(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Zc=Wi(`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`}]]),Qc=Wi(`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`}]]),$c=Wi(`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`}]]),el=Wi(`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`}]]),tl=Wi(`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`}]]),nl=Wi(`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`}]]),rl=Wi(`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`}]]),il=Wi(`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`}]]),al=Wi(`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`}]]),ol=Wi(`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`}]]),sl=Wi(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),cl=Wi(`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`}]]),ll=Wi(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),ul=Wi(`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`}]]),dl=Wi(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),fl=Wi(`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`}]]),pl=Wi(`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 ml(e,t){return e instanceof Error&&e.message?e.message:t}async function hl(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(ml(e,t))}}async function gl(e,t,n=Y,r=`action`){await hl(e,t,e=>{e!==null&&n.error(e)},r)}function _l(e){let t=/\/([^/]+?)(?:\.git)?\/?$/.exec(e);return t?t[1]:`repo`}function vl(e){return{async getAuthStatus(){return e.authQueryTransport.status()},async startSignIn(){return e.openSignIn()},async runClone({url:t}){let n=await e.bridge.dialog.openFolder();if(!n)return{kind:`cancelled`};let r=_l(t),i=`${n.replace(/\/$/,``)}/${r}`,a=Y.loading(`Cloning ${r}...`,{duration:1/0}),o=e.cloneTransport.start({url:t,dir:i});try{for await(let e of o.events){if(e.type===`progress`){Y.loading(`Cloning ${r}...`,{id:a,description:`${e.phase} — ${Math.round(e.pct)}%`,duration:1/0});continue}if(e.type===`complete`)return Y.success(`Cloned ${r}.`,{id:a,duration:4e3}),{kind:`ok`,dir:e.dir};if(e.type===`error`)return Y.error(`Clone failed: ${e.message}`,{id:a,duration:8e3}),{kind:`error`}}return Y.error(`Clone ended unexpectedly.`,{id:a,duration:8e3}),{kind:`error`}}catch(e){let t=e instanceof Error?e.message:`Unknown error`;return Y.error(`Clone failed: ${t}`,{id:a,duration:8e3}),{kind:`error`}}}}}async function yl(e){try{let t=await e.json(),n=Pr.safeParse(t);if(n.success)return n.data.title}catch{}}async function bl(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}function xl(e){let t=e.split(`
11
11
  `);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Sl(){return{async status(e){let t=e?.host??`github.com`,n=await bl(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await yl(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}},async repos(e){let t=e?.host??`github.com`,n=await bl(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await yl(n)??`Failed to fetch repositories`};let r=xl(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||`Failed to fetch repositories`}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:`Failed to fetch repositories`};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}}}}function Cl(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function wl(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
12
12
  `);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Tl(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}function El(){return{start(){return Tl((e,t)=>{(async()=>{try{let n=await fetch(`/api/local-op/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({json:!0}),signal:t});if(!n.ok){let t=`Failed to start sign-in — try again`;try{let e=await n.json(),r=Pr.safeParse(e);r.success&&(t=r.data.title)}catch{}e({type:`error`,message:t});return}if(!n.body){e({type:`error`,message:`Failed to start sign-in — try again`});return}!await wl(n.body,t=>{let n;try{n=JSON.parse(t)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,t.slice(0,100)),`continue`}if(n&&typeof n==`object`&&n.type===`error`&&`problem`in n){let t=n.problem;return e({type:`error`,message:t?.detail||t?.title||`Unknown error`}),`terminal`}let r=n;return e(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})&&!t.aborted&&e({type:`error`,message:`Sign-in stream ended without confirmation — please try again`})}catch(t){if(t instanceof Error&&t.name===`AbortError`)return;e({type:`error`,message:`Connection error — try again`})}})()})}}}function Dl(e){return{start(){return e.localOp.auth.start()}}}function Ol(){return{start(e){return Tl((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}),signal:n});if(!r.ok){let e=`Clone failed — check the URL and try again (${r.status})`;try{let t=await r.json(),n=Pr.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(`
13
- `);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 kl(e){return{start(t){return e.localOp.clone.start(t)}}}var Al=`ContextMenu`,[jl,Ml]=$i(Al,[wa]),Nl=wa(),[Pl,Fl]=jl(Al),Il=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Nl(t),l=Qi(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Pl,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Ua,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Il.displayName=Al;var Ll=`ContextMenuTrigger`,Rl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Fl(Ll,n),o=Nl(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)(ao,{...o,virtualRef:c}),(0,Z.jsx)(Zi.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:Ji(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:Ji(e.onPointerDown,pu(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:Ji(e.onPointerMove,pu(u)),onPointerCancel:r?e.onPointerCancel:Ji(e.onPointerCancel,pu(u)),onPointerUp:r?e.onPointerUp:Ji(e.onPointerUp,pu(u))})]})});Rl.displayName=Ll;var zl=`ContextMenuPortal`,Bl=e=>{let{__scopeContextMenu:t,...n}=e,r=Nl(t);return(0,Z.jsx)(Bo,{...r,...n})};Bl.displayName=zl;var Vl=`ContextMenuContent`,Hl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Fl(Vl,n),a=Nl(n),o=Q.useRef(!1);return(0,Z.jsx)(yo,{...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)`}})});Hl.displayName=Vl;var Ul=`ContextMenuGroup`,Wl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(fo,{...i,...r,ref:t})});Wl.displayName=Ul;var Gl=`ContextMenuLabel`,Kl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Po,{...i,...r,ref:t})});Kl.displayName=Gl;var ql=`ContextMenuItem`,Jl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(lo,{...i,...r,ref:t})});Jl.displayName=ql;var Yl=`ContextMenuCheckboxItem`,Xl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(wo,{...i,...r,ref:t})});Xl.displayName=Yl;var Zl=`ContextMenuRadioGroup`,Ql=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(ro,{...i,...r,ref:t})});Ql.displayName=Zl;var $l=`ContextMenuRadioItem`,eu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Ro,{...i,...r,ref:t})});eu.displayName=$l;var tu=`ContextMenuItemIndicator`,nu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)($a,{...i,...r,ref:t})});nu.displayName=tu;var ru=`ContextMenuSeparator`,iu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Sa,{...i,...r,ref:t})});iu.displayName=ru;var au=`ContextMenuArrow`,ou=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(so,{...i,...r,ref:t})});ou.displayName=au;var su=`ContextMenuSub`,cu=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Nl(t),[s,c]=Xi({prop:i,defaultProp:a??!1,onChange:r,caller:su});return(0,Z.jsx)(Io,{...o,open:s,onOpenChange:c,children:n})};cu.displayName=su;var lu=`ContextMenuSubTrigger`,uu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Ea,{...i,...r,ref:t})});uu.displayName=lu;var du=`ContextMenuSubContent`,fu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Ga,{...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)`}})});fu.displayName=du;function pu(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var mu=Il,hu=Rl,gu=Bl,_u=Hl,vu=Jl,yu=Xl,bu=nu,xu=iu,Su=cu,Cu=uu,wu=fu,Tu=`Radio`,[Eu,Du]=$i(Tu),[Ou,ku]=Eu(Tu),Au=Q.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=Q.useState(null),p=Ki(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(Ou,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(Zi.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Fu(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:Ji(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(Pu,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});Au.displayName=Tu;var ju=`RadioIndicator`,Mu=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=ku(ju,n);return(0,Z.jsx)(qi,{present:r||a.checked,children:(0,Z.jsx)(Zi.span,{"data-state":Fu(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Mu.displayName=ju;var Nu=`RadioBubbleInput`,Pu=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=Ki(o,a),c=an(n),l=ea(t);return Q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Z.jsx)(Zi.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Pu.displayName=Nu;function Fu(e){return e?`checked`:`unchecked`}var Iu=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Lu=`RadioGroup`,[Ru,zu]=$i(Lu,[$o,Du]),Bu=$o(),Vu=Du(),[Hu,Uu]=Ru(Lu),Wu=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,p=Bu(n),m=fr(l),[h,g]=Xi({prop:a,defaultProp:i??null,onChange:d,caller:Lu});return(0,Z.jsx)(Hu,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(Xo,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(Zi.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});Wu.displayName=Lu;var Gu=`RadioGroupItem`,Ku=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Uu(Gu,n),o=a.disabled||r,s=Bu(n),c=Vu(n),l=Q.useRef(null),u=Ki(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{Iu.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,Z.jsx)(Zo,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(Au,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:Ji(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:Ji(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ku.displayName=Gu;var qu=`RadioGroupIndicator`,Ju=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(Mu,{...Vu(n),...r,ref:t})});Ju.displayName=qu;var Yu=Wu,Xu=Ku,Zu=Ju;async function Qu(e){try{await navigator.clipboard.writeText(e)}catch{}}var $u=120*1e3;function ed(e){let t=(0,$.c)(28),{onSuccess:n,onCancel:r,transport:i}=e,{_:a}=Yt(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(`https://github.com/login/device`),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)($u),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),b;t[0]!==a||t[1]!==n||t[2]!==i?(b=async function(){p(null),h(!0);try{let e=i.start();v.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,o=await t.next();for(;!o.done;){let e=o.value;if(e.type===`verification`)s(e.user_code),l(e.verification_uri),_(e.expires_in*1e3),Qu(e.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)});else if(e.type===`complete`){r=!0,h(!1),n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,p(e.message),h(!1);break}o=await t.next()}r||(p(a({id:`DskIkK`})),h(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&p(a({id:`Q5fqMz`})),h(!1)}},t[0]=a,t[1]=n,t[2]=i,t[3]=b):b=t[3];let x=b,S;t[4]===x?S=t[5]:(S=()=>{let e=!1;return queueMicrotask(()=>{e||x()}),()=>{e=!0,v.current?.(),v.current=null,y.current&&clearInterval(y.current)}},t[4]=x,t[5]=S);let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[6]=C):C=t[6],(0,Q.useEffect)(S,C);let w,T;t[7]!==a||t[8]!==o?(w=()=>{if(!o)return;let e=Date.now();return y.current=setInterval(()=>{let t=$u-(Date.now()-e);t<=0?(_(0),y.current&&clearInterval(y.current),p(a({id:`ve8vEM`}))):_(t)},1e3),()=>{y.current&&clearInterval(y.current)}},T=[o,a],t[7]=a,t[8]=o,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=Math.floor(g/6e4),D=Math.floor(g%6e4/1e3),O;t[11]===D?O=t[12]:(O=D.toString().padStart(2,`0`),t[11]=D,t[12]=O);let k=`${E}:${O}`,A;t[13]!==u||t[14]!==f||t[15]!==k||t[16]!==o||t[17]!==c?(A=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`AVoO4B`,values:{verificationUri:c},components:{0:(0,Z.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ra(e,c),onAuxClick:e=>Ra(e,c),className:`underline underline-offset-2`})}})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`flex-1 text-center text-2xl font-mono font-bold tracking-widest border rounded-md py-3 bg-muted`,children:o}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void Qu(o).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)}),children:u?(0,Z.jsx)(J,{id:`PiH3UR`}):(0,Z.jsx)(J,{id:`he3ygx`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,Z.jsx)(J,{id:`5y_9lO`})]}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`gYz2ep`,values:{timeLabel:k}})})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:f?null:(0,Z.jsx)(J,{id:`aWlJai`})}),t[13]=u,t[14]=f,t[15]=k,t[16]=o,t[17]=c,t[18]=A):A=t[18];let j;t[19]===f?j=t[20]:(j=f&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:f}),t[19]=f,t[20]=j);let M;t[21]!==r||t[22]!==m?(M=m&&(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:r,children:(0,Z.jsx)(J,{id:`dEgA5A`})}),t[21]=r,t[22]=m,t[23]=M):M=t[23];let N;return t[24]!==A||t[25]!==j||t[26]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A,j,M]}),t[24]=A,t[25]=j,t[26]=M,t[27]=N):N=t[27],N}function td(e){let t=(0,$.c)(38),{onSuccess:n,onCancel:r}=e,{_:i}=Yt(),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>()=>{d.current?.abort()},p=[],t[0]=f,t[1]=p):(f=t[0],p=t[1]),(0,Q.useEffect)(f,p);let m;t[2]!==i||t[3]!==n||t[4]!==a?(m=async function(){if(!a.trim()){u(i({id:`6nB8LV`}));return}d.current?.abort();let e=new AbortController;d.current=e,c(!0),u(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:a.trim()}),signal:e.signal});if(!t.ok){let e=i({id:`TmKshB`});try{let n=await t.json(),r=Pr.safeParse(n);r.success&&(e=r.data.title)}catch{}u(e),c(!1);return}if(!t.body){u(i({id:`TmKshB`})),c(!1);return}await wl(t.body,e=>{let t;try{t=JSON.parse(e)}catch{return`continue`}return t.type===`complete`?(n({login:t.login,name:t.name,email:t.email}),c(!1),`terminal`):`continue`})||u(i({id:`muWKMD`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&u(i({id:`Q5fqMz`}))}c(!1)},t[2]=i,t[3]=n,t[4]=a,t[5]=m):m=t[5];let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dGaH3A`,components:{0:(0,Z.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noopener noreferrer`,onClick:rd,onAuxClick:nd,className:`underline underline-offset-2`}),1:(0,Z.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`})}})}),t[6]=g):g=t[6];let _;t[7]===i?_=t[8]:(_=i({id:`p2LEhJ`}),t[7]=i,t[8]=_);let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>o(e.target.value),t[9]=v):v=t[9];let y;t[10]===h?y=t[11]:(y=e=>{e.key===`Enter`&&h()},t[10]=h,t[11]=y);let b;t[12]!==s||t[13]!==a||t[14]!==_||t[15]!==y?(b=(0,Z.jsx)(Go,{type:`password`,"aria-label":_,placeholder:`ghp_…`,value:a,onChange:v,disabled:s,onKeyDown:y}),t[12]=s,t[13]=a,t[14]=_,t[15]=y,t[16]=b):b=t[16];let x;t[17]===l?x=t[18]:(x=l&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:l}),t[17]=l,t[18]=x);let S;t[19]===h?S=t[20]:(S=()=>void h(),t[19]=h,t[20]=S);let C;t[21]===s?C=t[22]:(C=s?(0,Z.jsx)(J,{id:`hYFQsG`}):(0,Z.jsx)(J,{id:`zXZJoN`}),t[21]=s,t[22]=C);let w;t[23]!==s||t[24]!==S||t[25]!==C?(w=(0,Z.jsx)(X,{className:`flex-1`,onClick:S,disabled:s,children:C}),t[23]=s,t[24]=S,t[25]=C,t[26]=w):w=t[26];let T;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(J,{id:`dEgA5A`}),t[27]=T):T=t[27];let E;t[28]!==s||t[29]!==r?(E=(0,Z.jsx)(X,{variant:`ghost`,onClick:r,disabled:s,children:T}),t[28]=s,t[29]=r,t[30]=E):E=t[30];let D;t[31]!==w||t[32]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[w,E]}),t[31]=w,t[32]=E,t[33]=D):D=t[33];let O;return t[34]!==D||t[35]!==b||t[36]!==x?(O=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,b,x,D]}),t[34]=D,t[35]=b,t[36]=x,t[37]=O):O=t[37],O}function nd(e){return Ra(e,`https://github.com/settings/tokens`)}function rd(e){return Ra(e,`https://github.com/settings/tokens`)}function id(e){let t=(0,$.c)(41),{login:n,onSave:r,onSkip:i}=e,{_:a}=Yt(),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`gp3I7-`})}),t[0]=u):u=t[0];let d;t[1]===a?d=t[2]:(d=a({id:`6YtxFj`}),t[1]=a,t[2]=d);let f;t[3]!==a||t[4]!==n?(f=a({id:`J2Mv98`,values:{login:n}}),t[3]=a,t[4]=n,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>s(e.target.value),t[6]=p):p=t[6];let m;t[7]!==o||t[8]!==d||t[9]!==f?(m=(0,Z.jsx)(Go,{"aria-label":d,placeholder:f,value:o,onChange:p}),t[7]=o,t[8]=d,t[9]=f,t[10]=m):m=t[10];let h;t[11]===a?h=t[12]:(h=a({id:`O3oNi5`}),t[11]=a,t[12]=h);let g;t[13]===a?g=t[14]:(g=a({id:`O3oNi5`}),t[13]=a,t[14]=g);let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>l(e.target.value),t[15]=_):_=t[15];let v;t[16]!==c||t[17]!==h||t[18]!==g?(v=(0,Z.jsx)(Go,{type:`email`,"aria-label":h,placeholder:g,value:c,onChange:_}),t[16]=c,t[17]=h,t[18]=g,t[19]=v):v=t[19];let y;t[20]!==c||t[21]!==o||t[22]!==r?(y=()=>r(o.trim(),c.trim()),t[20]=c,t[21]=o,t[22]=r,t[23]=y):y=t[23];let b;t[24]!==c||t[25]!==o?(b=!o.trim()||!c.trim(),t[24]=c,t[25]=o,t[26]=b):b=t[26];let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(J,{id:`tfDRzk`}),t[27]=x):x=t[27];let S;t[28]!==y||t[29]!==b?(S=(0,Z.jsx)(X,{className:`flex-1`,onClick:y,disabled:b,children:x}),t[28]=y,t[29]=b,t[30]=S):S=t[30];let C;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(J,{id:`6Uau97`}),t[31]=C):C=t[31];let w;t[32]===i?w=t[33]:(w=(0,Z.jsx)(X,{variant:`ghost`,onClick:i,children:C}),t[32]=i,t[33]=w);let T;t[34]!==S||t[35]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[S,w]}),t[34]=S,t[35]=w,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==m||t[39]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,m,v,T]}),t[37]=T,t[38]=m,t[39]=v,t[40]=E):E=t[40],E}function ad(e){let t=(0,$.c)(9),{authResult:n,onSave:r,onSkip:i}=e,a=n.login,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`KZkHZv`,values:{login:a}})}),t[0]=a,t[1]=o);let s;t[2]!==a||t[3]!==r||t[4]!==i?(s=(0,Z.jsx)(id,{login:a,onSave:r,onSkip:i}),t[2]=a,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)(Z.Fragment,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function od(e){let t=(0,$.c)(45),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s}=e,{_:c}=Yt(),l;t[0]===s?l=t[1]:(l=s??El(),t[0]=s,t[1]=l);let u=l,[d,f]=(0,Q.useState)(`device`),[p,m]=(0,Q.useState)(`auth`),[h,g]=(0,Q.useState)(null),_,v;t[2]===n?(_=t[3],v=t[4]):(_=()=>{n&&(f(`device`),m(`auth`),g(null))},v=[n],t[2]=n,t[3]=_,t[4]=v),(0,Q.useEffect)(_,v);let y;t[5]!==c||t[6]!==a||t[7]!==r||t[8]!==i?(y=function(e){if(g(e),a&&(!e.name||!e.email))m(`identity`);else{m(`done`),i?.(e),r(!1);let t=e.login;Y.success(c({id:`KZkHZv`,values:{login:t}}))}},t[5]=c,t[6]=a,t[7]=r,t[8]=i,t[9]=y):y=t[9];let b=y,x;t[10]!==c||t[11]!==h||t[12]!==r||t[13]!==i?(x=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(sd);let n={...h??{login:``},name:e,email:t};m(`done`),i?.(n),r(!1);let a=n.login;Y.success(c({id:`KZkHZv`,values:{login:a}}))},t[10]=c,t[11]=h,t[12]=r,t[13]=i,t[14]=x):x=t[14];let S=x,C;t[15]!==c||t[16]!==h||t[17]!==r||t[18]!==i?(C=function(){if(!h)return;m(`done`),i?.(h),r(!1);let e=h.login;Y.success(c({id:`KZkHZv`,values:{login:e}}))},t[15]=c,t[16]=h,t[17]=r,t[18]=i,t[19]=C):C=t[19];let w=C,T;t[20]===r?T=t[21]:(T=function(){r(!1)},t[20]=r,t[21]=T);let E=T,D;t[22]===o?D=t[23]:(D=(0,Z.jsx)(un,{children:(0,Z.jsx)($t,{children:o?(0,Z.jsx)(J,{id:`X8kjQX`}):(0,Z.jsx)(J,{id:`gtmbUO`})})}),t[22]=o,t[23]=D);let O;t[24]!==b||t[25]!==E||t[26]!==u||t[27]!==p||t[28]!==d?(O=p===`auth`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1 border-b pb-2 mb-1`,children:[(0,Z.jsx)(X,{variant:d===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>f(`device`),children:(0,Z.jsx)(J,{id:`pdHb22`})}),(0,Z.jsx)(X,{variant:d===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>f(`pat`),children:(0,Z.jsx)(J,{id:`TP9_K5`})})]}),d===`device`?(0,Z.jsx)(ed,{onSuccess:b,onCancel:E,transport:u}):(0,Z.jsx)(td,{onSuccess:b,onCancel:E})]}),t[24]=b,t[25]=E,t[26]=u,t[27]=p,t[28]=d,t[29]=O):O=t[29];let k;t[30]!==h||t[31]!==S||t[32]!==w||t[33]!==p?(k=p===`identity`&&h&&(0,Z.jsx)(ad,{authResult:h,onSave:S,onSkip:w}),t[30]=h,t[31]=S,t[32]=w,t[33]=p,t[34]=k):k=t[34];let A;t[35]!==k||t[36]!==O?(A=(0,Z.jsxs)(sn,{children:[O,k]}),t[35]=k,t[36]=O,t[37]=A):A=t[37];let j;t[38]!==A||t[39]!==D?(j=(0,Z.jsxs)(rn,{className:`sm:max-w-md`,children:[D,A]}),t[38]=A,t[39]=D,t[40]=j):j=t[40];let M;return t[41]!==r||t[42]!==n||t[43]!==j?(M=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:j}),t[41]=r,t[42]=n,t[43]=j,t[44]=M):M=t[44],M}function sd(){}function cd(){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(ld),()=>{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 ld(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function ud(e){let t=(0,$.c)(2),{className:n}=e,{channel:r}=cd();if(r!==`beta`)return null;let i;return t[0]===n?i=t[1]:(i=(0,Z.jsx)(pe,{variant:`secondary`,"aria-label":`Beta channel`,"data-testid":`beta-badge`,className:n,children:`BETA`}),t[0]=n,t[1]=i),i}function dd(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 fd(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`}}var pd=null;function md(e){let t=(0,$.c)(99),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=Yt(),d;t[0]===o?d=t[1]:(d=o??Ol(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Sl(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(pd),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(-1),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useId)(),I;t[4]!==n||t[5]!==m?(I=()=>{if(!n)return;let e=!1;return m.status().then(t=>{pd=t.authenticated,e||T(t.authenticated)}).catch(()=>{pd=!1,e||T(!1)}),()=>{e=!0}},t[4]=n,t[5]=m,t[6]=I):I=t[6];let L;t[7]===n?L=t[8]:(L=[n],t[7]=n,t[8]=L),(0,Q.useEffect)(I,L);let R;t[9]!==w||t[10]!==n||t[11]!==m?(R=()=>{if(!w||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[9]=w,t[10]=n,t[11]=m,t[12]=R):R=t[12];let z;t[13]!==w||t[14]!==n?(z=[w,n],t[13]=w,t[14]=n,t[15]=z):z=t[15],(0,Q.useEffect)(R,z);let B,V;t[16]!==l||t[17]!==n||t[18]!==h?(B=()=>{if(!n||!l||(_(l),h))return;let e=fd(l);e&&y(`~/Documents/${e}`)},V=[n,l,h],t[16]=l,t[17]=n,t[18]=h,t[19]=B,t[20]=V):(B=t[19],V=t[20]),(0,Q.useEffect)(B,V);let H,U;t[21]!==A||t[22]!==F?(U=()=>{A<0||document.getElementById(`${F}-opt-${A}`)?.scrollIntoView({block:`nearest`})},H=[A,F],t[21]=A,t[22]=F,t[23]=H,t[24]=U):(H=t[23],U=t[24]),(0,Q.useEffect)(U,H);let W;t[25]===h?W=t[26]:(W=function(e){if(_(e),k(!0),j(-1),h)return;let t=fd(e);t&&y(`~/Documents/${t}`)},t[25]=h,t[26]=W);let G=W,ee;t[27]===h?ee=t[28]:(ee=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[27]=h,t[28]=ee);let te=ee,ne;t[29]!==u||t[30]!==v||t[31]!==a||t[32]!==r||t[33]!==c||t[34]!==f||t[35]!==g?(ne=async function(){let e=g.trim();if(!e){Y.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){D(!0);let n=await c();if(!n){D(!1);return}let r=fd(e);t=`${n.replace(/\/$/,``)}/${r}`}else D(!0);let n=Y.loading(u({id:`2tgFCe`}),{duration:1/0});N.current=n;let i=f.start({url:e,dir:t});M.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=u(dd(i.phase));Y.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Y.success(u({id:`u_lS4C`}),{id:n}),r(!1),D(!1),M.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;Y.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),D(!1),M.current=null;return}t=await e.next()}Y.error(u({id:`Tz9pJB`}),{id:n}),D(!1),M.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Y.error(u({id:`K9J00P`}),{id:n}),D(!1),M.current=null}},t[29]=u,t[30]=v,t[31]=a,t[32]=r,t[33]=c,t[34]=f,t[35]=g,t[36]=ne):ne=t[36];let re=ne,ie;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){M.current?.(),M.current=null,D(!1),Y.dismiss(N.current??void 0)},t[37]=ie):ie=t[37];let ae=ie,oe;t[38]!==E||t[39]!==r||t[40]!==h?(oe=function(e){E||(r(e),e||(_(``),h||y(``),k(!1),j(-1)))},t[38]=E,t[39]=r,t[40]=h,t[41]=oe):oe=t[41];let se=oe,ce;t[42]===te?ce=t[43]:(ce=function(e){te(e),k(!1),j(-1),P.current?.focus()},t[42]=te,t[43]=ce);let le=ce,ue=w===null||S&&b===null,de;if(t[44]!==b||t[45]!==g){let e=g.trim().toLowerCase(),n;t[47]===b?n=t[48]:(n=b??[],t[47]=b,t[48]=n),de=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[44]=b,t[45]=g,t[46]=de}else de=t[46];let K=de,fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=/:\/\/|^git@|\.git$/i,t[49]=fe):fe=t[49];let pe;t[50]===g?pe=t[51]:(pe=fe.test(g.trim()),t[50]=g,t[51]=pe);let me=pe,he=w===!0&&b!==null&&K.length===0&&!me,ge=O&&w!==!1&&!E&&(ue||K.length>0||he),_e=K.length,ve=`${F}-loading`,ye,be;t[52]===_e?(ye=t[53],be=t[54]):(ye=()=>{j(e=>e>=_e?_e-1:e)},be=[_e],t[52]=_e,t[53]=ye,t[54]=be),(0,Q.useEffect)(ye,be);let xe;t[55]!==A||t[56]!==E||t[57]!==ge||t[58]!==le||t[59]!==K?(xe=function(e){if(!E)if(e.key===`ArrowDown`){if(e.preventDefault(),!ge){k(!0);return}j(e=>Math.min(e+1,K.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),j(bd)):e.key===`Enter`?ge&&A>=0&&A<K.length&&(e.preventDefault(),le(K[A])):e.key===`Escape`&&ge&&(e.preventDefault(),e.stopPropagation(),k(!1),j(-1))},t[55]=A,t[56]=E,t[57]=ge,t[58]=le,t[59]=K,t[60]=xe):xe=t[60];let Se=xe,Ce;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(un,{children:(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[61]=Ce):Ce=t[61];let we;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[62]=we):we=t[62];let Te;t[63]!==u||t[64]!==A||t[65]!==E||t[66]!==Se||t[67]!==G||t[68]!==w||t[69]!==F||t[70]!==ve||t[71]!==i||t[72]!==ge||t[73]!==ue||t[74]!==b||t[75]!==le||t[76]!==K||t[77]!==g?(Te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[we,w===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Go,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>G(e.target.value),disabled:E}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(X,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:E,children:(0,Z.jsx)(J,{id:`gtmbUO`})})]})]}):(0,Z.jsxs)(Ft,{open:ge,onOpenChange:k,children:[(0,Z.jsx)(Ut,{asChild:!0,children:(0,Z.jsx)(Go,{id:`clone-source`,ref:P,role:`combobox`,"aria-expanded":ge,"aria-controls":ge?ue?ve:F:void 0,"aria-activedescendant":A>=0?`${F}-opt-${A}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>G(e.target.value),onFocus:()=>k(!0),onKeyDown:Se,disabled:E})}),(0,Z.jsx)(Be,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:yd,onCloseAutoFocus:vd,onInteractOutside:e=>{P.current?.contains(e.target)&&e.preventDefault()},onWheel:_d,onTouchMove:gd,children:ue?(0,Z.jsxs)(`output`,{id:ve,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Mo,{className:`h-4 w-2/3`}),(0,Z.jsx)(Mo,{className:`h-4 w-1/2`}),(0,Z.jsx)(Mo,{className:`h-4 w-3/4`}),(0,Z.jsx)(Mo,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:F,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:K.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):K.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${F}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===A,onMouseDown:hd,onMouseEnter:()=>j(t),onClick:()=>le(e),className:Gi(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===A&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ni,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[63]=u,t[64]=A,t[65]=E,t[66]=Se,t[67]=G,t[68]=w,t[69]=F,t[70]=ve,t[71]=i,t[72]=ge,t[73]=ue,t[74]=b,t[75]=le,t[76]=K,t[77]=g,t[78]=Te):Te=t[78];let Ee;t[79]!==E||t[80]!==v||t[81]!==h?(Ee=!h&&(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)(J,{id:`Gp_twO`})}),(0,Z.jsx)(Go,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:E})]}),t[79]=E,t[80]=v,t[81]=h,t[82]=Ee):Ee=t[82];let De;t[83]!==Te||t[84]!==Ee?(De=(0,Z.jsx)(sn,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[Te,Ee]})}),t[83]=Te,t[84]=Ee,t[85]=De):De=t[85];let Oe;t[86]!==E||t[87]!==re||t[88]!==se||t[89]!==g||t[90]!==h?(Oe=(0,Z.jsx)(cn,{children:E?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:ae,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>se(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void re(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[86]=E,t[87]=re,t[88]=se,t[89]=g,t[90]=h,t[91]=Oe):Oe=t[91];let ke;t[92]!==De||t[93]!==Oe?(ke=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,children:[Ce,De,Oe]}),t[92]=De,t[93]=Oe,t[94]=ke):ke=t[94];let Ae;return t[95]!==se||t[96]!==n||t[97]!==ke?(Ae=(0,Z.jsx)(dn,{open:n,onOpenChange:se,children:ke}),t[95]=se,t[96]=n,t[97]=ke,t[98]=Ae):Ae=t[98],Ae}function hd(e){return e.preventDefault()}function gd(e){return e.stopPropagation()}function _d(e){return e.stopPropagation()}function vd(e){return e.preventDefault()}function yd(e){return e.preventDefault()}function bd(e){return Math.max(e-1,-1)}var xd=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-Y-YFxY-Y.js`),__vite__mapDeps([5,1,6,7,8,9,10,11,12]),import.meta.url));function Sd(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(as.subscribe,wd,Cd))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)(xd,{})}),e[0]=t):t=e[0],t}function Cd(){return!1}function wd(){return as.getSnapshot()!==null}var Td=180,Ed=5e3;function Dd(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function Od(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function kd(e){if(e===``)return``;let t=e.replace(/[/\\]+$/,``);if(t===``)return``;let n=t.match(/[/\\][^/\\]+$/);if(n===null)return``;let r=t.length-n[0].length;return r===0?t[0]??``:t.slice(0,r)}function Ad(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 jd(e){let t=e instanceof Error?e.message:String(e);for(let e of ai)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 Md(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 Nd(e){let t=(0,$.c)(160),{open:n,onOpenChange:r,bridge:i}=e,{_:a}=Yt(),o=(0,Q.useId)(),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(Bd),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={kind:`idle`},t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S={kind:`idle`},t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(0),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(``),j;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(j=new Set,t[2]=j):j=t[2];let M=(0,Q.useRef)(j),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L,R;t[3]!==i||t[4]!==n?(L=()=>{if(!n)return;M.current.clear(),x(null),h({kind:`idle`}),_(`idle`),y(!1),c(``),f(new Set(Ur)),w({kind:`idle`}),O(!1),A(``),I.current+=1;let e=!1;u(``),i.fs.defaultProjectsRoot().then(t=>{e||u(t)}).catch(zd);let t=requestAnimationFrame(()=>{F.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},R=[n,i],t[3]=i,t[4]=n,t[5]=L,t[6]=R):(L=t[5],R=t[6]),(0,Q.useEffect)(L,R);let z;t[7]!==i||t[8]!==D||t[9]!==n||t[10]!==s||t[11]!==k?(z=()=>{if(!n)return;if(P.current!==null&&clearTimeout(P.current),N.current!==null&&N.current.abort(),s===``){h({kind:`idle`}),_(`idle`);return}let e=k.trim(),t=D&&e!==``,r=t?s:kd(s),a=ui(t?e:Od(s));if(r===``||a===``){h({kind:`idle`}),_(`idle`);return}let o=Dd(r,a),c=new AbortController;return N.current=c,P.current=setTimeout(()=>{_(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(r),i.fs.findEnclosingGitRoot(r),i.fs.folderState(o)]).then(e=>{let[t,n,i]=e;if(c.signal.aborted)return;_(`idle`);let o=Ad({parent:r,sanitizedName:a,enclosingProject:t,enclosingGit:n,targetState:i});h(o),o.kind===`block-nonempty`&&O(!0)}).catch(e=>{c.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),_(`idle`),h({kind:`free`}))})},Td),()=>{P.current!==null&&clearTimeout(P.current),c.abort()}},t[7]=i,t[8]=D,t[9]=n,t[10]=s,t[11]=k,t[12]=z):z=t[12];let B;t[13]!==i||t[14]!==D||t[15]!==n||t[16]!==s||t[17]!==T||t[18]!==k?(B=[n,s,i,T,D,k],t[13]=i,t[14]=D,t[15]=n,t[16]=s,t[17]=T,t[18]=k,t[19]=B):B=t[19],(0,Q.useEffect)(z,B);let V,H;t[20]===n?(V=t[21],H=t[22]):(V=()=>{if(!n)return;let e=()=>E(Rd);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},H=[n],t[20]=n,t[21]=V,t[22]=H),(0,Q.useEffect)(V,H);let U=(0,Q.useRef)(`idle`),W,G;t[23]===g?(W=t[24],G=t[25]):(W=()=>{U.current=g},G=[g],t[23]=g,t[24]=W,t[25]=G),(0,Q.useEffect)(W,G);let ee,te;t[26]!==m.kind||t[27]!==n?(ee=()=>{if(!n||m.kind!==`confirm-git`)return;let e=setInterval(()=>{U.current!==`in-flight`&&E(Ld)},Ed);return()=>clearInterval(e)},te=[n,m.kind],t[26]=m.kind,t[27]=n,t[28]=ee,t[29]=te):(ee=t[28],te=t[29]),(0,Q.useEffect)(ee,te);let ne;t[30]!==m.gitRoot||t[31]!==m.kind||t[32]!==C.gitRoot||t[33]!==C.kind?(ne=()=>{if(m.kind!==`confirm-git`){C.kind!==`idle`&&(I.current+=1,w({kind:`idle`}));return}C.kind===`confirming`&&C.gitRoot!==m.gitRoot&&w({kind:`idle`}),C.kind===`pending`&&C.gitRoot!==m.gitRoot&&(I.current+=1,w({kind:`idle`}))},t[30]=m.gitRoot,t[31]=m.kind,t[32]=C.gitRoot,t[33]=C.kind,t[34]=ne):ne=t[34];let re;t[35]!==m||t[36]!==C?(re=[m,C],t[35]=m,t[36]=C,t[37]=re):re=t[37],(0,Q.useEffect)(ne,re);let ie;t[38]!==i||t[39]!==m.kind||t[40]!==n?(ie=()=>{if(!n)return;let e=null;m.kind===`block-nested`?e=`nested`:m.kind===`block-nonempty`?e=`nonempty`:m.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(M.current.has(e)||(M.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Id)))},t[38]=i,t[39]=m.kind,t[40]=n,t[41]=ie):ie=t[41];let ae;t[42]!==i||t[43]!==m||t[44]!==n?(ae=[n,m,i],t[42]=i,t[43]=m,t[44]=n,t[45]=ae):ae=t[45],(0,Q.useEffect)(ie,ae);let oe,se,ce,le,ue,de,K;t[46]!==D||t[47]!==s||t[48]!==k?(de=k.trim(),ue=D&&de!==``,oe=s===``?``:ue?de:Od(s),le=s===``?``:ui(oe),se=s!==``&&le!==oe&&le!==``,ce=s!==``&&oe!==``&&le===``,K=ue?Dd(s,le):s,t[46]=D,t[47]=s,t[48]=k,t[49]=oe,t[50]=se,t[51]=ce,t[52]=le,t[53]=ue,t[54]=de,t[55]=K):(oe=t[49],se=t[50],ce=t[51],le=t[52],ue=t[53],de=t[54],K=t[55]);let fe=K,pe=!v&&s!==``&&le!==``&&g===`idle`&&(m.kind===`free`||m.kind===`confirm-git`),me;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[56]=me):me=t[56];let he=me,ge;t[57]!==i||t[58]!==l?(ge=async function(){try{let e=await i.dialog.openFolder(l===``?void 0:{defaultPath:l});if(e===null)return;c(e),E(Fd),x(null),O(!1),A(``)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[57]=i,t[58]=l,t[59]=ge):ge=t[59];let _e=ge,ve;t[60]!==i||t[61]!==pe||t[62]!==d||t[63]!==r||t[64]!==s||t[65]!==le||t[66]!==ue?(ve=async function(e){if(e.preventDefault(),pe){y(!0),x(null);try{await i.project.createNew({parent:ue?s:kd(s),name:le,editors:Array.from(d)}),r(!1)}catch(e){x(jd(e)),y(!1)}}},t[60]=i,t[61]=pe,t[62]=d,t[63]=r,t[64]=s,t[65]=le,t[66]=ue,t[67]=ve):ve=t[67];let ye=ve,be;t[68]!==v||t[69]!==r?(be=function(e){v||r(e)},t[68]=v,t[69]=r,t[70]=be):be=t[70];let xe=be,Se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Se=async function(e){w({kind:`confirming`,gitRoot:e})},t[71]=Se):Se=t[71];let Ce=Se,we;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(we=async function(){w({kind:`idle`})},t[72]=we):we=t[72];let Te=we,Ee;t[73]===i?Ee=t[74]:(Ee=async function(e){let t=I.current+1;I.current=t,w({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),I.current!==t)return;E(Pd),w({kind:`idle`})}catch(e){let n=e;if(I.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),w({kind:`error`,message:r})}},t[73]=i,t[74]=Ee);let De=Ee,Oe;t[75]!==i||t[76]!==r?(Oe=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[75]=i,t[76]=r,t[77]=Oe):Oe=t[77];let ke=Oe,Ae;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`wbv9xO`})}),t[78]=Ae):Ae=t[78];let je;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsxs)(un,{children:[Ae,(0,Z.jsx)(Zt,{children:(0,Z.jsx)(J,{id:`WEzuMq`})})]}),t[79]=je):je=t[79];let Me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(ns,{htmlFor:`create-location`,children:(0,Z.jsx)(J,{id:`wJijgU`})}),t[80]=Me):Me=t[80];let Ne;t[81]===_e?Ne=t[82]:(Ne=()=>void _e(),t[81]=_e,t[82]=Ne);let Pe;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(J,{id:`O2UpM1`}),t[83]=Pe):Pe=t[83];let Fe;t[84]!==v||t[85]!==Ne?(Fe=(0,Z.jsx)(`div`,{className:`flex items-stretch gap-2`,children:(0,Z.jsx)(X,{id:`create-location`,ref:F,type:`button`,variant:`outline`,disabled:v,onClick:Ne,"aria-describedby":`create-target-caption`,"data-testid":`create-browse`,children:Pe})}),t[84]=v,t[85]=Ne,t[86]=Fe):Fe=t[86];let Ie;t[87]===fe?Ie=t[88]:(Ie=fe===``?(0,Z.jsx)(J,{id:`i_grbe`}):fe,t[87]=fe,t[88]=Ie);let Le;t[89]===Ie?Le=t[90]:(Le=(0,Z.jsx)(`p`,{id:`create-target-caption`,className:`text-1sm text-muted-foreground`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:Ie}),t[89]=Ie,t[90]=Le);let Re;t[91]!==Fe||t[92]!==Le?(Re=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Me,Fe,Le]}),t[91]=Fe,t[92]=Le,t[93]=Re):Re=t[93];let ze;t[94]!==v||t[95]!==m.kind||t[96]!==D||t[97]!==se||t[98]!==ce||t[99]!==le||t[100]!==ue||t[101]!==k||t[102]!==de?(ze=D?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":`create-subfolder-rescue`,children:[(0,Z.jsx)(ns,{htmlFor:`create-subfolder-name`,children:(0,Z.jsx)(J,{id:`NYUhy5`})}),(0,Z.jsx)(Go,{id:`create-subfolder-name`,value:k,placeholder:`my-project`,onChange:e=>A(e.target.value),disabled:v,autoFocus:!0,"aria-invalid":ue&&(ce||m.kind===`block-nonempty`),"data-testid":`create-subfolder-input`}),de===``?(0,Z.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-subfolder-empty-error`,children:(0,Z.jsx)(J,{id:`hJu2pH`})}):ce?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-subfolder-erased-error`,children:(0,Z.jsx)(J,{id:`JUamR6`})}):m.kind===`block-nonempty`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-subfolder-taken-error`,children:(0,Z.jsx)(J,{id:`tCelbM`,values:{sanitized:le},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):se?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`KnoB--`,values:{sanitized:le},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null]}):null,t[94]=v,t[95]=m.kind,t[96]=D,t[97]=se,t[98]=ce,t[99]=le,t[100]=ue,t[101]=k,t[102]=de,t[103]=ze):ze=t[103];let q;t[104]!==D||t[105]!==oe||t[106]!==se||t[107]!==le?(q=!D&&se?(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-sanitize-diverged`,children:(0,Z.jsx)(J,{id:`z2G3EK`,values:{rawName:oe,sanitized:le},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[104]=D,t[105]=oe,t[106]=se,t[107]=le,t[108]=q):q=t[108];let Be;t[109]!==D||t[110]!==oe||t[111]!==ce?(Be=!D&&ce?(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-sanitize-erased`,children:(0,Z.jsx)(J,{id:`cBbVqQ`,values:{rawName:oe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[109]=D,t[110]=oe,t[111]=ce,t[112]=Be):Be=t[112];let Ve;t[113]!==m||t[114]!==De||t[115]!==ke||t[116]!==C?(Ve=(0,Z.jsx)(Vd,{cascade:m,onOpenNested:ke,removeGitState:C,onRequestRemoveGit:Ce,onCancelRemoveGit:Te,onConfirmRemoveGit:De}),t[113]=m,t[114]=De,t[115]=ke,t[116]=C,t[117]=Ve):Ve=t[117];let He;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`0YEbfk`})}),t[118]=He):He=t[118];let Ue;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`prHfed`})}),t[119]=Ue):Ue=t[119];let We;t[120]!==v||t[121]!==d?(We=Ur.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(ns,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Yo,{id:t,checked:d.has(e),onCheckedChange:()=>he(e),disabled:v,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:Dr[e]})]},e)}),t[120]=v,t[121]=d,t[122]=We):We=t[122];let Ge;t[123]===We?Ge=t[124]:(Ge=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[He,Ue,We]}),t[123]=We,t[124]=Ge);let Ke;t[125]!==a||t[126]!==b?(Ke=b===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:a(Md(b))}),t[125]=a,t[126]=b,t[127]=Ke):Ke=t[127];let qe;t[128]!==o||t[129]!==ye||t[130]!==Re||t[131]!==ze||t[132]!==q||t[133]!==Be||t[134]!==Ve||t[135]!==Ge||t[136]!==Ke?(qe=(0,Z.jsx)(sn,{className:`space-y-4`,children:(0,Z.jsxs)(`form`,{id:o,onSubmit:ye,"data-testid":`create-project-form`,className:`space-y-4`,children:[Re,ze,q,Be,Ve,Ge,Ke]})}),t[128]=o,t[129]=ye,t[130]=Re,t[131]=ze,t[132]=q,t[133]=Be,t[134]=Ve,t[135]=Ge,t[136]=Ke,t[137]=qe):qe=t[137];let Je;t[138]===r?Je=t[139]:(Je=()=>r(!1),t[138]=r,t[139]=Je);let Ye;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(J,{id:`dEgA5A`}),t[140]=Ye):Ye=t[140];let Xe;t[141]!==v||t[142]!==Je?(Xe=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Je,disabled:v,"data-testid":`create-cancel`,children:Ye}),t[141]=v,t[142]=Je,t[143]=Xe):Xe=t[143];let Ze=!pe,Qe;t[144]===v?Qe=t[145]:(Qe=v?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[144]=v,t[145]=Qe);let $e;t[146]!==o||t[147]!==Ze||t[148]!==Qe?($e=(0,Z.jsx)(X,{type:`submit`,form:o,disabled:Ze,"data-testid":`create-submit`,children:Qe}),t[146]=o,t[147]=Ze,t[148]=Qe,t[149]=$e):$e=t[149];let et;t[150]!==Xe||t[151]!==$e?(et=(0,Z.jsxs)(cn,{children:[Xe,$e]}),t[150]=Xe,t[151]=$e,t[152]=et):et=t[152];let tt;t[153]!==qe||t[154]!==et?(tt=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[je,qe,et]}),t[153]=qe,t[154]=et,t[155]=tt):tt=t[155];let nt;return t[156]!==xe||t[157]!==n||t[158]!==tt?(nt=(0,Z.jsx)(dn,{open:n,onOpenChange:xe,children:tt}),t[156]=xe,t[157]=n,t[158]=tt,t[159]=nt):nt=t[159],nt}function Pd(e){return e+1}function Fd(e){return e+1}function Id(){}function Ld(e){return e+1}function Rd(e){return e+1}function zd(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Bd(){return new Set(Ur)}function Vd(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=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=Od(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 s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(J,{id:`aIgBKf`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(J,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(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:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}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 c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(J,{id:`5o4lc1`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(J,{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)(J,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},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)(J,{id:`WZ-vBy`,values:{targetGitPath:c},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)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(J,{id:`0-31GV`}):(0,Z.jsx)(J,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(J,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(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:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function Hd(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 Ud(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 Wd=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-CR1y0qI_.js`),__vite__mapDeps([13,1,6,7,8,9,14,15]),import.meta.url));function Gd(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(os.subscribe,qd,Kd))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)(Wd,{})}),e[0]=t):t=e[0],t}function Kd(){return!1}function qd(){return os.getSnapshot()!==null}function Jd(e){return`https://github.com/${e.owner}/${e.repo}.git`}function Yd(e){let t=e.toLowerCase().trim();return t.endsWith(`/`)&&(t=t.slice(0,-1)),t.endsWith(`.git`)&&(t=t.slice(0,-4)),t}function Xd(e,t){let n=Yd(Jd(t));for(let t of e)if(t.missing!==!0&&t.gitRemoteUrl&&Yd(t.gitRemoteUrl)===n)return t;return null}function Zd(e){return`https://github.com/${e.owner}/${e.repo}.git`}function Qd(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 $d(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 ef(e){return e.kind===`ok`?{owner:e.owner,repo:e.repo,branch:e.branch,path:e.path,blobUrl:e.blobUrl}:null}function tf(e){let t=[`[receive]`];return e.q1_hit!==void 0&&t.push(`q1_hit=${e.q1_hit}`),e.q2_path!==void 0&&t.push(`q2_path=${e.q2_path}`),e.folder_validate!==void 0&&t.push(`folder_validate=${e.folder_validate}`),t.join(` `)}function nf(){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 rf=nf();function af(e){return rf.install(e)}function of(e){let t=(0,$.c)(107),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?rf:i,{_:o}=Yt(),s=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,sf),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!1),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{l(!1),d(!1),p(null),h(!1),_(!1),v.current=!1},t[0]=y):y=t[0];let b;t[1]===s?b=t[2]:(b=[s],t[1]=s,t[2]=b),(0,Q.useEffect)(y,b);let x;t[3]!==f||t[4]!==r||t[5]!==s||t[6]!==c?(x=()=>{r&&(!s||s.kind!==`ok`||c&&f===null&&(v.current||(v.current=!0,h(!0),r.getAuthStatus().then(e=>{p(e)}).catch(()=>{p({authenticated:!1,host:`github.com`})}).finally(()=>{h(!1)}))))},t[3]=f,t[4]=r,t[5]=s,t[6]=c,t[7]=x):x=t[7];let S;t[8]!==f||t[9]!==s||t[10]!==c?(S=[s,c,f],t[8]=f,t[9]=s,t[10]=c,t[11]=S):S=t[11],(0,Q.useEffect)(x,S);let C,w;t[12]!==s||t[13]!==a?(C=()=>{if(!s)return;let e=$d(s);e&&(Y.error(e.message),a.dismiss())},w=[s,a],t[12]=s,t[13]=a,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,Q.useEffect)(C,w);let T,E;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a?(T=()=>{if(!s||s.kind!==`ok`||c)return;let e=!1;return cf(s,n).then(t=>{if(!e){if(t.kind===`hit`){console.log(tf({q1_hit:!0})),a.dismiss();return}console.log(tf({q1_hit:!1})),l(!0)}}),()=>{e=!0}},E=[s,c,n,a],t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=T,t[21]=E):(T=t[20],E=t[21]),(0,Q.useEffect)(T,E);let D,O,k,A,j,M,N,P,F,I;if(t[22]!==o||t[23]!==m||t[24]!==f?.authenticated||t[25]!==n||t[26]!==r||t[27]!==g||t[28]!==s||t[29]!==u||t[30]!==c||t[31]!==a){I=Symbol.for(`react.early_return_sentinel`);bb0:{if(M=s?ef(s):null,!M){I=null;break bb0}let e={owner:M.owner,repo:M.repo};if(!c){I=null;break bb0}k=async function(){if(!M)return;if(console.log(tf({q2_path:`clone`})),!r){Y.info(o({id:`27XW26`}),{action:{label:o({id:`B3NAZC`}),onClick:()=>{n.navigator.open()}},duration:8e3});return}if(!f?.authenticated||g)return;_(!0);let t=Zd(e),i;try{i=await r.runClone({url:t})}catch{Y.error(o({id:`jnXr0e`})),_(!1);return}if(_(!1),i.kind===`ok`){try{await n.project.open({path:i.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkDoc:M.path})}catch{Y.error(o({id:`438Fca`}))}a.dismiss();return}};let i;t[42]!==m||t[43]!==r?(i=async function(){if(!(!r||m)){h(!0);try{let e=await r.startSignIn();h(!1),e!==null&&p(e)}catch{h(!1)}}},t[42]=m,t[43]=r,t[44]=i):i=t[44],j=i,A=async function(){if(!(!M||u)){d(!0),console.log(tf({q2_path:`local`}));try{for(;;){let t=await n.dialog.openFolder();if(!t)break;let r=await n.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(tf({folder_validate:r.kind})),r.kind===`ok`){await n.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkDoc:M.path}),a.dismiss();break}let i=Qd(r,e);i&&Y.error(i)}}catch{Y.error(o({id:`rlUzXK`}))}d(!1)}},D=r!==void 0&&f?.authenticated===!0&&!g;let l;t[45]!==o||t[46]!==f?.authenticated||t[47]!==r||t[48]!==g?(l=g?o({id:`YjhKI5`}):r&&f?.authenticated===!1?o({id:`lanW9H`}):o({id:`LE7t79`}),t[45]=o,t[46]=f?.authenticated,t[47]=r,t[48]=g,t[49]=l):l=t[49],O=l,N=M.owner,P=M.repo,F=Jd(e)}t[22]=o,t[23]=m,t[24]=f?.authenticated,t[25]=n,t[26]=r,t[27]=g,t[28]=s,t[29]=u,t[30]=c,t[31]=a,t[32]=D,t[33]=O,t[34]=k,t[35]=A,t[36]=j,t[37]=M,t[38]=N,t[39]=P,t[40]=F,t[41]=I}else D=t[32],O=t[33],k=t[34],A=t[35],j=t[36],M=t[37],N=t[38],P=t[39],F=t[40],I=t[41];if(I!==Symbol.for(`react.early_return_sentinel`))return I;let L=F,R=f?.authenticated?f.login:void 0,z;t[50]===a?z=t[51]:(z=e=>{e||a.dismiss()},t[50]=a,t[51]=z);let B;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`PHRoEJ`})}),t[52]=B):B=t[52];let V=M.path?` · ${M.path}`:null,H;t[53]!==M.owner||t[54]!==M.repo||t[55]!==V?(H=(0,Z.jsxs)(un,{children:[B,(0,Z.jsxs)(Zt,{children:[M.owner,`/`,M.repo,V]})]}),t[53]=M.owner,t[54]=M.repo,t[55]=V,t[56]=H):H=t[56];let U;t[57]===k?U=t[58]:(U=()=>{k()},t[57]=k,t[58]=U);let W=r!==void 0&&!D,G=r!==void 0&&!D,ee;t[59]===O?ee=t[60]:(ee=(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:O}),t[59]=O,t[60]=ee);let te;t[61]!==N||t[62]!==P?(te=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`jGJy-9`,values:{shareOwner:N,shareRepo:P}})}),t[61]=N,t[62]=P,t[63]=te):te=t[63];let ne;t[64]!==U||t[65]!==W||t[66]!==G||t[67]!==ee||t[68]!==te?(ne=(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:U,disabled:W,"aria-disabled":G,children:[ee,te]}),t[64]=U,t[65]=W,t[66]=G,t[67]=ee,t[68]=te,t[69]=ne):ne=t[69];let re;t[70]===A?re=t[71]:(re=()=>{A()},t[70]=A,t[71]=re);let ie=u||g,ae;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,Z.jsx)(J,{id:`HfI1dR`})}),t[72]=ae):ae=t[72];let oe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`_qD6mn`})}),t[73]=oe):oe=t[73];let se;t[74]!==re||t[75]!==ie?(se=(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:re,disabled:ie,children:[ae,oe]}),t[74]=re,t[75]=ie,t[76]=se):se=t[76];let ce;t[77]!==ne||t[78]!==se?(ce=(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[ne,se]}),t[77]=ne,t[78]=se,t[79]=ce):ce=t[79];let le;t[80]!==m||t[81]!==f||t[82]!==r||t[83]!==j||t[84]!==R?(le=r?(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`,children:f===null?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`OZtLT5`})}):f.authenticated?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`95uxb3`,values:{signedInLogin:R},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)(J,{id:`MtR6ZK`})}),(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:()=>{j()},disabled:m,children:m?(0,Z.jsx)(J,{id:`PKLY-1`}):(0,Z.jsx)(J,{id:`gtmbUO`})})]})}):null,t[80]=m,t[81]=f,t[82]=r,t[83]=j,t[84]=R,t[85]=le):le=t[85];let ue;t[86]===L?ue=t[87]:(ue={lookingForUrl:L},t[86]=L,t[87]=ue);let de;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(de={0:(0,Z.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-foreground/80`})},t[88]=de):de=t[88];let K;t[89]===ue?K=t[90]:(K=(0,Z.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:(0,Z.jsx)(J,{id:`RJ3a8Z`,values:ue,components:de})}),t[89]=ue,t[90]=K);let fe;t[91]!==ce||t[92]!==le||t[93]!==K?(fe=(0,Z.jsxs)(sn,{children:[ce,le,K]}),t[91]=ce,t[92]=le,t[93]=K,t[94]=fe):fe=t[94];let pe;t[95]===a?pe=t[96]:(pe=()=>a.dismiss(),t[95]=a,t[96]=pe);let me;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(J,{id:`dEgA5A`}),t[97]=me):me=t[97];let he;t[98]===pe?he=t[99]:(he=(0,Z.jsx)(cn,{children:(0,Z.jsx)(X,{variant:`ghost`,onClick:pe,children:me})}),t[98]=pe,t[99]=he);let ge;t[100]!==H||t[101]!==fe||t[102]!==he?(ge=(0,Z.jsxs)(rn,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[H,fe,he]}),t[100]=H,t[101]=fe,t[102]=he,t[103]=ge):ge=t[103];let _e;return t[104]!==z||t[105]!==ge?(_e=(0,Z.jsx)(dn,{open:!0,onOpenChange:z,children:ge}),t[104]=z,t[105]=ge,t[106]=_e):_e=t[106],_e}function sf(){return null}async function cf(e,t){let n;try{n=Xd(await t.project.listRecent(),{owner:e.owner,repo:e.repo})}catch{return{kind:`miss`}}if(!n)return{kind:`miss`};try{if((await t.share.validateLocalFolder({folderPath:n.path,owner:e.owner,repo:e.repo})).kind!==`ok`)return{kind:`miss`}}catch{return{kind:`miss`}}try{return await t.project.open({path:n.path,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkDoc:e.path}),{kind:`hit`}}catch{return{kind:`miss`}}}var lf=(e,t,n)=>hl(e,t,n,`NavigatorApp`);function uf(e,t){return e.filter(e=>e.path!==t)}function df(e){let t=(0,$.c)(82),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`&&window.okDesktop!=null,[C,w]=(0,Q.useState)(`auth`),{theme:E}=li();m(n,E??`system`);let D;t[1]===n.project?D=t[2]:(D=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||u(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=D);let O;t[3]===n?O=t[4]:(O=[n],t[3]=n,t[4]=O),(0,Q.useEffect)(D,O);let k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=(e,t)=>lf(e,t,u),t[5]=k):k=t[5];let A=k,j;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>f(!0),t[6]=j):j=t[6];let M=j,N;t[7]===n?N=t[8]:(N=()=>A(async()=>{let e=await n.dialog.openFolder();e&&await mf(n,e,`pick-existing`)},`Failed to open folder.`),t[7]=n,t[8]=N);let P=N,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>h(!0),t[9]=F):F=t[9];let I=F,L;t[10]===n?L=t[11]:(L=e=>A(async()=>{await mf(n,e,`recents`)},`Failed to open project.`),t[10]=n,t[11]=L);let R=L,z;t[12]===n.project?z=t[13]:(z=e=>A(async()=>{await n.project.removeRecent(e),a(t=>uf(t,e))},`Failed to remove project.`),t[12]=n.project,t[13]=z);let B=z,V;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${S?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":S?``:void 0,"data-testid":`nav-chrome-row`}),t[14]=V):V=t[14];let H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Ud,{className:`size-12 shrink-0`}),t[15]=H):H=t[15];let U;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(U=(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)(ud,{})]}),t[16]=U):U=t[16];let W;t[17]===n.appVersion?W=t[18]:(W=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[H,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[U,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[17]=n.appVersion,t[18]=W);let G;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(ff,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:M,dataTestId:`nav-clone`,Icon:Hd}),t[19]=G):G=t[19];let te;t[20]===P?te=t[21]:(te=(0,Z.jsx)(ff,{title:`Open folder on disk`,description:`Use a folder you already have.`,onClick:P,dataTestId:`nav-open`,Icon:T}),t[20]=P,t[21]=te);let ne;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(ff,{title:`Create new project`,description:`Start a new Open Knowledge project.`,onClick:I,dataTestId:`nav-create-new`,Icon:c}),t[22]=ne):ne=t[22];let re;t[23]===te?re=t[24]:(re=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[G,te,ne]}),t[23]=te,t[24]=re);let ie;t[25]===l?ie=t[26]:(ie=l===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:l}),(0,Z.jsx)(X,{type:`button`,variant:`link`,size:`sm`,onClick:()=>u(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[25]=l,t[26]=ie);let ae;t[27]!==o||t[28]!==R||t[29]!==B||t[30]!==i?(ae=o?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ee,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.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:`Recent`}),(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:i.map(e=>(0,Z.jsx)(pf,{project:e,onOpen:()=>R(e.path),onRemove:()=>B(e.path)},e.path))})]}):null,t[27]=o,t[28]=R,t[29]=B,t[30]=i,t[31]=ae):ae=t[31];let oe;t[32]!==W||t[33]!==re||t[34]!==ie||t[35]!==ae?(oe=(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:[W,re,ie,ae]})}),t[32]=W,t[33]=re,t[34]=ie,t[35]=ae,t[36]=oe):oe=t[36];let se,ce;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Gd,{}),ce=(0,Z.jsx)(Sd,{}),t[37]=se,t[38]=ce):(se=t[37],ce=t[38]);let le;t[39]!==n||t[40]!==p?(le=(0,Z.jsx)(Nd,{open:p,onOpenChange:h,bridge:n}),t[39]=n,t[40]=p,t[41]=le):le=t[41];let ue;t[42]===b?ue=t[43]:(ue=e=>{_(e),e||(y(!1),b&&(b(null),x(null)))},t[42]=b,t[43]=ue);let de;t[44]===n?de=t[45]:(de=Dl(n),t[44]=n,t[45]=de);let K=C===`identity`,fe;t[46]!==v||t[47]!==b?(fe=e=>{_(!1),v&&(y(!1),f(!0)),b&&(b({authenticated:!0,host:`github.com`,login:e.login}),x(null))},t[46]=v,t[47]=b,t[48]=fe):fe=t[48];let pe;t[49]!==g||t[50]!==ue||t[51]!==de||t[52]!==K||t[53]!==fe?(pe=(0,Z.jsx)(od,{open:g,onOpenChange:ue,transport:de,identityPrompt:K,onSuccess:fe}),t[49]=g,t[50]=ue,t[51]=de,t[52]=K,t[53]=fe,t[54]=pe):pe=t[54];let me;t[55]===n?me=t[56]:(me=kl(n),t[55]=n,t[56]=me);let he;t[57]===n?he=t[58]:(he=Cl(n),t[57]=n,t[58]=he);let ge;t[59]===n.dialog?ge=t[60]:(ge=()=>n.dialog.openFolder(),t[59]=n.dialog,t[60]=ge);let _e;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(_e=()=>{f(!1),w(`auth`),y(!0),_(!0)},t[61]=_e):_e=t[61];let ve;t[62]===n?ve=t[63]:(ve=e=>{let{dir:t}=e;A(()=>mf(n,t,`pick-existing`),`Failed to open cloned project.`)},t[62]=n,t[63]=ve);let ye;t[64]!==d||t[65]!==me||t[66]!==he||t[67]!==ge||t[68]!==ve?(ye=(0,Z.jsx)(md,{open:d,onOpenChange:f,transport:me,authQueryTransport:he,pickParentFolder:ge,onSignIn:_e,onCloneComplete:ve}),t[64]=d,t[65]=me,t[66]=he,t[67]=ge,t[68]=ve,t[69]=ye):ye=t[69];let be;if(t[70]!==n){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{x(()=>e),_(!0)}),t[72]=e):e=t[72],be=vl({bridge:n,authQueryTransport:Cl(n),cloneTransport:kl(n),openSignIn:e}),t[70]=n,t[71]=be}else be=t[71];let xe;t[73]!==n||t[74]!==be?(xe=(0,Z.jsx)(of,{bridge:n,cloneController:be}),t[73]=n,t[74]=be,t[75]=xe):xe=t[75];let Se;return t[76]!==oe||t[77]!==le||t[78]!==pe||t[79]!==ye||t[80]!==xe?(Se=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[V,oe,se,ce,le,pe,ye,xe]}),t[76]=oe,t[77]=le,t[78]=pe,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function ff(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)(X,{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 pf(e){let t=(0,$.c)(25),{project:n,onOpen:r,onRemove:i}=e,a=n.missing,o=n.missing&&`opacity-50`,s;t[0]===o?s=t[1]:(s=Gi(`h-auto min-w-0 flex-1 justify-between gap-2 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,o),t[0]=o,t[1]=s);let c;t[2]===n.name?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[2]=n.name,t[3]=c);let l;t[4]===n.path?l=t[5]:(l=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[4]=n.path,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.missing?d=t[10]:(d=n.missing?(0,Z.jsx)(pe,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[9]=n.missing,t[10]=d);let f;t[11]!==r||t[12]!==n.missing||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:r,disabled:a,className:s,children:[u,d]}),t[11]=r,t[12]=n.missing,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16];let p=`Remove ${n.name} from recent projects`,m=`nav-recent-remove-${n.path}`,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Xt,{"aria-hidden":`true`}),t[17]=h):h=t[17];let g;t[18]!==i||t[19]!==m||t[20]!==p?(g=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":p,title:`Remove from recent projects`,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":m,children:h}),t[18]=i,t[19]=m,t[20]=p,t[21]=g):g=t[21];let _;return t[22]!==g||t[23]!==f?(_=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[f,g]}),t[22]=g,t[23]=f,t[24]=_):_=t[24],_}async function mf(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var hf=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=li(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(xi,{className:`size-4`}),info:(0,Z.jsx)(Kt,{className:`size-4`}),warning:(0,Z.jsx)(ei,{className:`size-4`}),error:(0,Z.jsx)(Ic,{className:`size-4`}),loading:(0,Z.jsx)(ee,{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)(Qt,{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};function gf(e){let{apiOrigin:t}=e;if(!t)return;let n=Symbol.for(`ok.desktop.fetchRewrite`);if(window.fetch[n])return;let r=window.fetch.bind(window),i=((e,n)=>{if(typeof e==`string`)return r(_f(e,t),n);if(e instanceof URL)return e.pathname.startsWith(`/api/`)&&(e.origin===window.location.origin||e.protocol===`file:`)?r(t+(e.pathname+e.search+e.hash),n):r(e,n);try{let i=new URL(e.url,window.location.origin);if(i.pathname.startsWith(`/api/`)){let a=i.pathname+i.search+i.hash;return r(new Request(t+a,e),n)}}catch{}return r(e,n)});i[n]=!0,window.fetch=i}function _f(e,t){return e.startsWith(`/api/`)?t+e:e}var vf=JSON.parse(`{"-8PP0T":["Match case"],"-KCZ6n":["Mark a block as the source of truth. Mirror references elsewhere render this content read-only and update live as you edit here."],"-g6KIS":["Unrecognized link"],"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"0-31GV":["Removing"],"0YEbfk":["Connect to AI tools"],"0eHrMb":["Could not complete delete"],"0rwwOn":["By tag"],"0t0bbC":["Could not save sync preference: ",["detail"]],"0wswKc":["Horizontal rule that divides sections."],"0xnmlQ":["Repository name"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1GhYxC":["of ",["totalPages"]],"1HBhDS":["Checking out files"],"1RluQD":["Show replace"],"1Ta7Fd":["Open ",["basename"]],"1WgmEM":["Failed to load template: ",["errorMessage"]],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"2QM24L":["All tags"],"2Xs2jo":["Switch Project"],"2q_Q7x":["Visibility"],"2tgFCe":["Starting clone"],"2wxgft":["Rename"],"322lyb":["Highlight tips, warnings, and notes."],"34qyH5":["Could not reach server"],"3Fcb0I":["Open graph"],"3J7d2N":["Big section heading."],"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."],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3wiBAs":["Where should it live?"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"44_vJP":[["deleteCount","plural",{"one":["Delete"],"other":["Delete ","#"," Items"]}]],"45MZFs":["Commands"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4CfgPM":["Project folder created, but git init failed. Try again."],"4TzU0n":["Initialize"],"4hJhzz":["Table"],"4jDd0j":["Anyone can see"],"4xtLTl":["Hidden folder “",["basename"],"”"],"5Ajb15":["The formula <0>c = √(a² + b²)</0> renders inline."],"5ClEAu":["Inline hashtag for cross-doc grouping."],"5D3Ior":["Hide folder"],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5Tk8Fb":["Loading files"],"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?"]}]],"5wV2qQ":["and more"],"5wyYmS":["Instantiate as <0>",["writeDocumentExample"],"</0>. This template is located at <1>",["templatePath"],"</1>."],"5y_9lO":["Waiting for authorization"],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"67f-3g":["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],"6Uau97":["Skip"],"6V3Ea3":["Copied"],"6WdDG7":["Page"],"6YtxFj":["Name"],"6_ZOw4":["Copied full path"],"6bTTAN":["Invalid input — pick a different folder."],"6gRgw8":["Retry"],"6ibbCg":["Create your first file"],"6nB8LV":["Paste a personal access token"],"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"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7JtSLi":["Failed to delete path"],"7PzzBU":["User"],"7d1a0d":["Public"],"7qRHf0":["Install for Claude Chat & Cowork"],"8C2UQ5":["No git remote was detected for this project. Set one up if you would like automatic git syncing."],"8F1i42":["Page not found"],"8OxKZy":["Move succeeded but the sidebar may be out of date — refresh to resync"],"8RtNI0":["Failed to load documents"],"8TLE9g":["Read-only copy of a MirrorSource block from another doc. Edit at the source — every Mirror reflects the change live."],"8XQ7Ib":["Pick an owner"],"8XQRON":["Loading repositories"],"8XS8nG":["Open in your favorite AI editor."],"8eW0WQ":["No matching repositories."],"92rbk2":["Mirror loading <0>",["mirrorRef"],"</0>"],"95uxb3":["Signed in as <0>@",["signedInLogin"],"</0>"],"96G6Re":["New folder"],"9UQ730":["Clone"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9jnjV0":["Embed an audio file with native player controls."],"9oE4C3":["Browse your repos:"],"A1taO8":["Search"],"A5hiCy":["Create template"],"A6h5b-":["File duplicated"],"AMyJts":["This path is on an external volume (/Volumes/...). Open Knowledge will lose track of files when the drive ejects."],"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."],"AVoO4B":["Open <0>",["verificationUri"],"</0> and enter this code:"],"AWOSPo":["Zoom in"],"AddR83":["Could not create project. Try again or pick a different location."],"B11p-O":["Edit markdown link"],"B3NAZC":["Open Navigator"],"BBtVak":["Collapse All"],"BGHHtQ":["Single page"],"BH56dn":["Custom display text"],"BJpGCq":["Open in Terminal"],"BQu9Pg":["Symlink"],"Bdha5y":["Publishing..."],"C0NPNd":["Add Open Knowledge to your AI tools"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CvsD6Y":["via ",["viaTags"]],"D8OV7J":["Only collaborators"],"DPfwMq":["Done"],"DVh_Tb":["Failed to clean up after trash"],"DeDYLr":["Unrecognized wiki link"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"E7BhZn":["Blank note"],"E9bKSA":["Creating"],"EBVbtP":["Could not duplicate item"],"EL_YRd":["Mirror of <0>api-spec</0>"],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"EcM3k7":["Failed to clean up pending ",["kind"]],"EgMJem":["Lands at <0>",["targetPath"],"</0>. Agents resolve it via leaf → root walk-up — closest-wins on filename collision."],"El7NbA":["Heading 2"],"Ev2r9A":["No results"],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"FCxvG5":["First item"],"FEr96N":["Theme"],"FF5rwn":["Connect Open Knowledge to other tools you use."],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"FaBZwp":["File extensions are managed automatically - please rename without changing the extension"],"FjkaiT":["Zoom out"],"Fqr8BP":["Multi-page PDF viewer with toolbar controls (thumbnails, page nav, zoom)."],"FvpFSZ":["Reveal in Finder, ",["hint"]],"Fxf4jq":["Description (optional)"],"FyW0WO":["Authorize in browser"],"G1Gw0v":["New template"],"GDvlUT":["Role"],"GJ3011":["Use ",["ext"]," extension"],"GQDSBN":["Layout options"],"GUpclA":["Created if missing; reused if it exists."],"G_686w":["Task List"],"GgQgML":["You picked your home directory. Open Knowledge will index everything in your home tree — large and may surface personal files."],"GjElCU":["Select a file from the sidebar, or pick where to edit alongside your agent."],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"H0WlWQ":["Grid of rows and columns with a header row."],"HIb0vl":["Network error — please try again"],"HM56Bx":["Creating..."],"HP5ML3":["Sign in to GitHub to continue."],"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."],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HlmZBk":["Documents response did not match expected shape."],"HpK_8d":["Reload"],"Hrz9NY":["Wiki link"],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"IKoTAC":["Keep disabled"],"IajAbS":["Add a starter pack"],"IrB5AK":["Server-side cleanup failed for ",["failedCount","plural",{"one":["#"," item"],"other":["#"," items"]}]],"IreQBq":["Repository"],"J2Mv98":["Name (e.g. ",["login"],")"],"J2eKUI":["File"],"JE21eh":["Symlink to ",["targetPath"]],"JK-Ave":["Hide thumbnails"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JUamR6":["This name has no characters that are safe for a folder identifier. Try a name with at least one letter or number."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jhj_lh":["Modify the link target, anchor, and display label."],"Jqqevv":["System error"],"JtD-Br":["Page link"],"K1ckLX":["Failed to create folder"],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K9J00P":["Clone failed — connection error"],"KDw4GX":["Try again"],"KX1MZR":["Your repositories"],"KYcZ6Y":["Above"],"KZLdgR":["See <0>#design-docs</0> for the latest specs."],"KZkHZv":["Signed in as @",["login"]],"K_wz1u":["Show Hidden Files"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"KujtjC":["Find"],"L-rMC9":["Reset to default"],"L3CEC1":["this item"],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LXdWeS":["Medium section heading."],"LlHqdU":["Initializing project"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"Lu_dOh":["Tree View Options"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"MKOVhz":["Enable git auto-sync"],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MVxpbf":["Find and replace"],"MW64zN":["New File"],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"MmDDWK":["Recently opened"],"MtR6ZK":["Not signed in to GitHub."],"N2eHWq":["Code Block"],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NOHyEE":["Retry push"],"NSnIUP":["Two-page (even)"],"NYUhy5":["Subfolder name"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"Nu4DdT":["Sync"],"NuH1jp":["Public repository"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"O2UpM1":["Browse"],"O3oNi5":["Email"],"O7_W_a":["Open with AI"],"OD0FCX":["Hidden “",["basename"],"”"],"ODD5Jc":["Edit ",["templateLabel"]],"ODGGlj":["Folder name: ",["detail"]],"OTF92M":["Label <0>(optional display text)</0>"],"OYnx7O":["Path cannot start with \\"/\\""],"OZtLT5":["Checking GitHub sign-in..."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"Oos8fo":["Copy command"],"Oxyd5f":["Pick a name"],"P-ye9o":["Could not open folder picker"],"P47EWZ":["Could not update sidebar settings"],"PHRoEJ":["Open shared document"],"PKLY-1":["Opening..."],"PiH3UR":["Copied!"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"QQghPu":["Install in Claude Desktop"],"QqBQu1":["Label <0>(visible link text)</0>"],"R0jJzV":["Paste URL, owner/repo, or search your repos"],"RDrXh4":["Configure user, project, and integration settings."],"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"],"RlCInP":["Slash commands"],"RobAKV":["Update the destination and optional section anchor."],"S6l5dv":["Could not start creating a new item"],"SFN6dN":["Heading 3"],"SUOoXn":["Failed to open project."],"ScUTHW":["Open Containing Folder, ",["hint"]],"ScwcF2":["A project already exists at this location. Pick a different parent folder."],"SiUUCS":["Next match"],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"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"],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TKQ7K-":["Install"],"TP9_K5":["Token"],"TXrEYR":["No templates resolve here. Add one in this folder's Templates section, or in Settings → Templates."],"ThmUrC":["Could not finalize project setup. Try again."],"Tjc1pH":["Section <0>(optional heading anchor)</0>"],"TmKshB":["Invalid token — check that it has repo scope"],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UBv8UK":["Delete Permanently"],"UL8A9w":["Tag"],"UQAp48":["Search templates"],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"Uci-Ph":["Ordered List"],"Ud0Pj9":["<0>Mirror source removed.</0> The doc <1>",["src"],"</1> is no longer available."],"UkQGhd":["Hide replace"],"Up2_7p":["Copy full path"],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"VUijjF":["Embed an image with optional alt text."],"VdXv4D":["Clone from GitHub"],"W-ntoW":["heading-slug"],"W8uemY":["Pick a starter pack to scaffold folders, templates, and AI-readable rules."],"W8vpBM":["starter pack"],"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"],"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"]],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"WqLq6M":["Open with AI ",["displayName"]],"Wtw22s":["Installing"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X8kjQX":["Re-authenticate with GitHub"],"XRuL0i":["Create page"],"XU0OXn":["Enable auto-sync"],"XYlJJT":["Setting up"],"Xl-UUg":["guides/install or https://example.com"],"XpIZmv":["Fenced code block with monospace text."],"XtRoxT":["Page ",["pageNumber"]],"Xv_ijG":["https://github.com/owner/repo or owner/repo"],"XyNe7f":["Electron bridge unavailable. Refresh and try again."],"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."],"YGIi_c":["Reinstall"],"YPFBfr":[["detail"]," - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"YTLmTM":["Remove the parent <0>.git</0> folder"],"Y_kL7X":["Customize how the editor looks and behaves."],"YjhKI5":["Cloning..."],"YlDuro":["Fit height"],"YwPUUP":["This pack is already set up here."],"Z1LF1M":["Sharing a doc needs a GitHub repository. Create one for this project."],"Z2M5XM":["Reason: ",["reason"]," (",["osDetail"],")"],"Z3FXyt":["Loading..."],"Z8KDox":["Enter a folder name (e.g. brain)."],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"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."],"ZWyHmq":["This project"],"ZhhOwV":["Quote"],"ZmGmNh":["Let's set up your project."],"_6IEmc":["Open in Terminal, No workspace"],"_7UQ7y":["Whole word"],"_K2CvV":["Template"],"_N2eSU":["org"],"_TDESN":["Network error - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"_TF8ep":["Failed to render PDF"],"_qD6mn":["Pick the folder where you've cloned it."],"a5W0q0":["Are you sure you want to delete ",["folderName"],"/ and all files inside? This action cannot be undone."],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"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"],"abiHje":["Delete selected items"],"adsMWO":["Resolving deltas"],"av_PD9":["you"],"b392Dr":["Expand All"],"b4itZn":["Working"],"bBE5tC":["Detected on this machine"],"bD8I7O":["Complete"],"bHboUQ":["Edit template"],"bS_boY":["Replace current match"],"bUUVED":["Asset"],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c5rF4v":["What is this knowledge base for?"],"c8iK2Y":["No templates found."],"cBbVqQ":["The folder name <0>",["rawName"],"</0> can't be used as a project identifier — it has no characters left after sanitization. Click Browse to pick a folder whose name contains at least one alphanumeric character."],"cIptmH":["In the Claude Desktop App"],"cKjLuT":["(project + user)"],"cOSAfL":["No repositories found on your GitHub account."],"cnGeoo":["Delete"],"cqQyPB":["Folder name"],"csDS2L":["Available"],"d2uTPx":["Server error (HTTP ",["status"],")"],"dDpCOp":["Rename succeeded but the sidebar may be out of date — refresh to resync"],"dEgA5A":["Cancel"],"dGaH3A":["Create a token at <0>github.com/settings/tokens</0> with <1>repo</1> scope."],"dOHMA0":["Failed to move"],"dOxPd4":["Footnote"],"dTaauv":["Reason: ",["reason"]],"dbhUX1":["Hide this file"],"dprWmL":["Anchor in this page"],"dr1vFs":["Replace all matches"],"dw_dUJ":["Failed to duplicate path"],"e0NrBM":["Project"],"e1hptq":["Embed a video with native player controls."],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"eFJkVt":["Clone failed: ",["cloneError"]],"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>."],"ehLu5O":["Open in Terminal, ",["hint"]],"emgiet":["Authoritative content; mirrored verbatim everywhere it's referenced."],"ensWZc":["or start from scratch <0/>"],"euc6Ns":["Duplicate"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f65AOQ":["Start from"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fX82Jn":["Open Knowledge will create a <0>.ok/</0> folder here to track this project's metadata."],"fYKgzG":["Failed to load recent projects."],"fYjgXu":["Unordered list of items."],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"fqSfXY":["Replace"],"g4XBm0":["Small section heading."],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gYz2ep":["Expires in ",["timeLabel"]],"gcV0dI":["The folders and templates are in place; there's nothing left to scaffold."],"ggs9f8":["Search files, folders, or commands"],"ghYcYZ":["File extension"],"gijbne":["Failed to rename path"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtmbUO":["Sign in to GitHub"],"hA8GQ6":["Will replace existing Open Knowledge entry"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hJu2pH":["This folder already has files. Add a name to create a new subfolder inside it."],"hSySVc":["Install handoff failed: ",["msg"]],"hYDc6B":["Name cannot be empty"],"hYFQsG":["Validating"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"he3ygx":["Copy"],"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"]],"hynz2K":["Download started"],"hz7n6T":["Open Containing Folder"],"i3f2kh":["No matching commands."],"i8dKs-":["Show all files"],"i9toLO":["Agent configuration file"],"iEYxO4":["Show thumbnails"],"iH8pgl":["Back"],"iKSP5j":["Word wrap"],"iMCW9z":["Publish & copy link"],"iTylMl":["Templates"],"i_grbe":["Click Browse to pick or create a project folder."],"idD8Ev":["Saved"],"iilQXA":["Folder duplicated"],"iqugog":["Initialize failed: ",["errorDetail"]],"jGJy-9":["Downloads ",["shareOwner"],"/",["shareRepo"]," from GitHub."],"jRHdCz":["Failed to load PDF"],"jTLWxh":["Embed an external page in an inline iframe (docs, demos, Figma, CodeSandbox)."],"jjtmV_":["First file name"],"jnXr0e":["Clone failed. Please try again."],"jol95m":["Failed to open Project Navigator."],"kFLlsI":["Insert a footnote reference + matching definition stub."],"kNqMMd":["Folder"],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kolRU1":["Do you want to permanently delete instead?"],"l17ab4":["Could not write project files. Try a different location."],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lGs_bQ":["Page <0>*</0>"],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lXKZGw":["Heading 1"],"lanW9H":["Sign in to clone"],"lhjq3G":["Reset ",["labelText"]," to default"],"ll2yNl":["Content directory"],"ls1N1w":["(missing)"],"m16xKo":["Add"],"m6YGpY":["Active panel content for the selected tab shows here."],"mGaZwZ":["See the full install guide"],"mKZODc":["Adds the Open Knowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"mSJ3Rn":["Computing scaffold plan"],"mWVJRX":["Collapsible section with a clickable summary."],"mYLRjR":["You picked ~/Desktop. Open Knowledge will index everything on your desktop."],"maDWIB":["Mirror source <0>api-spec</0>"],"mf37rL":["Retrying"],"mmpzAq":["Wrap long lines in the markdown source editor."],"mqSwZH":["<0>Mirror anchor not found.</0> No <1>",["mirrorSourceTag"],"</1> exists in <2>",["src"],"</2>."],"muWKMD":["No response — try again"],"n5n_vi":["Private repository"],"nNYV3Y":["and ",["remaining"]," more"],"nWv1ja":["Manage hidden files in Settings → Ignore patterns."],"nYKerc":["(user-level only)"],"nbfdhU":["Integrations"],"nzaV6Q":["Page thumbnails"],"o2yoFu":["Reveal in Finder, No workspace"],"o4dcAf":["Reveal in File Explorer, ",["hint"]],"oqB2ez":["Previous match"],"p2LEhJ":["Personal access token"],"pAlxX6":["Open this folder with Open Knowledge"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pdHb22":["GitHub App"],"pkAft1":["Search failed."],"prHfed":["Each selected tool gets an Open Knowledge MCP entry."],"q2kXMG":["Inline Math"],"qNOgUu":["Edits at the source land here — no copy-paste drift."],"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"],"qbfj1f":["Receiving objects"],"qi1F96":["Reveal in File Explorer"],"qioCwA":["Jump to page ",["pageNumber"]],"qo4zCg":["Path cannot contain backslashes"],"qvWGzP":["Collapse all"],"r4R7AZ":["Network error during cleanup"],"r51jLC":["File saved & Claude Desktop App opened"],"rEnIww":["Published to ",["ownerLogin"],"/",["repoName"],"."],"rXz97P":["Numbered list of items."],"rZ9HZq":["To do"],"rdU729":["Layout"],"rlUzXK":["Could not validate folder. Please try again."],"s-XOaI":["File name"],"s1c0ja":["Bullet List"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sJK6pq":["Permission denied"],"saIASg":["Second item"],"saYiIO":["Path cannot contain null bytes"],"snrVQ7":["probe failed"],"t-JXbf":["Notion-style inline row for a downloadable file. Drag-drop also works."],"tAPZEx":["Below"],"tCelbM":["A folder named <0>",["sanitized"],"</0> already has files at this location. Pick a different name."],"tX5yOZ":["New Folder"],"tXkhj_":["Start"],"t_YqKh":["Remove"],"tfDRzk":["Save"],"tfi40B":["Failed to create page"],"uF9ruK":["Saving"],"u_lS4C":["Clone complete — opening project"],"uuoHOU":["Command failed."],"v-h2hx":["Delete ",["targetGitPath"]],"v41fCm":["File not found"],"vEJDlt":["The file is in your Trash; the file-watcher will reconcile."],"vIxrEk":["Fit width"],"vPYaz3":["Scaffold directly under this project."],"vQayZz":["Add a remote with <0>git remote add origin <url></0> in this project's directory. This page will update automatically once a remote is detected."],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"w7nm4K":["Indented blockquote for citations."],"wJijgU":["Location"],"wJo9oS":["Close find"],"wQp1V3":["Mirror of <0>",["src"],"</0>"],"wTcjov":["No workspace"],"wbv9xO":["Create new project"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"xK291b":["Two-page (odd)"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"xiv-dW":["No files yet."],"xloBjn":["Relative Path"],"xsZhu-":["Page number"],"xzktOa":["Edit wiki link"],"y1t8bQ":["Settings sections"],"yLq4w4":["Separator"],"yQE2r9":["Loading"],"yWWThY":["Asset reference"],"yXiaxB":["Assets cannot be renamed from the sidebar"],"yYR6za":["Display text"],"ygLG1e":["Assets cannot be moved from the sidebar"],"yu8Pzy":["Not detected"],"yutJKi":["Checklist with checkboxes."],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"z0a2EA":["Diagram from Mermaid source — flowchart, sequence, class, state, ER, gantt, pie."],"z2G3EK":["<0>",["rawName"],"</0> has characters unsafe for the on-disk identifier, so the project will be created as <1>",["sanitized"],"</1>. Click Browse to pick a safer name."],"z2funE":["Full Path"],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"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."],"zXZJoN":["Add token"],"zd00pH":["Copy Path"],"zgSFyG":["External link"],"zo3Dl7":["Toggle thumbnails"],"zwBp5t":["Private"]}`),yf=`en`;Ie.load(yf,vf),Ie.activate(yf);function bf(e){return`#/${encodeURIComponent(e)}`}function xf(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(bf(e.doc))})}var Sf=4e3,Cf=1440*60*1e3;function wf(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){Y.success(`Opened existing Open Knowledge project at ${e.ancestorPath}`,{duration:Sf});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>Dr[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`;Y[r?`error`:`success`](n,{duration:r?Cf:Sf});return}let t=is(e.gitRoot,e.pickedPath)??e.pickedPath;Y.success(`Initialized Open Knowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Sf})})}var Tf=!1;function Ef(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{$e(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Df(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 Of=0,kf=0,Af=0,jf=0,Mf=null,Nf=[`linkResolutionDecoration$`],Pf=new WeakSet,Ff=new WeakSet;function If(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Lf(){return!1}function Rf(){return!Lf()}function zf(e,t){if(Rf())return t;let n=`ok/cold/nodeview-factory-${If(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;$e(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Bf(e){if(Rf())return;let t=e.state.plugins;for(let e of t){if(Ff.has(e))continue;let t=e.spec?.key?.key;if(!t||!Nf.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Ff.add(e);continue}let i=`ok/cold/decoration-${If(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;$e(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Ff.add(e)}}function Vf(e){if(Rf())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=zf(e,n);r.__okWrapped=!0,t[e]=r}}function Hf(e){return Rf()?e:e.map(e=>{let t=e.name??`unknown`,n=If(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;$e(`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;$e(`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;$e(`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;$e(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function Uf(){if(!Tf){Tf=!0,Ef(tr.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return Rf()||(Mf=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Df(i.editorState),durationMs:r}}),Ef(tr.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!Rf()&&!Pf.has(e)&&t.view&&(Bf(t.view),Vf(t.view),Pf.add(e)),{docSize:Df(t.editorState)}}),Ef(tr.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{jf+=1;let i=e;return!Rf()&&i.view&&Vf(i.view),{docSize:Df(i.view),seq:jf,durationMs:r}}),Ef(pr.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(kf+=1,{seq:kf,docSize:Df(e.state),durationMs:r})),Ef(pr.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Af+=1,{seq:Af,docSize:Df(e.state),durationMs:r})),Ef(F.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Of+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Of,topLevelYElements:a,durationMs:r}}),Ef(Ge.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`)&&($e(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}),!Rf()&&e===`first-paint`&&Mf!==null)){let e=Mf,n=Math.max(0,t.startTime-e);$e(`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}),Mf=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var Wf=`Relaunch`,Gf=`Release notes`,Kf=`Updates paused`,qf=`Download`,Jf=`Reset to defaults`,Yf=`Relaunch failed — please restart manually`,Xf=`Recovery action failed — please try again`;function Zf(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function Qf(e){return`Version ${e} ready to install`}function $f(e){return`Updated to Version ${e}`}function ep(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var tp=0,np=0,rp=1,ip=2,ap=3;function op(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded`;t({id:i,body:Qf(r),priority:ip,action:{label:Wf,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:Zf(Yf,e),variant:`error`,priority:rp})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:$f(n),priority:ap,action:{label:Gf,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:Kf,priority:np,action:{label:qf,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function sp(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:Zf(Xf,e),variant:`error`,priority:tp})};n({id:i,body:ep(t.currentBuild),priority:tp,action:{label:Jf,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var cp=[],lp=new Set,up=!1;function dp(){for(let e of lp)e()}function fp(e){let t=cp.findIndex(t=>t.id===e.id);if(t===-1)cp=[...cp,e];else{let n=cp.slice();n[t]=e,cp=n}dp()}function pp(e){let t=cp.filter(t=>t.id!==e);t.length!==cp.length&&(cp=t,dp())}function mp(){return cp}function hp(e){return lp.add(e),()=>{lp.delete(e)}}function gp(){if(up||typeof window>`u`)return;let e=window.okDesktop;e&&(up=!0,op(e,fp,pp),e.state.query().then(t=>{t.schemaIncompatibility&&sp(e,t.schemaIncompatibility,fp,pp)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var _p=`ok-omnibar-recents-v1`,vp=10;function yp(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function bp(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function xp(e,t){return`${e}:${t}`}function Sp(e){let t=bp(e);if(!t)return[];try{let e=t.getItem(_p);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(yp).slice(0,vp):[]}catch{return[]}}function Cp(e,t){let n=bp(t);if(n)try{n.setItem(_p,JSON.stringify(e.slice(0,vp)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function wp(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,vp)}function Tp(e,t){return e.filter(e=>t.has(xp(e.kind,e.path)))}var Ep=50,Dp=30,Op=``,kp=null;function Ap(e){return e.trim().toLowerCase()}function jp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Mp(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Np(e,t,n=new Map,r=new Map){let i=[];for(let t of e){let e=r.get(t)?.modified,a=n.get(t);i.push({kind:`file`,path:t,name:Er(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:Er(e)});return i.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),i}function Pp(e){return er({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function Fp(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:kr(e.map(Pp))}}function Ip(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function Lp(e){let t=Ip(e);return kp&&Op===t?kp:(Op=t,kp=Fp(e),kp)}function Rp(e,t,n=Ep){return zp(Lp(e),t,n)}function zp(e,t,n=Ep){let r=Ap(t);return r?oi(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function Bp(e,t){let n=Mp(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(jp).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 Vp(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=Er(e.path);return{kind:e.kind===`page`?`file`:`folder`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function Hp(e,t={}){let n=e.trim();if(!n)return[];let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,scopes:[`page`,`folder`,`content`],limit:t.limit??Dp}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error($n(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(Vp).filter(e=>!!e)}function Up(e,t,n=[]){let r=Ap(t);return r?Ap([e,...n].join(` `)).includes(r):!0}var Wp=`tag:`;function Gp(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 Kp(e,t){return R(e,t)}var qp=E;async function Jp(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 Yp=`open-knowledge:doc-panel-tab`,Xp=null;function Zp(){let e=Xp;return Xp=null,e}function Qp(e,t=typeof window>`u`?new EventTarget:window){Xp=e,t.dispatchEvent(new CustomEvent(Yp,{detail:{tab:e}}))}function $p(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(Yp,n),()=>t.removeEventListener(Yp,n)}var em=[`.md`,`.mdx`];function tm(e){let t=e.toLowerCase();for(let e of em)if(t.endsWith(e))return e;return null}function nm(e){let t=tm(e);return t?e.slice(0,-t.length):e}var rm=`__blank__`,im={local:0,inherited:1};function am(e){return[...e].sort((e,t)=>{let n=im[e.scope]-im[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}function om(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function sm(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 cm(e){let t=e.fileName.trim(),n=tm(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 lm(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&e.altKey&&e.key.toLowerCase()===`n`)}function um(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function dm(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{_:d}=Yt(),{addPage:f}=Zr(),p=_o(u?null:a),m=u??p,[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`.md`),[x,S]=(0,Q.useState)(rm),[C,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{if(n){T(null),k(null),D(!1),v(``),S(i===`file`&&s?s:rm),I(!1);let e=i===`file`?o??`untitled`:`index`,t=tm(e);b(t??`.md`),g(t?nm(e):e)}},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==m.state.data||t[7]!==m.state.status?(V=m.state.status===`ready`?am(m.state.data.folder.templates_available??[]):[],t[6]=m.state.data,t[7]=m.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==m.state.data||t[10]!==m.state.status||t[11]!==n||t[12]!==x?(U=()=>{n&&x!==rm&&m.state.status===`ready`&&((m.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(rm))},t[9]=m.state.data,t[10]=m.state.status,t[11]=n,t[12]=x,t[13]=U):U=t[13];let W;t[14]!==m.state||t[15]!==n||t[16]!==x?(W=[n,x,m.state],t[14]=m.state,t[15]=n,t[16]=x,t[17]=W):W=t[17],(0,Q.useEffect)(U,W);let G=i===`file`,ee=m.state.status===`loading`||m.state.status===`idle`,te=m.state.status===`error`?m.state.message:null,ne;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){let t=tm(e);t?(b(t),g(nm(e))):g(e),T(null)},t[18]=ne):ne=t[18];let re=ne,ie;t[19]!==y||t[20]!==h||t[21]!==_||t[22]!==a||t[23]!==i?(ie=function(){return cm({kind:i,initialDir:a,fileName:h,fileExtension:y,folderName:_})},t[19]=y,t[20]=h,t[21]=_,t[22]=a,t[23]=i,t[24]=ie):ie=t[24];let ae=ie,oe;t[25]!==d||t[26]!==h||t[27]!==_||t[28]!==i?(oe=function(){if(i===`folder`){let e=om(_.trim());if(e)return{message:d({id:`ODGGlj`,values:{detail:d(sm(e))}}),field:`folder`}}let e=om(h.trim());return e?{message:d(sm(e)),field:`file`}:null},t[25]=d,t[26]=h,t[27]=_,t[28]=i,t[29]=oe):oe=t[29];let se=oe,ce;t[30]!==E||t[31]!==h||t[32]!==_||t[33]!==i?(ce=E||!h.trim()||i===`folder`&&!_.trim(),t[30]=E,t[31]=h,t[32]=_,t[33]=i,t[34]=ce):ce=t[34];let le=ce,ue;t[35]!==d||t[36]!==f||t[37]!==ae||t[38]!==se||t[39]!==i||t[40]!==l||t[41]!==r||t[42]!==x?(ue=async function(){let e=se();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=ae(),n=i===`file`&&x!==rm?x:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await w(e,d({id:`d2uTPx`,values:{status:t}}));if(!n.ok){D(!1),T(n.title),k(`form`);return}let o=si.safeParse(n.body);if(D(!1),!o.success){T(d(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),k(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,f(s),ci([`files`,`backlinks`,`graph`]),l?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),D(!1),T(d({id:`HIb0vl`})),k(`form`)}},t[35]=d,t[36]=f,t[37]=ae,t[38]=se,t[39]=i,t[40]=l,t[41]=r,t[42]=x,t[43]=ue):ue=t[43];let de=ue,K;t[44]!==d||t[45]!==a?(K=a||d({id:`L6Hhh6`}),t[44]=d,t[45]=a,t[46]=K):K=t[46];let fe=K,pe;t[47]===i?pe=t[48]:(pe=(0,Z.jsx)($t,{children:i===`file`?(0,Z.jsx)(J,{id:`HdkSiO`}):(0,Z.jsx)(J,{id:`96G6Re`})}),t[47]=i,t[48]=pe);let me;t[49]!==c||t[50]!==fe?(me=c??(0,Z.jsx)(J,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[49]=c,t[50]=fe,t[51]=me):me=t[51];let he;t[52]===me?he=t[53]:(he=(0,Z.jsx)(Zt,{children:me}),t[52]=me,t[53]=he);let ge;t[54]!==pe||t[55]!==he?(ge=(0,Z.jsxs)(un,{children:[pe,he]}),t[54]=pe,t[55]=he,t[56]=ge):ge=t[56];let _e;t[57]!==x||t[58]!==G||t[59]!==N||t[60]!==F||t[61]!==P||t[62]!==H||t[63]!==te||t[64]!==ee?(_e=G&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{id:N,className:`mb-1.5 block text-sm font-medium`,children:(0,Z.jsx)(J,{id:`f65AOQ`})}),te?(0,Z.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:(0,Z.jsx)(J,{id:`sE7R19`,values:{templatesError:te}})}):null,(0,Z.jsx)(pm,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:x,onValueChange:S,templates:H,loading:ee}),!ee&&!te&&H.length===0?(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`TXrEYR`})}):null]}),t[57]=x,t[58]=G,t[59]=N,t[60]=F,t[61]=P,t[62]=H,t[63]=te,t[64]=ee,t[65]=_e):_e=t[65];let ve;t[66]!==d||t[67]!==C||t[68]!==O||t[69]!==A||t[70]!==j||t[71]!==_||t[72]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(J,{id:`cqQyPB`})}),(0,Z.jsx)(Go,{ref:R,id:j,value:_,onChange:e=>{v(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":C&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":C&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=om(_.trim());if(t){T(d({id:`ODGGlj`,values:{detail:d(sm(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[66]=d,t[67]=C,t[68]=O,t[69]=A,t[70]=j,t[71]=_,t[72]=i,t[73]=ve):ve=t[73];let ye;t[74]===i?ye=t[75]:(ye=i===`folder`?(0,Z.jsx)(J,{id:`jjtmV_`}):(0,Z.jsx)(J,{id:`s-XOaI`}),t[74]=i,t[75]=ye);let be;t[76]!==M||t[77]!==ye?(be=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:M,children:ye}),t[76]=M,t[77]=ye,t[78]=be):be=t[78];let xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>re(e.target.value),t[79]=xe):xe=t[79];let Se=i===`file`,Ce=C&&(O===`file`||O===`form`)?A:void 0,we=C&&(O===`file`||O===`form`)?!0:void 0,Te;t[80]!==de||t[81]!==le?(Te=e=>{e.key===`Enter`&&!le&&de()},t[80]=de,t[81]=le,t[82]=Te):Te=t[82];let Ee;t[83]!==M||t[84]!==h||t[85]!==Se||t[86]!==Ce||t[87]!==we||t[88]!==Te?(Ee=(0,Z.jsx)(Go,{ref:L,id:M,value:h,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:fm,onKeyDown:Te,className:`flex-1`}),t[83]=M,t[84]=h,t[85]=Se,t[86]=Ce,t[87]=we,t[88]=Te,t[89]=Ee):Ee=t[89];let De;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(De=e=>{(e===`.md`||e===`.mdx`)&&b(e)},t[90]=De):De=t[90];let Oe;t[91]===d?Oe=t[92]:(Oe=d({id:`ghYcYZ`}),t[91]=d,t[92]=Oe);let ke;t[93]===d?ke=t[94]:(ke=em.map(e=>(0,Z.jsx)(Qo,{value:e,"aria-label":d({id:`GJ3011`,values:{ext:e}}),children:e},e)),t[93]=d,t[94]=ke);let Ae;t[95]!==y||t[96]!==Oe||t[97]!==ke?(Ae=(0,Z.jsx)(ts,{type:`single`,value:y,onValueChange:De,variant:`outline`,"aria-label":Oe,className:`shrink-0`,children:ke}),t[95]=y,t[96]=Oe,t[97]=ke,t[98]=Ae):Ae=t[98];let je;t[99]!==Ee||t[100]!==Ae?(je=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Ee,Ae]}),t[99]=Ee,t[100]=Ae,t[101]=je):je=t[101];let Me;t[102]!==C||t[103]!==A?(Me=C&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:C}),t[102]=C,t[103]=A,t[104]=Me):Me=t[104];let Ne;t[105]!==be||t[106]!==je||t[107]!==Me?(Ne=(0,Z.jsxs)(`div`,{children:[be,je,Me]}),t[105]=be,t[106]=je,t[107]=Me,t[108]=Ne):Ne=t[108];let Pe;t[109]!==_e||t[110]!==ve||t[111]!==Ne?(Pe=(0,Z.jsx)(sn,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[_e,ve,Ne]})}),t[109]=_e,t[110]=ve,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]===r?Fe=t[114]:(Fe=()=>r(!1),t[113]=r,t[114]=Fe);let Ie;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(J,{id:`dEgA5A`}),t[115]=Ie):Ie=t[115];let Le;t[116]!==E||t[117]!==Fe?(Le=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Fe,disabled:E,children:Ie}),t[116]=E,t[117]=Fe,t[118]=Le):Le=t[118];let Re;t[119]===E?Re=t[120]:(Re=E?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[119]=E,t[120]=Re);let ze;t[121]!==de||t[122]!==le||t[123]!==Re?(ze=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Re}),t[121]=de,t[122]=le,t[123]=Re,t[124]=ze):ze=t[124];let q;t[125]!==Le||t[126]!==ze?(q=(0,Z.jsxs)(cn,{children:[Le,ze]}),t[125]=Le,t[126]=ze,t[127]=q):q=t[127];let Be;t[128]!==ge||t[129]!==Pe||t[130]!==q?(Be=(0,Z.jsxs)(rn,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,Pe,q]}),t[128]=ge,t[129]=Pe,t[130]=q,t[131]=Be):Be=t[131];let Ve;return t[132]!==r||t[133]!==n||t[134]!==Be?(Ve=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:Be}),t[132]=r,t[133]=n,t[134]=Be,t[135]=Ve):Ve=t[135],Ve}function fm(e){return um(e.currentTarget)}function pm(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=Yt(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,m=o===rm,h=i?d:void 0,g=`${r} ${n}`,_;t[5]!==m||t[6]!==l||t[7]!==p?.name||t[8]!==p?.title||t[9]!==o?(_=l?(0,Z.jsx)(J,{id:`Hl89Qd`}):m?(0,Z.jsx)(J,{id:`E7BhZn`}):p?.title??p?.name??o,t[5]=m,t[6]=l,t[7]=p?.name,t[8]=p?.title,t[9]=o,t[10]=_):_=t[10];let v;t[11]===_?v=t[12]:(v=(0,Z.jsx)(`span`,{className:`truncate`,children:_}),t[11]=_,t[12]=v);let y;t[13]!==m||t[14]!==l||t[15]!==p?(y=!l&&!m&&p?(0,Z.jsx)(_m,{entry:p}):null,t[13]=m,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ic,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==l||t[22]!==i||t[23]!==h||t[24]!==g||t[25]!==b||t[26]!==n?(S=(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":h,"aria-labelledby":g,disabled:l,className:`w-full justify-between font-normal`,children:[b,x]})}),t[21]=l,t[22]=i,t[23]=h,t[24]=g,t[25]=b,t[26]=n,t[27]=S):S=t[27];let C;t[28]===u?C=t[29]:(C=u({id:`UQAp48`}),t[28]=u,t[29]=C);let w;t[30]===C?w=t[31]:(w=(0,Z.jsx)(Ce,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`c8iK2Y`})}),t[32]=T):T=t[32];let E;t[33]!==a||t[34]!==s?(E=()=>{s(rm),a(!1)},t[33]=a,t[34]=s,t[35]=E):E=t[35];let D=o===rm?`opacity-100`:`opacity-0`,O;t[36]===D?O=t[37]:(O=Gi(`mt-1 size-4 shrink-0`,D),t[36]=D,t[37]=O);let A;t[38]===O?A=t[39]:(A=(0,Z.jsx)(Jt,{className:O,"aria-hidden":`true`}),t[38]=O,t[39]=A);let j;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`E7BhZn`})}),t[40]=j):j=t[40];let M;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[j,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hZoBHK`})})]}),t[41]=M):M=t[41];let N;t[42]!==E||t[43]!==A?(N=(0,Z.jsxs)(k,{value:`Blank note empty`,onSelect:E,className:`items-start gap-3`,children:[A,M]}),t[42]=E,t[43]=A,t[44]=N):N=t[44];let P;if(t[45]!==a||t[46]!==s||t[47]!==c||t[48]!==o){let e;t[50]!==a||t[51]!==s||t[52]!==o?(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)(k,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Jt,{className:Gi(`mt-1 size-4 shrink-0`,o===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)(_m,{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[50]=a,t[51]=s,t[52]=o,t[53]=e):e=t[53],P=c.map(e),t[45]=a,t[46]=s,t[47]=c,t[48]=o,t[49]=P}else P=t[49];let F;t[54]!==d||t[55]!==N||t[56]!==P?(F=(0,Z.jsxs)(be,{id:d,className:`subtle-scrollbar`,children:[T,N,P]}),t[54]=d,t[55]=N,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==w||t[59]!==F?(I=(0,Z.jsx)(Be,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:gm,onWheel:hm,onTouchMove:mm,children:(0,Z.jsxs)(V,{children:[w,F]})}),t[58]=w,t[59]=F,t[60]=I):I=t[60];let L;return t[61]!==a||t[62]!==i||t[63]!==I||t[64]!==S?(L=(0,Z.jsxs)(Ft,{open:i,onOpenChange:a,children:[S,I]}),t[61]=a,t[62]=i,t[63]=I,t[64]=S,t[65]=L):L=t[65],L}function mm(e){e.stopPropagation()}function hm(e){e.stopPropagation()}function gm(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function _m(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Gi(`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)(J,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(pe,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function vm(e){return e.split(`/`).pop()??e}function ym(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(vm(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:vm(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function bm(e){let t=(0,$.c)(20),{plan:n,selectedPack:r}=e,i,a,o,s,c,l;if(t[0]!==n||t[1]!==r){let e=[...ym(n,r)].sort(Cm),u=new Set(e.map(Sm));c=`space-y-2`,t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(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:`◇`}),`What gets created`]}),t[8]=l):l=t[8],s=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,i=`Items to be created`,a=`py-1.5`,o=e.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let i=t.slice(0,e).join(`/`);u.has(i)&&(n++,r=e)}let i=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),a=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},xm),a?(0,Z.jsx)(Sc,{"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:i}),a&&e.description?(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{"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)(Kt,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(vr,{children:e.description})]}):null]},e.name)}),t[0]=n,t[1]=r,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];let u;t[9]!==i||t[10]!==a||t[11]!==o?(u=(0,Z.jsx)(`ul`,{"aria-label":i,className:a,children:o}),t[9]=i,t[10]=a,t[11]=o,t[12]=u):u=t[12];let d;t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{className:s,children:u}),t[13]=s,t[14]=u,t[15]=d):d=t[15];let f;return t[16]!==c||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{className:c,children:[l,d]}),t[16]=c,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xm(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 Sm(e){return e.name.replace(/\/$/,``)}function Cm(e,t){return e.name.localeCompare(t.name)}async function wm(e){let t=await e.json().catch(()=>null),n=Pr.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 Tm(){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 wm(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 wm(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 Em={"knowledge-base":Oc,"software-lifecycle":Te,"plain-notes":il,worldbuilding:dc,"writing-pipeline":Vc,gbrain:Fc};function Dm(e){return Em[e]??Oc}function Om(e){let t=(0,$.c)(28),{onPackSelect:n,className:r,packs:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=i===void 0,u,d;t[0]===l?(u=t[1],d=t[2]):(u=()=>{if(!l)return;let e=!1;return(async()=>{try{let t=await Tm().listPacks();if(e)return;t.ok?o(t.packs):c(t.error.message)}catch(t){let n=t;if(e)return;c(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},d=[l],t[0]=l,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f=l?a:i;if(s!==null){let e;t[3]===r?e=t[4]:(e=Gi(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[3]=r,t[4]=e);let n;return t[5]!==s||t[6]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,s]}),t[5]=s,t[6]=e,t[7]=n):n=t[7],n}if(f===null){let e;t[8]===r?e=t[9]:(e=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},Am).map(km),t[10]=n):n=t[10];let i;return t[11]!==e||t[12]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[11]=e,t[12]=n,t[13]=i):i=t[13],i}if(f.length===0){let e;t[14]===r?e=t[15]:(e=Gi(`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`,r),t[14]=r,t[15]=e);let n;return t[16]===e?n=t[17]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[16]=e,t[17]=n),n}let p;t[18]===r?p=t[19]:(p=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[18]=r,t[19]=p);let m;if(t[20]!==n||t[21]!==f){let e;t[23]===n?e=t[24]:(e=e=>(0,Z.jsx)(jm,{pack:e,onSelect:()=>n(e.id)},e.id),t[23]=n,t[24]=e),m=f.map(e),t[20]=n,t[21]=f,t[22]=m}else m=t[22];let h;return t[25]!==p||t[26]!==m?(h=(0,Z.jsx)(`div`,{className:p,children:m}),t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function km(e){return(0,Z.jsx)(Nm,{},`skeleton-${e}`)}function Am(e,t){return t}function jm(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Dm(n.id),t[0]=n.id,t[1]=i);let a=i,{files:o,folders:s}=n.entryCounts,c;t[2]===a?c=t[3]:(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 items-center justify-center rounded-lg bg-primary/5 text-primary`,children:(0,Z.jsx)(a,{className:`size-4`})}),t[2]=a,t[3]=c);let l;t[4]===n.name?l=t[5]:(l=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.description?d=t[10]:(d=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==s?(p=Mm({files:o,folders:s}),t[14]=o,t[15]=s,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`p`,{className:`mt-auto pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==r||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`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:[f,m]}),t[19]=r,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Mm({files:e,folders:t}){let n=e>0?`${e} ${e===1?`file`:`files`}`:null,r=`${t} ${t===1?`folder`:`folders`}`;return n?`${n} · ${r}`:r}function Nm(){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)(ee,{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}function Pm(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Yu,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fm(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Zu,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(Xu,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var Im=`knowledge-base`;function Lm(e){let t=(0,$.c)(68),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Yt(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??Im),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Tm().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??Im),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(Rm),Tm().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Tm().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Y.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let e=x?.name??o({id:`W8vpBM`}),n=t.result.applied,a=o(n===0?{id:`K6jjWB`,values:{packName:e}}:{id:`x3-2ta`,values:{packName:e,projectEntries:n}});Y.success(a),i?.(),r(!1)}else{let n=t.error.message;Y.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F;t[21]!==o||t[22]!==x||t[23]!==v?(F=v===`configure`&&x?x.description:o({id:`T-4cw2`}),t[21]=o,t[22]=x,t[23]=v,t[24]=F):F=t[24];let I=F,L;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){p(e),y(`configure`),b.current=!0},t[25]=L):L=t[25];let R=L,z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[26]=z):z=t[26];let B=z,V;t[27]===P?V=t[28]:(V=(0,Z.jsx)($t,{children:P}),t[27]=P,t[28]=V);let H;t[29]===I?H=t[30]:(H=(0,Z.jsx)(Zt,{children:I}),t[29]=I,t[30]=H);let U;t[31]!==V||t[32]!==H?(U=(0,Z.jsxs)(un,{children:[V,H]}),t[31]=V,t[32]=H,t[33]=U):U=t[33];let W;t[34]!==u||t[35]!==c||t[36]!==m||t[37]!==x||t[38]!==v||t[39]!==g?(W=v===`pick`?(0,Z.jsx)(sn,{children:(0,Z.jsx)(Om,{packs:u,onPackSelect:R})}):(0,Z.jsxs)(sn,{className:`space-y-6`,children:[(0,Z.jsx)(zm,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Bm,{phase:c,selectedPack:x})]}),t[34]=u,t[35]=c,t[36]=m,t[37]=x,t[38]=v,t[39]=g,t[40]=W):W=t[40];let G;t[41]!==M||t[42]!==v?(G=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:B,children:[(0,Z.jsx)(la,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(J,{id:`iH8pgl`})]}):null,t[41]=M,t[42]=v,t[43]=G):G=t[43];let te;t[44]===r?te=t[45]:(te=()=>r(!1),t[44]=r,t[45]=te);let ne;t[46]===c.kind?ne=t[47]:(ne=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(J,{id:`yz7wBu`}):(0,Z.jsx)(J,{id:`dEgA5A`}),t[46]=c.kind,t[47]=ne);let re;t[48]!==te||t[49]!==ne?(re=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,onClick:te,children:ne}),t[48]=te,t[49]=ne,t[50]=re):re=t[50];let ie;t[51]!==j||t[52]!==c.kind||t[53]!==v||t[54]!==O?(ie=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(J,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`XYlJJT`})]}):null,t[51]=j,t[52]=c.kind,t[53]=v,t[54]=O,t[55]=ie):ie=t[55];let ae;t[56]!==G||t[57]!==re||t[58]!==ie?(ae=(0,Z.jsxs)(cn,{children:[G,re,ie]}),t[56]=G,t[57]=re,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]!==U||t[61]!==W||t[62]!==ae?(oe=(0,Z.jsxs)(rn,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[U,W,ae]}),t[60]=U,t[61]=W,t[62]=ae,t[63]=oe):oe=t[63];let se;return t[64]!==r||t[65]!==n||t[66]!==oe?(se=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:oe}),t[64]=r,t[65]=n,t[66]=oe,t[67]=se):se=t[67],se}function Rm(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function zm(e){let t=(0,$.c)(21),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`3wiBAs`})}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Oo,{children:(0,Z.jsx)(J,{id:`RSqaSd`})}),t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(So,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Do,{orientation:`horizontal`,children:[(0,Z.jsxs)(po,{children:[l,(0,Z.jsx)(to,{className:`text-1sm`,children:(0,Z.jsx)(J,{id:`vPYaz3`})})]}),(0,Z.jsx)(Fm,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Oo,{children:(0,Z.jsx)(J,{id:`ZWgr0b`})}),t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(to,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(J,{id:`GUpclA`})}),t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==r?(p=n===`subfolder`&&(0,Z.jsx)(Go,{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]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,Z.jsxs)(po,{children:[d,f,p]}),t[12]=p,t[13]=m);let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Fm,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=h):h=t[14];let g;t[15]===m?g=t[16]:(g=(0,Z.jsx)(So,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Do,{orientation:`horizontal`,children:[m,h]})}),t[15]=m,t[16]=g);let _;return t[17]!==n||t[18]!==g||t[19]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(Pm,{className:`sm:flex`,value:n,onValueChange:c,children:[u,g]})]}),t[17]=n,t[18]=g,t[19]=c,t[20]=_):_=t[20],_}function Bm(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)(ee,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{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)(J,{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)(J,{id:`gcV0dI`})})]}),t[4]=n):n=t[4],n}let i;t[5]!==n.plan||t[6]!==r?(i=(0,Z.jsx)(bm,{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(Vm)}):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 Vm(e){return(0,Z.jsx)(`p`,{children:e},e)}var Hm=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,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.`}],Um=Hm.filter(e=>e.id!==`claude-cowork`),Wm=`#settings`;function Gm(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function Km(e){return e.replace(/^#/,``)===`settings`}function qm(){return typeof window>`u`?``:window.location.hash}function Jm(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(Xm),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,Q.startTransition)(()=>{n(Km(qm()))})};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=Ym,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Ym(){typeof window>`u`||Km(qm())&&window.history.back()}function Xm(){return Km(qm())}function Zm(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(eh),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch($m);if(!e||!t.ok)return;let i=Jr.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(Qm),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Qm(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function $m(){return null}function eh(){return th()}function th(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function nh(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 rh(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=$n(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 ih(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?nh(e):rh()}var ah=`ok:skill:cowork:installed`,oh=`1`,sh=250,ch=`/api/skill/install-state`;function lh(e){return`${ah}:v${e}`}var uh=new Map;async function dh(e={},t={}){let n=t.force?`__force__`:`__default__`,r=uh.get(n);if(r)return r;let i=fh(e,t);return uh.set(n,i),i.finally(()=>{uh.get(n)===i&&uh.delete(n)}),i}async function fh(e,t){let n=e.installer===void 0?ih():e.installer,r=ph(e.storage),i=e.fetchSnapshot??hh,a=e.serverTimeoutMs??sh,o=null;if(!t.force){try{o=await gh(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=lh(o?.currentVersion??e.fallbackSkillVersion??mh());if(!t.force&&r?.getItem(s)===oh)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,oh)}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 ph(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function mh(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function hh(){let e;try{e=await fetch(ch,{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 gh(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function _h(e){return dh({},e)}function vh(){return dh({},{force:!0})}async function yh(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 bh(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return yh({target:`claude-cowork`,url:ti({mode:`cowork`},e)},n);case`claude-code`:return yh({target:`claude-code`,url:ti({mode:`code`},e)},n);case`codex`:return yh({target:`codex`,url:ri(e)},n);case`cursor`:return yh({target:`cursor`,url:Si(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function xh(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:Sh(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:Sh(e)}}}function Sh(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 Ch(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 wh(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Th(e){return`${e}.md`}function Eh(e){if(!e.docName||!e.workspace)return null;let t=Th(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:wh(n,t,r)}}function Dh(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Oh(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function kh(e){return xh(e.installUrl).then(()=>void 0)}function Ah(e){return`Opened in ${e}.`}function jh(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 Mh(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Nh(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}function Ph(e){return e.docContext===null?e.folderRelativePath?Ii(e.folderRelativePath):Ri():Yr(e.docContext.relativePath)}async function Fh(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:Ph(t)},a=await n.dispatchHandoff(i),o=Nh(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Ah(s));else{let i=Mh(r),a=jh(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Fh(e,t,n,r+1)}}})}return a}function Ih(e){return Hm.find(t=>t.id===e)?.displayName??e}function Lh(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Rh(){return{dispatchHandoff:bh,recordHandoff:Ch,toast:{success:e=>{Y.success(e)},error:(e,t)=>{Y.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Lh(),getDisplayName:Ih,ensureCoworkSkillInstalled:_h}}function zh(){return{dispatch:(e,t)=>Fh(e,t,Rh()),reinstallCoworkSkill:vh}}var Bh=[...new Set(Hm.flatMap(e=>e.schemes))];function Vh(e,t){let n=t.now?.()??Date.now(),r={};for(let t of Hm){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 Hh(e){return Vh({},e)}async function Uh(e){let t=e.schemes??Bh,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 Wh=Object.fromEntries(Bh.map(e=>[e,{installed:!1}]));async function Gh(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 Wh}if(!t.ok)return Wh;let n;try{n=await t.json()}catch{return Wh}if(typeof n!=`object`||!n||Array.isArray(n))return Wh;let r=n,i={};for(let e of Bh)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Kh(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 qh(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Hh({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Vh(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=!Kh(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 Jh(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Yh(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Uh({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>Gh({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Xh(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Zh),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=qh(Yh());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 Zh(){return Hh({isElectronHost:Jh(),now:Date.now})}var Qh=3e3,$h=(e,t,n)=>gl(e,t,n,`CommandPalette`);function eg(e){window.location.assign(qr(e))}function tg(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Fi(t)}function ng(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?T:St,s;t[0]===n?s=t[1]:(s=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=s);let c=s,l=`snippet`in n?n.snippet:void 0,u=`${n.kind} ${n.path}`,d=`command-palette-nav-${n.kind}-${n.path}`,f;t[2]===o?f=t[3]:(f=(0,Z.jsx)(o,{className:`mt-0.5`}),t[2]=o,t[3]=f);let p;t[4]!==a||t[5]!==c?(p=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(rg,{query:a,text:c})}),t[4]=a,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==n.path||t[8]!==a?(m=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(rg,{query:a,text:n.path})}),t[7]=n.path,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==l?(h=l?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(rg,{query:a,text:l})}):null,t[10]=a,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[p,m,h]}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==i||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==g?(_=(0,Z.jsxs)(k,{value:u,onSelect:i,"data-testid":d,className:`items-start`,children:[f,g]}),t[17]=i,t[18]=u,t[19]=d,t[20]=f,t[21]=g,t[22]=_):_=t[22],_}function rg(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=Bp(n,r).map(ig),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 ig(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 ag({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function og(e){let t=(0,$.c)(151),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=Yt(),[s,c]=(0,Q.useState)(``),l=(0,Q.useDeferredValue)(s),u=l.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[p,m]=(0,Q.useState)(d),[h,g]=(0,Q.useState)(`idle`),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[1]=_):_=t[1];let[v,y]=(0,Q.useState)(_),b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[2]=b):b=t[2];let[x,S]=(0,Q.useState)(b),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[3]=O):O=t[3];let[A,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(`idle`),P;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[4]=P):P=t[4];let[F,I]=(0,Q.useState)(P),[L,R]=(0,Q.useState)(`idle`),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),{activeDocName:H,activeTarget:U}=ft(),{pages:W,pageTitles:G,pageMeta:ee,folderPaths:te}=Zr(),ne=Zm(),{states:re,refresh:ie}=Xh(),{dispatch:ae}=zh(),oe=Eh({docName:H,workspace:ne}),se=Np(W,te,G,ee),ce=Tp(x,new Set(se.map(lg))),le=a?.config.projectPath??null,ue=a?v.filter(e=>e.path!==le):[],de;t[5]!==H||t[6]!==U?(de=tg(U,H),t[5]=H,t[6]=U,t[7]=de):de=t[7];let fe=de,pe=u===``?[]:Rp(se,u,8),me,he;t[8]!==i||t[9]!==r?(me=()=>{let e=function(e){e.key===`k`&&(Ui()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},he=[i,r],t[8]=i,t[9]=r,t[10]=me,t[11]=he):(me=t[10],he=t[11]),(0,Q.useEffect)(me,he);let ge,_e;t[12]!==o||t[13]!==a||t[14]!==r||t[15]!==ie?(ge=()=>{if(r){if(S(Sp()),ie(),a){let e=!1;return $h(async()=>{let t=await a.project.listRecent();e||y(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}c(``),j([]),N(`idle`),z.current=!1,I([]),R(`idle`)},_e=[r,a,ie,o],t[12]=o,t[13]=a,t[14]=r,t[15]=ie,t[16]=ge,t[17]=_e):(ge=t[16],_e=t[17]),(0,Q.useEffect)(ge,_e);let ve;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>{B.current&&(B.current.scrollTop=0)},t[18]=ve):ve=t[18];let xe;t[19]===s?xe=t[20]:(xe=[s],t[19]=s,t[20]=xe),(0,Q.useEffect)(ve,xe);let Se=Gp(l,new Set(A.map(cg))),we=Se.kind!==`normal`,Te=Se.kind===`tag-list`?Se.query:``,De=Se.kind===`tag-docs`?Se.tagName:``,Oe,ke;t[21]!==we||t[22]!==r?(Oe=()=>{if(!r||!we||z.current)return;z.current=!0,N(`loading`);let e=!1;return qp().then(t=>{e||(j(t),N(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),j([]),N(`error`))}),()=>{e=!0}},ke=[r,we],t[21]=we,t[22]=r,t[23]=Oe,t[24]=ke):(Oe=t[23],ke=t[24]),(0,Q.useEffect)(Oe,ke);let Ae=Se.kind===`tag-docs`?Se.tagName:null;(0,Q.useEffect)(()=>{if(!r||Ae===null){I([]),R(`idle`);return}R(`loading`),I([]);let e=!1;return Jp(Ae).then(t=>{e||(I(t),R(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),I([]),R(`error`))}),()=>{e=!0}},[r,Ae]),(0,Q.useEffect)(()=>{if(!r||!u||we){m([]),g(`idle`);return}let e=new AbortController;g(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),m([]),g(`error`)},Qh);return Hp(u,{signal:e.signal}).then(e=>{window.clearTimeout(n),m(e),g(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(m([]),g(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,u,we]);let je;t[25]!==o||t[26]!==i?(je=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),$h(async()=>{await e()},n)},t[25]=o,t[26]=i,t[27]=je):je=t[27];let Me=je,Ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=wp(Sp(),t);Cp(n),S(n)},t[28]=Ne):Ne=t[28];let Pe=Ne,Fe;t[29]===i?Fe=t[30]:(Fe=function(e){i(!1),Pe(e),eg(e.path)},t[29]=i,t[30]=Fe);let Ie=Fe,Le=!we&&u===``&&ce.length>0,Re=ag({searchResults:p,fallbackSearchResults:pe,searchStatus:h}),ze=!we&&Re.length>0,q=!we&&u!==``&&h===`loading`&&!ze,Be;t[31]!==o||t[32]!==l||t[33]!==we?(Be=!we&&Up(o({id:`HdkSiO`}),l,[`create file`]),t[31]=o,t[32]=l,t[33]=we,t[34]=Be):Be=t[34];let Ve=Be,He;t[35]!==o||t[36]!==l||t[37]!==we?(He=!we&&Up(o({id:`96G6Re`}),l,[`create folder`]),t[35]=o,t[36]=l,t[37]=we,t[38]=He):He=t[38];let Ue=He,We;t[39]!==o||t[40]!==H||t[41]!==l||t[42]!==we?(We=!we&&H!==null&&Up(o({id:`3Fcb0I`}),l,[`graph panel network`]),t[39]=o,t[40]=H,t[41]=l,t[42]=we,t[43]=We):We=t[43];let Ge=We,Ke;t[44]!==o||t[45]!==l||t[46]!==we?(Ke=!we&&Up(o({id:`fWi7pn`}),l,[`scaffold`,`seed`,`pack`,`starter`]),t[44]=o,t[45]=l,t[46]=we,t[47]=Ke):Ke=t[47];let qe=Ke,Je;t[48]!==o||t[49]!==a||t[50]!==l||t[51]!==we?(Je=!we&&a!==null&&Up(o({id:`WPwDin`}),l,[`project`]),t[48]=o,t[49]=a,t[50]=l,t[51]=we,t[52]=Je):Je=t[52];let Ye=Je,Xe;t[53]!==o||t[54]!==a||t[55]!==l||t[56]!==we?(Xe=!we&&a!==null&&Up(o({id:`2Xs2jo`}),l,[`switch project navigator projects`]),t[53]=o,t[54]=a,t[55]=l,t[56]=we,t[57]=Xe):Xe=t[57];let Ze=Xe,Qe;t[58]!==o||t[59]!==l||t[60]!==we?(Qe=!we&&Up(o({id:`Tz0i8g`}),l,[`preferences config`]),t[58]=o,t[59]=l,t[60]=we,t[61]=Qe):Qe=t[61];let $e=Qe,et;t[62]!==o||t[63]!==l||t[64]!==we?(et=!we&&Up(o({id:`62Pc08`}),l,[`claude desktop install cowork`]),t[62]=o,t[63]=l,t[64]=we,t[65]=et):et=t[65];let tt=et,nt=!we&&a!==null&&ue.length>0&&(u===``||ue.some(e=>Up(`${e.name} ${e.path}`,l,[`open recent project`]))),rt=!we&&oe!==null&&(u===``||Um.some(e=>{let t=e.displayName;return Up(o({id:`WqLq6M`,values:{displayName:t}}),l,[e.id,`agent handoff`,`open in`])})),it=Se.kind===`tag-list`?Kp(A,Se.query):[],at=Se.kind===`tag-list`&&M!==`loading`&&it.length===0,ot=Se.kind===`tag-docs`&&L===`success`&&F.length===0,st=we||Le||ze||q||Ve||Ue||Ge||qe||Ye||Ze||$e||tt||nt||rt,ct;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){c(`${Wp}${e}`)},t[66]=ct):ct=t[66];let lt=ct,ut=K,dt;t[67]===o?dt=t[68]:(dt=o({id:`1bDVu5`}),t[67]=o,t[68]=dt);let pt;t[69]===o?pt=t[70]:(pt=o({id:`5GRxoA`}),t[69]=o,t[70]=pt);let mt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(mt={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[71]=mt):mt=t[71];let ht;t[72]===o?ht=t[73]:(ht=o({id:`ggs9f8`}),t[72]=o,t[73]=ht);let gt;t[74]!==s||t[75]!==ht?(gt=(0,Z.jsx)(Ce,{ref:V,value:s,onValueChange:c,placeholder:ht}),t[74]=s,t[75]=ht,t[76]=gt):gt=t[76];let _t;t[77]===we?_t=t[78]:(_t=()=>{c(we?``:Wp),V.current?.focus()},t[77]=we,t[78]=_t);let vt=we?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,yt;t[79]===vt?yt=t[80]:(yt=Gi(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,vt),t[79]=vt,t[80]=yt);let bt,xt;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(ye,{className:`size-3.5`}),xt=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`0rwwOn`})}),t[81]=bt,t[82]=xt):(bt=t[81],xt=t[82]);let Ct;t[83]!==we||t[84]!==_t||t[85]!==yt?(Ct=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:_t,"data-testid":`command-palette-filter-tag`,"data-active":we,"aria-pressed":we,className:yt,children:[bt,xt]})}),t[83]=we,t[84]=_t,t[85]=yt,t[86]=Ct):Ct=t[86];let wt=be,Et;t[87]!==ze||t[88]!==q?(Et=q&&!ze?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`WRNXKp`})}):null,t[87]=ze,t[88]=q,t[89]=Et):Et=t[89];let Dt=st?null:(0,Z.jsx)(qt,{children:h===`error`?(0,Z.jsx)(J,{id:`pkAft1`}):(0,Z.jsx)(J,{id:`i3f2kh`})}),Ot=Se.kind===`tag-list`?(0,Z.jsxs)(f,{heading:Se.query?o({id:`evs0iw`,values:{tagListQuery:Te}}):o({id:`2QM24L`}),children:[M===`loading`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`a_u4ck`})}):null,M===`error`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`MZoxVx`})}):null,at?(0,Z.jsx)(qt,{children:Se.query?o({id:`X0ttSN`,values:{tagListQuery:Te}}):o({id:`JLUTgi`})}):null,it.map(e=>(0,Z.jsxs)(k,{value:`tag ${e.name}`,onSelect:()=>lt(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(ye,{}),(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)(J,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,kt=Se.kind===`tag-docs`?(0,Z.jsxs)(f,{heading:o({id:`hGmuTc`,values:{tagDocsName:De}}),children:[L===`loading`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`pWbsW6`})}):null,L===`error`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`48uGTI`})}):null,ot?(0,Z.jsx)(qt,{children:o({id:`NIWAux`,values:{tagDocsName:De}})}):null,F.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==Se.tagName).map(sg).join(`, `);return(0,Z.jsxs)(k,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),eg(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(St,{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!==Se.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(J,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,At=Le?(0,Z.jsx)(f,{heading:o({id:`MmDDWK`}),children:ce.map(e=>(0,Z.jsx)(ng,{entry:e,onSelect:()=>Ie(e)},xp(e.kind,e.path)))}):null,jt;t[90]!==o||t[91]!==H||t[92]!==i||t[93]!==w||t[94]!==D||t[95]!==Ve||t[96]!==Ue||t[97]!==Ge||t[98]!==qe?(jt=Ve||Ue||Ge||qe?(0,Z.jsxs)(f,{heading:o({id:`45MZFs`}),children:[Ve?(0,Z.jsxs)(k,{value:`new file create file`,onSelect:()=>{i(!1),w(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(gc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`HdkSiO`})})]}):null,Ue?(0,Z.jsxs)(k,{value:`new folder create folder`,onSelect:()=>{i(!1),w(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(xc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`96G6Re`})})]}):null,Ge?(0,Z.jsxs)(k,{value:`open graph graph panel network`,onSelect:()=>{H&&(i(!1),Qp(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Fc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`3Fcb0I`})})]}):null,qe?(0,Z.jsxs)(k,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),D(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(Lc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`fWi7pn`})})]}):null]}):null,t[90]=o,t[91]=H,t[92]=i,t[93]=w,t[94]=D,t[95]=Ve,t[96]=Ue,t[97]=Ge,t[98]=qe,t[99]=jt):jt=t[99];let Mt=rt?(0,Z.jsx)(f,{heading:o({id:`O7_W_a`}),children:Um.filter(e=>{let t=e.displayName;return Up(o({id:`WqLq6M`,values:{displayName:t}}),l,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=re[e.id],n=t.installed===!0&&oe!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`1ZpfyB`,values:{displayName:r,hint:a}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(k,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!oe||(i(!1),ae(e.id,oe))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`WqLq6M`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,Nt;t[100]!==o||t[101]!==a||t[102]!==i||t[103]!==Me||t[104]!==tt||t[105]!==Ye||t[106]!==Ze||t[107]!==$e?(Nt=Ye||Ze||$e||tt?(0,Z.jsxs)(f,{heading:o({id:`e0NrBM`}),children:[Ye&&a?(0,Z.jsxs)(k,{value:`open folder on disk project`,onSelect:()=>Me(async()=>{let e=await a.dialog.openFolder();e&&await a.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(T,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`WPwDin`})}),(0,Z.jsx)(Ee,{children:`⌘O`})]}):null,Ze&&a?(0,Z.jsxs)(k,{value:`switch-project navigator projects`,onSelect:()=>Me(()=>a.navigator.open(),o({id:`jol95m`})),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(Dc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`2Xs2jo`})}),(0,Z.jsx)(Ee,{children:`⌘⇧N`})]}):null,$e?(0,Z.jsxs)(k,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Wm)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Zc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),(0,Z.jsx)(Ee,{children:`⌘,`})]}):null,tt?(0,Z.jsxs)(k,{value:`install claude desktop cowork app`,onSelect:()=>{i(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(ho,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`62Pc08`})})]}):null]}):null,t[100]=o,t[101]=a,t[102]=i,t[103]=Me,t[104]=tt,t[105]=Ye,t[106]=Ze,t[107]=$e,t[108]=Nt):Nt=t[108];let Pt=nt&&a?(0,Z.jsx)(f,{heading:o({id:`3iyGWF`}),children:ue.filter(e=>Up(`${e.name} ${e.path}`,l,[`open recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(k,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>Me(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(Tt,{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)(J,{id:`ls1N1w`})]}):null]})]})]},e.path))}):null,Ft=ze?(0,Z.jsx)(f,{heading:o({id:`A1taO8`}),children:Re.map(e=>(0,Z.jsx)(ng,{entry:e,query:u,onSelect:()=>Ie(e)},xp(e.kind,e.path)))}):null,It;t[109]!==wt||t[110]!==Et||t[111]!==Dt||t[112]!==Ot||t[113]!==kt||t[114]!==At||t[115]!==jt||t[116]!==Mt||t[117]!==Nt||t[118]!==Pt||t[119]!==Ft?(It=(0,Z.jsxs)(wt,{ref:B,className:`subtle-scrollbar`,children:[Et,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft]}),t[109]=wt,t[110]=Et,t[111]=Dt,t[112]=Ot,t[113]=kt,t[114]=At,t[115]=jt,t[116]=Mt,t[117]=Nt,t[118]=Pt,t[119]=Ft,t[120]=It):It=t[120];let Lt;t[121]!==ut||t[122]!==i||t[123]!==r||t[124]!==dt||t[125]!==pt||t[126]!==mt||t[127]!==gt||t[128]!==Ct||t[129]!==It?(Lt=(0,Z.jsxs)(ut,{open:r,onOpenChange:i,title:dt,description:pt,className:`sm:max-w-2xl`,commandProps:mt,children:[gt,Ct,It]}),t[121]=ut,t[122]=i,t[123]=r,t[124]=dt,t[125]=pt,t[126]=mt,t[127]=gt,t[128]=Ct,t[129]=It,t[130]=Lt):Lt=t[130];let Rt=C===`file`,zt;t[131]===w?zt=t[132]:(zt=e=>{e||w(null)},t[131]=w,t[132]=zt);let Bt;t[133]!==fe||t[134]!==Rt||t[135]!==zt?(Bt=(0,Z.jsx)(dm,{open:Rt,onOpenChange:zt,kind:`file`,initialDir:fe}),t[133]=fe,t[134]=Rt,t[135]=zt,t[136]=Bt):Bt=t[136];let Vt=C===`folder`,Ht;t[137]===w?Ht=t[138]:(Ht=e=>{e||w(null)},t[137]=w,t[138]=Ht);let Ut;t[139]!==fe||t[140]!==Vt||t[141]!==Ht?(Ut=(0,Z.jsx)(dm,{open:Vt,onOpenChange:Ht,kind:`folder`,initialDir:fe}),t[139]=fe,t[140]=Vt,t[141]=Ht,t[142]=Ut):Ut=t[142];let Wt;t[143]!==E||t[144]!==D?(Wt=(0,Z.jsx)(Lm,{open:E,onOpenChange:D}),t[143]=E,t[144]=D,t[145]=Wt):Wt=t[145];let Gt;return t[146]!==Lt||t[147]!==Bt||t[148]!==Ut||t[149]!==Wt?(Gt=(0,Z.jsxs)(Z.Fragment,{children:[Lt,Bt,Ut,Wt]}),t[146]=Lt,t[147]=Bt,t[148]=Ut,t[149]=Wt,t[150]=Gt):Gt=t[150],Gt}function sg(e){return`#${e}`}function cg(e){return e.name}function lg(e){return xp(e.kind,e.path)}var ug=500;function dg(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function fg(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function pg(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=ft(),[a,o]=(0,Q.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),ug);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,Q.useEffect)(s,c);let l=dg(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=fg(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.ok/local/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Z.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(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:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(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:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(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:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function mg(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($n(e)??Ie._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function hg(){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,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),mg(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(lt,e),()=>document.removeEventListener(lt,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(qr(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)(un,{children:(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(sn,{children:(0,Z.jsx)(gg,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(rn,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(dn,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function gg(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)(J,{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)(J,{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(_g)}):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 _g(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 vg=`raw-mdx-nav`,yg=`ok-editor-mode-v1`,bg=[`wysiwyg`,`source`],xg=`wysiwyg`;function Sg(e){return bg.includes(e)}function Cg(e=localStorage){try{let t=e.getItem(yg);if(t===null)return xg;if(Sg(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return xg}function wg(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Sg(n)?n:Cg(t)}function Tg(e,t=localStorage){try{return t.setItem(yg,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Eg(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(wg),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Tg(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 Dg(e){let t=(0,$.c)(25),{open:n,onResolved:r}=e,{_:i}=Yt(),a=Ba(),o;t[0]!==i||t[1]!==r||t[2]!==a?(o=function(e){if(a===null){Y.error(i({id:`fiMNLl`}));return}let t=a(e);if(!t.ok){let n=t.error;Y.error(i(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}r()},t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(un,{children:(0,Z.jsx)(_a,{})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(oo,{}),t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(sn,{children:[l,(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ZLQol-`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})})]}),t[6]=u):u=t[6];let d;t[7]===s?d=t[8]:(d=()=>s(!1),t[7]=s,t[8]=d);let f=a===null,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`IKoTAC`}),t[9]=p):p=t[9];let m;t[10]!==d||t[11]!==f?(m=(0,Z.jsx)(X,{variant:`ghost`,className:`uppercase font-mono`,onClick:d,disabled:f,children:p}),t[10]=d,t[11]=f,t[12]=m):m=t[12];let h;t[13]===s?h=t[14]:(h=()=>s(!0),t[13]=s,t[14]=h);let g=a===null,_;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(J,{id:`XU0OXn`}),t[15]=_):_=t[15];let v;t[16]!==g||t[17]!==h?(v=(0,Z.jsx)(X,{onClick:h,disabled:g,children:_}),t[16]=g,t[17]=h,t[18]=v):v=t[18];let y;t[19]!==v||t[20]!==m?(y=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,showCloseButton:!1,children:[c,u,(0,Z.jsxs)(cn,{children:[m,v]})]}),t[19]=v,t[20]=m,t[21]=y):y=t[21];let b;return t[22]!==n||t[23]!==y?(b=(0,Z.jsx)(dn,{open:n,onOpenChange:Og,children:y}),t[22]=n,t[23]=y,t[24]=b):b=t[24],b}function Og(){}function kg(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=Ao();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ei,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Z.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Z.jsx)(X,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var Ag=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 jg(e,t,n,r,i,a){if(e==r)return[];let o=Vg(e,t,n,r,i,a),s=Hg(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 Ag(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Ag(t,t+o,i,i),new Ag(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 Ag(t,t,i,i+o),new Ag(n,n,i+o+c,a)]}if(c==1||l==1)return[new Ag(t,n,i,a)];let u=Wg(e,t,n,r,i,a);if(u){let[o,s,c]=u;return jg(e,t,o,r,i,s).concat(jg(e,o+c,n,r,s+c,a))}return Fg(e,t,n,r,i,a)}var Mg=1e9,Ng=0,Pg=!1;function Fg(e,t,n,r,i,a){let o=n-t,s=a-i;if(Mg<1e9&&Math.min(o,s)>Mg*16||Ng>0&&Date.now()>Ng)return Math.min(o,s)>Mg*64?[new Ag(t,n,i,a)]:Gg(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Lg.reset(c),Rg.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:Rg,f=d?null:Lg;for(let p=0;p<c;p++){if(p>Mg||Ng>0&&!(p&63)&&Date.now()>Ng)return Gg(e,t,n,r,i,a);let m=Lg.advance(p,o,s,c,d,!1,l)||Rg.advance(p,o,s,c,f,!0,u);if(m)return zg(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Ag(t,n,i,a)]}var Ig=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}},Lg=new Ig,Rg=new Ig;function zg(e,t,n,r,i,a,o,s){let c=!1;return!o_(e,r)&&++r==n&&(c=!0),!o_(i,s)&&++s==o&&(c=!0),c?[new Ag(t,n,a,o)]:jg(e,t,r,i,a,s).concat(jg(e,r,n,i,s,o))}function Bg(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Vg(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Bg(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-+!o_(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Hg(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Bg(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-+!o_(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Ug(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;;){o_(e,s)||s++;let u=s+o;if(o_(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=Vg(e,u,n,r,i+f+d.length,a),c=Hg(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 Wg(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Wg(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Ug(e,t,n,r,i,a,Math.floor(o/4),-1)}function Gg(e,t,n,r,i,a){Pg=!0;let o=n-t,s=a-i,c;if(o<s){let s=Ug(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Ug(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Ag(t,n,i,a)];let[l,u,d]=c;return jg(e,t,l,r,i,u).concat(jg(e,l+d,n,r,u+d,a))}function Kg(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 Ag(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function qg(e,t,n){for(;;){Kg(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Vg(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Ag(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Hg(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Ag(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 Ag(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 Ag(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function Jg(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=t_(t,a.fromA,l),f=e_(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 Ag(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=e_(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Ag(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=t_(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Ag(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=r_(n,a.fromB,a.toB),r,o=t<0?-1:n_(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=r_(t,a.fromA,a.toA),r,o=n<0?-1:n_(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 Kg(e,3),e}var Yg;try{Yg=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Xg(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Zg(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Xg(n):Yg?!i_(n)||t==e.length-1?+!!Yg.test(String.fromCharCode(n)):Yg.test(e.slice(t,t+2))?2:0:0}function Qg(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Xg(n):Yg?!a_(n)||t==1?+!!Yg.test(String.fromCharCode(n)):Yg.test(e.slice(t-2,t))?2:0:0}var $g=8;function e_(e,t,n){if(t==e.length||!Qg(e,t))return t;for(let r=t,i=t+n,a=0;a<$g;a++){let t=Zg(e,r);if(!t||r+t>i)return r;r+=t}return t}function t_(e,t,n){if(!t||!Zg(e,t))return t;for(let r=t,i=t-n,a=0;a<$g;a++){let t=Qg(e,r);if(!t||r-t<i)return r;r-=t}return t}function n_(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function r_(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var i_=e=>e>=55296&&e<=56319,a_=e=>e>=56320&&e<=57343;function o_(e,t){return!t||t==e.length||!i_(e.charCodeAt(t-1))||!a_(e.charCodeAt(t))}function s_(e,t,n){let r=n?.override;return r?r(e,t):(Mg=(n?.scanLimit??1e9)>>1,Ng=n?.timeout?Date.now()+n.timeout:0,Pg=!1,qg(e,t,jg(e,0,e.length,t,0,t.length)))}function c_(){return!Pg}function l_(e,t,n){return Jg(s_(e,t,n),e,t)}var u_=_s.define({combine:e=>e[0]}),d_=vs.define(),f_=_s.define(),p_=fs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(d_)&&(e=n.value);for(let n of t.state.facet(f_))e=n(e,t);return e}});function m_(e){let t=e.field(p_,!1);if(!t)return null;let n=e.facet(u_);return{chunks:t,side:n?n.side:null}}var h_=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 v_(l_(e.toString(),t.toString(),n),e,t,0,0,c_())}static updateA(e,t,n,r,i){return S_(x_(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return S_(x_(e,r,!1,t.length),e,t,n,i)}};function g_(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 __(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 v_(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=g_(c.fromA+r,c.fromB+i,t,n),[d,f]=__(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]=g_(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]=__(a.toA+r,a.toB+i,t,n),s++}o.push(new h_(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var y_=1e3;function b_(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 x_(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>y_&&([l,d]=b_(e,a-y_,n,!0)),o<t.length-y_&&([u,f]=b_(e,o+y_,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 S_(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=l_(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of v_(h,n,r,d,f,c_()))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 C_={scanLimit:500},w_=ys.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=P_(e))}update(e){(e.docChanged||e.viewportChanged||E_(e.startState,e.state)||D_(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=P_(e.view))}},{decorations:e=>e.deco}),T_=ls.low(Cs({class:`cm-changeGutter`,markers:e=>e.plugin(w_)?.gutter||Es.empty}));function E_(e,t){return e.field(p_,!1)!=t.field(p_,!1)}function D_(e,t){return e.facet(u_)!=t.facet(u_)}var O_=hs.line({class:`cm-changedLine`}),k_=hs.mark({class:`cm-changedText`}),A_=hs.mark({tagName:`ins`,class:`cm-insertedLine`}),j_=hs.mark({tagName:`del`,class:`cm-deletedLine`}),M_=new class extends Ss{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function N_(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,O_),i.add(o,s,n?j_:A_),a&&a.add(o,o,M_);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,O_),a&&a.add(u,u,M_);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,k_),s<t)c++;else break}u=t}}}function P_(e){let t=e.state.field(p_),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(u_),o=n==`a`,s=new gs,c=i?new gs: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))&&N_(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var F_=class extends cs{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}},I_=vs.define({map:(e,t)=>e.map(t)}),L_=fs.define({create:()=>hs.none,update:(e,t)=>{for(let e of t.effects)if(e.is(I_))return e.value;return e.map(t.changes)},provide:e=>xs.decorations.from(e)}),R_=.01;function z_(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 B_(e,t,n){let r=new gs,i=new gs,a=e.state.field(L_).iter(),o=t.state.field(L_).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<-R_?(l-=n,r.add(s,s,hs.widget({widget:new F_(-n),block:!0,side:-1}))):n>R_&&(u+=n,i.add(c,c,hs.widget({widget:new F_(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<R_?r.add(e.state.doc.length,e.state.doc.length,hs.widget({widget:new F_(-p),block:!0,side:1})):p>R_&&i.add(t.state.doc.length,t.state.doc.length,hs.widget({widget:new F_(p),block:!0,side:1}));let m=r.finish(),h=i.finish();z_(m,e.state.field(L_))||e.dispatch({effects:I_.of(m)}),z_(h,t.state.field(L_))||t.dispatch({effects:I_.of(h)})}var V_=vs.define({map:(e,t)=>t.mapPos(e)}),H_=class extends cs{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:V_.of(n)});let{side:r,sibling:i}=e.state.facet(u_);i&&i().dispatch({effects:V_.of(U_(n,e.state.field(p_),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function U_(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 W_=fs.define({create(e){return hs.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(V_)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>xs.decorations.from(e)});function G_({margin:e=3,minSize:t=4}){return W_.init(n=>K_(n,e,t))}function K_(e,t,n){let r=new gs,i=e.facet(u_).side==`a`,a=e.field(p_),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,hs.replace({widget:new H_(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var q_=xs.styleModule.of(new ws({".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`}})),J_=xs.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`}}),Y_=new bs,X_=new bs,Z_=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||C_;let t=[ls.low(w_),J_,q_,L_,xs.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(I_)))&&this.measure()})],n=[u_.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(T_);let r=ds.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],xs.editorAttributes.of({class:`cm-merge-a`}),X_.of(n),t]}),i=[u_.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(T_);let a=ds.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],xs.editorAttributes.of({class:`cm-merge-b`}),X_.of(i),t]});this.chunks=h_.build(r.doc,a.doc,this.diffConf);let o=[p_.init(()=>this.chunks),Y_.of(e.collapseUnchanged?G_(e.collapseUnchanged):[])];r=r.update({effects:vs.appendConfig.of(o)}).state,a=a.update({effects:vs.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 xs({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new xs({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),us.empty(e[0].startState.doc.length));this.chunks=t==this.a?h_.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):h_.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:d_.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:d_.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(u_),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(X_.reconfigure([u_.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?T_:[]])),a.push(X_.reconfigure([u_.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?T_:[]]))}if(r){let t=Y_.reconfigure(e.collapseUnchanged?G_(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(){B_(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=Q_(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=Q_(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 Q_(e){let t=e.nextSibling;return e.remove(),t}var $_=new class extends Ss{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},ev=ls.low(Cs({class:`cm-changeGutter`,markers:e=>e.plugin(w_)?.gutter||Es.empty,widgetMarker:(e,t)=>t instanceof av?$_:null}));function tv(e){let t=typeof e.original==`string`?ms.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||C_;return[ls.low(w_),uv,J_,xs.editorAttributes.of({class:`cm-merge-b`}),f_.of((e,t)=>{let r=t.effects.find(e=>e.is(nv));return r&&(e=h_.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=h_.updateB(e,t.state.field(rv),t.newDoc,t.changes,n)),e}),u_.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?gv:void 0,side:`b`}),rv.init(()=>t),e.gutter===!1?[]:ev,e.collapseUnchanged?G_(e.collapseUnchanged):[],p_.init(e=>h_.build(t,e.doc,n))]}var nv=vs.define(),rv=fs.define({create:()=>ms.empty,update(e,t){for(let n of t.effects)n.is(nv)&&(e=n.value.doc);return e}}),iv=new WeakMap,av=class extends cs{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 ov(e,t,n){let r=iv.get(t.changes);if(r)return r;let i=hs.widget({block:!0,side:-1,widget:new av(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(u_),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(),sv(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),cv(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(rv).sliceString(t.fromA,t.endA),u=a&&e.facet(Ds),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)==`
13
+ `);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 kl(e){return{start(t){return e.localOp.clone.start(t)}}}var Al=`ContextMenu`,[jl,Ml]=$i(Al,[wa]),Nl=wa(),[Pl,Fl]=jl(Al),Il=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=Nl(t),l=Qi(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Pl,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Ua,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Il.displayName=Al;var Ll=`ContextMenuTrigger`,Rl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Fl(Ll,n),o=Nl(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)(ao,{...o,virtualRef:c}),(0,Z.jsx)(Zi.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:Ji(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:Ji(e.onPointerDown,pu(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:Ji(e.onPointerMove,pu(u)),onPointerCancel:r?e.onPointerCancel:Ji(e.onPointerCancel,pu(u)),onPointerUp:r?e.onPointerUp:Ji(e.onPointerUp,pu(u))})]})});Rl.displayName=Ll;var zl=`ContextMenuPortal`,Bl=e=>{let{__scopeContextMenu:t,...n}=e,r=Nl(t);return(0,Z.jsx)(Bo,{...r,...n})};Bl.displayName=zl;var Vl=`ContextMenuContent`,Hl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Fl(Vl,n),a=Nl(n),o=Q.useRef(!1);return(0,Z.jsx)(yo,{...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)`}})});Hl.displayName=Vl;var Ul=`ContextMenuGroup`,Wl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(fo,{...i,...r,ref:t})});Wl.displayName=Ul;var Gl=`ContextMenuLabel`,Kl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Po,{...i,...r,ref:t})});Kl.displayName=Gl;var ql=`ContextMenuItem`,Jl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(lo,{...i,...r,ref:t})});Jl.displayName=ql;var Yl=`ContextMenuCheckboxItem`,Xl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(wo,{...i,...r,ref:t})});Xl.displayName=Yl;var Zl=`ContextMenuRadioGroup`,Ql=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(ro,{...i,...r,ref:t})});Ql.displayName=Zl;var $l=`ContextMenuRadioItem`,eu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Ro,{...i,...r,ref:t})});eu.displayName=$l;var tu=`ContextMenuItemIndicator`,nu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)($a,{...i,...r,ref:t})});nu.displayName=tu;var ru=`ContextMenuSeparator`,iu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Sa,{...i,...r,ref:t})});iu.displayName=ru;var au=`ContextMenuArrow`,ou=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(so,{...i,...r,ref:t})});ou.displayName=au;var su=`ContextMenuSub`,cu=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Nl(t),[s,c]=Xi({prop:i,defaultProp:a??!1,onChange:r,caller:su});return(0,Z.jsx)(Io,{...o,open:s,onOpenChange:c,children:n})};cu.displayName=su;var lu=`ContextMenuSubTrigger`,uu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Ea,{...i,...r,ref:t})});uu.displayName=lu;var du=`ContextMenuSubContent`,fu=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Nl(n);return(0,Z.jsx)(Ga,{...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)`}})});fu.displayName=du;function pu(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var mu=Il,hu=Rl,gu=Bl,_u=Hl,vu=Jl,yu=Xl,bu=nu,xu=iu,Su=cu,Cu=uu,wu=fu,Tu=`Radio`,[Eu,Du]=$i(Tu),[Ou,ku]=Eu(Tu),Au=Q.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:i=!1,required:a,disabled:o,value:s=`on`,onCheck:c,form:l,...u}=e,[d,f]=Q.useState(null),p=Ki(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(Ou,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(Zi.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Fu(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:Ji(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(Pu,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});Au.displayName=Tu;var ju=`RadioIndicator`,Mu=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=ku(ju,n);return(0,Z.jsx)(qi,{present:r||a.checked,children:(0,Z.jsx)(Zi.span,{"data-state":Fu(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Mu.displayName=ju;var Nu=`RadioBubbleInput`,Pu=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=Ki(o,a),c=an(n),l=ea(t);return Q.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,Z.jsx)(Zi.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Pu.displayName=Nu;function Fu(e){return e?`checked`:`unchecked`}var Iu=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Lu=`RadioGroup`,[Ru,zu]=$i(Lu,[$o,Du]),Bu=$o(),Vu=Du(),[Hu,Uu]=Ru(Lu),Wu=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:s=!1,orientation:c,dir:l,loop:u=!0,onValueChange:d,...f}=e,p=Bu(n),m=fr(l),[h,g]=Xi({prop:a,defaultProp:i??null,onChange:d,caller:Lu});return(0,Z.jsx)(Hu,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(Xo,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(Zi.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});Wu.displayName=Lu;var Gu=`RadioGroupItem`,Ku=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Uu(Gu,n),o=a.disabled||r,s=Bu(n),c=Vu(n),l=Q.useRef(null),u=Ki(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{Iu.includes(e.key)&&(f.current=!0)},t=()=>f.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,Z.jsx)(Zo,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(Au,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:Ji(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:Ji(i.onFocus,()=>{f.current&&l.current?.click()})})})});Ku.displayName=Gu;var qu=`RadioGroupIndicator`,Ju=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(Mu,{...Vu(n),...r,ref:t})});Ju.displayName=qu;var Yu=Wu,Xu=Ku,Zu=Ju;async function Qu(e){try{await navigator.clipboard.writeText(e)}catch{}}var $u=120*1e3;function ed(e){let t=(0,$.c)(28),{onSuccess:n,onCancel:r,transport:i}=e,{_:a}=Yt(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(`https://github.com/login/device`),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)($u),v=(0,Q.useRef)(null),y=(0,Q.useRef)(null),b;t[0]!==a||t[1]!==n||t[2]!==i?(b=async function(){p(null),h(!0);try{let e=i.start();v.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,o=await t.next();for(;!o.done;){let e=o.value;if(e.type===`verification`)s(e.user_code),l(e.verification_uri),_(e.expires_in*1e3),Qu(e.user_code).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)});else if(e.type===`complete`){r=!0,h(!1),n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,p(e.message),h(!1);break}o=await t.next()}r||(p(a({id:`DskIkK`})),h(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&p(a({id:`Q5fqMz`})),h(!1)}},t[0]=a,t[1]=n,t[2]=i,t[3]=b):b=t[3];let x=b,S;t[4]===x?S=t[5]:(S=()=>{let e=!1;return queueMicrotask(()=>{e||x()}),()=>{e=!0,v.current?.(),v.current=null,y.current&&clearInterval(y.current)}},t[4]=x,t[5]=S);let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[6]=C):C=t[6],(0,Q.useEffect)(S,C);let w,T;t[7]!==a||t[8]!==o?(w=()=>{if(!o)return;let e=Date.now();return y.current=setInterval(()=>{let t=$u-(Date.now()-e);t<=0?(_(0),y.current&&clearInterval(y.current),p(a({id:`ve8vEM`}))):_(t)},1e3),()=>{y.current&&clearInterval(y.current)}},T=[o,a],t[7]=a,t[8]=o,t[9]=w,t[10]=T):(w=t[9],T=t[10]),(0,Q.useEffect)(w,T);let E=Math.floor(g/6e4),D=Math.floor(g%6e4/1e3),O;t[11]===D?O=t[12]:(O=D.toString().padStart(2,`0`),t[11]=D,t[12]=O);let k=`${E}:${O}`,A;t[13]!==u||t[14]!==f||t[15]!==k||t[16]!==o||t[17]!==c?(A=o?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`AVoO4B`,values:{verificationUri:c},components:{0:(0,Z.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ra(e,c),onAuxClick:e=>Ra(e,c),className:`underline underline-offset-2`})}})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{className:`flex-1 text-center text-2xl font-mono font-bold tracking-widest border rounded-md py-3 bg-muted`,children:o}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void Qu(o).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)}),children:u?(0,Z.jsx)(J,{id:`PiH3UR`}):(0,Z.jsx)(J,{id:`he3ygx`})})]}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,Z.jsx)(J,{id:`5y_9lO`})]}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`gYz2ep`,values:{timeLabel:k}})})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:f?null:(0,Z.jsx)(J,{id:`aWlJai`})}),t[13]=u,t[14]=f,t[15]=k,t[16]=o,t[17]=c,t[18]=A):A=t[18];let j;t[19]===f?j=t[20]:(j=f&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:f}),t[19]=f,t[20]=j);let M;t[21]!==r||t[22]!==m?(M=m&&(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:r,children:(0,Z.jsx)(J,{id:`dEgA5A`})}),t[21]=r,t[22]=m,t[23]=M):M=t[23];let N;return t[24]!==A||t[25]!==j||t[26]!==M?(N=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[A,j,M]}),t[24]=A,t[25]=j,t[26]=M,t[27]=N):N=t[27],N}function td(e){let t=(0,$.c)(38),{onSuccess:n,onCancel:r}=e,{_:i}=Yt(),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),f,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>()=>{d.current?.abort()},p=[],t[0]=f,t[1]=p):(f=t[0],p=t[1]),(0,Q.useEffect)(f,p);let m;t[2]!==i||t[3]!==n||t[4]!==a?(m=async function(){if(!a.trim()){u(i({id:`6nB8LV`}));return}d.current?.abort();let e=new AbortController;d.current=e,c(!0),u(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:a.trim()}),signal:e.signal});if(!t.ok){let e=i({id:`TmKshB`});try{let n=await t.json(),r=Pr.safeParse(n);r.success&&(e=r.data.title)}catch{}u(e),c(!1);return}if(!t.body){u(i({id:`TmKshB`})),c(!1);return}await wl(t.body,e=>{let t;try{t=JSON.parse(e)}catch{return`continue`}return t.type===`complete`?(n({login:t.login,name:t.name,email:t.email}),c(!1),`terminal`):`continue`})||u(i({id:`muWKMD`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&u(i({id:`Q5fqMz`}))}c(!1)},t[2]=i,t[3]=n,t[4]=a,t[5]=m):m=t[5];let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`dGaH3A`,components:{0:(0,Z.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noopener noreferrer`,onClick:rd,onAuxClick:nd,className:`underline underline-offset-2`}),1:(0,Z.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`})}})}),t[6]=g):g=t[6];let _;t[7]===i?_=t[8]:(_=i({id:`p2LEhJ`}),t[7]=i,t[8]=_);let v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>o(e.target.value),t[9]=v):v=t[9];let y;t[10]===h?y=t[11]:(y=e=>{e.key===`Enter`&&h()},t[10]=h,t[11]=y);let b;t[12]!==s||t[13]!==a||t[14]!==_||t[15]!==y?(b=(0,Z.jsx)(Go,{type:`password`,"aria-label":_,placeholder:`ghp_…`,value:a,onChange:v,disabled:s,onKeyDown:y}),t[12]=s,t[13]=a,t[14]=_,t[15]=y,t[16]=b):b=t[16];let x;t[17]===l?x=t[18]:(x=l&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:l}),t[17]=l,t[18]=x);let S;t[19]===h?S=t[20]:(S=()=>void h(),t[19]=h,t[20]=S);let C;t[21]===s?C=t[22]:(C=s?(0,Z.jsx)(J,{id:`hYFQsG`}):(0,Z.jsx)(J,{id:`zXZJoN`}),t[21]=s,t[22]=C);let w;t[23]!==s||t[24]!==S||t[25]!==C?(w=(0,Z.jsx)(X,{className:`flex-1`,onClick:S,disabled:s,children:C}),t[23]=s,t[24]=S,t[25]=C,t[26]=w):w=t[26];let T;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(J,{id:`dEgA5A`}),t[27]=T):T=t[27];let E;t[28]!==s||t[29]!==r?(E=(0,Z.jsx)(X,{variant:`ghost`,onClick:r,disabled:s,children:T}),t[28]=s,t[29]=r,t[30]=E):E=t[30];let D;t[31]!==w||t[32]!==E?(D=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[w,E]}),t[31]=w,t[32]=E,t[33]=D):D=t[33];let O;return t[34]!==D||t[35]!==b||t[36]!==x?(O=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,b,x,D]}),t[34]=D,t[35]=b,t[36]=x,t[37]=O):O=t[37],O}function nd(e){return Ra(e,`https://github.com/settings/tokens`)}function rd(e){return Ra(e,`https://github.com/settings/tokens`)}function id(e){let t=(0,$.c)(41),{login:n,onSave:r,onSkip:i}=e,{_:a}=Yt(),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`gp3I7-`})}),t[0]=u):u=t[0];let d;t[1]===a?d=t[2]:(d=a({id:`6YtxFj`}),t[1]=a,t[2]=d);let f;t[3]!==a||t[4]!==n?(f=a({id:`J2Mv98`,values:{login:n}}),t[3]=a,t[4]=n,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>s(e.target.value),t[6]=p):p=t[6];let m;t[7]!==o||t[8]!==d||t[9]!==f?(m=(0,Z.jsx)(Go,{"aria-label":d,placeholder:f,value:o,onChange:p}),t[7]=o,t[8]=d,t[9]=f,t[10]=m):m=t[10];let h;t[11]===a?h=t[12]:(h=a({id:`O3oNi5`}),t[11]=a,t[12]=h);let g;t[13]===a?g=t[14]:(g=a({id:`O3oNi5`}),t[13]=a,t[14]=g);let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>l(e.target.value),t[15]=_):_=t[15];let v;t[16]!==c||t[17]!==h||t[18]!==g?(v=(0,Z.jsx)(Go,{type:`email`,"aria-label":h,placeholder:g,value:c,onChange:_}),t[16]=c,t[17]=h,t[18]=g,t[19]=v):v=t[19];let y;t[20]!==c||t[21]!==o||t[22]!==r?(y=()=>r(o.trim(),c.trim()),t[20]=c,t[21]=o,t[22]=r,t[23]=y):y=t[23];let b;t[24]!==c||t[25]!==o?(b=!o.trim()||!c.trim(),t[24]=c,t[25]=o,t[26]=b):b=t[26];let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(J,{id:`tfDRzk`}),t[27]=x):x=t[27];let S;t[28]!==y||t[29]!==b?(S=(0,Z.jsx)(X,{className:`flex-1`,onClick:y,disabled:b,children:x}),t[28]=y,t[29]=b,t[30]=S):S=t[30];let C;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(J,{id:`6Uau97`}),t[31]=C):C=t[31];let w;t[32]===i?w=t[33]:(w=(0,Z.jsx)(X,{variant:`ghost`,onClick:i,children:C}),t[32]=i,t[33]=w);let T;t[34]!==S||t[35]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[S,w]}),t[34]=S,t[35]=w,t[36]=T):T=t[36];let E;return t[37]!==T||t[38]!==m||t[39]!==v?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u,m,v,T]}),t[37]=T,t[38]=m,t[39]=v,t[40]=E):E=t[40],E}function ad(e){let t=(0,$.c)(9),{authResult:n,onSave:r,onSkip:i}=e,a=n.login,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`KZkHZv`,values:{login:a}})}),t[0]=a,t[1]=o);let s;t[2]!==a||t[3]!==r||t[4]!==i?(s=(0,Z.jsx)(id,{login:a,onSave:r,onSkip:i}),t[2]=a,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)(Z.Fragment,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function od(e){let t=(0,$.c)(45),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s}=e,{_:c}=Yt(),l;t[0]===s?l=t[1]:(l=s??El(),t[0]=s,t[1]=l);let u=l,[d,f]=(0,Q.useState)(`device`),[p,m]=(0,Q.useState)(`auth`),[h,g]=(0,Q.useState)(null),_,v;t[2]===n?(_=t[3],v=t[4]):(_=()=>{n&&(f(`device`),m(`auth`),g(null))},v=[n],t[2]=n,t[3]=_,t[4]=v),(0,Q.useEffect)(_,v);let y;t[5]!==c||t[6]!==a||t[7]!==r||t[8]!==i?(y=function(e){if(g(e),a&&(!e.name||!e.email))m(`identity`);else{m(`done`),i?.(e),r(!1);let t=e.login;Y.success(c({id:`KZkHZv`,values:{login:t}}))}},t[5]=c,t[6]=a,t[7]=r,t[8]=i,t[9]=y):y=t[9];let b=y,x;t[10]!==c||t[11]!==h||t[12]!==r||t[13]!==i?(x=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(sd);let n={...h??{login:``},name:e,email:t};m(`done`),i?.(n),r(!1);let a=n.login;Y.success(c({id:`KZkHZv`,values:{login:a}}))},t[10]=c,t[11]=h,t[12]=r,t[13]=i,t[14]=x):x=t[14];let S=x,C;t[15]!==c||t[16]!==h||t[17]!==r||t[18]!==i?(C=function(){if(!h)return;m(`done`),i?.(h),r(!1);let e=h.login;Y.success(c({id:`KZkHZv`,values:{login:e}}))},t[15]=c,t[16]=h,t[17]=r,t[18]=i,t[19]=C):C=t[19];let w=C,T;t[20]===r?T=t[21]:(T=function(){r(!1)},t[20]=r,t[21]=T);let E=T,D;t[22]===o?D=t[23]:(D=(0,Z.jsx)(un,{children:(0,Z.jsx)($t,{children:o?(0,Z.jsx)(J,{id:`X8kjQX`}):(0,Z.jsx)(J,{id:`gtmbUO`})})}),t[22]=o,t[23]=D);let O;t[24]!==b||t[25]!==E||t[26]!==u||t[27]!==p||t[28]!==d?(O=p===`auth`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex gap-1 border-b pb-2 mb-1`,children:[(0,Z.jsx)(X,{variant:d===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>f(`device`),children:(0,Z.jsx)(J,{id:`pdHb22`})}),(0,Z.jsx)(X,{variant:d===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>f(`pat`),children:(0,Z.jsx)(J,{id:`TP9_K5`})})]}),d===`device`?(0,Z.jsx)(ed,{onSuccess:b,onCancel:E,transport:u}):(0,Z.jsx)(td,{onSuccess:b,onCancel:E})]}),t[24]=b,t[25]=E,t[26]=u,t[27]=p,t[28]=d,t[29]=O):O=t[29];let k;t[30]!==h||t[31]!==S||t[32]!==w||t[33]!==p?(k=p===`identity`&&h&&(0,Z.jsx)(ad,{authResult:h,onSave:S,onSkip:w}),t[30]=h,t[31]=S,t[32]=w,t[33]=p,t[34]=k):k=t[34];let A;t[35]!==k||t[36]!==O?(A=(0,Z.jsxs)(sn,{children:[O,k]}),t[35]=k,t[36]=O,t[37]=A):A=t[37];let j;t[38]!==A||t[39]!==D?(j=(0,Z.jsxs)(rn,{className:`sm:max-w-md`,children:[D,A]}),t[38]=A,t[39]=D,t[40]=j):j=t[40];let M;return t[41]!==r||t[42]!==n||t[43]!==j?(M=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:j}),t[41]=r,t[42]=n,t[43]=j,t[44]=M):M=t[44],M}function sd(){}function cd(){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(ld),()=>{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 ld(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function ud(e){let t=(0,$.c)(2),{className:n}=e,{channel:r}=cd();if(r!==`beta`)return null;let i;return t[0]===n?i=t[1]:(i=(0,Z.jsx)(pe,{variant:`secondary`,"aria-label":`Beta channel`,"data-testid":`beta-badge`,className:n,children:`BETA`}),t[0]=n,t[1]=i),i}function dd(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 fd(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`}}var pd=null;function md(e){let t=(0,$.c)(99),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c,initialUrl:l}=e,{_:u}=Yt(),d;t[0]===o?d=t[1]:(d=o??Ol(),t[0]=o,t[1]=d);let f=d,p;t[2]===s?p=t[3]:(p=s??Sl(),t[2]=s,t[3]=p);let m=p,h=c!==void 0,[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(``),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(pd),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(!1),[A,j]=(0,Q.useState)(-1),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useId)(),I;t[4]!==n||t[5]!==m?(I=()=>{if(!n)return;let e=!1;return m.status().then(t=>{pd=t.authenticated,e||T(t.authenticated)}).catch(()=>{pd=!1,e||T(!1)}),()=>{e=!0}},t[4]=n,t[5]=m,t[6]=I):I=t[6];let L;t[7]===n?L=t[8]:(L=[n],t[7]=n,t[8]=L),(0,Q.useEffect)(I,L);let R;t[9]!==w||t[10]!==n||t[11]!==m?(R=()=>{if(!w||!n)return;let e=!1;return C(!0),m.repos().then(t=>{e||(x(t.ok?t.repos:[]),C(!1))}).catch(()=>{e||(x([]),C(!1))}),()=>{e=!0}},t[9]=w,t[10]=n,t[11]=m,t[12]=R):R=t[12];let z;t[13]!==w||t[14]!==n?(z=[w,n],t[13]=w,t[14]=n,t[15]=z):z=t[15],(0,Q.useEffect)(R,z);let B,V;t[16]!==l||t[17]!==n||t[18]!==h?(B=()=>{if(!n||!l||(_(l),h))return;let e=fd(l);e&&y(`~/Documents/${e}`)},V=[n,l,h],t[16]=l,t[17]=n,t[18]=h,t[19]=B,t[20]=V):(B=t[19],V=t[20]),(0,Q.useEffect)(B,V);let H,U;t[21]!==A||t[22]!==F?(U=()=>{A<0||document.getElementById(`${F}-opt-${A}`)?.scrollIntoView({block:`nearest`})},H=[A,F],t[21]=A,t[22]=F,t[23]=H,t[24]=U):(H=t[23],U=t[24]),(0,Q.useEffect)(U,H);let W;t[25]===h?W=t[26]:(W=function(e){if(_(e),k(!0),j(-1),h)return;let t=fd(e);t&&y(`~/Documents/${t}`)},t[25]=h,t[26]=W);let G=W,ee;t[27]===h?ee=t[28]:(ee=function(e){if(_(e.clone_url),h)return;let t=e.full_name.split(`/`)[1];y(`~/Documents/${t}`)},t[27]=h,t[28]=ee);let te=ee,ne;t[29]!==u||t[30]!==v||t[31]!==a||t[32]!==r||t[33]!==c||t[34]!==f||t[35]!==g?(ne=async function(){let e=g.trim();if(!e){Y.error(u({id:`FTUGgh`}));return}let t=v||``;if(c){D(!0);let n=await c();if(!n){D(!1);return}let r=fd(e);t=`${n.replace(/\/$/,``)}/${r}`}else D(!0);let n=Y.loading(u({id:`2tgFCe`}),{duration:1/0});N.current=n;let i=f.start({url:e,dir:t});M.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=u(dd(i.phase));Y.loading(`${e} — ${i.pct}%`,{id:n})}else if(i.type===`complete`){Y.success(u({id:`u_lS4C`}),{id:n}),r(!1),D(!1),M.current=null;let e=`port`in i?i.port:void 0;a?a({port:e,dir:i.dir}):e!==void 0&&(window.location.href=`http://localhost:${e}`);return}else if(i.type===`error`){let e=i.message;Y.error(u({id:`eFJkVt`,values:{cloneError:e}}),{id:n}),D(!1),M.current=null;return}t=await e.next()}Y.error(u({id:`Tz9pJB`}),{id:n}),D(!1),M.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Y.error(u({id:`K9J00P`}),{id:n}),D(!1),M.current=null}},t[29]=u,t[30]=v,t[31]=a,t[32]=r,t[33]=c,t[34]=f,t[35]=g,t[36]=ne):ne=t[36];let re=ne,ie;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(){M.current?.(),M.current=null,D(!1),Y.dismiss(N.current??void 0)},t[37]=ie):ie=t[37];let ae=ie,oe;t[38]!==E||t[39]!==r||t[40]!==h?(oe=function(e){E||(r(e),e||(_(``),h||y(``),k(!1),j(-1)))},t[38]=E,t[39]=r,t[40]=h,t[41]=oe):oe=t[41];let se=oe,ce;t[42]===te?ce=t[43]:(ce=function(e){te(e),k(!1),j(-1),P.current?.focus()},t[42]=te,t[43]=ce);let le=ce,ue=w===null||S&&b===null,de;if(t[44]!==b||t[45]!==g){let e=g.trim().toLowerCase(),n;t[47]===b?n=t[48]:(n=b??[],t[47]=b,t[48]=n),de=n.filter(t=>`${t.full_name} ${t.clone_url}`.toLowerCase().includes(e)),t[44]=b,t[45]=g,t[46]=de}else de=t[46];let K=de,fe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(fe=/:\/\/|^git@|\.git$/i,t[49]=fe):fe=t[49];let pe;t[50]===g?pe=t[51]:(pe=fe.test(g.trim()),t[50]=g,t[51]=pe);let me=pe,he=w===!0&&b!==null&&K.length===0&&!me,ge=O&&w!==!1&&!E&&(ue||K.length>0||he),_e=K.length,ve=`${F}-loading`,ye,be;t[52]===_e?(ye=t[53],be=t[54]):(ye=()=>{j(e=>e>=_e?_e-1:e)},be=[_e],t[52]=_e,t[53]=ye,t[54]=be),(0,Q.useEffect)(ye,be);let xe;t[55]!==A||t[56]!==E||t[57]!==ge||t[58]!==le||t[59]!==K?(xe=function(e){if(!E)if(e.key===`ArrowDown`){if(e.preventDefault(),!ge){k(!0);return}j(e=>Math.min(e+1,K.length-1))}else e.key===`ArrowUp`?(e.preventDefault(),j(bd)):e.key===`Enter`?ge&&A>=0&&A<K.length&&(e.preventDefault(),le(K[A])):e.key===`Escape`&&ge&&(e.preventDefault(),e.stopPropagation(),k(!1),j(-1))},t[55]=A,t[56]=E,t[57]=ge,t[58]=le,t[59]=K,t[60]=xe):xe=t[60];let Se=xe,Ce;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(un,{children:(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`VdXv4D`})})}),t[61]=Ce):Ce=t[61];let we;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(`label`,{htmlFor:`clone-source`,className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`IreQBq`})}),t[62]=we):we=t[62];let Te;t[63]!==u||t[64]!==A||t[65]!==E||t[66]!==Se||t[67]!==G||t[68]!==w||t[69]!==F||t[70]!==ve||t[71]!==i||t[72]!==ge||t[73]!==ue||t[74]!==b||t[75]!==le||t[76]!==K||t[77]!==g?(Te=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[we,w===!1?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Go,{id:`clone-source`,placeholder:u({id:`Xv_ijG`}),value:g,onChange:e=>G(e.target.value),disabled:E}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`9oE4C3`})}),(0,Z.jsx)(X,{variant:`link`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:E,children:(0,Z.jsx)(J,{id:`gtmbUO`})})]})]}):(0,Z.jsxs)(Ft,{open:ge,onOpenChange:k,children:[(0,Z.jsx)(Ut,{asChild:!0,children:(0,Z.jsx)(Go,{id:`clone-source`,ref:P,role:`combobox`,"aria-expanded":ge,"aria-controls":ge?ue?ve:F:void 0,"aria-activedescendant":A>=0?`${F}-opt-${A}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,placeholder:u({id:`R0jJzV`}),value:g,onChange:e=>G(e.target.value),onFocus:()=>k(!0),onKeyDown:Se,disabled:E})}),(0,Z.jsx)(Be,{align:`start`,sideOffset:4,className:`w-(--radix-popover-trigger-width) max-h-56 overflow-y-auto overscroll-y-contain subtle-scrollbar p-0`,onOpenAutoFocus:yd,onCloseAutoFocus:vd,onInteractOutside:e=>{P.current?.contains(e.target)&&e.preventDefault()},onWheel:_d,onTouchMove:gd,children:ue?(0,Z.jsxs)(`output`,{id:ve,className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":u({id:`8XQRON`}),children:[(0,Z.jsx)(Mo,{className:`h-4 w-2/3`}),(0,Z.jsx)(Mo,{className:`h-4 w-1/2`}),(0,Z.jsx)(Mo,{className:`h-4 w-3/4`}),(0,Z.jsx)(Mo,{className:`h-4 w-2/5`})]}):(0,Z.jsx)(`div`,{id:F,role:`listbox`,"aria-label":u({id:`KX1MZR`}),className:`py-1`,children:K.length===0?(0,Z.jsx)(`div`,{role:`presentation`,className:`px-3 py-2 text-xs text-muted-foreground`,children:b&&b.length===0?(0,Z.jsx)(J,{id:`cOSAfL`}):(0,Z.jsx)(J,{id:`8eW0WQ`})}):K.map((e,t)=>(0,Z.jsxs)(`div`,{id:`${F}-opt-${t}`,role:`option`,tabIndex:-1,"aria-selected":t===A,onMouseDown:hd,onMouseEnter:()=>j(t),onClick:()=>le(e),className:Gi(`flex cursor-default items-center gap-2 px-3 py-1.5 text-sm`,t===A&&`bg-accent text-accent-foreground`),children:[e.private?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Nc,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`n5n_vi`})})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ni,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`NuH1jp`})})]}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.full_name})]},e.full_name))})})]})]}),t[63]=u,t[64]=A,t[65]=E,t[66]=Se,t[67]=G,t[68]=w,t[69]=F,t[70]=ve,t[71]=i,t[72]=ge,t[73]=ue,t[74]=b,t[75]=le,t[76]=K,t[77]=g,t[78]=Te):Te=t[78];let Ee;t[79]!==E||t[80]!==v||t[81]!==h?(Ee=!h&&(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)(J,{id:`Gp_twO`})}),(0,Z.jsx)(Go,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:v,onChange:e=>y(e.target.value),disabled:E})]}),t[79]=E,t[80]=v,t[81]=h,t[82]=Ee):Ee=t[82];let De;t[83]!==Te||t[84]!==Ee?(De=(0,Z.jsx)(sn,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[Te,Ee]})}),t[83]=Te,t[84]=Ee,t[85]=De):De=t[85];let Oe;t[86]!==E||t[87]!==re||t[88]!==se||t[89]!==g||t[90]!==h?(Oe=(0,Z.jsx)(cn,{children:E?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:ae,children:(0,Z.jsx)(J,{id:`dEgA5A`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>se(!1),children:(0,Z.jsx)(J,{id:`dEgA5A`})}),(0,Z.jsx)(X,{onClick:()=>void re(),disabled:!g.trim(),"aria-describedby":h?`clone-picker-hint`:void 0,children:(0,Z.jsx)(J,{id:`9UQ730`})}),h&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:(0,Z.jsx)(J,{id:`EvPX7f`})})]})}),t[86]=E,t[87]=re,t[88]=se,t[89]=g,t[90]=h,t[91]=Oe):Oe=t[91];let ke;t[92]!==De||t[93]!==Oe?(ke=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,children:[Ce,De,Oe]}),t[92]=De,t[93]=Oe,t[94]=ke):ke=t[94];let Ae;return t[95]!==se||t[96]!==n||t[97]!==ke?(Ae=(0,Z.jsx)(dn,{open:n,onOpenChange:se,children:ke}),t[95]=se,t[96]=n,t[97]=ke,t[98]=Ae):Ae=t[98],Ae}function hd(e){return e.preventDefault()}function gd(e){return e.stopPropagation()}function _d(e){return e.stopPropagation()}function vd(e){return e.preventDefault()}function yd(e){return e.preventDefault()}function bd(e){return Math.max(e-1,-1)}var xd=(0,Q.lazy)(()=>n(()=>import(`./ConsentDialogBody-Y-YFxY-Y.js`),__vite__mapDeps([5,1,6,7,8,9,10,11,12]),import.meta.url));function Sd(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(as.subscribe,wd,Cd))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)(xd,{})}),e[0]=t):t=e[0],t}function Cd(){return!1}function wd(){return as.getSnapshot()!==null}var Td=180,Ed=5e3;function Dd(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function Od(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function kd(e){if(e===``)return``;let t=e.replace(/[/\\]+$/,``);if(t===``)return``;let n=t.match(/[/\\][^/\\]+$/);if(n===null)return``;let r=t.length-n[0].length;return r===0?t[0]??``:t.slice(0,r)}function Ad(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 jd(e){let t=e instanceof Error?e.message:String(e);for(let e of ai)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 Md(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 Nd(e){let t=(0,$.c)(160),{open:n,onOpenChange:r,bridge:i}=e,{_:a}=Yt(),o=(0,Q.useId)(),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(Bd),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={kind:`idle`},t[0]=p):p=t[0];let[m,h]=(0,Q.useState)(p),[g,_]=(0,Q.useState)(`idle`),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(S={kind:`idle`},t[1]=S):S=t[1];let[C,w]=(0,Q.useState)(S),[T,E]=(0,Q.useState)(0),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(``),j;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(j=new Set,t[2]=j):j=t[2];let M=(0,Q.useRef)(j),N=(0,Q.useRef)(null),P=(0,Q.useRef)(null),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L,R;t[3]!==i||t[4]!==n?(L=()=>{if(!n)return;M.current.clear(),x(null),h({kind:`idle`}),_(`idle`),y(!1),c(``),f(new Set(Ur)),w({kind:`idle`}),O(!1),A(``),I.current+=1;let e=!1;u(``),i.fs.defaultProjectsRoot().then(t=>{e||u(t)}).catch(zd);let t=requestAnimationFrame(()=>{F.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},R=[n,i],t[3]=i,t[4]=n,t[5]=L,t[6]=R):(L=t[5],R=t[6]),(0,Q.useEffect)(L,R);let z;t[7]!==i||t[8]!==D||t[9]!==n||t[10]!==s||t[11]!==k?(z=()=>{if(!n)return;if(P.current!==null&&clearTimeout(P.current),N.current!==null&&N.current.abort(),s===``){h({kind:`idle`}),_(`idle`);return}let e=k.trim(),t=D&&e!==``,r=t?s:kd(s),a=ui(t?e:Od(s));if(r===``||a===``){h({kind:`idle`}),_(`idle`);return}let o=Dd(r,a),c=new AbortController;return N.current=c,P.current=setTimeout(()=>{_(`in-flight`),Promise.all([i.fs.findEnclosingProjectRoot(r),i.fs.findEnclosingGitRoot(r),i.fs.folderState(o)]).then(e=>{let[t,n,i]=e;if(c.signal.aborted)return;_(`idle`);let o=Ad({parent:r,sanitizedName:a,enclosingProject:t,enclosingGit:n,targetState:i});h(o),o.kind===`block-nonempty`&&O(!0)}).catch(e=>{c.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),_(`idle`),h({kind:`free`}))})},Td),()=>{P.current!==null&&clearTimeout(P.current),c.abort()}},t[7]=i,t[8]=D,t[9]=n,t[10]=s,t[11]=k,t[12]=z):z=t[12];let B;t[13]!==i||t[14]!==D||t[15]!==n||t[16]!==s||t[17]!==T||t[18]!==k?(B=[n,s,i,T,D,k],t[13]=i,t[14]=D,t[15]=n,t[16]=s,t[17]=T,t[18]=k,t[19]=B):B=t[19],(0,Q.useEffect)(z,B);let V,H;t[20]===n?(V=t[21],H=t[22]):(V=()=>{if(!n)return;let e=()=>E(Rd);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},H=[n],t[20]=n,t[21]=V,t[22]=H),(0,Q.useEffect)(V,H);let U=(0,Q.useRef)(`idle`),W,G;t[23]===g?(W=t[24],G=t[25]):(W=()=>{U.current=g},G=[g],t[23]=g,t[24]=W,t[25]=G),(0,Q.useEffect)(W,G);let ee,te;t[26]!==m.kind||t[27]!==n?(ee=()=>{if(!n||m.kind!==`confirm-git`)return;let e=setInterval(()=>{U.current!==`in-flight`&&E(Ld)},Ed);return()=>clearInterval(e)},te=[n,m.kind],t[26]=m.kind,t[27]=n,t[28]=ee,t[29]=te):(ee=t[28],te=t[29]),(0,Q.useEffect)(ee,te);let ne;t[30]!==m.gitRoot||t[31]!==m.kind||t[32]!==C.gitRoot||t[33]!==C.kind?(ne=()=>{if(m.kind!==`confirm-git`){C.kind!==`idle`&&(I.current+=1,w({kind:`idle`}));return}C.kind===`confirming`&&C.gitRoot!==m.gitRoot&&w({kind:`idle`}),C.kind===`pending`&&C.gitRoot!==m.gitRoot&&(I.current+=1,w({kind:`idle`}))},t[30]=m.gitRoot,t[31]=m.kind,t[32]=C.gitRoot,t[33]=C.kind,t[34]=ne):ne=t[34];let re;t[35]!==m||t[36]!==C?(re=[m,C],t[35]=m,t[36]=C,t[37]=re):re=t[37],(0,Q.useEffect)(ne,re);let ie;t[38]!==i||t[39]!==m.kind||t[40]!==n?(ie=()=>{if(!n)return;let e=null;m.kind===`block-nested`?e=`nested`:m.kind===`block-nonempty`?e=`nonempty`:m.kind===`confirm-git`&&(e=`git-confirm`),e!==null&&(M.current.has(e)||(M.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Id)))},t[38]=i,t[39]=m.kind,t[40]=n,t[41]=ie):ie=t[41];let ae;t[42]!==i||t[43]!==m||t[44]!==n?(ae=[n,m,i],t[42]=i,t[43]=m,t[44]=n,t[45]=ae):ae=t[45],(0,Q.useEffect)(ie,ae);let oe,se,ce,le,ue,de,K;t[46]!==D||t[47]!==s||t[48]!==k?(de=k.trim(),ue=D&&de!==``,oe=s===``?``:ue?de:Od(s),le=s===``?``:ui(oe),se=s!==``&&le!==oe&&le!==``,ce=s!==``&&oe!==``&&le===``,K=ue?Dd(s,le):s,t[46]=D,t[47]=s,t[48]=k,t[49]=oe,t[50]=se,t[51]=ce,t[52]=le,t[53]=ue,t[54]=de,t[55]=K):(oe=t[49],se=t[50],ce=t[51],le=t[52],ue=t[53],de=t[54],K=t[55]);let fe=K,pe=!v&&s!==``&&le!==``&&g===`idle`&&(m.kind===`free`||m.kind===`confirm-git`),me;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(me=function(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[56]=me):me=t[56];let he=me,ge;t[57]!==i||t[58]!==l?(ge=async function(){try{let e=await i.dialog.openFolder(l===``?void 0:{defaultPath:l});if(e===null)return;c(e),E(Fd),x(null),O(!1),A(``)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[57]=i,t[58]=l,t[59]=ge):ge=t[59];let _e=ge,ve;t[60]!==i||t[61]!==pe||t[62]!==d||t[63]!==r||t[64]!==s||t[65]!==le||t[66]!==ue?(ve=async function(e){if(e.preventDefault(),pe){y(!0),x(null);try{await i.project.createNew({parent:ue?s:kd(s),name:le,editors:Array.from(d)}),r(!1)}catch(e){x(jd(e)),y(!1)}}},t[60]=i,t[61]=pe,t[62]=d,t[63]=r,t[64]=s,t[65]=le,t[66]=ue,t[67]=ve):ve=t[67];let ye=ve,be;t[68]!==v||t[69]!==r?(be=function(e){v||r(e)},t[68]=v,t[69]=r,t[70]=be):be=t[70];let xe=be,Se;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Se=async function(e){w({kind:`confirming`,gitRoot:e})},t[71]=Se):Se=t[71];let Ce=Se,we;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(we=async function(){w({kind:`idle`})},t[72]=we):we=t[72];let Te=we,Ee;t[73]===i?Ee=t[74]:(Ee=async function(e){let t=I.current+1;I.current=t,w({kind:`pending`,gitRoot:e});try{if(await i.fs.removeGitFolder(e),I.current!==t)return;E(Pd),w({kind:`idle`})}catch(e){let n=e;if(I.current!==t)return;let r=n instanceof Error?n.message:String(n);console.error(`[CreateProjectDialog] bridge.fs.removeGitFolder failed:`,n),w({kind:`error`,message:r})}},t[73]=i,t[74]=Ee);let De=Ee,Oe;t[75]!==i||t[76]!==r?(Oe=async function(e){r(!1);try{await i.project.open({path:e,target:`new-window`,entryPoint:`create-new-nested-redirect`})}catch(e){console.warn(`[CreateProjectDialog] project.open failed:`,e)}},t[75]=i,t[76]=r,t[77]=Oe):Oe=t[77];let ke=Oe,Ae;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`wbv9xO`})}),t[78]=Ae):Ae=t[78];let je;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsxs)(un,{children:[Ae,(0,Z.jsx)(Zt,{children:(0,Z.jsx)(J,{id:`WEzuMq`})})]}),t[79]=je):je=t[79];let Me;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Z.jsx)(ns,{htmlFor:`create-location`,children:(0,Z.jsx)(J,{id:`wJijgU`})}),t[80]=Me):Me=t[80];let Ne;t[81]===_e?Ne=t[82]:(Ne=()=>void _e(),t[81]=_e,t[82]=Ne);let Pe;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,Z.jsx)(J,{id:`O2UpM1`}),t[83]=Pe):Pe=t[83];let Fe;t[84]!==v||t[85]!==Ne?(Fe=(0,Z.jsx)(`div`,{className:`flex items-stretch gap-2`,children:(0,Z.jsx)(X,{id:`create-location`,ref:F,type:`button`,variant:`outline`,disabled:v,onClick:Ne,"aria-describedby":`create-target-caption`,"data-testid":`create-browse`,children:Pe})}),t[84]=v,t[85]=Ne,t[86]=Fe):Fe=t[86];let Ie;t[87]===fe?Ie=t[88]:(Ie=fe===``?(0,Z.jsx)(J,{id:`i_grbe`}):fe,t[87]=fe,t[88]=Ie);let Le;t[89]===Ie?Le=t[90]:(Le=(0,Z.jsx)(`p`,{id:`create-target-caption`,className:`text-1sm text-muted-foreground`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:Ie}),t[89]=Ie,t[90]=Le);let Re;t[91]!==Fe||t[92]!==Le?(Re=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Me,Fe,Le]}),t[91]=Fe,t[92]=Le,t[93]=Re):Re=t[93];let ze;t[94]!==v||t[95]!==m.kind||t[96]!==D||t[97]!==se||t[98]!==ce||t[99]!==le||t[100]!==ue||t[101]!==k||t[102]!==de?(ze=D?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,"data-testid":`create-subfolder-rescue`,children:[(0,Z.jsx)(ns,{htmlFor:`create-subfolder-name`,children:(0,Z.jsx)(J,{id:`NYUhy5`})}),(0,Z.jsx)(Go,{id:`create-subfolder-name`,value:k,placeholder:`my-project`,onChange:e=>A(e.target.value),disabled:v,autoFocus:!0,"aria-invalid":ue&&(ce||m.kind===`block-nonempty`),"data-testid":`create-subfolder-input`}),de===``?(0,Z.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`text-1sm text-muted-foreground`,"data-testid":`create-subfolder-empty-error`,children:(0,Z.jsx)(J,{id:`hJu2pH`})}):ce?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-subfolder-erased-error`,children:(0,Z.jsx)(J,{id:`JUamR6`})}):m.kind===`block-nonempty`?(0,Z.jsx)(`p`,{role:`alert`,className:`text-1sm text-destructive`,"data-testid":`create-subfolder-taken-error`,children:(0,Z.jsx)(J,{id:`tCelbM`,values:{sanitized:le},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):se?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`KnoB--`,values:{sanitized:le},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null]}):null,t[94]=v,t[95]=m.kind,t[96]=D,t[97]=se,t[98]=ce,t[99]=le,t[100]=ue,t[101]=k,t[102]=de,t[103]=ze):ze=t[103];let q;t[104]!==D||t[105]!==oe||t[106]!==se||t[107]!==le?(q=!D&&se?(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-sanitize-diverged`,children:(0,Z.jsx)(J,{id:`z2G3EK`,values:{rawName:oe,sanitized:le},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`}),1:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[104]=D,t[105]=oe,t[106]=se,t[107]=le,t[108]=q):q=t[108];let Be;t[109]!==D||t[110]!==oe||t[111]!==ce?(Be=!D&&ce?(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-sanitize-erased`,children:(0,Z.jsx)(J,{id:`cBbVqQ`,values:{rawName:oe},components:{0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})}})}):null,t[109]=D,t[110]=oe,t[111]=ce,t[112]=Be):Be=t[112];let Ve;t[113]!==m||t[114]!==De||t[115]!==ke||t[116]!==C?(Ve=(0,Z.jsx)(Vd,{cascade:m,onOpenNested:ke,removeGitState:C,onRequestRemoveGit:Ce,onCancelRemoveGit:Te,onConfirmRemoveGit:De}),t[113]=m,t[114]=De,t[115]=ke,t[116]=C,t[117]=Ve):Ve=t[117];let He;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`0YEbfk`})}),t[118]=He):He=t[118];let Ue;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`prHfed`})}),t[119]=Ue):Ue=t[119];let We;t[120]!==v||t[121]!==d?(We=Ur.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(ns,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)(Yo,{id:t,checked:d.has(e),onCheckedChange:()=>he(e),disabled:v,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:Dr[e]})]},e)}),t[120]=v,t[121]=d,t[122]=We):We=t[122];let Ge;t[123]===We?Ge=t[124]:(Ge=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[He,Ue,We]}),t[123]=We,t[124]=Ge);let Ke;t[125]!==a||t[126]!==b?(Ke=b===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:a(Md(b))}),t[125]=a,t[126]=b,t[127]=Ke):Ke=t[127];let qe;t[128]!==o||t[129]!==ye||t[130]!==Re||t[131]!==ze||t[132]!==q||t[133]!==Be||t[134]!==Ve||t[135]!==Ge||t[136]!==Ke?(qe=(0,Z.jsx)(sn,{className:`space-y-4`,children:(0,Z.jsxs)(`form`,{id:o,onSubmit:ye,"data-testid":`create-project-form`,className:`space-y-4`,children:[Re,ze,q,Be,Ve,Ge,Ke]})}),t[128]=o,t[129]=ye,t[130]=Re,t[131]=ze,t[132]=q,t[133]=Be,t[134]=Ve,t[135]=Ge,t[136]=Ke,t[137]=qe):qe=t[137];let Je;t[138]===r?Je=t[139]:(Je=()=>r(!1),t[138]=r,t[139]=Je);let Ye;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Z.jsx)(J,{id:`dEgA5A`}),t[140]=Ye):Ye=t[140];let Xe;t[141]!==v||t[142]!==Je?(Xe=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Je,disabled:v,"data-testid":`create-cancel`,children:Ye}),t[141]=v,t[142]=Je,t[143]=Xe):Xe=t[143];let Ze=!pe,Qe;t[144]===v?Qe=t[145]:(Qe=v?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[144]=v,t[145]=Qe);let $e;t[146]!==o||t[147]!==Ze||t[148]!==Qe?($e=(0,Z.jsx)(X,{type:`submit`,form:o,disabled:Ze,"data-testid":`create-submit`,children:Qe}),t[146]=o,t[147]=Ze,t[148]=Qe,t[149]=$e):$e=t[149];let et;t[150]!==Xe||t[151]!==$e?(et=(0,Z.jsxs)(cn,{children:[Xe,$e]}),t[150]=Xe,t[151]=$e,t[152]=et):et=t[152];let tt;t[153]!==qe||t[154]!==et?(tt=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,"data-testid":`create-project-dialog`,children:[je,qe,et]}),t[153]=qe,t[154]=et,t[155]=tt):tt=t[155];let nt;return t[156]!==xe||t[157]!==n||t[158]!==tt?(nt=(0,Z.jsx)(dn,{open:n,onOpenChange:xe,children:tt}),t[156]=xe,t[157]=n,t[158]=tt,t[159]=nt):nt=t[159],nt}function Pd(e){return e+1}function Fd(e){return e+1}function Id(){}function Ld(e){return e+1}function Rd(e){return e+1}function zd(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Bd(){return new Set(Ur)}function Vd(e){let t=(0,$.c)(37),{cascade:n,onOpenNested:r,removeGitState:i,onRequestRemoveGit:a,onCancelRemoveGit:o,onConfirmRemoveGit:s}=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=Od(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 s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={0:(0,Z.jsx)(`code`,{className:`font-mono break-all`})},t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,Z.jsx)(`p`,{className:`mb-2`,children:(0,Z.jsx)(J,{id:`aIgBKf`,values:o,components:s})}),t[5]=o,t[6]=c);let l;t[7]!==r||t[8]!==e?(l=()=>r(e),t[7]=r,t[8]=e,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=(0,Z.jsx)(J,{id:`1Ta7Fd`,values:{basename:a}}),t[10]=a,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:l,"data-testid":`create-banner-nested-open`,children:u}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;return t[15]!==c||t[16]!==d?(f=(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:[c,d]}),t[15]=c,t[16]=d,t[17]=f):f=t[17],f}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 c=`${r}/.git`,l=i.kind===`error`?i.message:null,u;t[21]===e?u=t[22]:(u={gitRoot:e},t[21]=e,t[22]=u);let d;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(d={0:(0,Z.jsx)(`code`,{}),1:(0,Z.jsx)(`code`,{})},t[23]=d):d=t[23];let f;t[24]===u?f=t[25]:(f=(0,Z.jsx)(`p`,{children:(0,Z.jsx)(J,{id:`5o4lc1`,values:u,components:d})}),t[24]=u,t[25]=f);let p;t[26]!==e||t[27]!==o||t[28]!==s||t[29]!==a||t[30]!==l||t[31]!==i.kind||t[32]!==c?(p=i.kind===`idle`||i.kind===`error`?(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1`,children:[(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(e),"data-testid":`create-banner-git-remove`,children:(0,Z.jsx)(J,{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)(J,{id:`SkMZlS`,values:{targetGitPath:c,removeGitError:l},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)(J,{id:`WZ-vBy`,values:{targetGitPath:c},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)(X,{type:`button`,variant:`destructive`,size:`sm`,disabled:i.kind===`pending`,onClick:()=>s(e),"data-testid":`create-banner-git-remove-confirm-button`,children:i.kind===`pending`?(0,Z.jsx)(J,{id:`0-31GV`}):(0,Z.jsx)(J,{id:`v-h2hx`,values:{targetGitPath:c}})}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,disabled:i.kind===`pending`,onClick:o,"data-testid":`create-banner-git-remove-cancel`,children:(0,Z.jsx)(J,{id:`dEgA5A`})})]})]}),t[26]=e,t[27]=o,t[28]=s,t[29]=a,t[30]=l,t[31]=i.kind,t[32]=c,t[33]=p):p=t[33];let m;return t[34]!==f||t[35]!==p?(m=(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:[f,p]}),t[34]=f,t[35]=p,t[36]=m):m=t[36],m}return null}function Hd(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 Ud(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 Wd=(0,Q.lazy)(()=>n(()=>import(`./McpConsentDialogBody-CR1y0qI_.js`),__vite__mapDeps([13,1,6,7,8,9,14,15]),import.meta.url));function Gd(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(os.subscribe,qd,Kd))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)(Wd,{})}),e[0]=t):t=e[0],t}function Kd(){return!1}function qd(){return os.getSnapshot()!==null}function Jd(e){return`https://github.com/${e.owner}/${e.repo}.git`}function Yd(e){let t=e.toLowerCase().trim();return t.endsWith(`/`)&&(t=t.slice(0,-1)),t.endsWith(`.git`)&&(t=t.slice(0,-4)),t}function Xd(e,t){let n=Yd(Jd(t));for(let t of e)if(t.missing!==!0&&t.gitRemoteUrl&&Yd(t.gitRemoteUrl)===n)return t;return null}function Zd(e){return`https://github.com/${e.owner}/${e.repo}.git`}function Qd(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 $d(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 ef(e){return e.kind===`ok`?{owner:e.owner,repo:e.repo,branch:e.branch,path:e.path,blobUrl:e.blobUrl}:null}function tf(e){let t=[`[receive]`];return e.q1_hit!==void 0&&t.push(`q1_hit=${e.q1_hit}`),e.q2_path!==void 0&&t.push(`q2_path=${e.q2_path}`),e.folder_validate!==void 0&&t.push(`folder_validate=${e.folder_validate}`),t.join(` `)}function nf(){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 rf=nf();function af(e){return rf.install(e)}function of(e){let t=(0,$.c)(107),{bridge:n,cloneController:r,store:i}=e,a=i===void 0?rf:i,{_:o}=Yt(),s=(0,Q.useSyncExternalStore)(a.subscribe,a.getSnapshot,sf),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=(0,Q.useRef)(!1),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{l(!1),d(!1),p(null),h(!1),_(!1),v.current=!1},t[0]=y):y=t[0];let b;t[1]===s?b=t[2]:(b=[s],t[1]=s,t[2]=b),(0,Q.useEffect)(y,b);let x;t[3]!==f||t[4]!==r||t[5]!==s||t[6]!==c?(x=()=>{r&&(!s||s.kind!==`ok`||c&&f===null&&(v.current||(v.current=!0,h(!0),r.getAuthStatus().then(e=>{p(e)}).catch(()=>{p({authenticated:!1,host:`github.com`})}).finally(()=>{h(!1)}))))},t[3]=f,t[4]=r,t[5]=s,t[6]=c,t[7]=x):x=t[7];let S;t[8]!==f||t[9]!==s||t[10]!==c?(S=[s,c,f],t[8]=f,t[9]=s,t[10]=c,t[11]=S):S=t[11],(0,Q.useEffect)(x,S);let C,w;t[12]!==s||t[13]!==a?(C=()=>{if(!s)return;let e=$d(s);e&&(Y.error(e.message),a.dismiss())},w=[s,a],t[12]=s,t[13]=a,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,Q.useEffect)(C,w);let T,E;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a?(T=()=>{if(!s||s.kind!==`ok`||c)return;let e=!1;return cf(s,n).then(t=>{if(!e){if(t.kind===`hit`){console.log(tf({q1_hit:!0})),a.dismiss();return}console.log(tf({q1_hit:!1})),l(!0)}}),()=>{e=!0}},E=[s,c,n,a],t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=T,t[21]=E):(T=t[20],E=t[21]),(0,Q.useEffect)(T,E);let D,O,k,A,j,M,N,P,F,I;if(t[22]!==o||t[23]!==m||t[24]!==f?.authenticated||t[25]!==n||t[26]!==r||t[27]!==g||t[28]!==s||t[29]!==u||t[30]!==c||t[31]!==a){I=Symbol.for(`react.early_return_sentinel`);bb0:{if(M=s?ef(s):null,!M){I=null;break bb0}let e={owner:M.owner,repo:M.repo};if(!c){I=null;break bb0}k=async function(){if(!M)return;if(console.log(tf({q2_path:`clone`})),!r){Y.info(o({id:`27XW26`}),{action:{label:o({id:`B3NAZC`}),onClick:()=>{n.navigator.open()}},duration:8e3});return}if(!f?.authenticated||g)return;_(!0);let t=Zd(e),i;try{i=await r.runClone({url:t})}catch{Y.error(o({id:`jnXr0e`})),_(!1);return}if(_(!1),i.kind===`ok`){try{await n.project.open({path:i.dir,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkDoc:M.path})}catch{Y.error(o({id:`438Fca`}))}a.dismiss();return}};let i;t[42]!==m||t[43]!==r?(i=async function(){if(!(!r||m)){h(!0);try{let e=await r.startSignIn();h(!1),e!==null&&p(e)}catch{h(!1)}}},t[42]=m,t[43]=r,t[44]=i):i=t[44],j=i,A=async function(){if(!(!M||u)){d(!0),console.log(tf({q2_path:`local`}));try{for(;;){let t=await n.dialog.openFolder();if(!t)break;let r=await n.share.validateLocalFolder({folderPath:t,owner:e.owner,repo:e.repo});if(console.log(tf({folder_validate:r.kind})),r.kind===`ok`){await n.project.open({path:t,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkDoc:M.path}),a.dismiss();break}let i=Qd(r,e);i&&Y.error(i)}}catch{Y.error(o({id:`rlUzXK`}))}d(!1)}},D=r!==void 0&&f?.authenticated===!0&&!g;let l;t[45]!==o||t[46]!==f?.authenticated||t[47]!==r||t[48]!==g?(l=g?o({id:`YjhKI5`}):r&&f?.authenticated===!1?o({id:`lanW9H`}):o({id:`LE7t79`}),t[45]=o,t[46]=f?.authenticated,t[47]=r,t[48]=g,t[49]=l):l=t[49],O=l,N=M.owner,P=M.repo,F=Jd(e)}t[22]=o,t[23]=m,t[24]=f?.authenticated,t[25]=n,t[26]=r,t[27]=g,t[28]=s,t[29]=u,t[30]=c,t[31]=a,t[32]=D,t[33]=O,t[34]=k,t[35]=A,t[36]=j,t[37]=M,t[38]=N,t[39]=P,t[40]=F,t[41]=I}else D=t[32],O=t[33],k=t[34],A=t[35],j=t[36],M=t[37],N=t[38],P=t[39],F=t[40],I=t[41];if(I!==Symbol.for(`react.early_return_sentinel`))return I;let L=F,R=f?.authenticated?f.login:void 0,z;t[50]===a?z=t[51]:(z=e=>{e||a.dismiss()},t[50]=a,t[51]=z);let B;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`PHRoEJ`})}),t[52]=B):B=t[52];let V=M.path?` · ${M.path}`:null,H;t[53]!==M.owner||t[54]!==M.repo||t[55]!==V?(H=(0,Z.jsxs)(un,{children:[B,(0,Z.jsxs)(Zt,{children:[M.owner,`/`,M.repo,V]})]}),t[53]=M.owner,t[54]=M.repo,t[55]=V,t[56]=H):H=t[56];let U;t[57]===k?U=t[58]:(U=()=>{k()},t[57]=k,t[58]=U);let W=r!==void 0&&!D,G=r!==void 0&&!D,ee;t[59]===O?ee=t[60]:(ee=(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:O}),t[59]=O,t[60]=ee);let te;t[61]!==N||t[62]!==P?(te=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`jGJy-9`,values:{shareOwner:N,shareRepo:P}})}),t[61]=N,t[62]=P,t[63]=te):te=t[63];let ne;t[64]!==U||t[65]!==W||t[66]!==G||t[67]!==ee||t[68]!==te?(ne=(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:U,disabled:W,"aria-disabled":G,children:[ee,te]}),t[64]=U,t[65]=W,t[66]=G,t[67]=ee,t[68]=te,t[69]=ne):ne=t[69];let re;t[70]===A?re=t[71]:(re=()=>{A()},t[70]=A,t[71]=re);let ie=u||g,ae;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(`span`,{className:`text-sm font-semibold`,children:(0,Z.jsx)(J,{id:`HfI1dR`})}),t[72]=ae):ae=t[72];let oe;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`_qD6mn`})}),t[73]=oe):oe=t[73];let se;t[74]!==re||t[75]!==ie?(se=(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:re,disabled:ie,children:[ae,oe]}),t[74]=re,t[75]=ie,t[76]=se):se=t[76];let ce;t[77]!==ne||t[78]!==se?(ce=(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[ne,se]}),t[77]=ne,t[78]=se,t[79]=ce):ce=t[79];let le;t[80]!==m||t[81]!==f||t[82]!==r||t[83]!==j||t[84]!==R?(le=r?(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`,children:f===null?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`OZtLT5`})}):f.authenticated?(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:(0,Z.jsx)(J,{id:`95uxb3`,values:{signedInLogin:R},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)(J,{id:`MtR6ZK`})}),(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:()=>{j()},disabled:m,children:m?(0,Z.jsx)(J,{id:`PKLY-1`}):(0,Z.jsx)(J,{id:`gtmbUO`})})]})}):null,t[80]=m,t[81]=f,t[82]=r,t[83]=j,t[84]=R,t[85]=le):le=t[85];let ue;t[86]===L?ue=t[87]:(ue={lookingForUrl:L},t[86]=L,t[87]=ue);let de;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(de={0:(0,Z.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 text-foreground/80`})},t[88]=de):de=t[88];let K;t[89]===ue?K=t[90]:(K=(0,Z.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:(0,Z.jsx)(J,{id:`RJ3a8Z`,values:ue,components:de})}),t[89]=ue,t[90]=K);let fe;t[91]!==ce||t[92]!==le||t[93]!==K?(fe=(0,Z.jsxs)(sn,{children:[ce,le,K]}),t[91]=ce,t[92]=le,t[93]=K,t[94]=fe):fe=t[94];let pe;t[95]===a?pe=t[96]:(pe=()=>a.dismiss(),t[95]=a,t[96]=pe);let me;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,Z.jsx)(J,{id:`dEgA5A`}),t[97]=me):me=t[97];let he;t[98]===pe?he=t[99]:(he=(0,Z.jsx)(cn,{children:(0,Z.jsx)(X,{variant:`ghost`,onClick:pe,children:me})}),t[98]=pe,t[99]=he);let ge;t[100]!==H||t[101]!==fe||t[102]!==he?(ge=(0,Z.jsxs)(rn,{className:`sm:max-w-xl`,"data-testid":`share-receive-dialog`,children:[H,fe,he]}),t[100]=H,t[101]=fe,t[102]=he,t[103]=ge):ge=t[103];let _e;return t[104]!==z||t[105]!==ge?(_e=(0,Z.jsx)(dn,{open:!0,onOpenChange:z,children:ge}),t[104]=z,t[105]=ge,t[106]=_e):_e=t[106],_e}function sf(){return null}async function cf(e,t){let n;try{n=Xd(await t.project.listRecent(),{owner:e.owner,repo:e.repo})}catch{return{kind:`miss`}}if(!n)return{kind:`miss`};try{if((await t.share.validateLocalFolder({folderPath:n.path,owner:e.owner,repo:e.repo})).kind!==`ok`)return{kind:`miss`}}catch{return{kind:`miss`}}try{return await t.project.open({path:n.path,target:`new-window`,entryPoint:`share-receive`,pendingDeepLinkDoc:e.path}),{kind:`hit`}}catch{return{kind:`miss`}}}var lf=(e,t,n)=>hl(e,t,n,`NavigatorApp`);function uf(e,t){return e.filter(e=>e.path!==t)}function df(e){let t=(0,$.c)(82),{bridge:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Q.useState)(r),[o,s]=(0,Q.useState)(!0),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(!1),[p,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),S=typeof window<`u`&&window.okDesktop!=null,[C,w]=(0,Q.useState)(`auth`),{theme:E}=li();m(n,E??`system`);let D;t[1]===n.project?D=t[2]:(D=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||u(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=D);let O;t[3]===n?O=t[4]:(O=[n],t[3]=n,t[4]=O),(0,Q.useEffect)(D,O);let k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=(e,t)=>lf(e,t,u),t[5]=k):k=t[5];let A=k,j;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>f(!0),t[6]=j):j=t[6];let M=j,N;t[7]===n?N=t[8]:(N=()=>A(async()=>{let e=await n.dialog.openFolder();e&&await mf(n,e,`pick-existing`)},`Failed to open folder.`),t[7]=n,t[8]=N);let P=N,F;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>h(!0),t[9]=F):F=t[9];let I=F,L;t[10]===n?L=t[11]:(L=e=>A(async()=>{await mf(n,e,`recents`)},`Failed to open project.`),t[10]=n,t[11]=L);let R=L,z;t[12]===n.project?z=t[13]:(z=e=>A(async()=>{await n.project.removeRecent(e),a(t=>uf(t,e))},`Failed to remove project.`),t[12]=n.project,t[13]=z);let B=z,V;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-0 z-10 h-9 ${S?`[-webkit-app-region:drag]`:``}`,"data-electron-drag":S?``:void 0,"data-testid":`nav-chrome-row`}),t[14]=V):V=t[14];let H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Ud,{className:`size-12 shrink-0`}),t[15]=H):H=t[15];let U;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(U=(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)(ud,{})]}),t[16]=U):U=t[16];let W;t[17]===n.appVersion?W=t[18]:(W=(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[H,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[U,(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]})]})]}),t[17]=n.appVersion,t[18]=W);let G;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(ff,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:M,dataTestId:`nav-clone`,Icon:Hd}),t[19]=G):G=t[19];let te;t[20]===P?te=t[21]:(te=(0,Z.jsx)(ff,{title:`Open folder on disk`,description:`Use a folder you already have.`,onClick:P,dataTestId:`nav-open`,Icon:T}),t[20]=P,t[21]=te);let ne;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(ff,{title:`Create new project`,description:`Start a new Open Knowledge project.`,onClick:I,dataTestId:`nav-create-new`,Icon:c}),t[22]=ne):ne=t[22];let re;t[23]===te?re=t[24]:(re=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[G,te,ne]}),t[23]=te,t[24]=re);let ie;t[25]===l?ie=t[26]:(ie=l===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:l}),(0,Z.jsx)(X,{type:`button`,variant:`link`,size:`sm`,onClick:()=>u(null),className:`h-auto p-0 text-red-700 text-xs dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[25]=l,t[26]=ie);let ae;t[27]!==o||t[28]!==R||t[29]!==B||t[30]!==i?(ae=o?(0,Z.jsx)(`section`,{className:`flex shrink-0 flex-col items-center`,children:(0,Z.jsx)(ee,{className:`size-4 animate-spin text-muted-foreground/60`})}):i.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:`Recent`}),(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:i.map(e=>(0,Z.jsx)(pf,{project:e,onOpen:()=>R(e.path),onRemove:()=>B(e.path)},e.path))})]}):null,t[27]=o,t[28]=R,t[29]=B,t[30]=i,t[31]=ae):ae=t[31];let oe;t[32]!==W||t[33]!==re||t[34]!==ie||t[35]!==ae?(oe=(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:[W,re,ie,ae]})}),t[32]=W,t[33]=re,t[34]=ie,t[35]=ae,t[36]=oe):oe=t[36];let se,ce;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(Gd,{}),ce=(0,Z.jsx)(Sd,{}),t[37]=se,t[38]=ce):(se=t[37],ce=t[38]);let le;t[39]!==n||t[40]!==p?(le=(0,Z.jsx)(Nd,{open:p,onOpenChange:h,bridge:n}),t[39]=n,t[40]=p,t[41]=le):le=t[41];let ue;t[42]===b?ue=t[43]:(ue=e=>{_(e),e||(y(!1),b&&(b(null),x(null)))},t[42]=b,t[43]=ue);let de;t[44]===n?de=t[45]:(de=Dl(n),t[44]=n,t[45]=de);let K=C===`identity`,fe;t[46]!==v||t[47]!==b?(fe=e=>{_(!1),v&&(y(!1),f(!0)),b&&(b({authenticated:!0,host:`github.com`,login:e.login}),x(null))},t[46]=v,t[47]=b,t[48]=fe):fe=t[48];let pe;t[49]!==g||t[50]!==ue||t[51]!==de||t[52]!==K||t[53]!==fe?(pe=(0,Z.jsx)(od,{open:g,onOpenChange:ue,transport:de,identityPrompt:K,onSuccess:fe}),t[49]=g,t[50]=ue,t[51]=de,t[52]=K,t[53]=fe,t[54]=pe):pe=t[54];let me;t[55]===n?me=t[56]:(me=kl(n),t[55]=n,t[56]=me);let he;t[57]===n?he=t[58]:(he=Cl(n),t[57]=n,t[58]=he);let ge;t[59]===n.dialog?ge=t[60]:(ge=()=>n.dialog.openFolder(),t[59]=n.dialog,t[60]=ge);let _e;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(_e=()=>{f(!1),w(`auth`),y(!0),_(!0)},t[61]=_e):_e=t[61];let ve;t[62]===n?ve=t[63]:(ve=e=>{let{dir:t}=e;A(()=>mf(n,t,`pick-existing`),`Failed to open cloned project.`)},t[62]=n,t[63]=ve);let ye;t[64]!==d||t[65]!==me||t[66]!==he||t[67]!==ge||t[68]!==ve?(ye=(0,Z.jsx)(md,{open:d,onOpenChange:f,transport:me,authQueryTransport:he,pickParentFolder:ge,onSignIn:_e,onCloneComplete:ve}),t[64]=d,t[65]=me,t[66]=he,t[67]=ge,t[68]=ve,t[69]=ye):ye=t[69];let be;if(t[70]!==n){let e;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>new Promise(e=>{x(()=>e),_(!0)}),t[72]=e):e=t[72],be=vl({bridge:n,authQueryTransport:Cl(n),cloneTransport:kl(n),openSignIn:e}),t[70]=n,t[71]=be}else be=t[71];let xe;t[73]!==n||t[74]!==be?(xe=(0,Z.jsx)(of,{bridge:n,cloneController:be}),t[73]=n,t[74]=be,t[75]=xe):xe=t[75];let Se;return t[76]!==oe||t[77]!==le||t[78]!==pe||t[79]!==ye||t[80]!==xe?(Se=(0,Z.jsxs)(`div`,{className:`relative flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[V,oe,se,ce,le,pe,ye,xe]}),t[76]=oe,t[77]=le,t[78]=pe,t[79]=ye,t[80]=xe,t[81]=Se):Se=t[81],Se}function ff(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)(X,{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 pf(e){let t=(0,$.c)(25),{project:n,onOpen:r,onRemove:i}=e,a=n.missing,o=n.missing&&`opacity-50`,s;t[0]===o?s=t[1]:(s=Gi(`h-auto min-w-0 flex-1 justify-between gap-2 py-3.5 pl-4 pr-2 text-left hover:bg-transparent`,o),t[0]=o,t[1]=s);let c;t[2]===n.name?c=t[3]:(c=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[2]=n.name,t[3]=c);let l;t[4]===n.path?l=t[5]:(l=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[4]=n.path,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.missing?d=t[10]:(d=n.missing?(0,Z.jsx)(pe,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[9]=n.missing,t[10]=d);let f;t[11]!==r||t[12]!==n.missing||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,onClick:r,disabled:a,className:s,children:[u,d]}),t[11]=r,t[12]=n.missing,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16];let p=`Remove ${n.name} from recent projects`,m=`nav-recent-remove-${n.path}`,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Xt,{"aria-hidden":`true`}),t[17]=h):h=t[17];let g;t[18]!==i||t[19]!==m||t[20]!==p?(g=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,onClick:i,"aria-label":p,title:`Remove from recent projects`,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":m,children:h}),t[18]=i,t[19]=m,t[20]=p,t[21]=g):g=t[21];let _;return t[22]!==g||t[23]!==f?(_=(0,Z.jsxs)(`li`,{className:`group flex items-center justify-between rounded-lg hover:bg-accent`,children:[f,g]}),t[22]=g,t[23]=f,t[24]=_):_=t[24],_}async function mf(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var hf=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=li(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(xi,{className:`size-4`}),info:(0,Z.jsx)(Kt,{className:`size-4`}),warning:(0,Z.jsx)(ei,{className:`size-4`}),error:(0,Z.jsx)(Ic,{className:`size-4`}),loading:(0,Z.jsx)(ee,{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)(Qt,{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};function gf(e){let{apiOrigin:t}=e;if(!t)return;let n=Symbol.for(`ok.desktop.fetchRewrite`);if(window.fetch[n])return;let r=window.fetch.bind(window),i=((e,n)=>{if(typeof e==`string`)return r(_f(e,t),n);if(e instanceof URL)return e.pathname.startsWith(`/api/`)&&(e.origin===window.location.origin||e.protocol===`file:`)?r(t+(e.pathname+e.search+e.hash),n):r(e,n);try{let i=new URL(e.url,window.location.origin);if(i.pathname.startsWith(`/api/`)){let a=i.pathname+i.search+i.hash;return r(new Request(t+a,e),n)}}catch{}return r(e,n)});i[n]=!0,window.fetch=i}function _f(e,t){return e.startsWith(`/api/`)?t+e:e}var vf=JSON.parse(`{"-3Qbv7":[["count","plural",{"one":["matches ","#"," file"],"other":["matches ","#"," files"]}]],"-8PP0T":["Match case"],"-KCZ6n":["Mark a block as the source of truth. Mirror references elsewhere render this content read-only and update live as you edit here."],"-QCLWk":["Templates available"],"-YV1Uo":["Pattern ",["patternNumber"]],"-g6KIS":["Unrecognized link"],"-gdcIo":["Auto-sync is on — your commits push and remote changes pull on intervals."],"0-31GV":["Removing"],"0YEbfk":["Connect to AI tools"],"0eHrMb":["Could not complete delete"],"0rwwOn":["By tag"],"0t0bbC":["Could not save sync preference: ",["detail"]],"0wswKc":["Horizontal rule that divides sections."],"0xnmlQ":["Repository name"],"16D5Zj":["Are you sure you want to delete ",["itemName"],"? This action cannot be undone."],"1GhYxC":["of ",["totalPages"]],"1HBhDS":["Checking out files"],"1RluQD":["Show replace"],"1Ta7Fd":["Open ",["basename"]],"1WgmEM":["Failed to load template: ",["errorMessage"]],"1ZpfyB":["Open with AI ",["displayName"],", ",["hint"]],"1bDVu5":["Workspace Command Palette"],"25Pw6a":["Cloning"],"27XW26":["Clone happens in the Project Navigator. Reclick the share link there."],"2QM24L":["All tags"],"2Xs2jo":["Switch Project"],"2q_Q7x":["Visibility"],"2ryd91":["Failed to rename property"],"2tgFCe":["Starting clone"],"2wxgft":["Rename"],"322lyb":["Highlight tips, warnings, and notes."],"34qyH5":["Could not reach server"],"3Fcb0I":["Open graph"],"3J7d2N":["Big section heading."],"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."],"3h5zMp":["Something went wrong loading the settings panel."],"3iyGWF":["Open recent project"],"3oh0nQ":["Nested .okignore error in ",["path"]],"3wiBAs":["Where should it live?"],"3zyg_A":["Ignore patterns"],"438Fca":["Cloned successfully, but could not open the project."],"44_vJP":[["deleteCount","plural",{"one":["Delete"],"other":["Delete ","#"," Items"]}]],"45MZFs":["Commands"],"48uGTI":["Failed to load docs. Press Escape and re-open to retry."],"4CfgPM":["Project folder created, but git init failed. Try again."],"4TzU0n":["Initialize"],"4UMKtb":["Failed to load folder defaults: ",["message"]],"4buZWd":["Inherited from ",["path"],">>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"4g19V6":["Failed to update property>>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"4hJhzz":["Table"],"4jDd0j":["Anyone can see"],"4xtLTl":["Hidden folder “",["basename"],"”"],"50Y3WA":["No defaults declared. Add a property to set a value every doc in this folder inherits."],"56xUL1":["Property name"],"5Ajb15":["The formula <0>c = √(a² + b²)</0> renders inline."],"5ClEAu":["Inline hashtag for cross-doc grouping."],"5D3Ior":["Hide folder"],"5GRxoA":["Search files, folders, and commands for the current workspace."],"5QGTaA":["Could not copy relative path"],"5SwVv1":["Not installed"],"5Tk8Fb":["Loading files"],"5dPlsv":["Allowed substitutions: ",["substitutionTokens"]],"5kWklo":["(some may already be hidden by other rules)"],"5m2Eho":["Create note from ",["label"]],"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?"]}]],"5wV2qQ":["and more"],"5wyYmS":["Instantiate as <0>",["writeDocumentExample"],"</0>. This template is located at <1>",["templatePath"],"</1>."],"5y_9lO":["Waiting for authorization"],"62Pc08":["Install for Claude Chat & Cowork (Desktop App)"],"67f-3g":["Duplicate succeeded but the sidebar may be out of date — refresh to resync"],"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."],"6gRgw8":["Retry"],"6ibbCg":["Create your first file"],"6lBXm5":["Key \\"",["trimmed"],"\\" already resolves here"],"6nB8LV":["Paste a personal access token"],"6vEr3W":["Link target"],"7-NvM7":["This permanently removes the template from this project's .ok/templates/ directory. Agents and folders that reference it by name will fail until it's recreated."],"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"]],"7H4UHD":["Documents tagged <0>#",["tagName"],"</0>"],"7JtSLi":["Failed to delete path"],"7PzzBU":["User"],"7_bFEL":["Drag ",["patternText"]," to reorder"],"7d1a0d":["Public"],"7qRHf0":["Install for Claude Chat & Cowork"],"8C2UQ5":["No git remote was detected for this project. Set one up if you would like automatic git syncing."],"8F1i42":["Page not found"],"8OxKZy":["Move succeeded but the sidebar may be out of date — refresh to resync"],"8RtNI0":["Failed to load documents"],"8TLE9g":["Read-only copy of a MirrorSource block from another doc. Edit at the source — every Mirror reflects the change live."],"8XQ7Ib":["Pick an owner"],"8XQRON":["Loading repositories"],"8XS8nG":["Open in your favorite AI editor."],"8_brI5":["Name is required"],"8eW0WQ":["No matching repositories."],"8fRyLo":["Invalid patch payload"],"92rbk2":["Mirror loading <0>",["mirrorRef"],"</0>"],"95uxb3":["Signed in as <0>@",["signedInLogin"],"</0>"],"96G6Re":["New folder"],"9PQysm":["Hide advanced"],"9UQ730":["Clone"],"9fvog2":["Preview unavailable: ",["errorDetail"]],"9jnjV0":["Embed an audio file with native player controls."],"9oE4C3":["Browse your repos:"],"9zb2WA":["Connecting"],"A1taO8":["Search"],"A5hiCy":["Create template"],"A6h5b-":["File duplicated"],"AMyJts":["This path is on an external volume (/Volumes/...). Open Knowledge will lose track of files when the drive ejects."],"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."],"AVoO4B":["Open <0>",["verificationUri"],"</0> and enter this code:"],"AWOSPo":["Zoom in"],"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"],"Am78jY":["Drag ",["keyName"]," to reorder"],"B11p-O":["Edit markdown link"],"B3NAZC":["Open Navigator"],"BBtVak":["Collapse All"],"BD0XSC":["Failed to load project templates"],"BGHHtQ":["Single page"],"BH56dn":["Custom display text"],"BHW0EW":["No templates resolve here. Add one to seed new docs in this folder."],"BJpGCq":["Open in Terminal"],"BQu9Pg":["Symlink"],"BY-g4_":["Add pattern"],"Bdha5y":["Publishing..."],"Bx4EXG":["Actions for ",["label"]],"C0NPNd":["Add Open Knowledge to your AI tools"],"COr1Y7":["Pick <0>openknowledge.skill</0> from your <1>Downloads</1> folder. It enables automatically."],"CXj9C-":["New property name"],"CvsD6Y":["via ",["viaTags"]],"D8OV7J":["Only collaborators"],"DPfwMq":["Done"],"DVh_Tb":["Failed to clean up after trash"],"DeDYLr":["Unrecognized wiki link"],"DiFKSL":["Counting markdown files"],"Dnn2XG":["Automatic"],"DskIkK":["Sign-in stream ended without confirmation — please try again"],"E7BhZn":["Blank note<<<<<<< HEAD"],"E9bKSA":["Creating"],"EBVbtP":["Could not duplicate item"],"EL_YRd":["Mirror of <0>api-spec</0>"],"E_BHoD":["Could not move \\"",["targetName"],"\\" to the Trash. Do you want to permanently delete instead?"],"EcM3k7":["Failed to clean up pending ",["kind"]],"EgMJem":["Lands at <0>",["targetPath"],"</0>. Agents resolve it via leaf → root walk-up — closest-wins on filename collision."],"El7NbA":["Heading 2"],"Ev2r9A":["No results"],"EvPX7f":["Opens a folder picker to choose where to clone the repository."],"F-NRCj":["Add property"],"FCxvG5":["First item"],"FEr96N":["Theme"],"FF5rwn":["Connect Open Knowledge to other tools you use."],"FP8DWL":["Create failed: ",["error"]],"FQlArb":["project template"],"FTUGgh":["Enter a repository URL or owner/repo"],"FUMerq":["Could not enable sync: ",["detail"]],"FaBZwp":["File extensions are managed automatically - please rename without changing the extension"],"FjkaiT":["Zoom out"],"Fqr8BP":["Multi-page PDF viewer with toolbar controls (thumbnails, page nav, zoom)."],"FvpFSZ":["Reveal in Finder, ",["hint"]],"Fxf4jq":["Description (optional)"],"FyW0WO":["Authorize in browser"],"G1Gw0v":["New template"],"G7-rf8":["Pattern syntax error: ",["message"]],"GDvlUT":["Role"],"GJ3011":["Use ",["ext"]," extension"],"GQDSBN":["Layout options"],"GUpclA":["Created if missing; reused if it exists."],"G_686w":["Task List"],"GamjcN":["Template saved"],"GgQgML":["You picked your home directory. Open Knowledge will index everything in your home tree — large and may surface personal files."],"GjElCU":["Select a file from the sidebar, or pick where to edit alongside your agent."],"Gp_twO":["Local path"],"GsBUCk":["Loading settings"],"Gx0VS1":["e.g. drafts/ or *.draft.md"],"H0WlWQ":["Grid of rows and columns with a header row."],"HIb0vl":["Network error — please try again"],"HM56Bx":["Creating..."],"HP5ML3":["Sign in to GitHub to continue."],"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."],"H_Plo-":["article"],"HdkSiO":["New file"],"HfI1dR":["I already have it locally →"],"Hl89Qd":["Loading templates"],"HlmZBk":["Documents response did not match expected shape."],"HpK_8d":["Reload"],"Hrz9NY":["Wiki link"],"I1gRhX":["Failed to rename"],"I23A-U":["Template \\"",["name"],"\\" deleted"],"IA1wNb":["The Claude Desktop App didn't open the file. Is it installed? (",["msg"],")"],"IA6JW2":["Detecting"],"IKoTAC":["Keep disabled"],"IX_qeH":["Folder defaults"],"IajAbS":["Add a starter pack"],"IrB5AK":["Server-side cleanup failed for ",["failedCount","plural",{"one":["#"," item"],"other":["#"," items"]}]],"IreQBq":["Repository"],"J2Mv98":["Name (e.g. ",["login"],")"],"J2eKUI":["File||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"JE21eh":["Symlink to ",["targetPath"]],"JK-Ave":["Hide thumbnails"],"JLUTgi":["No tags yet — author \`#tagname\` in any doc to populate the index."],"JUamR6":["This name has no characters that are safe for a folder identifier. Try a name with at least one letter or number."],"JVgg1-":["This permanently removes ",["path"],". Agents that reference this template by name will fail until it's recreated or shadowed by an ancestor."],"JWsZlx":["Open a project to edit."],"JZ8cO6":["Light, dark, or follow the OS."],"Jhj_lh":["Modify the link target, anchor, and display label."],"Jqqevv":["System error<<<<<<< HEAD"],"JtD-Br":["Page link"],"K1ckLX":["Failed to create folder"],"K6jjWB":[["packName"]," was already set up. Nothing to do."],"K9J00P":["Clone failed — connection error"],"KDw4GX":["Try again"],"KX1MZR":["Your repositories"],"KYcZ6Y":["Above"],"KZLdgR":["See <0>#design-docs</0> for the latest specs."],"KZkHZv":["Signed in as @",["login"]],"K_wz1u":["Show Hidden Files"],"KnoB--":["Will be saved as <0>",["sanitized"],"</0>."],"KujtjC":["Find"],"L-rMC9":["Reset to default"],"L3CEC1":["this item"],"L6Hhh6":["(root)"],"L8fKuc":["Run this in your terminal"],"LE7t79":["Clone to a new folder"],"LKOLNn":["No AI agents installed"],"LRgZAt":[["owner"],"/",["name"]," already exists"],"LUbzI-":["This template lives at an ancestor folder — deleting affects every folder under that ancestor that does not shadow it locally."],"LXdWeS":["Medium section heading."],"LlHqdU":["Initializing project"],"LtI9AS":["Owner"],"LtSYdi":["Reveal in Finder"],"Lu_dOh":["Tree View Options"],"M3ytY_":["This looks like a drive root (e.g., C:\\\\). Scaffolding here will scan an entire drive."],"MHrjPM":["Title>>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"MKOVhz":["Enable git auto-sync"],"MV-Dkb":["Found ",["countDisplay"]," markdown files"],"MVxpbf":["Find and replace"],"MW64zN":["New File"],"MZoxVx":["Failed to load tags. Press Escape and re-open to retry."],"MmDDWK":["Recently opened"],"MtR6ZK":["Not signed in to GitHub."],"N2S1rs":["Empty>>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"N2eHWq":["Code Block"],"NIWAux":["No docs registered under #",["tagDocsName"],"."],"NOHyEE":["Retry push"],"NORKZU":["Pattern warnings: ",["summary"]],"NSnIUP":["Two-page (even)"],"NYUhy5":["Subfolder name"],"Nn4GgW":["Will be created as <0>",["sanitizedName"],"</0>"],"Nu4DdT":["Sync"],"Nu4oKW":["Description"],"NuH1jp":["Public repository"],"Nv3mUj":["Show advanced"],"NvOvTi":["Create in <0>",["dirDisplay"],"</0>"],"Nx7BWE":["Git auto-sync"],"O2UpM1":["Browse"],"O3oNi5":["Email<<<<<<< HEAD"],"O7_W_a":["Open with AI"],"OD0FCX":["Hidden “",["basename"],"”"],"ODD5Jc":["Edit ",["templateLabel"]],"ODGGlj":["Folder name: ",["detail"]],"OJeiSH":["Failed to add property"],"OTF92M":["Label <0>(optional display text)</0>"],"OYHzN1":["Tags>>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"OYnx7O":["Path cannot start with \\"/\\""],"OZtLT5":["Checking GitHub sign-in..."],"OlAl5i":["Expand all"],"OmHTGj":["Disable git auto-sync"],"Oos8fo":["Copy command"],"Oxyd5f":["Pick a name"],"P-ye9o":["Could not open folder picker"],"P3NS4G":["Pattern syntax error (line ",["lineNumber"],"): ",["message"]],"P47EWZ":["Could not update sidebar settings"],"PHRoEJ":["Open shared document"],"PKLY-1":["Opening..."],"PiH3UR":["Copied!"],"Q5fqMz":["Connection error — try again"],"Q6hhn8":["Preferences"],"QQghPu":["Install in Claude Desktop"],"QqBQu1":["Label <0>(visible link text)</0>"],"R0jJzV":["Paste URL, owner/repo, or search your repos"],"RDrXh4":["Configure user, project, and integration settings."],"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"],"RlCInP":["Slash commands"],"RobAKV":["Update the destination and optional section anchor."],"Rx5ReQ":["Rename ",["keyName"]],"S6l5dv":["Could not start creating a new item"],"S9Vnum":["Remove ",["patternText"]],"SFN6dN":["Heading 3"],"SUOoXn":["Failed to open project."],"ScUTHW":["Open Containing Folder, ",["hint"]],"ScwcF2":["A project already exists at this location. Pick a different parent folder.<<<<<<< HEAD"],"SiUUCS":["Next match"],"SkMZlS":["Couldn't remove <0>",["targetGitPath"],"</0>: ",["removeGitError"]],"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"],"T67A0Y":["Auto-sync pushes/pulls commits to your git remote on intervals and on save. Toggling on requires confirmation."],"TKQ7K-":["Install"],"TP9_K5":["Token"],"TXrEYR":["No templates resolve here. Add one in this folder's Templates section, or in Settings → Templates."],"ThmUrC":["Could not finalize project setup. Try again."],"Tjc1pH":["Section <0>(optional heading anchor)</0>"],"TmKshB":["Invalid token — check that it has repo scope"],"Tz0i8g":["Settings"],"Tz9pJB":["Clone stream ended unexpectedly — check if the clone completed"],"U3IvM5":["Full guide"],"U5Spo9":["Content directory must be inside the project"],"U8CD-l":["Copy full path, No workspace"],"UBv8UK":["Delete Permanently"],"UG-Phk":["Frontmatter YAML is malformed; fix in source mode to recover."],"UL8A9w":["Tag||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"UQAp48":["Search templates"],"UTZ97u":["Selection must be inside the project"],"UVLlMV":["Couldn't reach GitHub. Try again?"],"Uci-Ph":["Ordered List"],"Ud0Pj9":["<0>Mirror source removed.</0> The doc <1>",["src"],"</1> is no longer available."],"UkQGhd":["Hide replace"],"Up2_7p":["Copy full path"],"Uuj_R4":["New from template"],"Uw6ERJ":["Couldn't copy: ",["detail"]],"VUijjF":["Embed an image with optional alt text.||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"VdXv4D":["Clone from GitHub"],"W-ntoW":["heading-slug"],"W8uemY":["Pick a starter pack to scaffold folders, templates, and AI-readable rules."],"W8vpBM":["starter pack"],"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"],"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"]],"Wcv-Zi":["Make this knowledge base available as a Claude Skill."],"WqLq6M":["Open with AI ",["displayName"]],"Wtw22s":["Installing"],"Wyxs0x":["Path cannot contain \\"..\\""],"X0ttSN":["No tags match \\"",["tagListQuery"],"\\"."],"X8kjQX":["Re-authenticate with GitHub"],"XRuL0i":["Create page"],"XU0OXn":["Enable auto-sync"],"XYlJJT":["Setting up"],"XfzqjK":["template \\"",["name"],"\\""],"Xl-UUg":["guides/install or https://example.com"],"XpIZmv":["Fenced code block with monospace text."],"XtRoxT":["Page ",["pageNumber"]],"Xv_ijG":["https://github.com/owner/repo or owner/repo"],"XyNe7f":["Electron bridge unavailable. Refresh and try again."],"Y-Urt2":["Block math equation rendered with KaTeX from a LaTeX source string.||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"Y8ViJx":["A newer version may have been deployed since this tab opened."],"YGIi_c":["Reinstall"],"YPFBfr":[["detail"]," - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"YTLmTM":["Remove the parent <0>.git</0> folder"],"Y_kL7X":["Customize how the editor looks and behaves."],"YjhKI5":["Cloning..."],"YlDuro":["Fit height"],"YwPUUP":["This pack is already set up here."],"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>."],"Z7fox7":["Actions for ",["rowLabel"],">>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"Z8KDox":["Enter a folder name (e.g. brain)."],"ZLQol-":["You can turn this on later in <0>Settings → Sync</0>."],"ZNK2Tq":["root"],"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."],"ZWyHmq":["This project<<<<<<< HEAD"],"ZhhOwV":["Quote"],"ZmGmNh":["Let's set up your project."],"_6IEmc":["Open in Terminal, No workspace"],"_7UQ7y":["Whole word"],"_K2CvV":["Template"],"_N2eSU":["org"],"_TDESN":["Network error - ",["kind"]," \\"",["createdPath"],"\\" still exists on disk"],"_TF8ep":["Failed to render PDF<<<<<<< HEAD"],"_qD6mn":["Pick the folder where you've cloned it."],"a5W0q0":["Are you sure you want to delete ",["folderName"],"/ and all files inside? This action cannot be undone."],"aE2_XM":["One pattern per line — appended to <0>.okignore</0>."],"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"],"abiHje":["Delete selected items"],"adsMWO":["Resolving deltas"],"av_PD9":["you"],"b392Dr":["Expand All"],"b4itZn":["Working"],"bBE5tC":["Detected on this machine"],"bD8I7O":["Complete"],"bGQplw":["Body>>>>>>> 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)"],"bHboUQ":["Edit template"],"bS_boY":["Replace current match"],"bUUVED":["Asset"],"bwil08":["Building <0>openknowledge.skill</0> and opening the Claude Desktop App"],"c5rF4v":["What is this knowledge base for?"],"c8iK2Y":["No templates found."],"cBbVqQ":["The folder name <0>",["rawName"],"</0> can't be used as a project identifier — it has no characters left after sanitization. Click Browse to pick a folder whose name contains at least one alphanumeric character."],"cIptmH":["In the Claude Desktop App<<<<<<< HEAD"],"cKjLuT":["(project + user)"],"cOSAfL":["No repositories found on your GitHub account."],"cVUTnt":["Template \\"",["trimmedName"],"\\" created"],"cZGNlb":["Add another pattern"],"cnGeoo":["Delete"],"cqQyPB":["Folder name"],"csDS2L":["Available"],"d2uTPx":["Server error (HTTP ",["status"],")"],"dDpCOp":["Rename succeeded but the sidebar may be out of date — refresh to resync"],"dEgA5A":["Cancel"],"dGaH3A":["Create a token at <0>github.com/settings/tokens</0> with <1>repo</1> scope."],"dOHMA0":["Failed to move"],"dOxPd4":["Footnote"],"dTaauv":["Reason: ",["reason"]],"dURmlQ":["\\"frontmatter\\" is a reserved property name"],"dbhUX1":["Hide this file"],"dprWmL":["Anchor in this page"],"dr1vFs":["Replace all matches"],"dw_dUJ":["Failed to duplicate path"],"e0NrBM":["Project"],"e1hptq":["Embed a video with native player controls."],"e8L17t":["A non-empty folder already exists at this path. Pick a different folder."],"eFJkVt":["Clone failed: ",["cloneError"]],"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>."],"ehLu5O":["Open in Terminal, ",["hint"]],"emgiet":["Authoritative content; mirrored verbatim everywhere it's referenced."],"ensWZc":["or start from scratch <0/>"],"euc6Ns":["Duplicate"],"evs0iw":["Tags matching \\"",["tagListQuery"],"\\""],"f65AOQ":["Start from"],"fIgqfQ":["Reinstalling"],"fJgQHX":["Failed to create file"],"fVcm9t":[["0","plural",{"one":["#"," doc"],"other":["#"," docs"]}]],"fWi7pn":["Initialize starter pack"],"fX82Jn":["Open Knowledge will create a <0>.ok/</0> folder here to track this project's metadata."],"fYKgzG":["Failed to load recent projects."],"fYjgXu":["Unordered list of items."],"fiMNLl":["Sync settings not yet loaded — try again in a moment"],"fqSfXY":["Replace"],"g1tOCu":["Required. Title is the agent menu surface."],"g4XBm0":["Small section heading."],"gGVP4q":["Click <0>+</0> <1/> <2>Create skill</2> <3/> <4>Upload skill</4>."],"gJR87V":["Could not create the project folder. Pick a different folder."],"gYz2ep":["Expires in ",["timeLabel"]],"gcV0dI":["The folders and templates are in place; there's nothing left to scaffold."],"ggs9f8":["Search files, folders, or commands"],"ghYcYZ":["File extension"],"gijbne":["Failed to rename path"],"gp3I7-":["Before syncing, set your identity for git commits:"],"gtmbUO":["Sign in to GitHub"],"hA8GQ6":["Will replace existing Open Knowledge entry"],"hBMK4W":["Project templates"],"hGmuTc":["Docs tagged #",["tagDocsName"]],"hJu2pH":["This folder already has files. Add a name to create a new subfolder inside it."],"hSySVc":["Install handoff failed: ",["msg"]],"hYDc6B":["Name cannot be empty"],"hYFQsG":["Validating"],"hYgDIe":["Create"],"hZoBHK":["Empty starting content"],"haHgQj":["Copied relative path"],"he3ygx":["Copy"],"hmUQVj":["Letters, digits, <0>_</0>, <1>-</1> only — no slashes, dots, spaces, or <2>.md</2>."],"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"]],"hynz2K":["Download started"],"hz7n6T":["Open Containing Folder"],"i3f2kh":["No matching commands."],"i8dKs-":["Show all files"],"i9toLO":["Agent configuration file"],"iDZtvM":["Failed to load templates: ",["message"]],"iEYxO4":["Show thumbnails"],"iH8pgl":["Back"],"iKSP5j":["Word wrap"],"iMCW9z":["Publish & copy link"],"iTylMl":["Templates"],"i_grbe":["Click Browse to pick or create a project folder."],"idD8Ev":["Saved"],"iilQXA":["Folder duplicated"],"iqugog":["Initialize failed: ",["errorDetail"]],"j9Vqvc":["inherited"],"jGJy-9":["Downloads ",["shareOwner"],"/",["shareRepo"]," from GitHub."],"jRHdCz":["Failed to load PDF"],"jTLWxh":["Embed an external page in an inline iframe (docs, demos, Figma, CodeSandbox)."],"jjtmV_":["First file name"],"jnXr0e":["Clone failed. Please try again."],"jol95m":["Failed to open Project Navigator."],"kFLlsI":["Insert a footnote reference + matching definition stub."],"kNqMMd":["Folder"],"kV2YZv":["Don't see <0>Skills</0>? Enable <1>Settings <2/> Capabilities <3/> Code execution and file creation</1> first."],"kolRU1":["Do you want to permanently delete instead?"],"l17ab4":["Could not write project files. Try a different location."],"lAiyU_":["Only the current document uses <0>#",["tag"],"</0>."],"lGs_bQ":["Page <0>*</0>"],"lHwYMr":["Server error: ",["status"]," ",["statusText"]],"lXKZGw":["Heading 1"],"l_UFPv":["Properties"],"lanW9H":["Sign in to clone"],"lhjq3G":["Reset ",["labelText"]," to default"],"ll2yNl":["Content directory"],"ls1N1w":["(missing)"],"m16xKo":["Add"],"m6YGpY":["Active panel content for the selected tab shows here.||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"mGaZwZ":["See the full install guide"],"mKZODc":["Adds the Open Knowledge skill to the <0>Claude Desktop App</0> so it's available in Chat and Cowork sessions."],"mSJ3Rn":["Computing scaffold plan"],"mWVJRX":["Collapsible section with a clickable summary."],"mYLRjR":["You picked ~/Desktop. Open Knowledge will index everything on your desktop."],"maDWIB":["Mirror source <0>api-spec</0>"],"makN88":["No patterns yet. Type a folder or file name below to start hiding files."],"mf37rL":["Retrying"],"mmpzAq":["Wrap long lines in the markdown source editor."],"mqSwZH":["<0>Mirror anchor not found.</0> No <1>",["mirrorSourceTag"],"</1> exists in <2>",["src"],"</2>."],"muWKMD":["No response — try again"],"n5n_vi":["Private repository"],"nNYV3Y":["and ",["remaining"]," more"],"nWv1ja":["Manage hidden files in Settings → Ignore patterns."],"nYKerc":["(user-level only)"],"nbfdhU":["Integrations"],"nft48x":["Stored at <0>.ok/templates/</0> in this project. Available in every folder (folder-scoped templates can override by filename)."],"njU86j":["Property \\"",["trimmed"],"\\" already exists"],"nzaV6Q":["Page thumbnails"],"o2yoFu":["Reveal in Finder, No workspace"],"o4dcAf":["Reveal in File Explorer, ",["hint"]],"oqB2ez":["Previous match"],"outYNy":["Duplicate name \\"",["keyName"],"\\""],"p2LEhJ":["Personal access token"],"p9sdCy":["New ignore pattern"],"pAlxX6":["Open this folder with Open Knowledge"],"pHYP6v":["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],"pWT04I":["Checking..."],"pWbsW6":["Loading docs"],"pdHb22":["GitHub App"],"pkAft1":["Search failed."],"prHfed":["Each selected tool gets an Open Knowledge MCP entry."],"q2kXMG":["Inline Math"],"qNOgUu":["Edits at the source land here — no copy-paste drift."],"qUB_o_":["Auto-sync is off — your edits stay local until you commit and push manually."],"qXBTvV":["A template named <0>",["trimmedName"],"</0> already resolves here (likely inherited). Saving creates a <1>local</1> shadow that supersedes it for this folder."],"qXg5W9":["File saves to <0>~/Downloads/openknowledge.skill</0>."],"qXsafh":["Publish to GitHub"],"qbfj1f":["Receiving objects"],"qi1F96":["Reveal in File Explorer"],"qioCwA":["Jump to page ",["pageNumber"]],"qo4zCg":["Path cannot contain backslashes"],"qvWGzP":["Collapse all"],"r4R7AZ":["Network error during cleanup"],"r51jLC":["File saved & Claude Desktop App opened"],"rEnIww":["Published to ",["ownerLogin"],"/",["repoName"],"."],"rXz97P":["Numbered list of items."],"rZ9HZq":["To do||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"rdU729":["Layout"],"rlUzXK":["Could not validate folder. Please try again."],"rssK8c":["Ignore patterns (raw text)"],"s-XOaI":["File name"],"s1c0ja":["Bullet List"],"s3caR3":["Deleting"],"sE7R19":["Could not load templates: ",["templatesError"],". You can still create a blank note."],"sER-bs":["Files"],"sJK6pq":["Permission denied"],"saIASg":["Second item"],"saYiIO":["Path cannot contain null bytes"],"snrVQ7":["probe failed"],"t-JXbf":["Notion-style inline row for a downloadable file. Drag-drop also works."],"tAPZEx":["Below"],"tCelbM":["A folder named <0>",["sanitized"],"</0> already has files at this location. Pick a different name."],"tX5yOZ":["New Folder"],"tXkhj_":["Start"],"t_YqKh":["Remove"],"tfDRzk":["Save"],"tfi40B":["Failed to create page"],"uF9ruK":["Saving"],"uH_S-u":[["loadErrorTitle"],": ",["message"]],"u_lS4C":["Clone complete — opening project"],"uuoHOU":["Command failed."],"v-h2hx":["Delete ",["targetGitPath"]],"v41fCm":["File not found"],"vEJDlt":["The file is in your Trash; the file-watcher will reconcile."],"vIxrEk":["Fit width"],"vPYaz3":["Scaffold directly under this project."],"vQayZz":["Add a remote with <0>git remote add origin <url></0> in this project's directory. This page will update automatically once a remote is detected."],"ve8vEM":["Code expired — please try again"],"vfRlCI":["Could not copy full path"],"w7nm4K":["Indented blockquote for citations.||||||| parent of 11d802035 (feat(open-knowledge): wrap settings and template strings with Lingui)======="],"wJijgU":["Location"],"wJo9oS":["Close find"],"wQp1V3":["Mirror of <0>",["src"],"</0>"],"wTcjov":["No workspace"],"wbv9xO":["Create new project"],"wlwXUk":["You picked ~/Downloads. Files there are usually transient — consider a stable folder instead."],"x3-2ta":[["packName"]," initialized (",["projectEntries","plural",{"one":["#"," entry"],"other":["#"," entries"]}],")"],"xK291b":["Two-page (odd)"],"xNyj3h":["Reinstall for Claude Chat & Cowork"],"xXo8FT":["Save failed: ",["error"]],"xhlFsx":["Inherited — set a value here to replace it."],"xiv-dW":["No files yet."],"xloBjn":["Relative Path"],"xsZhu-":["Page number"],"xzktOa":["Edit wiki link"],"y1t8bQ":["Settings sections"],"yLq4w4":["Separator"],"yOGrCR":["Delete failed: ",["error"]],"yQE2r9":["Loading"],"yWWThY":["Asset reference"],"yXiaxB":["Assets cannot be renamed from the sidebar"],"yYR6za":["Display text"],"ygLG1e":["Assets cannot be moved from the sidebar"],"ysxgu8":["project"],"yu8Pzy":["Not detected"],"yutJKi":["Checklist with checkboxes."],"yvHDYG":["Claude Desktop"],"yz7wBu":["Close"],"z0a2EA":["Diagram from Mermaid source — flowchart, sequence, class, state, ER, gantt, pie."],"z2G3EK":["<0>",["rawName"],"</0> has characters unsafe for the on-disk identifier, so the project will be created as <1>",["sanitized"],"</1>. Click Browse to pick a safer name."],"z2funE":["Full Path"],"z60Lgn":["Saves the file to <0>~/Downloads/openknowledge.skill</0> and opens the Claude Desktop App. Requires Node.js or Bun on your PATH."],"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."],"zXZJoN":["Add token"],"zd00pH":["Copy Path"],"zgSFyG":["External link"],"zo3Dl7":["Toggle thumbnails"],"zwBp5t":["Private"]}`),yf=`en`;Ie.load(yf,vf),Ie.activate(yf);function bf(e){return`#/${encodeURIComponent(e)}`}function xf(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(bf(e.doc))})}var Sf=4e3,Cf=1440*60*1e3;function wf(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){Y.success(`Opened existing Open Knowledge project at ${e.ancestorPath}`,{duration:Sf});return}if(e.kind===`startup-reclaim`){let t=[];if(e.mcp.status===`repaired`){let n=e.mcp.editors.map(e=>Dr[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`;Y[r?`error`:`success`](n,{duration:r?Cf:Sf});return}let t=is(e.gitRoot,e.pickedPath)??e.pickedPath;Y.success(`Initialized Open Knowledge at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Sf})})}var Tf=!1;function Ef(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{$e(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Df(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 Of=0,kf=0,Af=0,jf=0,Mf=null,Nf=[`linkResolutionDecoration$`],Pf=new WeakSet,Ff=new WeakSet;function If(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function Lf(){return!1}function Rf(){return!Lf()}function zf(e,t){if(Rf())return t;let n=`ok/cold/nodeview-factory-${If(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;$e(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function Bf(e){if(Rf())return;let t=e.state.plugins;for(let e of t){if(Ff.has(e))continue;let t=e.spec?.key?.key;if(!t||!Nf.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){Ff.add(e);continue}let i=`ok/cold/decoration-${If(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;$e(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},Ff.add(e)}}function Vf(e){if(Rf())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=zf(e,n);r.__okWrapped=!0,t[e]=r}}function Hf(e){return Rf()?e:e.map(e=>{let t=e.name??`unknown`,n=If(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;$e(`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;$e(`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;$e(`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;$e(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function Uf(){if(!Tf){Tf=!0,Ef(tr.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return Rf()||(Mf=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Df(i.editorState),durationMs:r}}),Ef(tr.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!Rf()&&!Pf.has(e)&&t.view&&(Bf(t.view),Vf(t.view),Pf.add(e)),{docSize:Df(t.editorState)}}),Ef(tr.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{jf+=1;let i=e;return!Rf()&&i.view&&Vf(i.view),{docSize:Df(i.view),seq:jf,durationMs:r}}),Ef(pr.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(kf+=1,{seq:kf,docSize:Df(e.state),durationMs:r})),Ef(pr.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Af+=1,{seq:Af,docSize:Df(e.state),durationMs:r})),Ef(F.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Of+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Of,topLevelYElements:a,durationMs:r}}),Ef(Ge.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`)&&($e(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}),!Rf()&&e===`first-paint`&&Mf!==null)){let e=Mf,n=Math.max(0,t.startTime-e);$e(`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}),Mf=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var Wf=`Relaunch`,Gf=`Release notes`,Kf=`Updates paused`,qf=`Download`,Jf=`Reset to defaults`,Yf=`Relaunch failed — please restart manually`,Xf=`Recovery action failed — please try again`;function Zf(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function Qf(e){return`Version ${e} ready to install`}function $f(e){return`Updated to Version ${e}`}function ep(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var tp=0,np=0,rp=1,ip=2,ap=3;function op(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded`;t({id:i,body:Qf(r),priority:ip,action:{label:Wf,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:Zf(Yf,e),variant:`error`,priority:rp})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:$f(n),priority:ap,action:{label:Gf,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:Kf,priority:np,action:{label:qf,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function sp(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:Zf(Xf,e),variant:`error`,priority:tp})};n({id:i,body:ep(t.currentBuild),priority:tp,action:{label:Jf,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var cp=[],lp=new Set,up=!1;function dp(){for(let e of lp)e()}function fp(e){let t=cp.findIndex(t=>t.id===e.id);if(t===-1)cp=[...cp,e];else{let n=cp.slice();n[t]=e,cp=n}dp()}function pp(e){let t=cp.filter(t=>t.id!==e);t.length!==cp.length&&(cp=t,dp())}function mp(){return cp}function hp(e){return lp.add(e),()=>{lp.delete(e)}}function gp(){if(up||typeof window>`u`)return;let e=window.okDesktop;e&&(up=!0,op(e,fp,pp),e.state.query().then(t=>{t.schemaIncompatibility&&sp(e,t.schemaIncompatibility,fp,pp)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var _p=`ok-omnibar-recents-v1`,vp=10;function yp(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function bp(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function xp(e,t){return`${e}:${t}`}function Sp(e){let t=bp(e);if(!t)return[];try{let e=t.getItem(_p);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(yp).slice(0,vp):[]}catch{return[]}}function Cp(e,t){let n=bp(t);if(n)try{n.setItem(_p,JSON.stringify(e.slice(0,vp)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function wp(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,vp)}function Tp(e,t){return e.filter(e=>t.has(xp(e.kind,e.path)))}var Ep=50,Dp=30,Op=``,kp=null;function Ap(e){return e.trim().toLowerCase()}function jp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Mp(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function Np(e,t,n=new Map,r=new Map){let i=[];for(let t of e){let e=r.get(t)?.modified,a=n.get(t);i.push({kind:`file`,path:t,name:Er(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:Er(e)});return i.sort((e,t)=>{let n=e.path.localeCompare(t.path);return n===0?e.kind===t.kind?0:e.kind===`folder`?-1:1:n}),i}function Pp(e){return er({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function Fp(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:kr(e.map(Pp))}}function Ip(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function Lp(e){let t=Ip(e);return kp&&Op===t?kp:(Op=t,kp=Fp(e),kp)}function Rp(e,t,n=Ep){return zp(Lp(e),t,n)}function zp(e,t,n=Ep){let r=Ap(t);return r?oi(e.corpus,r,{intent:`omnibar`,limit:n,scopes:[`page`,`folder`]}).map(t=>e.byId.get(t.document.id)).filter(e=>e!==void 0):e.entries.slice(0,20)}function Bp(e,t){let n=Mp(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(jp).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 Vp(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=Er(e.path);return{kind:e.kind===`page`?`file`:`folder`,path:e.path,name:t,...e.title&&{title:e.title},...e.snippet&&{snippet:e.snippet},...typeof e.score==`number`&&{score:e.score}}}async function Hp(e,t={}){let n=e.trim();if(!n)return[];let r=await fetch(`/api/search`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({query:n,intent:`full_text`,scopes:[`page`,`folder`,`content`],limit:t.limit??Dp}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error($n(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(Vp).filter(e=>!!e)}function Up(e,t,n=[]){let r=Ap(t);return r?Ap([e,...n].join(` `)).includes(r):!0}var Wp=`tag:`;function Gp(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 Kp(e,t){return R(e,t)}var qp=E;async function Jp(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 Yp=`open-knowledge:doc-panel-tab`,Xp=null;function Zp(){let e=Xp;return Xp=null,e}function Qp(e,t=typeof window>`u`?new EventTarget:window){Xp=e,t.dispatchEvent(new CustomEvent(Yp,{detail:{tab:e}}))}function $p(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(Yp,n),()=>t.removeEventListener(Yp,n)}var em=[`.md`,`.mdx`];function tm(e){let t=e.toLowerCase();for(let e of em)if(t.endsWith(e))return e;return null}function nm(e){let t=tm(e);return t?e.slice(0,-t.length):e}var rm=`__blank__`,im={local:0,inherited:1};function am(e){return[...e].sort((e,t)=>{let n=im[e.scope]-im[t.scope];if(n!==0)return n;let r=(e.title??e.name).toLowerCase(),i=(t.title??t.name).toLowerCase();return r.localeCompare(i)})}function om(e){return e.trim()?e.includes(`..`)?`dotdot`:e.startsWith(`/`)?`leading-slash`:e.includes(`\\`)?`backslash`:e.includes(`\0`)?`null-byte`:null:`empty`}function sm(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 cm(e){let t=e.fileName.trim(),n=tm(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 lm(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&e.altKey&&e.key.toLowerCase()===`n`)}function um(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function dm(e){let t=(0,$.c)(136),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{_:d}=Yt(),{addPage:f}=Zr(),p=_o(u?null:a),m=u??p,[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`.md`),[x,S]=(0,Q.useState)(rm),[C,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useId)(),N=(0,Q.useId)(),P=(0,Q.useId)(),[F,I]=(0,Q.useState)(!1),L=(0,Q.useRef)(null),R=(0,Q.useRef)(null),z,B;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(z=()=>{if(n){T(null),k(null),D(!1),v(``),S(i===`file`&&s?s:rm),I(!1);let e=i===`file`?o??`untitled`:`index`,t=tm(e);b(t??`.md`),g(t?nm(e):e)}},B=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=z,t[5]=B):(z=t[4],B=t[5]),(0,Q.useEffect)(z,B);let V;t[6]!==m.state.data||t[7]!==m.state.status?(V=m.state.status===`ready`?am(m.state.data.folder.templates_available??[]):[],t[6]=m.state.data,t[7]=m.state.status,t[8]=V):V=t[8];let H=V,U;t[9]!==m.state.data||t[10]!==m.state.status||t[11]!==n||t[12]!==x?(U=()=>{n&&x!==rm&&m.state.status===`ready`&&((m.state.data.folder.templates_available??[]).some(e=>e.name===x)||S(rm))},t[9]=m.state.data,t[10]=m.state.status,t[11]=n,t[12]=x,t[13]=U):U=t[13];let W;t[14]!==m.state||t[15]!==n||t[16]!==x?(W=[n,x,m.state],t[14]=m.state,t[15]=n,t[16]=x,t[17]=W):W=t[17],(0,Q.useEffect)(U,W);let G=i===`file`,ee=m.state.status===`loading`||m.state.status===`idle`,te=m.state.status===`error`?m.state.message:null,ne;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ne=function(e){let t=tm(e);t?(b(t),g(nm(e))):g(e),T(null)},t[18]=ne):ne=t[18];let re=ne,ie;t[19]!==y||t[20]!==h||t[21]!==_||t[22]!==a||t[23]!==i?(ie=function(){return cm({kind:i,initialDir:a,fileName:h,fileExtension:y,folderName:_})},t[19]=y,t[20]=h,t[21]=_,t[22]=a,t[23]=i,t[24]=ie):ie=t[24];let ae=ie,oe;t[25]!==d||t[26]!==h||t[27]!==_||t[28]!==i?(oe=function(){if(i===`folder`){let e=om(_.trim());if(e)return{message:d({id:`ODGGlj`,values:{detail:d(sm(e))}}),field:`folder`}}let e=om(h.trim());return e?{message:d(sm(e)),field:`file`}:null},t[25]=d,t[26]=h,t[27]=_,t[28]=i,t[29]=oe):oe=t[29];let se=oe,ce;t[30]!==E||t[31]!==h||t[32]!==_||t[33]!==i?(ce=E||!h.trim()||i===`folder`&&!_.trim(),t[30]=E,t[31]=h,t[32]=_,t[33]=i,t[34]=ce):ce=t[34];let le=ce,ue;t[35]!==d||t[36]!==f||t[37]!==ae||t[38]!==se||t[39]!==i||t[40]!==l||t[41]!==r||t[42]!==x?(ue=async function(){let e=se();if(e){T(e.message),k(e.field);return}D(!0),T(null),k(null);let t=ae(),n=i===`file`&&x!==rm?x:void 0,a={path:t};n!==void 0&&(a.template=n);try{let e=await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(a)}),t=e.status,n=await w(e,d({id:`d2uTPx`,values:{status:t}}));if(!n.ok){D(!1),T(n.title),k(`form`);return}let o=si.safeParse(n.body);if(D(!1),!o.success){T(d(i===`folder`?{id:`K1ckLX`}:{id:`fJgQHX`})),k(`form`);return}let s=o.data.docName;r(!1),window.location.hash=`#/${s}`,f(s),ci([`files`,`backlinks`,`graph`]),l?.(s)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),D(!1),T(d({id:`HIb0vl`})),k(`form`)}},t[35]=d,t[36]=f,t[37]=ae,t[38]=se,t[39]=i,t[40]=l,t[41]=r,t[42]=x,t[43]=ue):ue=t[43];let de=ue,K;t[44]!==d||t[45]!==a?(K=a||d({id:`L6Hhh6`}),t[44]=d,t[45]=a,t[46]=K):K=t[46];let fe=K,pe;t[47]===i?pe=t[48]:(pe=(0,Z.jsx)($t,{children:i===`file`?(0,Z.jsx)(J,{id:`HdkSiO`}):(0,Z.jsx)(J,{id:`96G6Re`})}),t[47]=i,t[48]=pe);let me;t[49]!==c||t[50]!==fe?(me=c??(0,Z.jsx)(J,{id:`NvOvTi`,values:{dirDisplay:fe},components:{0:(0,Z.jsx)(`span`,{className:`font-medium text-foreground`})}}),t[49]=c,t[50]=fe,t[51]=me):me=t[51];let he;t[52]===me?he=t[53]:(he=(0,Z.jsx)(Zt,{children:me}),t[52]=me,t[53]=he);let ge;t[54]!==pe||t[55]!==he?(ge=(0,Z.jsxs)(un,{children:[pe,he]}),t[54]=pe,t[55]=he,t[56]=ge):ge=t[56];let _e;t[57]!==x||t[58]!==G||t[59]!==N||t[60]!==F||t[61]!==P||t[62]!==H||t[63]!==te||t[64]!==ee?(_e=G&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{id:N,className:`mb-1.5 block text-sm font-medium`,children:(0,Z.jsx)(J,{id:`f65AOQ`})}),te?(0,Z.jsx)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:(0,Z.jsx)(J,{id:`sE7R19`,values:{templatesError:te}})}):null,(0,Z.jsx)(pm,{triggerId:P,labelledById:N,open:F,onOpenChange:I,value:x,onValueChange:S,templates:H,loading:ee}),!ee&&!te&&H.length===0?(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`TXrEYR`})}):null]}),t[57]=x,t[58]=G,t[59]=N,t[60]=F,t[61]=P,t[62]=H,t[63]=te,t[64]=ee,t[65]=_e):_e=t[65];let ve;t[66]!==d||t[67]!==C||t[68]!==O||t[69]!==A||t[70]!==j||t[71]!==_||t[72]!==i?(ve=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:j,children:(0,Z.jsx)(J,{id:`cqQyPB`})}),(0,Z.jsx)(Go,{ref:R,id:j,value:_,onChange:e=>{v(e.target.value),T(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":C&&(O===`folder`||O===`form`)?A:void 0,"aria-invalid":C&&(O===`folder`||O===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=om(_.trim());if(t){T(d({id:`ODGGlj`,values:{detail:d(sm(t))}})),k(`folder`);return}L.current?.focus()}}})]}),t[66]=d,t[67]=C,t[68]=O,t[69]=A,t[70]=j,t[71]=_,t[72]=i,t[73]=ve):ve=t[73];let ye;t[74]===i?ye=t[75]:(ye=i===`folder`?(0,Z.jsx)(J,{id:`jjtmV_`}):(0,Z.jsx)(J,{id:`s-XOaI`}),t[74]=i,t[75]=ye);let be;t[76]!==M||t[77]!==ye?(be=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:M,children:ye}),t[76]=M,t[77]=ye,t[78]=be):be=t[78];let xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>re(e.target.value),t[79]=xe):xe=t[79];let Se=i===`file`,Ce=C&&(O===`file`||O===`form`)?A:void 0,we=C&&(O===`file`||O===`form`)?!0:void 0,Te;t[80]!==de||t[81]!==le?(Te=e=>{e.key===`Enter`&&!le&&de()},t[80]=de,t[81]=le,t[82]=Te):Te=t[82];let Ee;t[83]!==M||t[84]!==h||t[85]!==Se||t[86]!==Ce||t[87]!==we||t[88]!==Te?(Ee=(0,Z.jsx)(Go,{ref:L,id:M,value:h,onChange:xe,placeholder:`my-note`,autoFocus:Se,"aria-describedby":Ce,"aria-invalid":we,onFocus:fm,onKeyDown:Te,className:`flex-1`}),t[83]=M,t[84]=h,t[85]=Se,t[86]=Ce,t[87]=we,t[88]=Te,t[89]=Ee):Ee=t[89];let De;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(De=e=>{(e===`.md`||e===`.mdx`)&&b(e)},t[90]=De):De=t[90];let Oe;t[91]===d?Oe=t[92]:(Oe=d({id:`ghYcYZ`}),t[91]=d,t[92]=Oe);let ke;t[93]===d?ke=t[94]:(ke=em.map(e=>(0,Z.jsx)(Qo,{value:e,"aria-label":d({id:`GJ3011`,values:{ext:e}}),children:e},e)),t[93]=d,t[94]=ke);let Ae;t[95]!==y||t[96]!==Oe||t[97]!==ke?(Ae=(0,Z.jsx)(ts,{type:`single`,value:y,onValueChange:De,variant:`outline`,"aria-label":Oe,className:`shrink-0`,children:ke}),t[95]=y,t[96]=Oe,t[97]=ke,t[98]=Ae):Ae=t[98];let je;t[99]!==Ee||t[100]!==Ae?(je=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Ee,Ae]}),t[99]=Ee,t[100]=Ae,t[101]=je):je=t[101];let Me;t[102]!==C||t[103]!==A?(Me=C&&(0,Z.jsx)(`p`,{id:A,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:C}),t[102]=C,t[103]=A,t[104]=Me):Me=t[104];let Ne;t[105]!==be||t[106]!==je||t[107]!==Me?(Ne=(0,Z.jsxs)(`div`,{children:[be,je,Me]}),t[105]=be,t[106]=je,t[107]=Me,t[108]=Ne):Ne=t[108];let Pe;t[109]!==_e||t[110]!==ve||t[111]!==Ne?(Pe=(0,Z.jsx)(sn,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[_e,ve,Ne]})}),t[109]=_e,t[110]=ve,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]===r?Fe=t[114]:(Fe=()=>r(!1),t[113]=r,t[114]=Fe);let Ie;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(J,{id:`dEgA5A`}),t[115]=Ie):Ie=t[115];let Le;t[116]!==E||t[117]!==Fe?(Le=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Fe,disabled:E,children:Ie}),t[116]=E,t[117]=Fe,t[118]=Le):Le=t[118];let Re;t[119]===E?Re=t[120]:(Re=E?(0,Z.jsx)(J,{id:`E9bKSA`}):(0,Z.jsx)(J,{id:`hYgDIe`}),t[119]=E,t[120]=Re);let ze;t[121]!==de||t[122]!==le||t[123]!==Re?(ze=(0,Z.jsx)(X,{onClick:de,disabled:le,children:Re}),t[121]=de,t[122]=le,t[123]=Re,t[124]=ze):ze=t[124];let q;t[125]!==Le||t[126]!==ze?(q=(0,Z.jsxs)(cn,{children:[Le,ze]}),t[125]=Le,t[126]=ze,t[127]=q):q=t[127];let Be;t[128]!==ge||t[129]!==Pe||t[130]!==q?(Be=(0,Z.jsxs)(rn,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[ge,Pe,q]}),t[128]=ge,t[129]=Pe,t[130]=q,t[131]=Be):Be=t[131];let Ve;return t[132]!==r||t[133]!==n||t[134]!==Be?(Ve=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:Be}),t[132]=r,t[133]=n,t[134]=Be,t[135]=Ve):Ve=t[135],Ve}function fm(e){return um(e.currentTarget)}function pm(e){let t=(0,$.c)(66),{triggerId:n,labelledById:r,open:i,onOpenChange:a,value:o,onValueChange:s,templates:c,loading:l}=e,{_:u}=Yt(),d=(0,Q.useId)(),f;if(t[0]!==c||t[1]!==o){let e;t[3]===o?e=t[4]:(e=e=>e.name===o,t[3]=o,t[4]=e),f=c.find(e),t[0]=c,t[1]=o,t[2]=f}else f=t[2];let p=f,m=o===rm,h=i?d:void 0,g=`${r} ${n}`,_;t[5]!==m||t[6]!==l||t[7]!==p?.name||t[8]!==p?.title||t[9]!==o?(_=l?(0,Z.jsx)(J,{id:`Hl89Qd`}):m?(0,Z.jsx)(J,{id:`E7BhZn`}):p?.title??p?.name??o,t[5]=m,t[6]=l,t[7]=p?.name,t[8]=p?.title,t[9]=o,t[10]=_):_=t[10];let v;t[11]===_?v=t[12]:(v=(0,Z.jsx)(`span`,{className:`truncate`,children:_}),t[11]=_,t[12]=v);let y;t[13]!==m||t[14]!==l||t[15]!==p?(y=!l&&!m&&p?(0,Z.jsx)(_m,{entry:p}):null,t[13]=m,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==y?(b=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19];let x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(ic,{className:`ml-2 size-4 shrink-0 opacity-50`,"aria-hidden":`true`}),t[20]=x):x=t[20];let S;t[21]!==l||t[22]!==i||t[23]!==h||t[24]!==g||t[25]!==b||t[26]!==n?(S=(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(X,{id:n,type:`button`,variant:`outline`,role:`combobox`,"aria-expanded":i,"aria-haspopup":`listbox`,"aria-controls":h,"aria-labelledby":g,disabled:l,className:`w-full justify-between font-normal`,children:[b,x]})}),t[21]=l,t[22]=i,t[23]=h,t[24]=g,t[25]=b,t[26]=n,t[27]=S):S=t[27];let C;t[28]===u?C=t[29]:(C=u({id:`UQAp48`}),t[28]=u,t[29]=C);let w;t[30]===C?w=t[31]:(w=(0,Z.jsx)(Ce,{placeholder:C}),t[30]=C,t[31]=w);let T;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`c8iK2Y`})}),t[32]=T):T=t[32];let E;t[33]!==a||t[34]!==s?(E=()=>{s(rm),a(!1)},t[33]=a,t[34]=s,t[35]=E):E=t[35];let D=o===rm?`opacity-100`:`opacity-0`,O;t[36]===D?O=t[37]:(O=Gi(`mt-1 size-4 shrink-0`,D),t[36]=D,t[37]=O);let A;t[38]===O?A=t[39]:(A=(0,Z.jsx)(Jt,{className:O,"aria-hidden":`true`}),t[38]=O,t[39]=A);let j;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(`span`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`E7BhZn`})}),t[40]=j):j=t[40];let M;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[j,(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`hZoBHK`})})]}),t[41]=M):M=t[41];let N;t[42]!==E||t[43]!==A?(N=(0,Z.jsxs)(k,{value:`Blank note empty`,onSelect:E,className:`items-start gap-3`,children:[A,M]}),t[42]=E,t[43]=A,t[44]=N):N=t[44];let P;if(t[45]!==a||t[46]!==s||t[47]!==c||t[48]!==o){let e;t[50]!==a||t[51]!==s||t[52]!==o?(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)(k,{value:r,keywords:[t,e.name,e.description??``,e.scope,e.source_folder??``],onSelect:()=>{s(e.name),a(!1)},className:`items-start gap-3`,children:[(0,Z.jsx)(Jt,{className:Gi(`mt-1 size-4 shrink-0`,o===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)(_m,{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[50]=a,t[51]=s,t[52]=o,t[53]=e):e=t[53],P=c.map(e),t[45]=a,t[46]=s,t[47]=c,t[48]=o,t[49]=P}else P=t[49];let F;t[54]!==d||t[55]!==N||t[56]!==P?(F=(0,Z.jsxs)(be,{id:d,className:`subtle-scrollbar`,children:[T,N,P]}),t[54]=d,t[55]=N,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==w||t[59]!==F?(I=(0,Z.jsx)(Be,{className:`w-[var(--radix-popover-trigger-width)] p-0`,align:`start`,onOpenAutoFocus:gm,onWheel:hm,onTouchMove:mm,children:(0,Z.jsxs)(V,{children:[w,F]})}),t[58]=w,t[59]=F,t[60]=I):I=t[60];let L;return t[61]!==a||t[62]!==i||t[63]!==I||t[64]!==S?(L=(0,Z.jsxs)(Ft,{open:i,onOpenChange:a,children:[S,I]}),t[61]=a,t[62]=i,t[63]=I,t[64]=S,t[65]=L):L=t[65],L}function mm(e){e.stopPropagation()}function hm(e){e.stopPropagation()}function gm(e){e.preventDefault(),e.currentTarget.querySelector(`[cmdk-input]`)?.focus()}function _m(e){let t=(0,$.c)(7),{entry:n,className:r}=e;if(n.scope===`inherited`){let e;t[0]===r?e=t[1]:(e=Gi(`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)(J,{id:`ZNK2Tq`}),t[2]=n.source_folder,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Z.jsx)(pe,{variant:`gray`,className:e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}return null}function vm(e){return e.split(`/`).pop()??e}function ym(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(vm(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:vm(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function bm(e){let t=(0,$.c)(20),{plan:n,selectedPack:r}=e,i,a,o,s,c,l;if(t[0]!==n||t[1]!==r){let e=[...ym(n,r)].sort(Cm),u=new Set(e.map(Sm));c=`space-y-2`,t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(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:`◇`}),`What gets created`]}),t[8]=l):l=t[8],s=`overflow-hidden rounded-md border border-border/60 bg-muted/20`,i=`Items to be created`,a=`py-1.5`,o=e.map(e=>{let t=e.name.replace(/\/$/,``).split(`/`),n=0,r=0;for(let e=1;e<t.length;e++){let i=t.slice(0,e).join(`/`);u.has(i)&&(n++,r=e)}let i=t.slice(r).join(`/`)+(e.kind===`folder`?`/`:``),a=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},xm),a?(0,Z.jsx)(Sc,{"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:i}),a&&e.description?(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{"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)(Kt,{"aria-hidden":`true`,className:`size-3 text-muted-foreground/60`,strokeWidth:1.5})}),(0,Z.jsx)(vr,{children:e.description})]}):null]},e.name)}),t[0]=n,t[1]=r,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];let u;t[9]!==i||t[10]!==a||t[11]!==o?(u=(0,Z.jsx)(`ul`,{"aria-label":i,className:a,children:o}),t[9]=i,t[10]=a,t[11]=o,t[12]=u):u=t[12];let d;t[13]!==s||t[14]!==u?(d=(0,Z.jsx)(`div`,{className:s,children:u}),t[13]=s,t[14]=u,t[15]=d):d=t[15];let f;return t[16]!==c||t[17]!==l||t[18]!==d?(f=(0,Z.jsxs)(`section`,{className:c,children:[l,d]}),t[16]=c,t[17]=l,t[18]=d,t[19]=f):f=t[19],f}function xm(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 Sm(e){return e.name.replace(/\/$/,``)}function Cm(e,t){return e.name.localeCompare(t.name)}async function wm(e){let t=await e.json().catch(()=>null),n=Pr.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 Tm(){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 wm(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 wm(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 Em={"knowledge-base":Oc,"software-lifecycle":Te,"plain-notes":il,worldbuilding:dc,"writing-pipeline":Vc,gbrain:Fc};function Dm(e){return Em[e]??Oc}function Om(e){let t=(0,$.c)(28),{onPackSelect:n,className:r,packs:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=i===void 0,u,d;t[0]===l?(u=t[1],d=t[2]):(u=()=>{if(!l)return;let e=!1;return(async()=>{try{let t=await Tm().listPacks();if(e)return;t.ok?o(t.packs):c(t.error.message)}catch(t){let n=t;if(e)return;c(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},d=[l],t[0]=l,t[1]=u,t[2]=d),(0,Q.useEffect)(u,d);let f=l?a:i;if(s!==null){let e;t[3]===r?e=t[4]:(e=Gi(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[3]=r,t[4]=e);let n;return t[5]!==s||t[6]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,s]}),t[5]=s,t[6]=e,t[7]=n):n=t[7],n}if(f===null){let e;t[8]===r?e=t[9]:(e=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[8]=r,t[9]=e);let n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},Am).map(km),t[10]=n):n=t[10];let i;return t[11]!==e||t[12]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[11]=e,t[12]=n,t[13]=i):i=t[13],i}if(f.length===0){let e;t[14]===r?e=t[15]:(e=Gi(`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`,r),t[14]=r,t[15]=e);let n;return t[16]===e?n=t[17]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[16]=e,t[17]=n),n}let p;t[18]===r?p=t[19]:(p=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[18]=r,t[19]=p);let m;if(t[20]!==n||t[21]!==f){let e;t[23]===n?e=t[24]:(e=e=>(0,Z.jsx)(jm,{pack:e,onSelect:()=>n(e.id)},e.id),t[23]=n,t[24]=e),m=f.map(e),t[20]=n,t[21]=f,t[22]=m}else m=t[22];let h;return t[25]!==p||t[26]!==m?(h=(0,Z.jsx)(`div`,{className:p,children:m}),t[25]=p,t[26]=m,t[27]=h):h=t[27],h}function km(e){return(0,Z.jsx)(Nm,{},`skeleton-${e}`)}function Am(e,t){return t}function jm(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Dm(n.id),t[0]=n.id,t[1]=i);let a=i,{files:o,folders:s}=n.entryCounts,c;t[2]===a?c=t[3]:(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-8 items-center justify-center rounded-lg bg-primary/5 text-primary`,children:(0,Z.jsx)(a,{className:`size-4`})}),t[2]=a,t[3]=c);let l;t[4]===n.name?l=t[5]:(l=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.name}),t[4]=n.name,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n.description?d=t[10]:(d=(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.description}),t[9]=n.description,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==s?(p=Mm({files:o,folders:s}),t[14]=o,t[15]=s,t[16]=p):p=t[16];let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`p`,{className:`mt-auto pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:p}),t[17]=p,t[18]=m);let h;return t[19]!==r||t[20]!==f||t[21]!==m?(h=(0,Z.jsxs)(`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:[f,m]}),t[19]=r,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Mm({files:e,folders:t}){let n=e>0?`${e} ${e===1?`file`:`files`}`:null,r=`${t} ${t===1?`folder`:`folders`}`;return n?`${n} · ${r}`:r}function Nm(){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)(ee,{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}function Pm(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`grid w-full gap-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Yu,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fm(e){let t=(0,$.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Zu,{"data-slot":`radio-group-indicator`,className:`flex size-4 items-center justify-center`,children:(0,Z.jsx)(`span`,{className:`absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,Z.jsx)(Xu,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var Im=`knowledge-base`;function Lm(e){let t=(0,$.c)(68),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,{_:o}=Yt(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={kind:`loading`},t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(a??Im),[m,h]=(0,Q.useState)(`project-root`),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(a===void 0?`pick`:`configure`),b=(0,Q.useRef)(!0),x=u?.find(e=>e.id===f),S,C;t[1]!==n||t[2]!==u?(S=()=>{if(!n||u!==null)return;let e=!1;return(async()=>{try{let t=await Tm().listPacks();if(e)return;t.ok?d(t.packs):(d([]),l({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;d([]),l({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,u],t[1]=n,t[2]=u,t[3]=S,t[4]=C):(S=t[3],C=t[4]),(0,Q.useEffect)(S,C);let w,T;t[5]!==a||t[6]!==n?(w=()=>{n&&(p(a??Im),h(`project-root`),_(``),y(a===void 0?`pick`:`configure`),l({kind:`loading`}),b.current=!0)},T=[n,a],t[5]=a,t[6]=n,t[7]=w,t[8]=T):(w=t[7],T=t[8]),(0,Q.useEffect)(w,T),(0,Q.useEffect)(()=>{x&&_(x.defaultSubfolder??``)},[x]);let E;t[9]===g?E=t[10]:(E=g.trim(),t[9]=g,t[10]=E);let D=E,O=m===`subfolder`&&D===``,k,A;t[11]!==o||t[12]!==n||t[13]!==u||t[14]!==m||t[15]!==f||t[16]!==v||t[17]!==O||t[18]!==D?(k=()=>{if(!n||v!==`configure`||u===null)return;if(O){l({kind:`error`,message:o({id:`Z8KDox`})});return}let e=m===`project-root`?void 0:D,t=b.current?0:200;b.current=!1;let r=!1,i=setTimeout(()=>{r||(l(Rm),Tm().plan({rootDir:e,packId:f}).then(e=>{if(!r){if(!e.ok){l({kind:`error`,message:e.error.message});return}l(e.plan.created.length>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||l({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},A=[n,v,u,f,m,D,O,o],t[11]=o,t[12]=n,t[13]=u,t[14]=m,t[15]=f,t[16]=v,t[17]=O,t[18]=D,t[19]=k,t[20]=A):(k=t[19],A=t[20]),(0,Q.useEffect)(k,A);let j=async function(){if(c.kind!==`plan`)return;let e=c.plan;l({kind:`applying`,plan:e});let t;try{t=await Tm().apply(e,{packId:f})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Y.error(o({id:`iqugog`,values:{errorDetail:r}})),l({kind:`plan`,plan:e});return}if(t.ok){let e=x?.name??o({id:`W8vpBM`}),n=t.result.applied,a=o(n===0?{id:`K6jjWB`,values:{packName:e}}:{id:`x3-2ta`,values:{packName:e,projectEntries:n}});Y.success(a),i?.(),r(!1)}else{let n=t.error.message;Y.error(o({id:`iqugog`,values:{errorDetail:n}})),l({kind:`plan`,plan:e})}},M=a!==void 0,N=x?.name,P=o(v===`configure`&&x?{id:`hxEUVJ`,values:{selectedPackName:N}}:{id:`RGkNeJ`}),F;t[21]!==o||t[22]!==x||t[23]!==v?(F=v===`configure`&&x?x.description:o({id:`T-4cw2`}),t[21]=o,t[22]=x,t[23]=v,t[24]=F):F=t[24];let I=F,L;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(L=function(e){p(e),y(`configure`),b.current=!0},t[25]=L):L=t[25];let R=L,z;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(z=function(){y(`pick`),l({kind:`loading`}),b.current=!0},t[26]=z):z=t[26];let B=z,V;t[27]===P?V=t[28]:(V=(0,Z.jsx)($t,{children:P}),t[27]=P,t[28]=V);let H;t[29]===I?H=t[30]:(H=(0,Z.jsx)(Zt,{children:I}),t[29]=I,t[30]=H);let U;t[31]!==V||t[32]!==H?(U=(0,Z.jsxs)(un,{children:[V,H]}),t[31]=V,t[32]=H,t[33]=U):U=t[33];let W;t[34]!==u||t[35]!==c||t[36]!==m||t[37]!==x||t[38]!==v||t[39]!==g?(W=v===`pick`?(0,Z.jsx)(sn,{children:(0,Z.jsx)(Om,{packs:u,onPackSelect:R})}):(0,Z.jsxs)(sn,{className:`space-y-6`,children:[(0,Z.jsx)(zm,{choice:m,subfolder:g,placeholder:x?.defaultSubfolder??`subfolder`,onChoiceChange:h,onSubfolderChange:_}),(0,Z.jsx)(Bm,{phase:c,selectedPack:x})]}),t[34]=u,t[35]=c,t[36]=m,t[37]=x,t[38]=v,t[39]=g,t[40]=W):W=t[40];let G;t[41]!==M||t[42]!==v?(G=v===`configure`&&!M?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:B,children:[(0,Z.jsx)(la,{"aria-hidden":`true`,className:`h-4 w-4`}),(0,Z.jsx)(J,{id:`iH8pgl`})]}):null,t[41]=M,t[42]=v,t[43]=G):G=t[43];let te;t[44]===r?te=t[45]:(te=()=>r(!1),t[44]=r,t[45]=te);let ne;t[46]===c.kind?ne=t[47]:(ne=c.kind===`already-seeded`||c.kind===`error`?(0,Z.jsx)(J,{id:`yz7wBu`}):(0,Z.jsx)(J,{id:`dEgA5A`}),t[46]=c.kind,t[47]=ne);let re;t[48]!==te||t[49]!==ne?(re=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,onClick:te,children:ne}),t[48]=te,t[49]=ne,t[50]=re):re=t[50];let ie;t[51]!==j||t[52]!==c.kind||t[53]!==v||t[54]!==O?(ie=v===`configure`&&c.kind===`plan`?(0,Z.jsx)(X,{onClick:j,disabled:O,children:(0,Z.jsx)(J,{id:`4TzU0n`})}):v===`configure`&&c.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{id:`XYlJJT`})]}):null,t[51]=j,t[52]=c.kind,t[53]=v,t[54]=O,t[55]=ie):ie=t[55];let ae;t[56]!==G||t[57]!==re||t[58]!==ie?(ae=(0,Z.jsxs)(cn,{children:[G,re,ie]}),t[56]=G,t[57]=re,t[58]=ie,t[59]=ae):ae=t[59];let oe;t[60]!==U||t[61]!==W||t[62]!==ae?(oe=(0,Z.jsxs)(rn,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[U,W,ae]}),t[60]=U,t[61]=W,t[62]=ae,t[63]=oe):oe=t[63];let se;return t[64]!==r||t[65]!==n||t[66]!==oe?(se=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:oe}),t[64]=r,t[65]=n,t[66]=oe,t[67]=se):se=t[67],se}function Rm(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function zm(e){let t=(0,$.c)(21),{choice:n,subfolder:r,placeholder:i,onChoiceChange:a,onSubfolderChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:(0,Z.jsx)(J,{id:`3wiBAs`})}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e),t[1]=a,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Oo,{children:(0,Z.jsx)(J,{id:`RSqaSd`})}),t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(So,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Do,{orientation:`horizontal`,children:[(0,Z.jsxs)(po,{children:[l,(0,Z.jsx)(to,{className:`text-1sm`,children:(0,Z.jsx)(J,{id:`vPYaz3`})})]}),(0,Z.jsx)(Fm,{value:`project-root`,id:`seed-root-project-root`})]})}),t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(Oo,{children:(0,Z.jsx)(J,{id:`ZWgr0b`})}),t[5]=d):d=t[5];let f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(to,{className:`nth-last-2:mt-0 text-1sm`,children:(0,Z.jsx)(J,{id:`GUpclA`})}),t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==o||t[9]!==i||t[10]!==r?(p=n===`subfolder`&&(0,Z.jsx)(Go,{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]=p):p=t[11];let m;t[12]===p?m=t[13]:(m=(0,Z.jsxs)(po,{children:[d,f,p]}),t[12]=p,t[13]=m);let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Fm,{value:`subfolder`,id:`seed-root-subfolder`}),t[14]=h):h=t[14];let g;t[15]===m?g=t[16]:(g=(0,Z.jsx)(So,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Do,{orientation:`horizontal`,children:[m,h]})}),t[15]=m,t[16]=g);let _;return t[17]!==n||t[18]!==g||t[19]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(Pm,{className:`sm:flex`,value:n,onValueChange:c,children:[u,g]})]}),t[17]=n,t[18]=g,t[19]=c,t[20]=_):_=t[20],_}function Bm(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)(ee,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(J,{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)(J,{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)(J,{id:`gcV0dI`})})]}),t[4]=n):n=t[4],n}let i;t[5]!==n.plan||t[6]!==r?(i=(0,Z.jsx)(bm,{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(Vm)}):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 Vm(e){return(0,Z.jsx)(`p`,{children:e},e)}var Hm=[{id:`claude-cowork`,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`},{id:`claude-code`,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,hasWebFallback:!0,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.`}],Um=Hm.filter(e=>e.id!==`claude-cowork`),Wm=`#settings`;function Gm(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function Km(e){return e.replace(/^#/,``)===`settings`}function qm(){return typeof window>`u`?``:window.location.hash}function Jm(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(Xm),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{(0,Q.startTransition)(()=>{n(Km(qm()))})};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=Ym,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Ym(){typeof window>`u`||Km(qm())&&window.history.back()}function Xm(){return Km(qm())}function Zm(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(eh),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch($m);if(!e||!t.ok)return;let i=Jr.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(Qm),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Qm(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function $m(){return null}function eh(){return th()}function th(e=typeof window>`u`?void 0:window){if(!e)return null;let t=e.okDesktop;return t?{contentDir:t.config.projectPath,pathSeparator:t.platform===`win32`?`\\`:`/`}:null}function nh(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 rh(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=$n(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 ih(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?nh(e):rh()}var ah=`ok:skill:cowork:installed`,oh=`1`,sh=250,ch=`/api/skill/install-state`;function lh(e){return`${ah}:v${e}`}var uh=new Map;async function dh(e={},t={}){let n=t.force?`__force__`:`__default__`,r=uh.get(n);if(r)return r;let i=fh(e,t);return uh.set(n,i),i.finally(()=>{uh.get(n)===i&&uh.delete(n)}),i}async function fh(e,t){let n=e.installer===void 0?ih():e.installer,r=ph(e.storage),i=e.fetchSnapshot??hh,a=e.serverTimeoutMs??sh,o=null;if(!t.force){try{o=await gh(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=lh(o?.currentVersion??e.fallbackSkillVersion??mh());if(!t.force&&r?.getItem(s)===oh)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,oh)}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 ph(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function mh(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function hh(){let e;try{e=await fetch(ch,{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 gh(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function _h(e){return dh({},e)}function vh(){return dh({},{force:!0})}async function yh(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 bh(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return yh({target:`claude-cowork`,url:ti({mode:`cowork`},e)},n);case`claude-code`:return yh({target:`claude-code`,url:ti({mode:`code`},e)},n);case`codex`:return yh({target:`codex`,url:ri(e)},n);case`cursor`:return yh({target:`cursor`,url:Si(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function xh(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:Sh(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:Sh(e)}}}function Sh(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 Ch(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 wh(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Th(e){return`${e}.md`}function Eh(e){if(!e.docName||!e.workspace)return null;let t=Th(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:wh(n,t,r)}}function Dh(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Oh(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function kh(e){return xh(e.installUrl).then(()=>void 0)}function Ah(e){return`Opened in ${e}.`}function jh(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 Mh(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Nh(e,t,n,r){return t.ok?{target:e,host:n,outcome:`ok`,ts:r}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason}}function Ph(e){return e.docContext===null?e.folderRelativePath?Ii(e.folderRelativePath):Ri():Yr(e.docContext.relativePath)}async function Fh(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:Ph(t)},a=await n.dispatchHandoff(i),o=Nh(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Ah(s));else{let i=Mh(r),a=jh(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Fh(e,t,n,r+1)}}})}return a}function Ih(e){return Hm.find(t=>t.id===e)?.displayName??e}function Lh(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Rh(){return{dispatchHandoff:bh,recordHandoff:Ch,toast:{success:e=>{Y.success(e)},error:(e,t)=>{Y.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Lh(),getDisplayName:Ih,ensureCoworkSkillInstalled:_h}}function zh(){return{dispatch:(e,t)=>Fh(e,t,Rh()),reinstallCoworkSkill:vh}}var Bh=[...new Set(Hm.flatMap(e=>e.schemes))];function Vh(e,t){let n=t.now?.()??Date.now(),r={};for(let t of Hm){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 Hh(e){return Vh({},e)}async function Uh(e){let t=e.schemes??Bh,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 Wh=Object.fromEntries(Bh.map(e=>[e,{installed:!1}]));async function Gh(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 Wh}if(!t.ok)return Wh;let n;try{n=await t.json()}catch{return Wh}if(typeof n!=`object`||!n||Array.isArray(n))return Wh;let r=n,i={};for(let e of Bh)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Kh(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 qh(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Hh({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Vh(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=!Kh(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 Jh(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Yh(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Uh({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>Gh({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Xh(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Zh),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=qh(Yh());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 Zh(){return Hh({isElectronHost:Jh(),now:Date.now})}var Qh=3e3,$h=(e,t,n)=>gl(e,t,n,`CommandPalette`);function eg(e){window.location.assign(qr(e))}function tg(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Fi(t)}function ng(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?T:St,s;t[0]===n?s=t[1]:(s=`title`in n&&n.title?n.title:n.path.split(`/`).pop()??n.path,t[0]=n,t[1]=s);let c=s,l=`snippet`in n?n.snippet:void 0,u=`${n.kind} ${n.path}`,d=`command-palette-nav-${n.kind}-${n.path}`,f;t[2]===o?f=t[3]:(f=(0,Z.jsx)(o,{className:`mt-0.5`}),t[2]=o,t[3]=f);let p;t[4]!==a||t[5]!==c?(p=(0,Z.jsx)(`span`,{className:`truncate font-medium`,children:(0,Z.jsx)(rg,{query:a,text:c})}),t[4]=a,t[5]=c,t[6]=p):p=t[6];let m;t[7]!==n.path||t[8]!==a?(m=(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-xs`,children:(0,Z.jsx)(rg,{query:a,text:n.path})}),t[7]=n.path,t[8]=a,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==l?(h=l?(0,Z.jsx)(`span`,{className:`max-h-10 overflow-hidden text-muted-foreground text-xs leading-relaxed`,children:(0,Z.jsx)(rg,{query:a,text:l})}):null,t[10]=a,t[11]=l,t[12]=h):h=t[12];let g;t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[p,m,h]}),t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==i||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==g?(_=(0,Z.jsxs)(k,{value:u,onSelect:i,"data-testid":d,className:`items-start`,children:[f,g]}),t[17]=i,t[18]=u,t[19]=d,t[20]=f,t[21]=g,t[22]=_):_=t[22],_}function rg(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=Bp(n,r).map(ig),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 ig(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 ag({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function og(e){let t=(0,$.c)(151),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,{_:o}=Yt(),[s,c]=(0,Q.useState)(``),l=(0,Q.useDeferredValue)(s),u=l.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[p,m]=(0,Q.useState)(d),[h,g]=(0,Q.useState)(`idle`),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[1]=_):_=t[1];let[v,y]=(0,Q.useState)(_),b;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[2]=b):b=t[2];let[x,S]=(0,Q.useState)(b),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),O;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(O=[],t[3]=O):O=t[3];let[A,j]=(0,Q.useState)(O),[M,N]=(0,Q.useState)(`idle`),P;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(P=[],t[4]=P):P=t[4];let[F,I]=(0,Q.useState)(P),[L,R]=(0,Q.useState)(`idle`),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),{activeDocName:H,activeTarget:U}=ft(),{pages:W,pageTitles:G,pageMeta:ee,folderPaths:te}=Zr(),ne=Zm(),{states:re,refresh:ie}=Xh(),{dispatch:ae}=zh(),oe=Eh({docName:H,workspace:ne}),se=Np(W,te,G,ee),ce=Tp(x,new Set(se.map(lg))),le=a?.config.projectPath??null,ue=a?v.filter(e=>e.path!==le):[],de;t[5]!==H||t[6]!==U?(de=tg(U,H),t[5]=H,t[6]=U,t[7]=de):de=t[7];let fe=de,pe=u===``?[]:Rp(se,u,8),me,he;t[8]!==i||t[9]!==r?(me=()=>{let e=function(e){e.key===`k`&&(Ui()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},he=[i,r],t[8]=i,t[9]=r,t[10]=me,t[11]=he):(me=t[10],he=t[11]),(0,Q.useEffect)(me,he);let ge,_e;t[12]!==o||t[13]!==a||t[14]!==r||t[15]!==ie?(ge=()=>{if(r){if(S(Sp()),ie(),a){let e=!1;return $h(async()=>{let t=await a.project.listRecent();e||y(t)},o({id:`fYKgzG`})),()=>{e=!0}}return}c(``),j([]),N(`idle`),z.current=!1,I([]),R(`idle`)},_e=[r,a,ie,o],t[12]=o,t[13]=a,t[14]=r,t[15]=ie,t[16]=ge,t[17]=_e):(ge=t[16],_e=t[17]),(0,Q.useEffect)(ge,_e);let ve;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>{B.current&&(B.current.scrollTop=0)},t[18]=ve):ve=t[18];let xe;t[19]===s?xe=t[20]:(xe=[s],t[19]=s,t[20]=xe),(0,Q.useEffect)(ve,xe);let Se=Gp(l,new Set(A.map(cg))),we=Se.kind!==`normal`,Te=Se.kind===`tag-list`?Se.query:``,De=Se.kind===`tag-docs`?Se.tagName:``,Oe,ke;t[21]!==we||t[22]!==r?(Oe=()=>{if(!r||!we||z.current)return;z.current=!0,N(`loading`);let e=!1;return qp().then(t=>{e||(j(t),N(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),j([]),N(`error`))}),()=>{e=!0}},ke=[r,we],t[21]=we,t[22]=r,t[23]=Oe,t[24]=ke):(Oe=t[23],ke=t[24]),(0,Q.useEffect)(Oe,ke);let Ae=Se.kind===`tag-docs`?Se.tagName:null;(0,Q.useEffect)(()=>{if(!r||Ae===null){I([]),R(`idle`);return}R(`loading`),I([]);let e=!1;return Jp(Ae).then(t=>{e||(I(t),R(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),I([]),R(`error`))}),()=>{e=!0}},[r,Ae]),(0,Q.useEffect)(()=>{if(!r||!u||we){m([]),g(`idle`);return}let e=new AbortController;g(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),m([]),g(`error`)},Qh);return Hp(u,{signal:e.signal}).then(e=>{window.clearTimeout(n),m(e),g(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(m([]),g(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,u,we]);let je;t[25]!==o||t[26]!==i?(je=(e,t)=>{let n=t===void 0?o({id:`uuoHOU`}):t;i(!1),$h(async()=>{await e()},n)},t[25]=o,t[26]=i,t[27]=je):je=t[27];let Me=je,Ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=wp(Sp(),t);Cp(n),S(n)},t[28]=Ne):Ne=t[28];let Pe=Ne,Fe;t[29]===i?Fe=t[30]:(Fe=function(e){i(!1),Pe(e),eg(e.path)},t[29]=i,t[30]=Fe);let Ie=Fe,Le=!we&&u===``&&ce.length>0,Re=ag({searchResults:p,fallbackSearchResults:pe,searchStatus:h}),ze=!we&&Re.length>0,q=!we&&u!==``&&h===`loading`&&!ze,Be;t[31]!==o||t[32]!==l||t[33]!==we?(Be=!we&&Up(o({id:`HdkSiO`}),l,[`create file`]),t[31]=o,t[32]=l,t[33]=we,t[34]=Be):Be=t[34];let Ve=Be,He;t[35]!==o||t[36]!==l||t[37]!==we?(He=!we&&Up(o({id:`96G6Re`}),l,[`create folder`]),t[35]=o,t[36]=l,t[37]=we,t[38]=He):He=t[38];let Ue=He,We;t[39]!==o||t[40]!==H||t[41]!==l||t[42]!==we?(We=!we&&H!==null&&Up(o({id:`3Fcb0I`}),l,[`graph panel network`]),t[39]=o,t[40]=H,t[41]=l,t[42]=we,t[43]=We):We=t[43];let Ge=We,Ke;t[44]!==o||t[45]!==l||t[46]!==we?(Ke=!we&&Up(o({id:`fWi7pn`}),l,[`scaffold`,`seed`,`pack`,`starter`]),t[44]=o,t[45]=l,t[46]=we,t[47]=Ke):Ke=t[47];let qe=Ke,Je;t[48]!==o||t[49]!==a||t[50]!==l||t[51]!==we?(Je=!we&&a!==null&&Up(o({id:`WPwDin`}),l,[`project`]),t[48]=o,t[49]=a,t[50]=l,t[51]=we,t[52]=Je):Je=t[52];let Ye=Je,Xe;t[53]!==o||t[54]!==a||t[55]!==l||t[56]!==we?(Xe=!we&&a!==null&&Up(o({id:`2Xs2jo`}),l,[`switch project navigator projects`]),t[53]=o,t[54]=a,t[55]=l,t[56]=we,t[57]=Xe):Xe=t[57];let Ze=Xe,Qe;t[58]!==o||t[59]!==l||t[60]!==we?(Qe=!we&&Up(o({id:`Tz0i8g`}),l,[`preferences config`]),t[58]=o,t[59]=l,t[60]=we,t[61]=Qe):Qe=t[61];let $e=Qe,et;t[62]!==o||t[63]!==l||t[64]!==we?(et=!we&&Up(o({id:`62Pc08`}),l,[`claude desktop install cowork`]),t[62]=o,t[63]=l,t[64]=we,t[65]=et):et=t[65];let tt=et,nt=!we&&a!==null&&ue.length>0&&(u===``||ue.some(e=>Up(`${e.name} ${e.path}`,l,[`open recent project`]))),rt=!we&&oe!==null&&(u===``||Um.some(e=>{let t=e.displayName;return Up(o({id:`WqLq6M`,values:{displayName:t}}),l,[e.id,`agent handoff`,`open in`])})),it=Se.kind===`tag-list`?Kp(A,Se.query):[],at=Se.kind===`tag-list`&&M!==`loading`&&it.length===0,ot=Se.kind===`tag-docs`&&L===`success`&&F.length===0,st=we||Le||ze||q||Ve||Ue||Ge||qe||Ye||Ze||$e||tt||nt||rt,ct;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(ct=function(e){c(`${Wp}${e}`)},t[66]=ct):ct=t[66];let lt=ct,ut=K,dt;t[67]===o?dt=t[68]:(dt=o({id:`1bDVu5`}),t[67]=o,t[68]=dt);let pt;t[69]===o?pt=t[70]:(pt=o({id:`5GRxoA`}),t[69]=o,t[70]=pt);let mt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(mt={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[71]=mt):mt=t[71];let ht;t[72]===o?ht=t[73]:(ht=o({id:`ggs9f8`}),t[72]=o,t[73]=ht);let gt;t[74]!==s||t[75]!==ht?(gt=(0,Z.jsx)(Ce,{ref:V,value:s,onValueChange:c,placeholder:ht}),t[74]=s,t[75]=ht,t[76]=gt):gt=t[76];let _t;t[77]===we?_t=t[78]:(_t=()=>{c(we?``:Wp),V.current?.focus()},t[77]=we,t[78]=_t);let vt=we?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,yt;t[79]===vt?yt=t[80]:(yt=Gi(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,vt),t[79]=vt,t[80]=yt);let bt,xt;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,Z.jsx)(ye,{className:`size-3.5`}),xt=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`0rwwOn`})}),t[81]=bt,t[82]=xt):(bt=t[81],xt=t[82]);let Ct;t[83]!==we||t[84]!==_t||t[85]!==yt?(Ct=(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5 border-b px-3 py-2`,children:(0,Z.jsxs)(`button`,{type:`button`,onClick:_t,"data-testid":`command-palette-filter-tag`,"data-active":we,"aria-pressed":we,className:yt,children:[bt,xt]})}),t[83]=we,t[84]=_t,t[85]=yt,t[86]=Ct):Ct=t[86];let wt=be,Et;t[87]!==ze||t[88]!==q?(Et=q&&!ze?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`WRNXKp`})}):null,t[87]=ze,t[88]=q,t[89]=Et):Et=t[89];let Dt=st?null:(0,Z.jsx)(qt,{children:h===`error`?(0,Z.jsx)(J,{id:`pkAft1`}):(0,Z.jsx)(J,{id:`i3f2kh`})}),Ot=Se.kind===`tag-list`?(0,Z.jsxs)(f,{heading:Se.query?o({id:`evs0iw`,values:{tagListQuery:Te}}):o({id:`2QM24L`}),children:[M===`loading`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`a_u4ck`})}):null,M===`error`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`MZoxVx`})}):null,at?(0,Z.jsx)(qt,{children:Se.query?o({id:`X0ttSN`,values:{tagListQuery:Te}}):o({id:`JLUTgi`})}):null,it.map(e=>(0,Z.jsxs)(k,{value:`tag ${e.name}`,onSelect:()=>lt(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(ye,{}),(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)(J,{id:`fVcm9t`,values:{0:e.count}})})]},`tag:${e.name}`))]}):null,kt=Se.kind===`tag-docs`?(0,Z.jsxs)(f,{heading:o({id:`hGmuTc`,values:{tagDocsName:De}}),children:[L===`loading`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`pWbsW6`})}):null,L===`error`?(0,Z.jsx)(qt,{children:(0,Z.jsx)(J,{id:`48uGTI`})}):null,ot?(0,Z.jsx)(qt,{children:o({id:`NIWAux`,values:{tagDocsName:De}})}):null,F.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName,n=e.matchingTags.filter(e=>e!==Se.tagName).map(sg).join(`, `);return(0,Z.jsxs)(k,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),eg(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(St,{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!==Se.tagName)?(0,Z.jsx)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:(0,Z.jsx)(J,{id:`CvsD6Y`,values:{viaTags:n}})}):null]})]},`tag-doc:${e.docName}`)})]}):null,At=Le?(0,Z.jsx)(f,{heading:o({id:`MmDDWK`}),children:ce.map(e=>(0,Z.jsx)(ng,{entry:e,onSelect:()=>Ie(e)},xp(e.kind,e.path)))}):null,jt;t[90]!==o||t[91]!==H||t[92]!==i||t[93]!==w||t[94]!==D||t[95]!==Ve||t[96]!==Ue||t[97]!==Ge||t[98]!==qe?(jt=Ve||Ue||Ge||qe?(0,Z.jsxs)(f,{heading:o({id:`45MZFs`}),children:[Ve?(0,Z.jsxs)(k,{value:`new file create file`,onSelect:()=>{i(!1),w(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(gc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`HdkSiO`})})]}):null,Ue?(0,Z.jsxs)(k,{value:`new folder create folder`,onSelect:()=>{i(!1),w(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(xc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`96G6Re`})})]}):null,Ge?(0,Z.jsxs)(k,{value:`open graph graph panel network`,onSelect:()=>{H&&(i(!1),Qp(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Fc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`3Fcb0I`})})]}):null,qe?(0,Z.jsxs)(k,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),D(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(Lc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`fWi7pn`})})]}):null]}):null,t[90]=o,t[91]=H,t[92]=i,t[93]=w,t[94]=D,t[95]=Ve,t[96]=Ue,t[97]=Ge,t[98]=qe,t[99]=jt):jt=t[99];let Mt=rt?(0,Z.jsx)(f,{heading:o({id:`O7_W_a`}),children:Um.filter(e=>{let t=e.displayName;return Up(o({id:`WqLq6M`,values:{displayName:t}}),l,[e.id,`agent handoff`,`open in`])}).map(e=>{let t=re[e.id],n=t.installed===!0&&oe!==null,r=e.displayName,a=t.installed===null?o({id:`IA6JW2`}):t.installed===!1?o({id:`5SwVv1`}):null,s=o(a?{id:`1ZpfyB`,values:{displayName:r,hint:a}}:{id:`WqLq6M`,values:{displayName:r}});return(0,Z.jsxs)(k,{value:`send to ai ${e.displayName} ${e.id} agent open in`,disabled:!n,onSelect:()=>{!n||!oe||(i(!1),ae(e.id,oe))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:(0,Z.jsx)(J,{id:`WqLq6M`,values:{displayName:r}})}),a?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:a}):null]},e.id)})}):null,Nt;t[100]!==o||t[101]!==a||t[102]!==i||t[103]!==Me||t[104]!==tt||t[105]!==Ye||t[106]!==Ze||t[107]!==$e?(Nt=Ye||Ze||$e||tt?(0,Z.jsxs)(f,{heading:o({id:`e0NrBM`}),children:[Ye&&a?(0,Z.jsxs)(k,{value:`open folder on disk project`,onSelect:()=>Me(async()=>{let e=await a.dialog.openFolder();e&&await a.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})}),"data-testid":`command-palette-open-folder`,children:[(0,Z.jsx)(T,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`WPwDin`})}),(0,Z.jsx)(Ee,{children:`⌘O`})]}):null,Ze&&a?(0,Z.jsxs)(k,{value:`switch-project navigator projects`,onSelect:()=>Me(()=>a.navigator.open(),o({id:`jol95m`})),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(Dc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`2Xs2jo`})}),(0,Z.jsx)(Ee,{children:`⌘⇧N`})]}):null,$e?(0,Z.jsxs)(k,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Wm)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(Zc,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),(0,Z.jsx)(Ee,{children:`⌘,`})]}):null,tt?(0,Z.jsxs)(k,{value:`install claude desktop cowork app`,onSelect:()=>{i(!1),window.location.hash=`#install-claude-desktop`},"data-testid":`command-palette-install-claude-desktop`,children:[(0,Z.jsx)(ho,{}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`62Pc08`})})]}):null]}):null,t[100]=o,t[101]=a,t[102]=i,t[103]=Me,t[104]=tt,t[105]=Ye,t[106]=Ze,t[107]=$e,t[108]=Nt):Nt=t[108];let Pt=nt&&a?(0,Z.jsx)(f,{heading:o({id:`3iyGWF`}),children:ue.filter(e=>Up(`${e.name} ${e.path}`,l,[`open recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(k,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>Me(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),o({id:`SUOoXn`})),"data-testid":`command-palette-recent-${e.path}`,className:`items-start`,children:[(0,Z.jsx)(Tt,{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)(J,{id:`ls1N1w`})]}):null]})]})]},e.path))}):null,Ft=ze?(0,Z.jsx)(f,{heading:o({id:`A1taO8`}),children:Re.map(e=>(0,Z.jsx)(ng,{entry:e,query:u,onSelect:()=>Ie(e)},xp(e.kind,e.path)))}):null,It;t[109]!==wt||t[110]!==Et||t[111]!==Dt||t[112]!==Ot||t[113]!==kt||t[114]!==At||t[115]!==jt||t[116]!==Mt||t[117]!==Nt||t[118]!==Pt||t[119]!==Ft?(It=(0,Z.jsxs)(wt,{ref:B,className:`subtle-scrollbar`,children:[Et,Dt,Ot,kt,At,jt,Mt,Nt,Pt,Ft]}),t[109]=wt,t[110]=Et,t[111]=Dt,t[112]=Ot,t[113]=kt,t[114]=At,t[115]=jt,t[116]=Mt,t[117]=Nt,t[118]=Pt,t[119]=Ft,t[120]=It):It=t[120];let Lt;t[121]!==ut||t[122]!==i||t[123]!==r||t[124]!==dt||t[125]!==pt||t[126]!==mt||t[127]!==gt||t[128]!==Ct||t[129]!==It?(Lt=(0,Z.jsxs)(ut,{open:r,onOpenChange:i,title:dt,description:pt,className:`sm:max-w-2xl`,commandProps:mt,children:[gt,Ct,It]}),t[121]=ut,t[122]=i,t[123]=r,t[124]=dt,t[125]=pt,t[126]=mt,t[127]=gt,t[128]=Ct,t[129]=It,t[130]=Lt):Lt=t[130];let Rt=C===`file`,zt;t[131]===w?zt=t[132]:(zt=e=>{e||w(null)},t[131]=w,t[132]=zt);let Bt;t[133]!==fe||t[134]!==Rt||t[135]!==zt?(Bt=(0,Z.jsx)(dm,{open:Rt,onOpenChange:zt,kind:`file`,initialDir:fe}),t[133]=fe,t[134]=Rt,t[135]=zt,t[136]=Bt):Bt=t[136];let Vt=C===`folder`,Ht;t[137]===w?Ht=t[138]:(Ht=e=>{e||w(null)},t[137]=w,t[138]=Ht);let Ut;t[139]!==fe||t[140]!==Vt||t[141]!==Ht?(Ut=(0,Z.jsx)(dm,{open:Vt,onOpenChange:Ht,kind:`folder`,initialDir:fe}),t[139]=fe,t[140]=Vt,t[141]=Ht,t[142]=Ut):Ut=t[142];let Wt;t[143]!==E||t[144]!==D?(Wt=(0,Z.jsx)(Lm,{open:E,onOpenChange:D}),t[143]=E,t[144]=D,t[145]=Wt):Wt=t[145];let Gt;return t[146]!==Lt||t[147]!==Bt||t[148]!==Ut||t[149]!==Wt?(Gt=(0,Z.jsxs)(Z.Fragment,{children:[Lt,Bt,Ut,Wt]}),t[146]=Lt,t[147]=Bt,t[148]=Ut,t[149]=Wt,t[150]=Gt):Gt=t[150],Gt}function sg(e){return`#${e}`}function cg(e){return e.name}function lg(e){return xp(e.kind,e.path)}var ug=500;function dg(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function fg(e){return e===null?`no response`:e.kind===`null-collab`?`ok ui responded but server.lock has no port yet`:e.code===`network`?"network error (is `ok ui` running?)":e.code===`invalid-body`?`/api/config returned a malformed body`:`/api/config returned HTTP ${e.code}`}function pg(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=ft(),[a,o]=(0,Q.useState)(!1),s,c;e[0]!==n||e[1]!==t?(s=()=>{if(t!==null||n){o(!1);return}let e=setTimeout(()=>o(!0),ug);return()=>clearTimeout(e)},c=[t,n],e[0]=n,e[1]=t,e[2]=s,e[3]=c):(s=e[2],c=e[3]),(0,Q.useEffect)(s,c);let l=dg(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=fg(r),e[4]=r,e[5]=t);let n;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`ok status`}),e[6]=n):n=e[6];let a;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`code`,{className:`bg-red-100/60 px-1 rounded`,children:`.ok/local/last-spawn-error.log`}),e[7]=a):a=e[7];let o;e[8]===t?o=e[9]:(o=(0,Z.jsxs)(`span`,{children:[`Couldn't reach collab server — `,t,`. Try`,` `,n,` or check`,` `,a,`.`]}),e[8]=t,e[9]=o);let s;e[10]===i?s=e[11]:(s=(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:`Retry`}),e[10]=i,e[11]=s);let c;return e[12]!==o||e[13]!==s?(c=(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:[o,s]}),e[12]=o,e[13]=s,e[14]=c):c=e[14],c}let u;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(u=(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:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function mg(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($n(e)??Ie._({id:`lHwYMr`,values:{status:n,statusText:r}}))}return(await t.json()).docs??[]}function hg(){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,s]=(0,Q.useState)(a),c=(0,Q.useRef)(0),l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=function(e){let t=e.detail;if(!t||typeof t.value!=`string`)return;let r=c.current+=1;i(t.value),n(!0),s({kind:`loading`}),mg(t.value).then(e=>{c.current===r&&s({kind:`ready`,docs:e})}).catch(e=>{c.current===r&&s({kind:`error`,message:e instanceof Error?e.message:String(e)})})};return document.addEventListener(lt,e),()=>document.removeEventListener(lt,e)},u=[],e[1]=l,e[2]=u):(l=e[1],u=e[2]),(0,Q.useEffect)(l,u);let d;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){n(!1),window.location.assign(qr(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m={tagName:p},e[4]=p,e[5]=m);let h;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(h={0:(0,Z.jsx)(`span`,{className:`font-mono`})},e[6]=h):h=e[6];let g;e[7]===m?g=e[8]:(g=(0,Z.jsx)(un,{children:(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`7H4UHD`,values:m,components:h})})}),e[7]=m,e[8]=g);let _=r??``,v;e[9]!==o||e[10]!==_?(v=(0,Z.jsx)(sn,{children:(0,Z.jsx)(gg,{fetchState:o,tag:_,onSelectDoc:f})}),e[9]=o,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==g||e[13]!==v?(y=(0,Z.jsxs)(rn,{children:[g,v]}),e[12]=g,e[13]=v,e[14]=y):y=e[14];let b;return e[15]!==t||e[16]!==y?(b=(0,Z.jsx)(dn,{open:t,onOpenChange:n,children:y}),e[15]=t,e[16]=y,e[17]=b):b=e[17],b}function gg(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)(J,{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)(J,{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(_g)}):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 _g(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 vg=`raw-mdx-nav`,yg=`ok-editor-mode-v1`,bg=[`wysiwyg`,`source`],xg=`wysiwyg`;function Sg(e){return bg.includes(e)}function Cg(e=localStorage){try{let t=e.getItem(yg);if(t===null)return xg;if(Sg(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return xg}function wg(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Sg(n)?n:Cg(t)}function Tg(e,t=localStorage){try{return t.setItem(yg,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Eg(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(wg),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Tg(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 Dg(e){let t=(0,$.c)(25),{open:n,onResolved:r}=e,{_:i}=Yt(),a=Ba(),o;t[0]!==i||t[1]!==r||t[2]!==a?(o=function(e){if(a===null){Y.error(i({id:`fiMNLl`}));return}let t=a(e);if(!t.ok){let n=t.error;Y.error(i(e?{id:`FUMerq`,values:{detail:n}}:{id:`0t0bbC`,values:{detail:n}}));return}r()},t[0]=i,t[1]=r,t[2]=a,t[3]=o):o=t[3];let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(un,{children:(0,Z.jsx)(_a,{})}),t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(oo,{}),t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(sn,{children:[l,(0,Z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`ZLQol-`,components:{0:(0,Z.jsx)(`span`,{className:`font-medium`})}})})]}),t[6]=u):u=t[6];let d;t[7]===s?d=t[8]:(d=()=>s(!1),t[7]=s,t[8]=d);let f=a===null,p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(J,{id:`IKoTAC`}),t[9]=p):p=t[9];let m;t[10]!==d||t[11]!==f?(m=(0,Z.jsx)(X,{variant:`ghost`,className:`uppercase font-mono`,onClick:d,disabled:f,children:p}),t[10]=d,t[11]=f,t[12]=m):m=t[12];let h;t[13]===s?h=t[14]:(h=()=>s(!0),t[13]=s,t[14]=h);let g=a===null,_;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(J,{id:`XU0OXn`}),t[15]=_):_=t[15];let v;t[16]!==g||t[17]!==h?(v=(0,Z.jsx)(X,{onClick:h,disabled:g,children:_}),t[16]=g,t[17]=h,t[18]=v):v=t[18];let y;t[19]!==v||t[20]!==m?(y=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,showCloseButton:!1,children:[c,u,(0,Z.jsxs)(cn,{children:[m,v]})]}),t[19]=v,t[20]=m,t[21]=y):y=t[21];let b;return t[22]!==n||t[23]!==y?(b=(0,Z.jsx)(dn,{open:n,onOpenChange:Og,children:y}),t[22]=n,t[23]=y,t[24]=b):b=t[24],b}function Og(){}function kg(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=Ao();if(!r||r.state!==`conflict`)return null;let i=r.conflictCount,a=i>0?`${i} page${i===1?``:`s`}`:`Some pages`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(ei,{className:`size-4 shrink-0`}),t[0]=o):o=t[0];let s=i===1?`has`:`have`,c;t[1]!==a||t[2]!==s?(c=(0,Z.jsxs)(`span`,{className:`flex-1`,children:[a,` `,s,` conflicting changes.`]}),t[1]=a,t[2]=s,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,Z.jsx)(X,{variant:`outline`,size:`xs`,className:`shrink-0 border-amber-400 dark:border-amber-700 text-amber-800 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/50`,onClick:n,children:`Review and resolve`}),t[4]=n,t[5]=l);let u;return t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm border-b bg-amber-50 dark:bg-amber-950/30 text-amber-800 dark:text-amber-300 shrink-0`,children:[o,c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8],u}var Ag=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 jg(e,t,n,r,i,a){if(e==r)return[];let o=Vg(e,t,n,r,i,a),s=Hg(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 Ag(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Ag(t,t+o,i,i),new Ag(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 Ag(t,t,i,i+o),new Ag(n,n,i+o+c,a)]}if(c==1||l==1)return[new Ag(t,n,i,a)];let u=Wg(e,t,n,r,i,a);if(u){let[o,s,c]=u;return jg(e,t,o,r,i,s).concat(jg(e,o+c,n,r,s+c,a))}return Fg(e,t,n,r,i,a)}var Mg=1e9,Ng=0,Pg=!1;function Fg(e,t,n,r,i,a){let o=n-t,s=a-i;if(Mg<1e9&&Math.min(o,s)>Mg*16||Ng>0&&Date.now()>Ng)return Math.min(o,s)>Mg*64?[new Ag(t,n,i,a)]:Gg(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Lg.reset(c),Rg.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:Rg,f=d?null:Lg;for(let p=0;p<c;p++){if(p>Mg||Ng>0&&!(p&63)&&Date.now()>Ng)return Gg(e,t,n,r,i,a);let m=Lg.advance(p,o,s,c,d,!1,l)||Rg.advance(p,o,s,c,f,!0,u);if(m)return zg(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Ag(t,n,i,a)]}var Ig=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}},Lg=new Ig,Rg=new Ig;function zg(e,t,n,r,i,a,o,s){let c=!1;return!o_(e,r)&&++r==n&&(c=!0),!o_(i,s)&&++s==o&&(c=!0),c?[new Ag(t,n,a,o)]:jg(e,t,r,i,a,s).concat(jg(e,r,n,i,s,o))}function Bg(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Vg(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Bg(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-+!o_(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Hg(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Bg(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-+!o_(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Ug(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;;){o_(e,s)||s++;let u=s+o;if(o_(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=Vg(e,u,n,r,i+f+d.length,a),c=Hg(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 Wg(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Wg(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Ug(e,t,n,r,i,a,Math.floor(o/4),-1)}function Gg(e,t,n,r,i,a){Pg=!0;let o=n-t,s=a-i,c;if(o<s){let s=Ug(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Ug(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Ag(t,n,i,a)];let[l,u,d]=c;return jg(e,t,l,r,i,u).concat(jg(e,l+d,n,r,u+d,a))}function Kg(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 Ag(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function qg(e,t,n){for(;;){Kg(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Vg(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Ag(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Hg(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Ag(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 Ag(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 Ag(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function Jg(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=t_(t,a.fromA,l),f=e_(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 Ag(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=e_(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Ag(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=t_(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Ag(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=r_(n,a.fromB,a.toB),r,o=t<0?-1:n_(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=r_(t,a.fromA,a.toA),r,o=n<0?-1:n_(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 Kg(e,3),e}var Yg;try{Yg=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Xg(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Zg(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Xg(n):Yg?!i_(n)||t==e.length-1?+!!Yg.test(String.fromCharCode(n)):Yg.test(e.slice(t,t+2))?2:0:0}function Qg(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Xg(n):Yg?!a_(n)||t==1?+!!Yg.test(String.fromCharCode(n)):Yg.test(e.slice(t-2,t))?2:0:0}var $g=8;function e_(e,t,n){if(t==e.length||!Qg(e,t))return t;for(let r=t,i=t+n,a=0;a<$g;a++){let t=Zg(e,r);if(!t||r+t>i)return r;r+=t}return t}function t_(e,t,n){if(!t||!Zg(e,t))return t;for(let r=t,i=t-n,a=0;a<$g;a++){let t=Qg(e,r);if(!t||r-t<i)return r;r-=t}return t}function n_(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function r_(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var i_=e=>e>=55296&&e<=56319,a_=e=>e>=56320&&e<=57343;function o_(e,t){return!t||t==e.length||!i_(e.charCodeAt(t-1))||!a_(e.charCodeAt(t))}function s_(e,t,n){let r=n?.override;return r?r(e,t):(Mg=(n?.scanLimit??1e9)>>1,Ng=n?.timeout?Date.now()+n.timeout:0,Pg=!1,qg(e,t,jg(e,0,e.length,t,0,t.length)))}function c_(){return!Pg}function l_(e,t,n){return Jg(s_(e,t,n),e,t)}var u_=_s.define({combine:e=>e[0]}),d_=vs.define(),f_=_s.define(),p_=fs.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(d_)&&(e=n.value);for(let n of t.state.facet(f_))e=n(e,t);return e}});function m_(e){let t=e.field(p_,!1);if(!t)return null;let n=e.facet(u_);return{chunks:t,side:n?n.side:null}}var h_=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 v_(l_(e.toString(),t.toString(),n),e,t,0,0,c_())}static updateA(e,t,n,r,i){return S_(x_(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return S_(x_(e,r,!1,t.length),e,t,n,i)}};function g_(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 __(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 v_(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=g_(c.fromA+r,c.fromB+i,t,n),[d,f]=__(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]=g_(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]=__(a.toA+r,a.toB+i,t,n),s++}o.push(new h_(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var y_=1e3;function b_(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 x_(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>y_&&([l,d]=b_(e,a-y_,n,!0)),o<t.length-y_&&([u,f]=b_(e,o+y_,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 S_(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=l_(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of v_(h,n,r,d,f,c_()))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 C_={scanLimit:500},w_=ys.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=P_(e))}update(e){(e.docChanged||e.viewportChanged||E_(e.startState,e.state)||D_(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=P_(e.view))}},{decorations:e=>e.deco}),T_=ls.low(Cs({class:`cm-changeGutter`,markers:e=>e.plugin(w_)?.gutter||Es.empty}));function E_(e,t){return e.field(p_,!1)!=t.field(p_,!1)}function D_(e,t){return e.facet(u_)!=t.facet(u_)}var O_=hs.line({class:`cm-changedLine`}),k_=hs.mark({class:`cm-changedText`}),A_=hs.mark({tagName:`ins`,class:`cm-insertedLine`}),j_=hs.mark({tagName:`del`,class:`cm-deletedLine`}),M_=new class extends Ss{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function N_(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,O_),i.add(o,s,n?j_:A_),a&&a.add(o,o,M_);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,O_),a&&a.add(u,u,M_);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,k_),s<t)c++;else break}u=t}}}function P_(e){let t=e.state.field(p_),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(u_),o=n==`a`,s=new gs,c=i?new gs: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))&&N_(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var F_=class extends cs{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}},I_=vs.define({map:(e,t)=>e.map(t)}),L_=fs.define({create:()=>hs.none,update:(e,t)=>{for(let e of t.effects)if(e.is(I_))return e.value;return e.map(t.changes)},provide:e=>xs.decorations.from(e)}),R_=.01;function z_(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 B_(e,t,n){let r=new gs,i=new gs,a=e.state.field(L_).iter(),o=t.state.field(L_).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<-R_?(l-=n,r.add(s,s,hs.widget({widget:new F_(-n),block:!0,side:-1}))):n>R_&&(u+=n,i.add(c,c,hs.widget({widget:new F_(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<R_?r.add(e.state.doc.length,e.state.doc.length,hs.widget({widget:new F_(-p),block:!0,side:1})):p>R_&&i.add(t.state.doc.length,t.state.doc.length,hs.widget({widget:new F_(p),block:!0,side:1}));let m=r.finish(),h=i.finish();z_(m,e.state.field(L_))||e.dispatch({effects:I_.of(m)}),z_(h,t.state.field(L_))||t.dispatch({effects:I_.of(h)})}var V_=vs.define({map:(e,t)=>t.mapPos(e)}),H_=class extends cs{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:V_.of(n)});let{side:r,sibling:i}=e.state.facet(u_);i&&i().dispatch({effects:V_.of(U_(n,e.state.field(p_),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function U_(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 W_=fs.define({create(e){return hs.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(V_)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>xs.decorations.from(e)});function G_({margin:e=3,minSize:t=4}){return W_.init(n=>K_(n,e,t))}function K_(e,t,n){let r=new gs,i=e.facet(u_).side==`a`,a=e.field(p_),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,hs.replace({widget:new H_(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var q_=xs.styleModule.of(new ws({".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`}})),J_=xs.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`}}),Y_=new bs,X_=new bs,Z_=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||C_;let t=[ls.low(w_),J_,q_,L_,xs.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(I_)))&&this.measure()})],n=[u_.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(T_);let r=ds.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],xs.editorAttributes.of({class:`cm-merge-a`}),X_.of(n),t]}),i=[u_.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(T_);let a=ds.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],xs.editorAttributes.of({class:`cm-merge-b`}),X_.of(i),t]});this.chunks=h_.build(r.doc,a.doc,this.diffConf);let o=[p_.init(()=>this.chunks),Y_.of(e.collapseUnchanged?G_(e.collapseUnchanged):[])];r=r.update({effects:vs.appendConfig.of(o)}).state,a=a.update({effects:vs.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 xs({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new xs({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),us.empty(e[0].startState.doc.length));this.chunks=t==this.a?h_.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):h_.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:d_.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:d_.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(u_),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(X_.reconfigure([u_.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?T_:[]])),a.push(X_.reconfigure([u_.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?T_:[]]))}if(r){let t=Y_.reconfigure(e.collapseUnchanged?G_(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(){B_(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=Q_(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=Q_(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 Q_(e){let t=e.nextSibling;return e.remove(),t}var $_=new class extends Ss{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},ev=ls.low(Cs({class:`cm-changeGutter`,markers:e=>e.plugin(w_)?.gutter||Es.empty,widgetMarker:(e,t)=>t instanceof av?$_:null}));function tv(e){let t=typeof e.original==`string`?ms.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||C_;return[ls.low(w_),uv,J_,xs.editorAttributes.of({class:`cm-merge-b`}),f_.of((e,t)=>{let r=t.effects.find(e=>e.is(nv));return r&&(e=h_.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=h_.updateB(e,t.state.field(rv),t.newDoc,t.changes,n)),e}),u_.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?gv:void 0,side:`b`}),rv.init(()=>t),e.gutter===!1?[]:ev,e.collapseUnchanged?G_(e.collapseUnchanged):[],p_.init(e=>h_.build(t,e.doc,n))]}var nv=vs.define(),rv=fs.define({create:()=>ms.empty,update(e,t){for(let n of t.effects)n.is(nv)&&(e=n.value.doc);return e}}),iv=new WeakMap,av=class extends cs{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 ov(e,t,n){let r=iv.get(t.changes);if(r)return r;let i=hs.widget({block:!0,side:-1,widget:new av(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(u_),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(),sv(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),cv(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(rv).sliceString(t.fromA,t.endA),u=a&&e.facet(Ds),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)==`
14
14
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
15
15
  `,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;ps(t,{style:t=>Os(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 iv.set(t.changes,i),i}function sv(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(p_).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(rv);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=us.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:nv.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function cv(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(p_).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(rv).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 lv(e){let t=new gs;for(let n of e.field(p_)){let r=e.facet(u_).overrideChunk&&fv(e,n);t.add(n.fromB,n.fromB,ov(e,n,!!r))}return t.finish()}var uv=fs.define({create:e=>lv(e),update(e,t){return t.state.field(p_,!1)==t.startState.field(p_,!1)?e:lv(t.state)},provide:e=>xs.decorations.from(e)}),dv=new WeakMap;function fv(e,t){let n=dv.get(t);if(n!==void 0)return n;n=null;let r=e.field(rv),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(hs.widget({widget:new pv(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(k_.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return dv.set(t,n),n}var pv=class extends cs{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}},mv=new class extends Ss{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},hv=hs.line({class:`cm-inlineChangedLine`});function gv(e,t,n,r){let i=fv(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,mv),n.add(o.from,o.from,hv);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 _v=fe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),vv=Bt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function yv(e){let t=(0,$.c)(20),{oldContent:n,newContent:r,layout:i,conflictMode:a,onResolve:o,onAbort:s}=e,c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),{resolvedTheme:u}=li(),d=(0,Q.useRef)(o),f=(0,Q.useRef)(s),[p,m]=(0,Q.useState)(null),h;t[0]!==s||t[1]!==o?(h=()=>{d.current=o,f.current=s},t[0]=s,t[1]=o,t[2]=h):h=t[2],(0,Q.useEffect)(h);let _,v;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(_=()=>{if(!c.current)return;let e=u===`dark`?_v:vv,t=[xs.editable.of(!1),ds.readOnly.of(!0)],o=[Ms,g(),...t,e,xs.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new xs({doc:r,extensions:[Ms,g(),xs.editable.of(!1),e,xs.lineWrapping,tv({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),xs.updateListener.of(e=>{let t=m_(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=m_(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new Z_({a:{doc:n,extensions:o},b:{doc:r,extensions:o},parent:c.current,highlightChanges:!0,gutter:!0,collapseUnchanged:{margin:3,minSize:4}}):l.current=new xs({doc:r,extensions:[...o,tv({original:n,highlightChanges:!0,gutter:!0,mergeControls:!1,collapseUnchanged:{margin:3,minSize:4}})],parent:c.current});return()=>{l.current&&=(l.current.destroy(),null)}},v=[n,r,i,u,a],t[3]=a,t[4]=i,t[5]=r,t[6]=n,t[7]=u,t[8]=_,t[9]=v):(_=t[8],v=t[9]),(0,Q.useEffect)(_,v);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){let e=l.current;!e||!(e instanceof xs)||d.current?.(e.state.doc.toString())},t[10]=y):y=t[10];let b=y,x=p===0,S=p===null?``:p===0?`All hunks resolved`:`${p} unresolved hunk${p===1?``:`s`}`,C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(`div`,{ref:c,className:`diff-view min-h-0 flex-1 overflow-y-auto subtle-scrollbar`}),t[11]=C):C=t[11];let w;t[12]!==x||t[13]!==a||t[14]!==S||t[15]!==s||t[16]!==o?(w=a&&(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2 border-t shrink-0`,children:[(0,Z.jsx)(`span`,{className:`text-xs ${x?`text-emerald-600 dark:text-emerald-400`:`text-muted-foreground`}`,children:S}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s&&(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:s,children:`Exit merge`}),o&&(0,Z.jsx)(X,{variant:`default`,size:`sm`,disabled:!x,onClick:b,children:`Save resolution`})]})]}),t[12]=x,t[13]=a,t[14]=S,t[15]=s,t[16]=o,t[17]=w):w=t[17];let T;return t[18]===w?T=t[19]:(T=(0,Z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[C,w]}),t[18]=w,t[19]=T),T}function bv(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)(on,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function xv(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)(ln,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Sv(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(tn,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cv(e){let t=(0,$.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,side:a,showCloseButton:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Sv,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=Gi(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10 motion-reduce:transition-none motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Z.jsx)(fn,{"data-slot":`sheet-close`,asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,Z.jsx)(Xt,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[9]=c,t[10]=d);let f;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(xv,{children:[l,(0,Z.jsxs)(en,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function wv(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-col gap-0.5 p-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tv(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`font-heading text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(nn,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function Ev(){try{let e=await fetch(`/api/sync/conflicts`);return e.ok?{conflicts:(await e.json()).conflicts??[]}:{conflicts:[],error:`server`}}catch{return{conflicts:[],error:`network`}}}async function Dv(e){try{let t=await fetch(`/api/sync/conflict-content?file=${encodeURIComponent(e)}`);if(!t.ok)return{ours:``,theirs:``,base:``};let n=await t.json();return{ours:n.ours??``,theirs:n.theirs??``,base:n.base??``}}catch{return{ours:``,theirs:``,base:``}}}async function Ov(e,t,n){try{let r={file:e,strategy:t};return n!==void 0&&(r.content=n),(await fetch(`/api/sync/resolve-conflict`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})).ok}catch{return!1}}var kv=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function Av(e){let t=(0,$.c)(31),{file:n,onResolve:r,onAbort:i}=e,[a,o]=(0,Q.useState)(null),s,c;if(t[0]===n?(s=t[1],c=t[2]):(s=()=>{let e=!1;return Dv(n).then(t=>{e||o(t)}),()=>{e=!0}},c=[n],t[0]=n,t[1]=s,t[2]=c),(0,Q.useEffect)(s,c),a===null){let e;t[3]===i?e=t[4]:(e=e=>!e&&i(),t[3]=i,t[4]=e);let r;t[5]===n?r=t[6]:(r=(0,Z.jsx)(un,{className:`shrink-0`,children:(0,Z.jsxs)($t,{children:[`Resolving: `,n]})}),t[5]=n,t[6]=r);let a;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted-foreground`,children:`Loading`}),t[7]=a):a=t[7];let o;t[8]===r?o=t[9]:(o=(0,Z.jsxs)(rn,{className:kv,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(dn,{open:!0,onOpenChange:e,children:o}),t[10]=e,t[11]=o,t[12]=s):s=t[12],s}let l;t[13]===i?l=t[14]:(l=e=>!e&&i(),t[13]=i,t[14]=l);let u;t[15]===n?u=t[16]:(u=(0,Z.jsxs)($t,{className:`text-sm font-medium`,children:[`Resolving: `,n]}),t[15]=n,t[16]=u);let d;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Red = your version (ours). Green = team's version (theirs). Accept each hunk to take theirs, reject to keep yours, then save.`}),t[17]=d):d=t[17];let f;t[18]===u?f=t[19]:(f=(0,Z.jsxs)(un,{className:`px-4 pt-4 pb-2 shrink-0`,children:[u,d]}),t[18]=u,t[19]=f);let p;t[20]!==i||t[21]!==r||t[22]!==a.ours||t[23]!==a.theirs?(p=(0,Z.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Z.jsx)(yv,{oldContent:a.ours,newContent:a.theirs,layout:`unified`,conflictMode:!0,onResolve:r,onAbort:i})}),t[20]=i,t[21]=r,t[22]=a.ours,t[23]=a.theirs,t[24]=p):p=t[24];let m;t[25]!==f||t[26]!==p?(m=(0,Z.jsxs)(rn,{className:`${kv} p-0`,children:[f,p]}),t[25]=f,t[26]=p,t[27]=m):m=t[27];let h;return t[28]!==l||t[29]!==m?(h=(0,Z.jsx)(dn,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function jv(e){let t=(0,$.c)(50),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(null),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Set,t[1]=l):l=t[1];let[u,d]=(0,Q.useState)(l),f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[2]=f):f=t[2];let[p,m]=(0,Q.useState)(f),[h,g]=(0,Q.useState)(null),_;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){Ev().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(Mv));return new Set([...e].filter(e=>!n.has(e)))})})},t[3]=_):_=t[3];let v=_,y,b;t[4]===n?(y=t[5],b=t[6]):(y=()=>{n&&v()},b=[n],t[4]=n,t[5]=y,t[6]=b),(0,Q.useEffect)(y,b);let x,S;t[7]===n?(x=t[8],S=t[9]):(x=()=>Gr(e=>{e.includes(`sync-status`)&&n&&v()}),S=[n],t[7]=n,t[8]=x,t[9]=S),(0,Q.useEffect)(x,S);let C,w;t[10]!==a.length||t[11]!==r||t[12]!==n||t[13]!==u.size?(w=()=>{n&&a.length>0&&u.size>=a.length&&(Y.success(`All conflicts resolved — sync resuming`),r(!1),d(new Set))},C=[n,a.length,u.size,r],t[10]=a.length,t[11]=r,t[12]=n,t[13]=u.size,t[14]=C,t[15]=w):(C=t[14],w=t[15]),(0,Q.useEffect)(w,C);let T;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(T=async function(e,t,n){m(t=>new Set([...t,e]));let r=await Ov(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):Y.error(`Failed to resolve ${e}`)},t[16]=T):T=t[16];let E=T,D;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){g(e)},t[17]=D):D=t[17];let O=D,k;t[18]===h?k=t[19]:(k=async function(e){if(!h)return;let t=h;g(null),await E(t,`content`,e)},t[18]=h,t[19]=k);let A=k,j;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(j=function(){g(null)},t[20]=j):j=t[20];let M=j,N;t[21]===r?N=t[22]:(N=async function(){try{(await fetch(`/api/sync/abort-merge`,{method:`POST`})).ok?Y.info(`Merge aborted — sync paused`):Y.error(`Failed to abort merge`)}catch{Y.error(`Failed to abort merge — connection error`)}r(!1),d(new Set)},t[21]=r,t[22]=N);let P=N,F=a.length,I=u.size,L;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(Tv,{className:`text-sm font-medium`,children:`Resolve conflicts`}),t[23]=L):L=t[23];let R;t[24]!==I||t[25]!==F?(R=F>0&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[I,` of `,F,` resolved`]}),t[24]=I,t[25]=F,t[26]=R):R=t[26];let z;t[27]===R?z=t[28]:(z=(0,Z.jsxs)(wv,{className:`px-4 py-3 border-b shrink-0`,children:[L,R]}),t[27]=R,t[28]=z);let B;t[29]!==a||t[30]!==s||t[31]!==u||t[32]!==p?(B=(0,Z.jsx)(`div`,{className:`flex-1 overflow-y-auto subtle-scrollbar`,children:s?(0,Z.jsxs)(`div`,{className:`px-4 py-6 text-sm text-center space-y-2`,children:[(0,Z.jsx)(`p`,{className:`text-destructive`,children:s===`network`?`Could not reach the sync server — check your connection.`:`Sync server error — try again in a moment.`}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:v,children:`Retry`})]}):a.length===0?(0,Z.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted-foreground text-center`,children:`No conflicts found.`}):(0,Z.jsx)(`ul`,{className:`divide-y`,children:a.map(e=>{let t=u.has(e.file),n=p.has(e.file),r=e.file.split(`/`).pop()??e.file;return(0,Z.jsxs)(`li`,{className:`px-4 py-3 ${t?`opacity-50`:``}`,children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium truncate mb-2`,title:e.file,children:[t?`✓ `:``,r]}),!t&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[(0,Z.jsx)(X,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`mine`),children:`Keep my version`}),(0,Z.jsx)(X,{variant:`outline`,size:`xs`,disabled:n,onClick:()=>void E(e.file,`theirs`),children:`Keep team's version`}),(0,Z.jsx)(X,{variant:`ghost`,size:`xs`,disabled:n,onClick:()=>O(e.file),children:`Resolve manually`})]})]},e.file)})})}),t[29]=a,t[30]=s,t[31]=u,t[32]=p,t[33]=B):B=t[33];let V;t[34]===P?V=t[35]:(V=(0,Z.jsx)(`div`,{className:`px-4 py-3 border-t shrink-0`,children:(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:P,children:`Exit merge`})}),t[34]=P,t[35]=V);let H;t[36]!==z||t[37]!==B||t[38]!==V?(H=(0,Z.jsxs)(Cv,{side:`right`,className:`w-80 sm:w-96 flex flex-col gap-0 p-0`,children:[z,B,V]}),t[36]=z,t[37]=B,t[38]=V,t[39]=H):H=t[39];let U;t[40]!==r||t[41]!==n||t[42]!==H?(U=(0,Z.jsx)(bv,{open:n,onOpenChange:r,children:H}),t[40]=r,t[41]=n,t[42]=H,t[43]=U):U=t[43];let W;t[44]!==A||t[45]!==h?(W=h&&(0,Z.jsx)(Av,{file:h,onResolve:e=>void A(e),onAbort:M}),t[44]=A,t[45]=h,t[46]=W):W=t[46];let G;return t[47]!==U||t[48]!==W?(G=(0,Z.jsxs)(Z.Fragment,{children:[U,W]}),t[47]=U,t[48]=W,t[49]=G):G=t[49],G}function Mv(e){return e.file}var Nv=5;async function Pv(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=Pr.safeParse(n);throw e.success?Error(e.data.title):new mt(`Failed to parse backlinks error response (HTTP ${t.status})`,{status:t.status})}let r=Di.safeParse(n);if(!r.success)throw new mt(`Backlinks response did not match expected shape.`,{status:t.status});return r.data.backlinks}async function Fv(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=Pr.safeParse(n);throw e.success?Error(e.data.title):new mt(`Failed to parse forward-links error response (HTTP ${t.status})`,{status:t.status})}let r=nr.safeParse(n);if(!r.success)throw new mt(`Forward-links response did not match expected shape.`,{status:t.status});return r.data.forwardLinks}function Iv(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function Lv(e){window.location.hash=qr(e)}function Rv(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)(pt,{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)(In,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Fn,{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)(qo,{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 zv(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=Nv)return null;let a=n-Nv,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(pt,{className:`size-3`}):(0,Z.jsx)(Wo,{className:`size-3`}),t[0]=r,t[1]=o);let s=r?`Show fewer`:`Show ${a} more`,c;return t[2]!==r||t[3]!==i||t[4]!==o||t[5]!==s?(c=(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,s]}),t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c):c=t[6],c}function Bv(e){let t=(0,$.c)(35),{icon:n,iconColorClass:r,rowTooltip:i,title:a,path:o,anchor:s,snippet:c,titleHover:l,ariaLabel:u,href:d,external:f,disabled:p,onClick:m}=e,h=o!==void 0&&o!==a,g=r??`text-muted-foreground`,_;t[0]===g?_=t[1]:(_=Gi(`mt-0.5 shrink-0`,g),t[0]=g,t[1]=_);let v;t[2]!==n||t[3]!==_?(v=(0,Z.jsx)(`span`,{className:_,children:n}),t[2]=n,t[3]=_,t[4]=v):v=t[4];let y=v,b;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(b=d?(0,Z.jsxs)(`a`,{href:d,target:f?`_blank`:void 0,rel:f?`noopener noreferrer`:void 0,"aria-label":u,title:l,onClick:m,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,f?(0,Z.jsx)(`span`,{className:`sr-only`,children:` (opens in new tab)`}):null]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,title:l,disabled:p,onClick:m,className:Gi(`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]=u,t[6]=p,t[7]=f,t[8]=d,t[9]=m,t[10]=a,t[11]=l,t[12]=b):b=t[12];let x=b,S;t[13]===y?S=t[14]:(S=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:y}),t[13]=y,t[14]=S);let C;t[15]!==s||t[16]!==o||t[17]!==h?(C=h?(0,Z.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[o,s?(0,Z.jsxs)(`span`,{className:`ml-1`,children:[`· #`,s]}):null]}):null,t[15]=s,t[16]=o,t[17]=h,t[18]=C):C=t[18];let w;t[19]===c?w=t[20]:(w=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=w);let T;t[21]!==x||t[22]!==C||t[23]!==w?(T=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[x,C,w]}),t[21]=x,t[22]=C,t[23]=w,t[24]=T):T=t[24];let E;t[25]!==S||t[26]!==T?(E=(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:[S,T]}),t[25]=S,t[26]=T,t[27]=E):E=t[27];let D=E;if(i){let e;t[28]===D?e=t[29]:(e=(0,Z.jsx)(Wn,{asChild:!0,children:D}),t[28]=D,t[29]=e);let n;t[30]===i?n=t[31]:(n=(0,Z.jsx)(vr,{side:`top`,children:i}),t[30]=i,t[31]=n);let r;return t[32]!==e||t[33]!==n?(r=(0,Z.jsxs)(Yn,{children:[e,n]}),t[32]=e,t[33]=n,t[34]=r):r=t[34],r}return D}function Vv(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=Zr(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>Pv(n),t[0]=n,t[1]=o,t[2]=s);let c;t[3]!==n||t[4]!==a||t[5]!==i?(c=!a&&i.has(n),t[3]=n,t[4]=a,t[5]=i,t[6]=c):c=t[6];let l;t[7]!==o||t[8]!==s||t[9]!==c?(l={queryKey:o,queryFn:s,enabled:c},t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10];let{data:u,isLoading:d,error:f}=wn(l),p;t[11]===u?p=t[12]:(p=u===void 0?[]:u,t[11]=u,t[12]=p);let m=p,[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(n);_!==n&&(v(n),g(!1));let y;t[13]!==m||t[14]!==h?(y=h?m:m.slice(0,Nv),t[13]=m,t[14]=h,t[15]=y):y=t[15];let b=y,x;t[16]!==m.length||t[17]!==d?(x=(0,Z.jsx)(Rv,{title:`Backlinks`,count:m.length,isLoading:d}),t[16]=m.length,t[17]=d,t[18]=x):x=t[18];let S;t[19]!==m.length||t[20]!==f||t[21]!==h||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==b?(S=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Sn,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):m.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(kn,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:b.map((e,t)=>{let n=Uo(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(Bv,{icon:(0,Z.jsx)(L,{className:`size-3.5`}),title:e.title,path:Iv(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:qr(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(zv,{total:m.length,expanded:h,onToggle:()=>g(Hv)})]}),t[19]=m.length,t[20]=f,t[21]=h,t[22]=r,t[23]=d,t[24]=i,t[25]=b,t[26]=S):S=t[26];let C;t[27]!==d||t[28]!==S?(C=(0,Z.jsx)(Ko,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:S})}),t[27]=d,t[28]=S,t[29]=C):C=t[29];let w;return t[30]!==C||t[31]!==x?(w=(0,Z.jsxs)(Jo,{defaultOpen:!0,children:[x,C]}),t[30]=C,t[31]=x,t[32]=w):w=t[32],w}function Hv(e){return!e}function Uv(e){let t=(0,$.c)(42),{docName:n}=e,{addPage:r,folderPaths:i,pages:a,pagesBySlug:o,loading:s}=Zr(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>Fv(n),t[0]=n,t[1]=c,t[2]=l);let u;t[3]!==n||t[4]!==a||t[5]!==s?(u=!s&&a.has(n),t[3]=n,t[4]=a,t[5]=s,t[6]=u):u=t[6];let d;t[7]!==c||t[8]!==l||t[9]!==u?(d={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=d):d=t[10];let{data:f,isLoading:p,error:m}=wn(d),h;t[11]===f?h=t[12]:(h=f===void 0?[]:f,t[11]=f,t[12]=h);let g=h,[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(n);x!==n&&(S(n),b(!1),v(null));let C;t[13]!==y||t[14]!==g?(C=y?g:g.slice(0,Nv),t[13]=y,t[14]=g,t[15]=C):C=t[15];let w=C,T;t[16]!==r||t[17]!==_?(T=async function(e,t){if(!_){v(t);try{await xe(e,{addPage:r,onCreated:Lv}),v(null)}catch(e){let t=e;Y.error(t instanceof Error?t.message:`Failed to create page`),v(null)}}},t[16]=r,t[17]=_,t[18]=T):T=t[18];let E=T,D;t[19]!==_||t[20]!==i||t[21]!==E||t[22]!==a||t[23]!==o||t[24]!==s?(D=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(Bv,{icon:(0,Z.jsx)(Ho,{className:`size-3.5`}),rowTooltip:`Opens in a new tab`,title:e.title,path:t?void 0:e.url,titleHover:e.url,snippet:e.snippet,href:e.url,external:!0},`ext:${e.url}`)}let t=ve(e.docName,{pages:a,folderPaths:i,pagesBySlug:o}),n=!s&&t.kind===`create`,r=!s&&t.kind===`navigate`&&t.displayState===`folder`,c=Iv(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,d=qr(t.kind===`navigate`?t.hashDocName:e.docName,e.anchor);if(n&&t.kind===`create`){let n={initialDir:t.initialDir,suggestedName:t.suggestedName};return(0,Z.jsx)(Bv,{icon:(0,Z.jsx)(ei,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:_===u?`Creating page`:`Missing page — click to create`,ariaLabel:_===u?`Creating page: ${e.title}.`:`Missing page: ${e.title}. Click to create.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,disabled:_!==null,onClick:()=>void E(n,u)},u)}return r&&t.kind===`navigate`?(0,Z.jsx)(Bv,{icon:(0,Z.jsx)(Sc,{className:`size-3.5`}),iconColorClass:`text-sky-600 dark:text-sky-400`,ariaLabel:`Folder target: ${e.title}. Click to open the overview.`,title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d},u):(0,Z.jsx)(Bv,{icon:(0,Z.jsx)(L,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:d},u)},t[19]=_,t[20]=i,t[21]=E,t[22]=a,t[23]=o,t[24]=s,t[25]=D):D=t[25];let O=D,k;t[26]!==p||t[27]!==g.length?(k=(0,Z.jsx)(Rv,{title:`Outgoing`,count:g.length,isLoading:p}),t[26]=p,t[27]=g.length,t[28]=k):k=t[28];let A;t[29]!==m||t[30]!==y||t[31]!==p||t[32]!==g.length||t[33]!==O||t[34]!==w?(A=m?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Sn,{children:m instanceof Error?m.message:`Failed to load outgoing links`})}):g.length===0&&!p?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(kn,{children:`This page doesn't link to anything yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:w.map(O)}),(0,Z.jsx)(zv,{total:g.length,expanded:y,onToggle:()=>b(Wv)})]}),t[29]=m,t[30]=y,t[31]=p,t[32]=g.length,t[33]=O,t[34]=w,t[35]=A):A=t[35];let j;t[36]!==p||t[37]!==A?(j=(0,Z.jsx)(Ko,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":p,children:A})}),t[36]=p,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==k||t[40]!==j?(M=(0,Z.jsxs)(Jo,{defaultOpen:!0,children:[k,j]}),t[39]=k,t[40]=j,t[41]=M):M=t[41],M}function Wv(e){return!e}function Gv(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)(Uv,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(io,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Vv,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(Nn,{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)(Ln,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var Kv=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 Kv{};function qv(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 Jv(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 Yv(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 Xv(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 Zv(e,t){return Yv(e,t,``)}function Qv(e,t){return Xv(e,t,``)}function $v(e,t){return t.slice(0,ey(e,t))}function ey(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 ty(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 ny(e,t){if(t)return iy(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function ry(e,t){if(t)return iy(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function iy(e,t){if(!t)return[ry(e),ny(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=ty(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var ay=`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}`,oy=RegExp(`[${ay}]+|\\s+|[^${ay}]`,`ug`);new class extends Kv{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=ty(e,r)}else n=e.match(oy)||[];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)&&sy(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&sy(n,i,r,null,t.intlSegmenter),e}};function sy(e,t,n,r,i){if(t&&n){let[a,o]=iy(t.value,i),[s,c]=iy(n.value,i);if(e){let r=qv(a,s);e.value=Xv(e.value,s,r),t.value=Zv(t.value,r),n.value=Zv(n.value,r)}if(r){let e=Jv(o,c);r.value=Yv(r.value,c,e),t.value=Qv(t.value,e),n.value=Qv(n.value,e)}}else if(n){if(e){let e=ry(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=ry(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=ry(r.value,i),[a,o]=iy(t.value,i),s=qv(n,a);t.value=Zv(t.value,s);let c=Jv(Zv(n,s),o);t.value=Qv(t.value,c),r.value=Yv(r.value,n,c),e.value=Xv(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=ry(r.value,i),n=$v(ny(t.value,i),e);t.value=Qv(t.value,n)}else if(e){let n=$v(ny(e.value,i),ry(t.value,i));t.value=Zv(t.value,n)}}new class extends Kv{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ay}]+|[^\\S\\n\\r]+|[^${ay}]`,`ug`);return e.match(t)||[]}};var cy=new class extends Kv{constructor(){super(...arguments),this.tokenize=uy}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
16
16
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
@@ -24,15 +24,13 @@ Error generating stack: `+e.message+`
24
24
  `}function gy(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;my(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?hy(e,o.headerOptions):void 0)}}))}else{let s=my(e,t,n,r,i,a,o);return s?hy(s,o?.headerOptions):void 0}}function _y(e,t,n,r,i,a){return gy(e,e,t,n,r,i,a)}function vy(e){let t=e.endsWith(`
25
25
  `),n=e.split(`
26
26
  `).map(e=>e+`
27
- `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function yy(e,t){return`${e}\u0000${t}`}function by(e,t,n){let r=ji(e).body,i=ji(t).body;return r===i?``:_y(n,r,i,``,``,{context:3})}function xy(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ft(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=yy(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=by(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 Sy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-d4ec9M69.js`),__vite__mapDeps([16,1,8,17]),import.meta.url)).ActivityPanelDiffView}));function Cy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return`just now`;if(r<3600)return`${Math.floor(r/60)} min ago`;if(r<86400)return`${Math.floor(r/3600)}h ago`;if(r<86400*2)return`yesterday`;let i=Math.floor(r/86400);return i<7?`${i} days ago`:t.toLocaleDateString()}function wy(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ty(e){return e.slice(0,7)}function Ey(e){return e.type===`upstream`?`Upstream sync`: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`?`Auto-save`:e.author}function Dy(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)(aa,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(da,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ra,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ca,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ga,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(ma,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(fa,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Oy(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)(Te,{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=Kn(i),t[1]=i,t[2]=a);let o=a,s=r?Ir[o]??zr[o]:zr[o],c;t[3]!==s||t[4]!==i?(c=s??Ai(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)(Dy,{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)(wc,{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)(Ys,{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)(fl,{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)(fa,{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)(Ys,{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)(fl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function ky(e){let t=(0,$.c)(20),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r);if(n.length===0)return null;let p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>f(Ay),t[0]=p):p=t[0];let m;t[1]===d?m=t[2]:(m=d?(0,Z.jsx)(pt,{className:`size-3`}):(0,Z.jsx)(Wo,{className:`size-3`}),t[1]=d,t[2]=m);let h=d?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,g;t[3]!==d||t[4]!==m||t[5]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:p,children:[m,h]}),t[3]=d,t[4]=m,t[5]=h,t[6]=g):g=t[6];let _;t[7]!==o||t[8]!==a||t[9]!==s||t[10]!==n||t[11]!==d||t[12]!==c||t[13]!==i||t[14]!==u||t[15]!==l?(_=d&&n.map(e=>(0,Z.jsx)(Wy,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[7]=o,t[8]=a,t[9]=s,t[10]=n,t[11]=d,t[12]=c,t[13]=i,t[14]=u,t[15]=l,t[16]=_):_=t[16];let v;return t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19],v}function Ay(e){return!e}function jy(e){return e.checkpoint?e.checkpoint.kind:`save`}function My(e){let t=jy(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${Ny(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function Ny(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function Py(e){return e.type===`checkpoint`?jy(e)===`save`?`version`:`auto-save`:`wip`}var Fy={version:`Restore this version`,"auto-save":`Restore this auto-save`,wip:`Restore to this point`},Iy={version:`Restore this version?`,"auto-save":`Restore this auto-save?`,wip:`Restore to this point?`};function Ly(e){return Fy[Py(e)]}function Ry(e){return Iy[Py(e)]}function zy(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function By(e){let t=(0,$.c)(20),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=l);let u;t[6]!==r||t[7]!==s?(u=r&&s.map(Hy),t[6]=r,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[l,u]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==a||t[15]!==s.length?(f=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(Vy)},children:[r?(0,Z.jsx)(pt,{className:`size-3`}):(0,Z.jsx)(Wo,{className:`size-3`}),r?`Hide`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function Vy(e){return!e}function Hy(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 Uy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=xy(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ee,{className:`size-3 animate-spin`}),`Loading diff`]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:`Diff unavailable`}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ee,{className:`size-3 animate-spin`}),`Loading diff renderer`]}),children:(0,Z.jsx)(Sy,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Wy(e){let t=(0,$.c)(128),{entry:n,prominent:r,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c,onToggleExpanded:l,onRestoreSuccess:u}=e,d=r===void 0?!1:r,f;t[0]===n.timestamp?f=t[1]:(f=Cy(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=Ey(n),t[2]=n,t[3]=m);let h=m,g=n.contributors.flatMap(Gy),_;t[4]===n?_=t[5]:(_=zy(n),t[4]=n,t[5]=_);let v=_,[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),w=(0,Q.useId)(),T,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>()=>C.current?.abort(),E=[],t[6]=T,t[7]=E):(T=t[6],E=t[7]),(0,Q.useEffect)(T,E);let D;t[8]!==n.sha||t[9]!==l?(D=()=>l(n.sha),t[8]=n.sha,t[9]=l,t[10]=D):D=t[10];let O=D,k;t[11]===b?k=t[12]:(k=function(){C.current?.abort(),C.current=null,S(!1),b(!1)},t[11]=b,t[12]=k);let A=k,j;t[13]!==s||t[14]!==n.sha||t[15]!==u||t[16]!==b?(j=async function(){S(!0);let e=new AbortController;C.current=e;let t=function(){e.signal.aborted||S(!1),C.current===e&&(C.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:s,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:s,sha:n.sha,err:i}),Y.error(`Restore failed — document unchanged`,{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)b(!1),u();else{let e=`HTTP ${r.status}`;try{let t=Pr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:s,sha:n.sha,status:r.status,detail:e}),Y.error(`Restore failed`,{description:e,duration:6e3})}t()},t[13]=s,t[14]=n.sha,t[15]=u,t[16]=b,t[17]=j):j=t[17];let M=j,N;t[18]!==n||t[19]!==i||t[20]!==d?(N=d?(()=>{let e=jy(n);return e===`bridge-merge-loss`?(0,Z.jsx)(ei,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(hc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(pc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(Oy,{entry:n,isDark:i}),t[18]=n,t[19]=i,t[20]=d,t[21]=N):N=t[21];let P=N,F=c?w:void 0,I=c?`bg-muted`:`hover:bg-muted/80`,L;t[22]===I?L=t[23]:(L=[`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`,I],t[22]=I,t[23]=L);let R=L.join(` `),z;t[24]===O?z=t[25]:(z=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),O())},t[24]=O,t[25]=z);let B;t[26]===P?B=t[27]:(B=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:P}),t[26]=P,t[27]=B);let V;t[28]!==h||t[29]!==n||t[30]!==d?(V=d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:My(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:h})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[28]=h,t[29]=n,t[30]=d,t[31]=V):V=t[31];let H;t[32]!==n.timestamp||t[33]!==p?(H=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[32]=n.timestamp,t[33]=p,t[34]=H):H=t[34];let U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[35]=U):U=t[35];let W;t[36]===n?W=t[37]:(W=Ly(n),t[36]=n,t[37]=W);let G;t[38]===b?G=t[39]:(G=e=>{e.stopPropagation(),b(!0)},t[38]=b,t[39]=G);let te;t[40]===x?te=t[41]:(te=x?(0,Z.jsx)(ee,{className:`size-3 animate-spin`}):(0,Z.jsx)(oa,{className:`size-3`}),t[40]=x,t[41]=te);let ne;t[42]!==x||t[43]!==W||t[44]!==G||t[45]!==te?(ne=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":W,disabled:x,onClick:G,children:te})}),t[42]=x,t[43]=W,t[44]=G,t[45]=te,t[46]=ne):ne=t[46];let re;t[47]===n?re=t[48]:(re=Ly(n),t[47]=n,t[48]=re);let ie;t[49]===re?ie=t[50]:(ie=(0,Z.jsx)(vr,{side:`top`,children:re}),t[49]=re,t[50]=ie);let ae;t[51]!==ne||t[52]!==ie?(ae=(0,Z.jsxs)(Yn,{children:[ne,ie]}),t[51]=ne,t[52]=ie,t[53]=ae):ae=t[53];let oe;t[54]!==V||t[55]!==H||t[56]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[V,H,U,ae]}),t[54]=V,t[55]=H,t[56]=ae,t[57]=oe):oe=t[57];let se;t[58]===v?se=t[59]:(se=v.length>0&&(0,Z.jsx)(By,{summaries:v}),t[58]=v,t[59]=se);let ce=g.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:g.join(`, `),children:g.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),le;t[60]!==oe||t[61]!==se||t[62]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[60]=oe,t[61]=se,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]!==c||t[65]!==O||t[66]!==F||t[67]!==R||t[68]!==z||t[69]!==B||t[70]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":c,"aria-controls":F,"data-testid":`timeline-entry-expand`,className:R,onClick:O,onKeyDown:z,children:[B,le]}),t[64]=c,t[65]=O,t[66]=F,t[67]=R,t[68]=z,t[69]=B,t[70]=le,t[71]=ue):ue=t[71];let de;t[72]!==o||t[73]!==a||t[74]!==w||t[75]!==s||t[76]!==n.sha||t[77]!==c?(de=c&&(0,Z.jsx)(Uy,{sha:n.sha,docName:s,cache:o,diffLayout:a,panelId:w}),t[72]=o,t[73]=a,t[74]=w,t[75]=s,t[76]=n.sha,t[77]=c,t[78]=de):de=t[78];let K;t[79]!==ue||t[80]!==de?(K=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[79]=ue,t[80]=de,t[81]=K):K=t[81];let fe;t[82]!==A||t[83]!==b?(fe=e=>{e?b(!0):A()},t[82]=A,t[83]=b,t[84]=fe):fe=t[84];let pe;t[85]===n?pe=t[86]:(pe=Ry(n),t[85]=n,t[86]=pe);let me;t[87]===pe?me=t[88]:(me=(0,Z.jsx)($t,{children:pe}),t[87]=pe,t[88]=me);let he;t[89]===n.timestamp?he=t[90]:(he=wy(n.timestamp),t[89]=n.timestamp,t[90]=he);let ge;t[91]===n.sha?ge=t[92]:(ge=Ty(n.sha),t[91]=n.sha,t[92]=ge);let _e;t[93]!==p||t[94]!==he||t[95]!==ge?(_e=(0,Z.jsxs)(`span`,{className:`font-medium text-foreground`,children:[p,` (`,he,`, `,ge,`)`]}),t[93]=p,t[94]=he,t[95]=ge,t[96]=_e):_e=t[96];let ve;t[97]===h?ve=t[98]:(ve=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[97]=h,t[98]=ve);let ye;t[99]!==_e||t[100]!==ve?(ye=(0,Z.jsxs)(Zt,{children:[`This will replace the current document content with the version from`,` `,_e,` `,`by `,ve,`. Your current content is already saved in the timeline — you can restore it anytime.`]}),t[99]=_e,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]!==me||t[103]!==ye?(be=(0,Z.jsxs)(un,{children:[me,ye]}),t[102]=me,t[103]=ye,t[104]=be):be=t[104];let xe;t[105]===A?xe=t[106]:(xe=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:A,children:`Cancel`}),t[105]=A,t[106]=xe);let Se;t[107]===M?Se=t[108]:(Se=()=>M(),t[107]=M,t[108]=Se);let Ce;t[109]===x?Ce=t[110]:(Ce=x?(0,Z.jsx)(ee,{className:`mr-2 size-4 animate-spin`}):null,t[109]=x,t[110]=Ce);let we;t[111]!==x||t[112]!==Se||t[113]!==Ce?(we=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:x,onClick:Se,children:[Ce,`Restore`]}),t[111]=x,t[112]=Se,t[113]=Ce,t[114]=we):we=t[114];let Te;t[115]!==xe||t[116]!==we?(Te=(0,Z.jsxs)(cn,{children:[xe,we]}),t[115]=xe,t[116]=we,t[117]=Te):Te=t[117];let Ee;t[118]!==be||t[119]!==Te?(Ee=(0,Z.jsxs)(rn,{children:[be,Te]}),t[118]=be,t[119]=Te,t[120]=Ee):Ee=t[120];let De;t[121]!==y||t[122]!==fe||t[123]!==Ee?(De=(0,Z.jsx)(dn,{open:y,onOpenChange:fe,children:Ee}),t[121]=y,t[122]=fe,t[123]=Ee,t[124]=De):De=t[124];let Oe;return t[125]!==K||t[126]!==De?(Oe=(0,Z.jsxs)(Z.Fragment,{children:[K,De]}),t[125]=K,t[126]=De,t[127]=Oe):Oe=t[127],Oe}function Gy(e){return e.docs}function Ky(e){let t=(0,$.c)(63),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{resolvedTheme:a}=li(),o=a===`dark`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),[h]=(0,Q.useState)(Xy),[g,_]=(0,Q.useState)(Yy),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]===n?(w=t[8],T=t[9]):(w=()=>{if(!n){l([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){p(`History unavailable`);return}let r=await t.json();if(e)return;l(r.entries??[]),p(null)}catch(t){let n=t;if(e)return;p(`History unavailable`),console.error(`[timeline]`,n)}};return d(!0),t().finally(()=>{e||d(!1)}),m.current=setInterval(t,1e4),()=>{e=!0,m.current&&clearInterval(m.current)}},T=[n],t[7]=n,t[8]=w,t[9]=T),(0,Q.useEffect)(w,T);let E,D,O,k,A,j,M,N;if(t[10]!==h||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==f||t[15]!==g||t[16]!==o||t[17]!==u||t[18]!==i){let e=[],a=[],s=!1;for(let t of c)t.type===`checkpoint`?(a.length>0&&(e.push({kind:`wip-group`,entries:a,isPreCheckpoint:!s}),a=[]),e.push({kind:`checkpoint`,entry:t}),s=!0):a.push(t);a.length>0&&e.push({kind:`wip-group`,entries:a,isPreCheckpoint:!s});let l;t[27]===c?l=t[28]:(l=c.some(Jy),t[27]=c,t[28]=l);let d=!l,p=!u&&!f&&c.length>0;A=`flex h-full flex-col`,t[29]!==r||t[30]!==p||t[31]!==i?(j=p&&(0,Z.jsx)(`div`,{className:`flex items-center justify-end gap-1 px-2 py-1.5`,children:(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsxs)(ts,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":`Diff layout`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(Qo,{value:`unified`,"aria-label":`Unified diff`,className:`size-6 px-0`,children:(0,Z.jsx)(Yc,{className:`size-3.5`})}),(0,Z.jsx)(Qo,{value:`split`,"aria-label":`Split diff`,className:`size-6 px-0`,children:(0,Z.jsx)(lc,{className:`size-3.5`})})]})}),(0,Z.jsx)(vr,{children:r===`unified`?`Unified diff`:`Split diff`})]})}),t[29]=r,t[30]=p,t[31]=i,t[32]=j):j=t[32],M=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[33]===u?N=t[34]:(N=u&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading timeline history`,children:[1,2,3].map(qy)}),t[33]=u,t[34]=N),t[35]!==f||t[36]!==u?(E=!u&&f&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:f})}),t[35]=f,t[36]=u,t[37]=E):E=t[37],t[38]!==c.length||t[39]!==f||t[40]!==u?(D=!u&&!f&&c.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:`No history yet`})}),t[38]=c.length,t[39]=f,t[40]=u,t[41]=D):D=t[41],t[42]!==h||t[43]!==r||t[44]!==n||t[45]!==c||t[46]!==f||t[47]!==g||t[48]!==d||t[49]!==o||t[50]!==u?(O=!u&&!f&&d&&c.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:c.map(e=>(0,Z.jsx)(Wy,{entry:e,isDark:o,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[42]=h,t[43]=r,t[44]=n,t[45]=c,t[46]=f,t[47]=g,t[48]=d,t[49]=o,t[50]=u,t[51]=O):O=t[51],k=!u&&!f&&!d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(Wy,{entry:e.entry,prominent:!0,isDark:o,diffLayout:r,cache:h,docName:n,expanded:g.has(e.entry.sha),onToggleExpanded:x,onRestoreSuccess:C},e.entry.sha):(0,Z.jsx)(ky,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:o,diffLayout:r,cache:h,docName:n,expandedShas:g,onToggleExpanded:x,onRestoreSuccess:C},e.entries[0]?.sha??`wip-${t}`))}),t[10]=h,t[11]=r,t[12]=n,t[13]=c,t[14]=f,t[15]=g,t[16]=o,t[17]=u,t[18]=i,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A,t[24]=j,t[25]=M,t[26]=N}else E=t[19],D=t[20],O=t[21],k=t[22],A=t[23],j=t[24],M=t[25],N=t[26];let P;t[52]!==E||t[53]!==D||t[54]!==O||t[55]!==k||t[56]!==M||t[57]!==N?(P=(0,Z.jsxs)(`div`,{className:M,children:[N,E,D,O,k]}),t[52]=E,t[53]=D,t[54]=O,t[55]=k,t[56]=M,t[57]=N,t[58]=P):P=t[58];let F;return t[59]!==A||t[60]!==j||t[61]!==P?(F=(0,Z.jsxs)(`div`,{className:A,children:[j,P]}),t[59]=A,t[60]=j,t[61]=P,t[62]=F):F=t[62],F}function qy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Mo,{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)(Mo,{className:`h-3 w-28`}),(0,Z.jsx)(Mo,{className:`h-3 w-40`})]})]},e)}function Jy(e){return e.type===`checkpoint`}function Yy(){return new Set}function Xy(){return new sa(32)}var Zy=[{id:`outline`,label:`Outline`,icon:Mc},{id:`links`,label:`Links`,icon:B},{id:`graph`,label:`Graph`,icon:Fc},{id:`timeline`,label:`Timeline`,icon:ac}];function Qy(){return n(()=>import(`./GraphPanel-Btq3W8xK.js`),__vite__mapDeps([18,1,19,3,7,8,20,21,22,23,24,25,26,27,28,29,30,31]),import.meta.url)}var $y=(0,Q.lazy)(async()=>({default:(await Qy()).GraphPanel})),eb=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Dgodq1_3.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,41]),import.meta.url)).ActivityModeContent}));function tb(e){let t=(0,$.c)(13),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,[s,c]=(0,Q.useState)(`unified`),l;t[0]!==i||t[1]!==o||t[2]!==a?(l=o===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ts,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:Zy.map(nb)})}):null,t[0]=i,t[1]=o,t[2]=a,t[3]=l):l=t[3];let u;t[4]!==i||t[5]!==s||t[6]!==n||t[7]!==r||t[8]!==o?(u=o===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${i}`,"aria-labelledby":`tab-${i}`,className:`min-h-0 flex-1`,children:[i===`outline`&&(0,Z.jsx)(As,{docName:n,isSourceMode:r}),i===`links`&&(0,Z.jsx)(Gv,{docName:n}),i===`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:`Loading graph`}),children:(0,Z.jsx)($y,{activeDocName:n})}),i===`timeline`&&(0,Z.jsx)(Ky,{docName:n,diffLayout:s,onDiffLayoutChange:c})]}):(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:`Loading agent activity`}),children:(0,Z.jsx)(eb,{})})}),t[4]=i,t[5]=s,t[6]=n,t[7]=r,t[8]=o,t[9]=u):u=t[9];let d;return t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(Z.Fragment,{children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function nb(e){let{id:t,label:n,icon:r}=e;return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Qo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Z.jsx)(Wn,{children:(0,Z.jsx)(r,{})})}),(0,Z.jsx)(vr,{side:`bottom`,children:n})]},t)}function rb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ib(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function ab(e){return e/100*window.innerHeight}function ob(e){return e/100*window.innerWidth}function sb(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 cb({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=sb(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ib(t,i);break;case`em`:r=rb(t,i);break;case`vh`:r=ab(i);break;case`vw`:r=ob(i);break}return r}function lb(e){return parseFloat(e.toFixed(3))}function ub({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 db(e){let{panels:t}=e,n=ub({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=lb(cb({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=lb(cb({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=lb(cb({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=lb(cb({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 fb(e,t=`Assertion error`){if(!e)throw Error(t)}function pb(e,t){return Array.from(t).sort(e===`horizontal`?mb:hb)}function mb(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function hb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function gb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function _b(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 vb({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}=_b(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return fb(i,`No rect found`),i}var yb;function bb(){return yb===void 0&&(yb=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),yb}function xb(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=pb(n,Array.from(t.children).filter(gb).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,vb({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=bb()?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:ub({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 Sb=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)}}},Cb=new Map,wb=new Sb;function Tb(e){Cb=new Map(Cb),Cb.delete(e)}function Eb(e,t){for(let[t]of Cb)if(t.id===e)return t}function Db(e,t){for(let[t,n]of Cb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Ob(){return Cb}function kb(e,t){return wb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ab(e,t){let n=Cb.get(e);Cb=new Map(Cb),Cb.set(e,t),wb.emit(`groupChange`,{group:e,prev:n,next:t})}function jb(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=_b(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 Mb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Nb(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:zb(e),b:zb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();fb(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Rb(Lb(n.a)),b:Rb(Lb(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 Pb=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Fb(e){let t=getComputedStyle(Bb(e)??e).display;return t===`flex`||t===`inline-flex`}function Ib(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`||Pb.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Lb(e){let t=e.length;for(;t--;){let n=e[t];if(fb(n,`Missing node`),Ib(n))return n}return null}function Rb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function zb(e){let t=[];for(;e;)t.push(e),e=Bb(e);return t}function Bb(e){let{parentNode:t}=e;return Mb(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 Hb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!gb(n)||n.contains(e)||e.contains(n))return!0;if(Nb(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 Ub(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=xb(r),a=jb(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Hb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Wb(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 Gb(e,t,n=0){return Math.abs(lb(e)-lb(t))<=n}function Kb(e,t){return Gb(e,t)?0:e>t?1:-1}function qb({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(Kb(r,c)<0)if(a){let e=(i+c)/2;r=Kb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=lb(r),r}function Jb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Gb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;fb(u!=null,`Invalid first pivot index`),fb(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];fb(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(fb(n!=null,`Previous layout not found for panel index ${t}`),Gb(n,i)){let t=o-n;Kb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];fb(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(fb(n!=null,`Previous layout not found for panel index ${t}`),Gb(n,o)){let t=n-i;Kb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];fb(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Kb(i,c)<0)if(e>0){let t=c-o,n=t/2;Kb(i+e,c)<0&&(e=Kb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Kb(i-e,c)<0&&(e=Kb(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];fb(e!=null,`Previous layout not found for panel index ${r}`);let a=qb({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];fb(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=qb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Gb(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(Wb(c,l))return i;{let t=e<0?d:u,r=s[t];fb(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=qb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Gb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];fb(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=qb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Gb(i,s)||(t-=s-i,l[r]=s),Gb(t,0))break;e>0?r--:r++}}}if(!Gb(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 Yb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Kb(e[n],t[n])!==0)return!1;return!0}function Xb({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(!Gb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];fb(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];fb(i!=null,`No layout data found for index ${e}`);let o=r[e];fb(o!=null,`No layout data found for index ${e}`);let s=qb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Gb(a,0))for(let e=0;e<t.length;e++){let n=r[e];fb(n!=null,`No layout data found for index ${e}`);let i=n+a,o=qb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Gb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Zb({groupId:e,panelId:t}){let n=()=>{let t=Ob();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=Xb({layout:Jb({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});Yb(l,p)||Ab(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&&Gb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ub({group:t});o(lb(cb({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Qb(e){e.defaultPrevented||Ub(e,Ob()).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=Zb({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function $b(e){let t=Ob();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 ex({groupId:e}){let t=()=>{let t=Ob();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=Xb({layout:e,panelConstraints:r});return n?o:(Yb(o,c)||Ab(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function tx(e,t){let n=$b(e),r=Db(n.id,!0),i=n.separators.find(t=>t.element===e);fb(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);fb(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=ex({groupId:n.id}).getLayout(),c=Xb({layout:Jb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Yb(s,c)||Ab(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function nx(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=$b(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&tx(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&tx(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&tx(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&tx(t,-5);break;case`End`:e.preventDefault(),tx(t,100);break;case`Enter`:{e.preventDefault();let n=$b(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Db(n.id,!0),o=n.separators.find(e=>e.element===t);fb(o,`Matching separator not found`);let s=a.get(o);fb(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(fb(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];tx(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=$b(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);fb(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(),tx(t,-100);break}}var rx={cursorFlags:0,state:`inactive`},ix=new Sb;function ax(){return rx}function ox(e){return ix.addListener(`change`,e)}function sx(e){let t=rx,n={...rx};n.cursorFlags=e,rx=n,ix.emit(`change`,{prev:t,next:n})}function cx(e){let t=rx;rx=e,ix.emit(`change`,{prev:t,next:e})}function lx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ob(),n=Ub(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)}),cx({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ux=e=>e,dx=()=>{},fx=1,px=2,mx=4,hx=8,gx=3,_x=12,vx;function yx(){return vx===void 0&&(vx=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(vx=!0)),vx}function bx({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&&yx()){let t=(e&fx)!==0,n=(e&px)!==0,r=(e&mx)!==0,i=(e&hx)!==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 yx()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var xx=new WeakMap;function Sx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=xx.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=ax();switch(r.state){case`active`:case`hover`:{let e=bx({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}xx.set(e,{prevStyle:t,styleSheet:n})}function Cx({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=Jb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Yb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?fx:px;break;case`vertical`:s|=d<0?mx:hx;break}}else Ab(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&gx:c|=s&gx,t.movementY===0?c|=o&_x:c|=s&_x,sx(c),Sx(e)}function wx(e){let t=Ob(),n=ax();switch(n.state){case`active`:Cx({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Tx(e){if(e.defaultPrevented)return;let t=ax(),n=Ob();switch(t.state){case`active`:if(e.buttons===0){cx({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Db(e.group.id,!0);Ab(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)}Cx({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ub(e,n);r.length===0?t.state!==`inactive`&&cx({cursorFlags:0,state:`inactive`}):cx({cursorFlags:0,hitRegions:r,state:`hover`}),Sx(e.currentTarget);break}}}function Ex(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ax().state){case`hover`:cx({cursorFlags:0,state:`inactive`})}}function Dx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ax();switch(t.state){case`active`:cx({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Sx(e.currentTarget),t.hitRegions.forEach(e=>{let t=Db(e.group.id,!0);Ab(e.group,t)}),e.preventDefault())}}function Ox(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=lb(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=lb((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function kx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ub({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:lb(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ax(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 jx({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=lb(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]=lb((r[e]??0)/a*l);else{let e=lb(l/c.length);for(let t of c)u[t]=e}return u}function Mx(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 Nx=new Map;function Px(e){let t=!0;fb(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=ub({group:e});if(t===0)return;let n=Db(e.id);if(!n)return;let r=db(e),i=n.defaultLayoutDeferred?Ox(r):n.layout,a=Xb({layout:jx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Yb(n.layout,a)&&Ax(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ab(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else kx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{fb(!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=ub({group:e}),s=db(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Mx(e.panels,l)||(l=void 0));let u=Xb({layout:e.mutableState.layouts[c]??l??Ox(s),panelConstraints:s}),d=e.element.ownerDocument;Nx.set(d,(Nx.get(d)??0)+1);let f=new Map;return xb(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ab(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{fb(!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`,nx)}),Nx.get(d)===1&&(d.addEventListener(`dblclick`,Qb,!0),d.addEventListener(`pointerdown`,lx,!0),d.addEventListener(`pointerleave`,wx),d.addEventListener(`pointermove`,Tx),d.addEventListener(`pointerout`,Ex),d.addEventListener(`pointerup`,Dx,!0)),function(){t=!1,Nx.set(d,Math.max(0,(Nx.get(d)??0)-1)),Tb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,nx)}),Nx.get(d)||(d.removeEventListener(`dblclick`,Qb,!0),d.removeEventListener(`pointerdown`,lx,!0),d.removeEventListener(`pointerleave`,wx),d.removeEventListener(`pointermove`,Tx),d.removeEventListener(`pointerout`,Ex),d.removeEventListener(`pointerup`,Dx,!0)),a.disconnect()}}function Fx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Ix(e){let t=(0,Q.useId)();return`${e??t}`}var Lx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Rx(e){let t=(0,Q.useRef)(e);return Lx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function zx(...e){return Rx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Bx(e){let t=(0,Q.useRef)({...e});return Lx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Vx=(0,Q.createContext)(null);function Hx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:ux});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Lx(()=>{Object.assign(n.current,ex({groupId:e}))})}function Ux({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=Rx(e=>{Yb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Rx(e=>{Yb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Ix(s),v=(0,Q.useRef)(null),[y,b]=Fx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=zx(v,a);Hx(_,o);let C=Rx((e,t)=>{let r=ax(),i=Eb(e),a=Db(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=Bx({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=pb(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=pb(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=Eb(_),i=Db(_);r&&i&&Ab(r,{...i,derivedPanelConstraints:db(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 Lx(()=>{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=Px(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Db(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=kb(_,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=Gb(t.collapsedSize,i[t.panelId]),a=Gb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=ax().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})})}Ux.displayName=`Group`;function Wx(){let e=(0,Q.useContext)(Vx);return fb(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Gx(e,t){let{id:n}=Wx(),r=(0,Q.useRef)({collapse:dx,expand:dx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:dx});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Lx(()=>{Object.assign(r.current,Zb({groupId:n,panelId:e}))})}function Kx({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=Ix(c),_=Bx({disabled:a}),v=(0,Q.useRef)(null),y=zx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Wx(),T=d!==null,E=Rx((e,t,n)=>{d?.(e,c,n)});Lx(()=>{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]),Gx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>kb(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:{...qx,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})})}Kx.displayName=`Panel`;var qx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Jx(){return(0,Q.useRef)(null)}function Yx({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=Xb({layout:Jb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Xb({layout:Jb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Xx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ix(a),l=Bx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=zx(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Wx(),x=v===`horizontal`?`vertical`:`horizontal`;Lx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=ox(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=kb(_,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(Yx({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})}Xx.displayName=`Separator`;var Zx={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Qx=fe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),$x=Bt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function eS(e){switch(e.toLowerCase()){case`json`:return ks().language;case`toml`:return Ts.define(Zx);default:return null}}function tS(e){let t=(0,$.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`loading`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),a,o;return t[1]===e?(a=t[2],o=t[3]):(a=()=>{let t=!1,n=new AbortController;return i({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:n.signal}).then(nS).then(e=>{t||i({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||i({status:`error`,message:e instanceof Error?e.message:`Failed to load file`})}),()=>{t=!0,n.abort()}},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,Q.useEffect)(a,o),r}async function nS(e){if(!e.ok)throw Error(`Failed to load file (HTTP ${e.status})`);return e.text()}function rS(e){let t=(0,$.c)(27),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=li(),c=tS(n),l=c.status===`loaded`?c.content:null,u,d;if(t[0]!==i||t[1]!==l||t[2]!==s?(u=()=>{if(!a.current||l===null)return;let e=eS(i),t=s===`dark`?Qx:$x,n=[Ms,...e?[e]:[],xs.editable.of(!1),ds.readOnly.of(!0),xs.lineWrapping,t],r=new xs({state:ds.create({doc:l,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},d=[l,i,s],t[0]=i,t[1]=l,t[2]=s,t[3]=u,t[4]=d):(u=t[3],d=t[4]),(0,Q.useEffect)(u,d),c.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsxs)(`span`,{children:[`Loading `,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(c.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsxs)(`div`,{className:`font-medium text-sm`,children:[`Couldn't load `,r]}),t[11]=r,t[12]=e);let a;t[13]===c.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:c.message}),t[13]=c.message,t[14]=a);let o;t[15]===n?o=t[16]:(o=(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:`Open file`}),t[15]=n,t[16]=o);let s;return t[17]!==i||t[18]!==r||t[19]!==e||t[20]!==a||t[21]!==o?(s=(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,o]}),t[17]=i,t[18]=r,t[19]=e,t[20]=a,t[21]=o,t[22]=s):s=t[22],s}let f;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[23]=f):f=t[23];let p;return t[24]!==i||t[25]!==r?(p=(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:f}),t[24]=i,t[25]=r,t[26]=p):p=t[26],p}function iS(e){return zi(`/api/asset?path=${encodeURIComponent(e)}`)}function aS(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function oS(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),s;t[0]===n?s=t[1]:(s=iS(n),t[0]=n,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Ne,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=aS(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(rS,{src:r,fileName:u,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(o,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(X,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:`Open file`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:`Open with built-in text editor`})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function sS(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":`Loading document`,children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Mo,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Mo,{className:`h-4 w-full`}),(0,Z.jsx)(Mo,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}var cS={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function lS(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}=li(),s=cS[r],c=s?(o===`dark`?Ir[s]:void 0)??zr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Gi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(aa,{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)(ia,{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)(da,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function uS(e){let{installState:t}=e;return t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null}function dS(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:`Requires ${e}.`,installAction:{label:`Install ${e} →`,url:t.installUrl},...t.hasWebFallback?{webFallback:{label:`Open in claude.ai →`,url:``}}:{}}}}return{enabled:!0,tooltip:null}}function fS(e){return ki(e)}function pS(e){return`Opened ${e} in your browser.`}var mS=`claude.ai`;async function hS(e,t=xh){(await t(ki(e))).ok?Y.success(pS(mS)):Y.error(`Couldn't open ${mS} in your browser.`)}function gS(e){let t=(0,$.c)(73),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o}=e,s=e.openExternal??xh,c=e.onWebFallbackSuccess??vS,l=e.onWebFallbackError??_S,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=dS({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d=u,f;t[4]!==r||t[5]!==i||t[6]!==n?(f=uS({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=f):f=t[7];let p=f,m;t[8]!==s||t[9]!==d.tooltip?(m=()=>{d.tooltip&&s(d.tooltip.installAction.url)},t[8]=s,t[9]=d.tooltip,t[10]=m):m=t[10];let h=m,g;t[11]!==l||t[12]!==c||t[13]!==s||t[14]!==a||t[15]!==n?(g=()=>{(async()=>{let e=await s(fS(a));e.ok?c(n):l(n,e.detail??e.reason)})()},t[11]=l,t[12]=c,t[13]=s,t[14]=a,t[15]=n,t[16]=g):g=t[16];let _=g;if(d.enabled){let e=`open-in-agent-item-${n.id}`,r=`Open with AI ${n.displayName}`,i;t[17]===n.id?i=t[18]:(i=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`}),t[17]=n.id,t[18]=i);let a;t[19]===n.displayName?a=t[20]:(a=(0,Z.jsx)(`span`,{children:n.displayName}),t[19]=n.displayName,t[20]=a);let s;return t[21]!==o||t[22]!==e||t[23]!==r||t[24]!==i||t[25]!==a?(s=(0,Z.jsxs)(Ja,{onSelect:o,"data-testid":e,"aria-label":r,children:[i,a]}),t[21]=o,t[22]=e,t[23]=r,t[24]=i,t[25]=a,t[26]=s):s=t[26],s}if(!d.tooltip){let e=p?`Open with AI ${n.displayName}, ${p}`:`Open with AI ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[27]===n.id?i=t[28]:(i=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`}),t[27]=n.id,t[28]=i);let a;t[29]===n.displayName?a=t[30]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[29]=n.displayName,t[30]=a);let o;t[31]===p?o=t[32]:(o=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[31]=p,t[32]=o);let s;return t[33]!==e||t[34]!==r||t[35]!==i||t[36]!==a||t[37]!==o?(s=(0,Z.jsxs)(Ja,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[33]=e,t[34]=r,t[35]=i,t[36]=a,t[37]=o,t[38]=s):s=t[38],s}let v=p?`Open with AI ${n.displayName}, ${p}`:`Open with AI ${n.displayName}`,y=`open-in-agent-item-${n.id}`,b;t[39]===n.id?b=t[40]:(b=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[39]=n.id,t[40]=b);let x;t[41]===n.displayName?x=t[42]:(x=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[41]=n.displayName,t[42]=x);let S;t[43]===p?S=t[44]:(S=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[43]=p,t[44]=S);let C;t[45]!==v||t[46]!==y||t[47]!==b||t[48]!==x||t[49]!==S?(C=(0,Z.jsxs)(Xa,{"data-testid":y,"data-row-disabled":``,"aria-label":v,children:[b,x,S]}),t[45]=v,t[46]=y,t[47]=b,t[48]=x,t[49]=S,t[50]=C):C=t[50];let w=`open-in-agent-submenu-${n.id}`,T=`open-in-agent-message-${n.id}`,E;t[51]!==d.tooltip.message||t[52]!==T?(E=(0,Z.jsx)(Oa,{className:`font-normal text-muted-foreground text-xs`,"data-testid":T,children:d.tooltip.message}),t[51]=d.tooltip.message,t[52]=T,t[53]=E):E=t[53];let D;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Ma,{}),t[54]=D):D=t[54];let O=`open-in-agent-install-${n.id}`,k;t[55]===d.tooltip.installAction.label?k=t[56]:(k=(0,Z.jsx)(`span`,{children:d.tooltip.installAction.label}),t[55]=d.tooltip.installAction.label,t[56]=k);let A;t[57]!==h||t[58]!==O||t[59]!==k?(A=(0,Z.jsx)(Ja,{onSelect:h,"data-testid":O,children:k}),t[57]=h,t[58]=O,t[59]=k,t[60]=A):A=t[60];let j;t[61]!==_||t[62]!==d.tooltip.webFallback||t[63]!==n.id?(j=d.tooltip.webFallback?(0,Z.jsxs)(Ja,{onSelect:_,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${d.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:d.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[61]=_,t[62]=d.tooltip.webFallback,t[63]=n.id,t[64]=j):j=t[64];let M;t[65]!==E||t[66]!==A||t[67]!==j||t[68]!==w?(M=(0,Z.jsxs)(ja,{className:`min-w-[260px]`,"data-testid":w,children:[E,D,A,j]}),t[65]=E,t[66]=A,t[67]=j,t[68]=w,t[69]=M):M=t[69];let N;return t[70]!==M||t[71]!==C?(N=(0,Z.jsxs)(To,{children:[C,M]}),t[70]=M,t[71]=C,t[72]=N):N=t[72],N}function _S(){}function vS(){}function yS(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Xh(),{dispatch:a}=zh(),o=Zm(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Dh({workspace:o});t[7]===n?s=t[8]:(s=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=Um.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(bS,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{kh(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function bS(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(Ho,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var xS=3100,SS=3;function CS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??SS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var wS={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}},TS=[`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 ES(e,t={}){let n=t.rng??Math.random,r=t.colors??TS,i=wS[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,OS=90,kS=16,AS=380,jS=.025,MS=.1,NS=.18,PS=400,FS=9.2736,IS=18.1799,LS=14.5244,RS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function zS(e,t){let{halfWidth:n,apexLift:r}=RS[t];return`M${e-n} ${LS+.3} Q${e} ${LS-r}, ${e+n} ${LS+.3}`}function BS(e){let t=1.5,n=.3;return`M${e-t} ${LS-n} Q${e} ${LS+1.4}, ${e+t} ${LS-n}`}var VS=15,HS=15;function US(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 WS(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=CS(g,t);_(n),y(JS),S(ES(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xS)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(qS),S(ES(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xS))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/AS)),C=Math.max(-1,Math.min(1,b/AS)),w=S*kS,T=-C*kS,E=0,D=0;if(x>=1){let e=Math.min(x/OS,1)*DS;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*MS,i+=(w-i)*MS,u.style.transform=`perspective(${PS}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*NS,o+=(D-o)*NS;let k=i*jS,A=-r*jS,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Gi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Gi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=Gi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let ee;t[24]===G?ee=t[25]:(ee=(0,Z.jsx)(`ellipse`,{cx:FS,cy:LS,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=ee);let te=(F||T)&&`ok-blob-eye-hidden`,ne;t[26]===te?ne=t[27]:(ne=Gi(`ok-blob-eye ok-blob-eye-right`,te),t[26]=te,t[27]=ne);let re;t[28]===ne?re=t[29]:(re=(0,Z.jsx)(`ellipse`,{cx:IS,cy:LS,rx:1.2722,ry:1.9083,className:ne}),t[28]=ne,t[29]=re);let ie;t[30]===I?ie=t[31]:(ie=zS(FS,I),t[30]=I,t[31]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[32]===ae?oe=t[33]:(oe=Gi(`ok-blob-happy-eye`,ae),t[32]=ae,t[33]=oe);let se;t[34]!==ie||t[35]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[34]=ie,t[35]=oe,t[36]=se):se=t[36];let ce;t[37]===I?ce=t[38]:(ce=zS(IS,I),t[37]=I,t[38]=ce);let le=(!F||T)&&`ok-blob-eye-hidden`,ue;t[39]===le?ue=t[40]:(ue=Gi(`ok-blob-happy-eye`,le),t[39]=le,t[40]=ue);let de;t[41]!==ce||t[42]!==ue?(de=(0,Z.jsx)(`path`,{d:ce,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ue}),t[41]=ce,t[42]=ue,t[43]=de):de=t[43];let K;t[44]===T?K=t[45]:(K=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:BS(FS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:BS(IS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=K);let fe;t[46]!==ee||t[47]!==re||t[48]!==se||t[49]!==de||t[50]!==K?(fe=(0,Z.jsxs)(`g`,{ref:p,children:[ee,re,se,de,K]}),t[46]=ee,t[47]=re,t[48]=se,t[49]=de,t[50]=K,t[51]=fe):fe=t[51];let pe;t[52]!==B||t[53]!==H||t[54]!==fe?(pe=(0,Z.jsxs)(`g`,{className:H,children:[U,fe]},B),t[52]=B,t[53]=H,t[54]=fe,t[55]=pe):pe=t[55];let me;t[56]===T?me=t[57]:(me=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=me);let he;t[58]!==v||t[59]!==x?(he=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(GS)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=he):he=t[60];let ge;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==pe||t[65]!==me||t[66]!==he?(ge=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:KS,children:[pe,me,he]}),t[61]=D,t[62]=s,t[63]=z,t[64]=pe,t[65]=me,t[66]=he,t[67]=ge):ge=t[67];let _e;return t[68]!==R||t[69]!==ge?(_e=(0,Z.jsx)(`span`,{ref:d,className:R,children:ge}),t[68]=R,t[69]=ge,t[70]=_e):_e=t[70],_e}function GS(e){return(0,Z.jsx)(`circle`,{cx:VS+e.originDx,cy:HS+e.originDy,r:e.size,className:`ok-blob-firework`,style:US(e)},e.id)}function KS(e){return e.preventDefault()}function qS(e){return e+1}function JS(e){return e+1}function YS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(WS,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function XS(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`kbd`,{"data-slot":`kbd`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZS(){let e=(0,$.c)(2),t=Ui()?`⌘ K`:`Ctrl K`,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(XS,{children:t}),e[0]=n):n=e[0];let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n,` `,(0,Z.jsx)(`span`,{children:`Search`})]}),e[1]=r):r=e[1],r}var QS=`open-knowledge:create-top-level-file`;function $S(){window.dispatchEvent(new CustomEvent(QS))}function eC(e){let t=()=>e();return window.addEventListener(QS,t),()=>window.removeEventListener(QS,t)}function tC(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(aC);if(e)return;let r=t.ok?Xr.safeParse(n):null;r?.success?(o(oC(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Gr(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(iC),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(rC);if(!e.ok)return;let n=Xr.safeParse(t);n.success&&o(oC(n.data.documents))}).catch(nC)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(sC,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(cC,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(Lm,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function nC(){}function rC(){return null}function iC(e){return e+1}function aC(){return null}function oC(e){return wr(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function sC(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=Yt(),a;t[0]===i?a=t[1]:(a=i({id:`ZmGmNh`}),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i({id:`W8uemY`}),t[2]=i,t[3]=o);let s;t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(YS,{title:a,subtitle:o,celebrateSignal:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]===r?c=t[9]:(c=(0,Z.jsx)(Om,{onPackSelect:r}),t[8]=r,t[9]=c);let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:$S,children:(0,Z.jsx)(J,{id:`ensWZc`,components:{0:(0,Z.jsx)(Fa,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=l):l=t[10];let u;t[11]===c?u=t[12]:(u=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[c,l]}),t[11]=c,t[12]=u);let d;return t[13]!==s||t[14]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[s,u]}),t[13]=s,t[14]=u,t[15]=d):d=t[15],d}function cC(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=Yt(),a;t[0]===i?a=t[1]:(a=i({id:`8XS8nG`}),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i({id:`GjElCU`}),t[2]=i,t[3]=o);let s;t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(YS,{title:a,subtitle:o,celebrateSignal:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(yS,{}),t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(c,{"aria-hidden":`true`,className:`size-3`}),d=(0,Z.jsx)(J,{id:`IajAbS`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;t[11]===r?f=t[12]:(f=(0,Z.jsxs)(X,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[u,d]}),t[11]=r,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(ZS,{}),t[13]=p):p=t[13];let m;t[14]===f?m=t[15]:(m=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[l,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[f,p]})]}),t[14]=f,t[15]=m);let h;return t[16]!==s||t[17]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[s,m]}),t[16]=s,t[17]=m,t[18]=h):h=t[18],h}function lC(e){let t=(0,$.c)(74),{folderPath:n,state:r,onChange:i}=e,[a,o]=(0,Q.useState)(!1),[s,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null);if(r.status===`idle`||r.status===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card p-4 space-y-3`,children:[(0,Z.jsx)(dC,{}),(0,Z.jsx)(Mo,{className:`h-7 w-full`}),(0,Z.jsx)(Mo,{className:`h-7 w-full`}),(0,Z.jsx)(Mo,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let e;return t[1]===r.message?e=t[2]:(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:[`Failed to load folder defaults: `,r.message]}),t[1]=r.message,t[2]=e),e}let f;t[3]===r.data.folder.frontmatter_defaults?f=t[4]:(f=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=f);let p=f,m;t[5]===r.data.frontmatterLocal?m=t[6]:(m=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=m);let h=m,g=r.data.frontmatterSources,_;t[7]===r.data.folder.path?_=t[8]:(_=zo(r.data.folder.path),t[7]=r.data.folder.path,t[8]=_);let v=_,y,b,x,S,C,w,T,E,D,O,k,A,j;if(t[9]!==s||t[10]!==a||t[11]!==v||t[12]!==n||t[13]!==h||t[14]!==p||t[15]!==i||t[16]!==u||t[17]!==g){let e=Object.keys(p),r=async function(e,t){let r=await Lo(n,{[e]:t});if(!r.ok){Y.error(`Save failed: ${r.error}`);return}i()},c=async function(e){let t=await Lo(n,{[e]:null});if(!t.ok){Y.error(`Remove failed: ${t.error}`);return}i()},f=function(e,t){let n=p[e];r(e,Ta(n,t))},m;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(m=function(){l({name:``,type:`text`,value:``,error:null}),o(!1)},t[31]=m):m=t[31],x=m;let _;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){l(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Wa[e];return{...t,type:e,value:n,error:null}})},t[32]=_):_=t[32],C=_;let M;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){l(t=>t&&{...t,value:e})},t[33]=M):M=t[33],w=M;let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){l(t=>t&&{...t,name:e,error:null})},t[34]=N):N=t[34],S=N;let P;t[35]!==s||t[36]!==n||t[37]!==p||t[38]!==i?(P=async function(){if(!s)return;let e=s.name.trim();if(!e){l({...s,error:`Name is required`});return}if(Object.hasOwn(p,e)){l({...s,error:`Key "${e}" already resolves here`});return}let t=await Lo(n,{[e]:s.value});if(!t.ok){l({...s,error:t.error});return}l(null),i()},t[35]=s,t[36]=n,t[37]=p,t[38]=i,t[39]=P):P=t[39],T=P;let F=function(e){d({key:e,draft:e,error:null})},I=function(e){d(t=>t&&{...t,draft:e,error:null})},L=async function(){if(!u)return;let e=u.draft.trim();if(!e){d({...u,error:`Name is required`});return}if(e===u.key){d(null);return}if(Object.hasOwn(p,e)){d({...u,error:`Key "${e}" already resolves here`});return}let t=p[u.key],r=await Lo(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},R=function(){d(null)};j=`rounded-lg border bg-card`,b=Jo,O=!a,t[40]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>o(!e),t[40]=k):k=t[40];let z=`size-3 transition-transform ${a?``:`rotate-90`}`,B;t[41]===z?B=t[42]:(B=(0,Z.jsx)(Wo,{className:z,"aria-hidden":!0}),t[41]=z,t[42]=B);let V;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(`span`,{children:`Folder defaults`}),t[43]=V):V=t[43];let H;t[44]===B?H=t[45]:(H=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[B,V]}),t[44]=B,t[45]=H);let U;t[46]===v?U=t[47]:(U=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:uC,children:v}),t[46]=v,t[47]=U),t[48]!==H||t[49]!==U?(A=(0,Z.jsxs)(qo,{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:[H,U]}),t[48]=H,t[49]=U,t[50]=A):A=t[50],y=Ko,E=`px-2 py-2`,D=e.length===0&&!s?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:`No defaults declared. Add a property to set a value every doc in this folder inherits.`}):e.map(e=>{let t=p[e],n=Object.hasOwn(h,e);return(0,Z.jsx)(xa,{keyName:e,value:t,declared:Ca(t,Sr(t)),rename:n?{state:u?.key===e?u:null,onBegin:()=>F(e),onChangeDraft:I,onCommit:L,onCancel:R}:void 0,badge:n?null:(0,Z.jsx)(Fo,{source:g[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>f(e,t),onRemove:n?()=>void c(e):void 0},e)}),t[9]=s,t[10]=a,t[11]=v,t[12]=n,t[13]=h,t[14]=p,t[15]=i,t[16]=u,t[17]=g,t[18]=y,t[19]=b,t[20]=x,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else y=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=t[29],j=t[30];let M;t[51]!==s||t[52]!==x||t[53]!==S||t[54]!==C||t[55]!==w||t[56]!==T?(M=s?(0,Z.jsx)(Ha,{draft:s,onChangeName:S,onChangeType:C,onChangeValue:w,onCommit:()=>void T(),onCancel:()=>l(null)}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:x,className:`mt-1 flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(c,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[51]=s,t[52]=x,t[53]=S,t[54]=C,t[55]=w,t[56]=T,t[57]=M):M=t[57];let N;t[58]!==M||t[59]!==E||t[60]!==D?(N=(0,Z.jsxs)(`div`,{className:E,children:[D,M]}),t[58]=M,t[59]=E,t[60]=D,t[61]=N):N=t[61];let P;t[62]!==y||t[63]!==N?(P=(0,Z.jsx)(y,{children:N}),t[62]=y,t[63]=N,t[64]=P):P=t[64];let F;t[65]!==b||t[66]!==P||t[67]!==O||t[68]!==k||t[69]!==A?(F=(0,Z.jsxs)(b,{open:O,onOpenChange:k,children:[A,P]}),t[65]=b,t[66]=P,t[67]=O,t[68]=k,t[69]=A,t[70]=F):F=t[70];let I;return t[71]!==F||t[72]!==j?(I=(0,Z.jsx)(`section`,{className:j,children:F}),t[71]=F,t[72]=j,t[73]=I):I=t[73],I}function uC(e){return e.stopPropagation()}function dC(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(bc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:`Folder defaults`})]}),e[0]=t):t=e[0],t}function fC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function pC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=fC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function mC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function hC(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:pC(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:mC(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:pC(e,t.pageTitles),children:a}}function gC(e){let t=(0,$.c)(52),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_;t[0]===i?_=t[1]:(_=async function(e){m(!0);let t=await no(e.source_folder,e.name);if(m(!1),!t.ok){Y.error(`Delete failed: ${t.error}`);return}Y.success(`Template "${e.name}" deleted`),u(null),i()},t[0]=i,t[1]=_);let v=_;if(r.status===`idle`||r.status===`loading`){let e;return t[2]===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:`Templates available`})}),(0,Z.jsx)(Mo,{className:`h-12 w-full`}),(0,Z.jsx)(Mo,{className:`h-12 w-full`})]}),t[2]=e):e=t[2],e}if(r.status===`error`){let e;return t[3]===r.message?e=t[4]:(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:[`Failed to load templates: `,r.message]}),t[3]=r.message,t[4]=e),e}let y;t[5]===r.data.folder.templates_available?y=t[6]:(y=r.data.folder.templates_available??[],t[5]=r.data.folder.templates_available,t[6]=y);let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:`Templates available`}),t[7]=x):x=t[7];let S;t[8]===b.length?S=t[9]:(S=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,(0,Z.jsx)(pe,{className:`text-xs`,variant:`secondary`,children:b.length})]}),t[8]=b.length,t[9]=S);let C;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>g(!0),children:[(0,Z.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),`New template`]}),t[10]=C):C=t[10];let w;t[11]===S?w=t[12]:(w=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[S,C]}),t[11]=S,t[12]=w);let T;t[13]===b?T=t[14]:(T=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:b.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No templates resolve here. Add one to seed new docs in this folder.`}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:b.map(e=>(0,Z.jsx)(vC,{template:e,onCreate:()=>f(e.name),onEdit:()=>s(e),onDelete:()=>u(e)},e.path))})}),t[13]=b,t[14]=T);let E;t[15]!==w||t[16]!==T?(E=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[w,T]}),t[15]=w,t[16]=T,t[17]=E):E=t[17];let D;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||s(null)},t[18]=D):D=t[18];let O;t[19]!==o||t[20]!==n||t[21]!==i?(O=(0,Z.jsx)(co,{folderPath:n,template:o,onOpenChange:D,onSaved:i}),t[19]=o,t[20]=n,t[21]=i,t[22]=O):O=t[22];let k=!!l,A;t[23]===p?A=t[24]:(A=e=>{!e&&!p&&u(null)},t[23]=p,t[24]=A);let j;t[25]!==l||t[26]!==p||t[27]!==v?(j=l&&(0,Z.jsx)(No,{itemName:`template "${l.name}"`,isSubmitting:p,onDelete:()=>v(l),customDescription:`This permanently removes ${l.path}. Agents that reference this template by name will fail until it's recreated or shadowed by an ancestor.${l.scope===`inherited`?`
28
-
29
- This template lives at an ancestor folder — deleting affects every folder under that ancestor that does not shadow it locally.`:``}`}),t[25]=l,t[26]=p,t[27]=v,t[28]=j):j=t[28];let M;t[29]!==k||t[30]!==A||t[31]!==j?(M=(0,Z.jsx)(dn,{open:k,onOpenChange:A,children:j}),t[29]=k,t[30]=A,t[31]=j,t[32]=M):M=t[32];let N;t[33]===b?N=t[34]:(N=new Set(b.map(_C)),t[33]=b,t[34]=N);let P;t[35]!==n||t[36]!==h||t[37]!==i||t[38]!==N?(P=(0,Z.jsx)(Qa,{folderPath:n,existingNames:N,open:h,onOpenChange:g,onCreated:i}),t[35]=n,t[36]=h,t[37]=i,t[38]=N,t[39]=P):P=t[39];let F=d!==null,I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{e||f(null)},t[40]=I):I=t[40];let L=d??void 0,R;t[41]!==a||t[42]!==n||t[43]!==F||t[44]!==L?(R=(0,Z.jsx)(dm,{open:F,onOpenChange:I,kind:`file`,initialDir:n,initialTemplate:L,folderConfig:a}),t[41]=a,t[42]=n,t[43]=F,t[44]=L,t[45]=R):R=t[45];let z;return t[46]!==O||t[47]!==M||t[48]!==P||t[49]!==R||t[50]!==E?(z=(0,Z.jsxs)(Z.Fragment,{children:[E,O,M,P,R]}),t[46]=O,t[47]=M,t[48]=P,t[49]=R,t[50]=E,t[51]=z):z=t[51],z}function _C(e){return e.name}function vC(e){let t=(0,$.c)(42),{template:n,onCreate:r,onEdit:i,onDelete:a}=e,o=n.title&&n.title!==n.name,s=n.title??n.name,c;t[0]===s?c=t[1]:(c=(0,Z.jsx)(`span`,{className:`font-medium truncate`,children:s}),t[0]=s,t[1]=c);let l;t[2]!==o||t[3]!==n.name?(l=o?(0,Z.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground shrink-0`,children:n.name}):null,t[2]=o,t[3]=n.name,t[4]=l):l=t[4];let u;t[5]!==n.name||t[6]!==n.scope||t[7]!==n.source_folder?(u=n.scope===`inherited`?(0,Z.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Z.jsx)(Fo,{source:n.source_folder,target:`templates/${n.name}.md`})}):null,t[5]=n.name,t[6]=n.scope,t[7]=n.source_folder,t[8]=u):u=t[8];let d;t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[c,l,u]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]===n.description?f=t[14]:(f=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[13]=n.description,t[14]=f);let p;t[15]!==i||t[16]!==d||t[17]!==f?(p=(0,Z.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:[d,f]}),t[15]=i,t[16]=d,t[17]=f,t[18]=p):p=t[18];let m=`Create note from ${s}`,h;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(_c,{className:`size-3.5`,"aria-hidden":!0}),t[19]=h):h=t[19];let g;t[20]!==r||t[21]!==m?(g=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`font-mono uppercase shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:r,"aria-label":m,children:[h,`Create`]}),t[20]=r,t[21]=m,t[22]=g):g=t[22];let _=`Actions for ${s}`,v;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(ya,{className:`size-4`,"aria-hidden":!0}),t[23]=v):v=t[23];let y;t[24]===_?y=t[25]:(y=(0,Z.jsx)(Ya,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":_,children:v})}),t[24]=_,t[25]=y);let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(rt,{"aria-hidden":!0}),t[26]=b):b=t[26];let x;t[27]===i?x=t[28]:(x=(0,Z.jsxs)(Ja,{onSelect:i,children:[b,`Edit`]}),t[27]=i,t[28]=x);let S;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(Rt,{"aria-hidden":!0}),t[29]=S):S=t[29];let C;t[30]===a?C=t[31]:(C=(0,Z.jsxs)(Ja,{variant:`destructive`,onSelect:a,children:[S,`Delete`]}),t[30]=a,t[31]=C);let w;t[32]!==x||t[33]!==C?(w=(0,Z.jsxs)(Ka,{align:`end`,children:[x,C]}),t[32]=x,t[33]=C,t[34]=w):w=t[34];let T;t[35]!==y||t[36]!==w?(T=(0,Z.jsxs)(qa,{children:[y,w]}),t[35]=y,t[36]=w,t[37]=T):T=t[37];let E;return t[38]!==T||t[39]!==p||t[40]!==g?(E=(0,Z.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm`,children:[p,g,T]}),t[38]=T,t[39]=p,t[40]=g,t[41]=E):E=t[41],E}function yC(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Gi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Gi(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function bC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Gi(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function CC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Gi(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function wC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function EC(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 DC(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)(ze,{className:`ml-1 size-3`}):(0,Z.jsx)(gt,{className:`ml-1 size-3`}):(0,Z.jsx)(Xs,{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)(X,{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 OC(e){let t=(0,$.c)(81),{folderPath:n}=e,{folderPaths:r,loading:i,pages:a,pageTitles:o,pageMeta:s}=Zr(),l=_o(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(i){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(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)(Mo,{className:`size-5 rounded`}),(0,Z.jsx)(Mo,{className:`h-7 w-48`})]}),(0,Z.jsx)(Mo,{className:`h-9 w-20 rounded-md`})]}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Mo,{className:`h-4 w-16`}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(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":`Loading folder contents`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[e,(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:[n,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Mo,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(jC)]})]})}),t[2]=r):r=t[2],r}let v,y,b,x,S,C,w,E,D,O;if(t[3]!==u||t[4]!==l||t[5]!==n||t[6]!==r||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==d||t[11]!==g||t[12]!==m){let e=hC(n,{pages:a,pageTitles:o,pageMeta:s,folderPaths:r}),i=EC(e.children,m,g),f;t[23]===m?f=t[24]:(f=function(e){e===m?_(AC):(h(e),_(`asc`))},t[23]=m,t[24]=f);let k=f;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(T,{className:`size-5 text-muted-foreground`}),t[25]=A):A=t[25];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(c,{className:`size-4`}),`New`]}),t[26]=M):M=t[26],t[27]===j?w=t[28]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[27]=j,t[28]=w),t[29]!==u||t[30]!==n||t[31]!==d?(E=(0,Z.jsx)(lC,{folderPath:n,state:u,onChange:d}),t[29]=u,t[30]=n,t[31]=d,t[32]=E):E=t[32],t[33]!==u||t[34]!==l||t[35]!==n||t[36]!==d?(D=(0,Z.jsx)(gC,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[33]=u,t[34]=l,t[35]=n,t[36]=d,t[37]=D):D=t[37],S=`rounded-lg border`,y=yC;let N=m===`name`?g===`asc`?`ascending`:`descending`:`none`,P;t[38]!==k||t[39]!==g||t[40]!==m?(P=(0,Z.jsx)(DC,{label:`Name`,sortKey:`name`,activeKey:m,activeDir:g,onSort:k}),t[38]=k,t[39]=g,t[40]=m,t[41]=P):P=t[41];let F;t[42]!==N||t[43]!==P?(F=(0,Z.jsx)(CC,{"aria-sort":N,children:P}),t[42]=N,t[43]=P,t[44]=F):F=t[44];let I=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,L;t[45]!==k||t[46]!==g||t[47]!==m?(L=(0,Z.jsx)(DC,{label:`Modified`,sortKey:`modified`,activeKey:m,activeDir:g,onSort:k}),t[45]=k,t[46]=g,t[47]=m,t[48]=L):L=t[48];let R;t[49]!==I||t[50]!==L?(R=(0,Z.jsx)(CC,{className:`w-32`,"aria-sort":I,children:L}),t[49]=I,t[50]=L,t[51]=R):R=t[51],t[52]!==F||t[53]!==R?(x=(0,Z.jsx)(bC,{children:(0,Z.jsxs)(SC,{children:[F,R]})}),t[52]=F,t[53]=R,t[54]=x):x=t[54],v=xC,b=i.length?i.map(kC):(0,Z.jsx)(SC,{children:(0,Z.jsx)(wC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=u,t[4]=l,t[5]=n,t[6]=r,t[7]=s,t[8]=o,t[9]=a,t[10]=d,t[11]=g,t[12]=m,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=E,t[21]=D,t[22]=O}else v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],E=t[20],D=t[21],O=t[22];let k;t[55]!==v||t[56]!==b?(k=(0,Z.jsx)(v,{children:b}),t[55]=v,t[56]=b,t[57]=k):k=t[57];let A;t[58]!==y||t[59]!==x||t[60]!==k?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[58]=y,t[59]=x,t[60]=k,t[61]=A):A=t[61];let j;t[62]!==A||t[63]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[62]=A,t[63]=S,t[64]=j):j=t[64];let M;t[65]!==j||t[66]!==C||t[67]!==w||t[68]!==E||t[69]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,E,D,j]}),t[65]=j,t[66]=C,t[67]=w,t[68]=E,t[69]=D,t[70]=M):M=t[70];let N;t[71]!==M||t[72]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[71]=M,t[72]=O,t[73]=N):N=t[73];let P;t[74]!==f||t[75]!==l||t[76]!==n?(P=(0,Z.jsx)(dm,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[74]=f,t[75]=l,t[76]=n,t[77]=P):P=t[77];let F;return t[78]!==N||t[79]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[78]=N,t[79]=P,t[80]=F):F=t[80],F}function kC(e){return(0,Z.jsxs)(SC,{children:[(0,Z.jsx)(wC,{children:(0,Z.jsxs)(`a`,{href:qr(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)(Sc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(L,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(wC,{className:`text-muted-foreground`,children:e.kind===`file`?TC(e.modified):`—`})]},e.path)}function AC(e){return e===`asc`?`desc`:`asc`}function jC(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)(Mo,{className:`size-4 rounded`}),(0,Z.jsx)(Mo,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Mo,{className:`h-4 w-16`})})]},e)}function MC(e){let t=(0,$.c)(7),{docName:n}=e,[r,i]=(0,Q.useState)(NC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>zt(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Ht(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:`Still loading`}),t[4]=l):l=t[4];let u;return t[5]===c?u=t[6]:(u=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:`Cancel`})]}),t[5]=c,t[6]=u),u}function NC(){return new Set}var PC=(0,Q.createContext)(null);function FC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(IC),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)(PC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function IC(){return new Map}function LC(){let e=(0,Q.use)(PC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function RC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var zC=RC(()=>n(()=>import(`./SettingsDialogBody-Dr2p2Reu.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([42,1,33,2,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,43,9,14,21,11]),import.meta.url));function BC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=Yt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{variant:`default`,onClick:VC,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function VC(){return window.location.reload()}function HC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(ue,{fallbackRender:WC,onError:UC,children:n}),t[0]=n,t[1]=r),r}function UC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function WC(e){return(0,Z.jsx)(BC,{...e})}function GC(e){let t=(0,$.c)(64),{open:n,onOpenChange:r}=e,{_:i}=Yt(),{collabUrl:a}=ft(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=y(),{desktopPresent:u}=uo(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g;t[3]===i?g=t[4]:(g=i({id:`7PzzBU`}),t[3]=i,t[4]=g);let _;t[5]===i?_=t[6]:(_=i({id:`Q6hhn8`}),t[5]=i,t[6]=_);let v;t[7]===_?v=t[8]:(v=[{id:`preferences`,label:_}],t[7]=_,t[8]=v);let b;t[9]!==g||t[10]!==v?(b={id:`user`,label:g,enabled:!0,items:v},t[9]=g,t[10]=v,t[11]=b):b=t[11];let x;t[12]===i?x=t[13]:(x=i({id:`ZWyHmq`}),t[12]=i,t[13]=x);let S;t[14]===i?S=t[15]:(S=i({id:`Nu4DdT`}),t[14]=i,t[15]=S);let C;t[16]===S?C=t[17]:(C={id:`sync`,label:S},t[16]=S,t[17]=C);let w;t[18]===i?w=t[19]:(w=i({id:`iTylMl`}),t[18]=i,t[19]=w);let T;t[20]===w?T=t[21]:(T={id:`project-templates`,label:w},t[20]=w,t[21]=T);let E;t[22]===i?E=t[23]:(E=i({id:`3zyg_A`}),t[22]=i,t[23]=E);let D;t[24]===E?D=t[25]:(D={id:`okignore`,label:E},t[24]=E,t[25]=D);let O;t[26]!==T||t[27]!==D||t[28]!==C?(O=[C,T,D],t[26]=T,t[27]=D,t[28]=C,t[29]=O):O=t[29];let k;t[30]!==h||t[31]!==O||t[32]!==x?(k={id:`project`,label:x,enabled:h,items:O},t[30]=h,t[31]=O,t[32]=x,t[33]=k):k=t[33];let A;t[34]===i?A=t[35]:(A=i({id:`nbfdhU`}),t[34]=i,t[35]=A);let j;t[36]!==i||t[37]!==u?(j=u?[{id:`claude-desktop`,label:i({id:`yvHDYG`})}]:[],t[36]=i,t[37]=u,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M={id:`integrations`,label:A,enabled:!0,items:j},t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==k||t[43]!==M||t[44]!==b?(N=[b,k,M],t[42]=k,t[43]=M,t[44]=b,t[45]=N):N=t[45];let P=N,F;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)($t,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Zt,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[47]=I):I=t[47];let L;t[48]!==d||t[49]!==P?(L=(0,Z.jsx)(KC,{groups:P,activeId:d,onSelect:f}),t[48]=d,t[49]=P,t[50]=L):L=t[50];let R;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(JC,{}),t[51]=R):R=t[51];let z=s?o:null,B;t[52]!==d||t[53]!==c||t[54]!==l||t[55]!==z?(B=(0,Z.jsx)(`div`,{className:`min-h-0 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,children:(0,Z.jsx)(HC,{children:(0,Z.jsx)(Q.Suspense,{fallback:R,children:(0,Z.jsx)(zC,{activeId:d,userBinding:z,okignoreBinding:c,okignoreSynced:l})})})}),t[52]=d,t[53]=c,t[54]=l,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==L||t[58]!==B?(V=(0,Z.jsxs)(rn,{className:`grid h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] grid-cols-[220px_1fr] gap-0 overflow-hidden p-0 sm:max-w-[900px]`,"data-testid":`settings-dialog`,children:[F,I,L,B]}),t[57]=L,t[58]=B,t[59]=V):V=t[59];let H;return t[60]!==r||t[61]!==n||t[62]!==V?(H=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:V}),t[60]=r,t[61]=n,t[62]=V,t[63]=H):H=t[63],H}function KC(e){let t=(0,$.c)(12),{groups:n,activeId:r,onSelect:i}=e,{_:a}=Yt(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(qC,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;return t[9]!==o||t[10]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,className:`h-full overflow-y-auto overscroll-contain subtle-scrollbar border-r bg-muted/30 px-3 py-4`,children:s}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function qC(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=Gi(`mb-1 px-2 text-xs font-semibold uppercase tracking-wide font-mono`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`mb-1 px-2 text-xs italic text-muted-foreground/60`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Gi(`w-full rounded px-2 py-1.5 text-left text-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function JC(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Mo,{className:`h-5 w-32`}),r=(0,Z.jsx)(Mo,{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)(Mo,{className:`h-9 w-full`}),(0,Z.jsx)(Mo,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}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=Gi(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ux,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XC(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)(Kx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function ZC(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Gi(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(Xx,{"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 QC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var $C=na(`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 ew(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Gi($C({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:tw,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function tw(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}na(`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 nw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Go,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=Yt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(rw,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(nc,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(es,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(Yn,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(pl,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(es,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(Yn,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(ew,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(QC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let ee;t[52]===w?ee=t[53]:(ee=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=ee);let te;t[54]===b?te=t[55]:(te=b({id:`oqB2ez`}),t[54]=b,t[55]=te);let ne=!S,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(At,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==g||t[58]!==te||t[59]!==ne?(ie=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:g,children:re})}),t[57]=g,t[58]=te,t[59]=ne,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(Yn,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===b?se=t[65]:(se=b({id:`SiUUCS`}),t[64]=b,t[65]=se);let ce=!S,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(pt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==h||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:h,children:le})}),t[67]=h,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=de):de=t[71];let K;t[72]===ue?K=t[73]:(K=(0,Z.jsxs)(Yn,{children:[ue,de]}),t[72]=ue,t[73]=K);let fe=a?`secondary`:`ghost`,pe;t[74]!==b||t[75]!==a?(pe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=pe):pe=t[76];let me=a?`ok-replace-input`:void 0,he;t[77]!==f||t[78]!==a?(he=()=>f(!a),t[77]=f,t[78]=a,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Jc,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":me,onClick:he,children:ge})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===a?ve=t[88]:(ve=(0,Z.jsx)(vr,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Yn,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(be=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(Go,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(Jc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(qc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=be):be=t[100];let xe;t[101]===b?xe=t[102]:(xe=b({id:`wJo9oS`}),t[101]=b,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Xt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==y||t[105]!==xe?(Ce=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:y,children:Se})}),t[104]=y,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Yn,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==G||t[111]!==ee||t[112]!==oe||t[113]!==K||t[114]!==k||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,G,ee,oe,K,ye,be,Te]}),t[110]=G,t[111]=ee,t[112]=oe,t[113]=K,t[114]=k,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var aw={current:0,total:0},ow=120,sw=100;function cw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?re(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(l,n,lw)}function lw(){return null}function uw(e){if(!e||e.isDestroyed)return null;let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
27
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function yy(e,t){return`${e}\u0000${t}`}function by(e,t,n){let r=ji(e).body,i=ji(t).body;return r===i?``:_y(n,r,i,``,``,{context:3})}function xy(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=ft(),a;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={status:`idle`,diff:null},r[0]=a):a=r[0];let[o,s]=(0,Q.useState)(a),c=(0,Q.useRef)(i),l;r[1]===i?l=r[2]:(l=()=>{c.current=i},r[1]=i,r[2]=l),(0,Q.useEffect)(l);let u,d;return r[3]!==n||r[4]!==t||r[5]!==e?(u=()=>{if(!e){s({status:`idle`,diff:null});return}let r=e,i=!1;return s({status:`loading`,diff:null}),(async function(){try{let e=yy(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=by(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 Sy=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityPanelDiffView-d4ec9M69.js`),__vite__mapDeps([16,1,8,17]),import.meta.url)).ActivityPanelDiffView}));function Cy(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3);if(r<60)return`just now`;if(r<3600)return`${Math.floor(r/60)} min ago`;if(r<86400)return`${Math.floor(r/3600)}h ago`;if(r<86400*2)return`yesterday`;let i=Math.floor(r/86400);return i<7?`${i} days ago`:t.toLocaleDateString()}function wy(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Ty(e){return e.slice(0,7)}function Ey(e){return e.type===`upstream`?`Upstream sync`: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`?`Auto-save`:e.author}function Dy(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)(aa,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(da,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(ra,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ca,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ga,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(ma,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(fa,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function Oy(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)(Te,{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=Kn(i),t[1]=i,t[2]=a);let o=a,s=r?Ir[o]??zr[o]:zr[o],c;t[3]!==s||t[4]!==i?(c=s??Ai(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)(Dy,{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)(wc,{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)(Ys,{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)(fl,{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)(fa,{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)(Ys,{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)(fl,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function ky(e){let t=(0,$.c)(20),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:l,onRestoreSuccess:u}=e,[d,f]=(0,Q.useState)(r);if(n.length===0)return null;let p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>f(Ay),t[0]=p):p=t[0];let m;t[1]===d?m=t[2]:(m=d?(0,Z.jsx)(pt,{className:`size-3`}):(0,Z.jsx)(Wo,{className:`size-3`}),t[1]=d,t[2]=m);let h=d?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,g;t[3]!==d||t[4]!==m||t[5]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":d,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:p,children:[m,h]}),t[3]=d,t[4]=m,t[5]=h,t[6]=g):g=t[6];let _;t[7]!==o||t[8]!==a||t[9]!==s||t[10]!==n||t[11]!==d||t[12]!==c||t[13]!==i||t[14]!==u||t[15]!==l?(_=d&&n.map(e=>(0,Z.jsx)(Wy,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:l,onRestoreSuccess:u},e.sha)),t[7]=o,t[8]=a,t[9]=s,t[10]=n,t[11]=d,t[12]=c,t[13]=i,t[14]=u,t[15]=l,t[16]=_):_=t[16];let v;return t[17]!==g||t[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[g,_]}),t[17]=g,t[18]=_,t[19]=v):v=t[19],v}function Ay(e){return!e}function jy(e){return e.checkpoint?e.checkpoint.kind:`save`}function My(e){let t=jy(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${Ny(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function Ny(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function Py(e){return e.type===`checkpoint`?jy(e)===`save`?`version`:`auto-save`:`wip`}var Fy={version:`Restore this version`,"auto-save":`Restore this auto-save`,wip:`Restore to this point`},Iy={version:`Restore this version?`,"auto-save":`Restore this auto-save?`,wip:`Restore to this point?`};function Ly(e){return Fy[Py(e)]}function Ry(e){return Iy[Py(e)]}function zy(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function By(e){let t=(0,$.c)(20),{summaries:n}=e,[r,i]=(0,Q.useState)(!1),a=(0,Q.useId)();if(n.length===0)return null;let o,s;t[0]===n?(o=t[1],s=t[2]):([o,...s]=n,t[0]=n,t[1]=o,t[2]=s);let c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`• `}),t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=l);let u;t[6]!==r||t[7]!==s?(u=r&&s.map(Hy),t[6]=r,t[7]=s,t[8]=u):u=t[8];let d;t[9]!==a||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[l,u]}),t[9]=a,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==a||t[15]!==s.length?(f=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(Vy)},children:[r?(0,Z.jsx)(pt,{className:`size-3`}):(0,Z.jsx)(Wo,{className:`size-3`}),r?`Hide`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[d,f]}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}function Vy(e){return!e}function Hy(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 Uy(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=xy(n,r,i),c;t[0]===s.status?c=t[1]:(c=s.status===`loading`&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ee,{className:`size-3 animate-spin`}),`Loading diff`]}),t[0]=s.status,t[1]=c);let l;t[2]===s.status?l=t[3]:(l=s.status===`error`&&(0,Z.jsx)(`p`,{className:`py-2 text-xs text-destructive`,children:`Diff unavailable`}),t[2]=s.status,t[3]=l);let u;t[4]!==a||t[5]!==s.diff||t[6]!==s.status?(u=s.status===`ready`&&(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(ee,{className:`size-3 animate-spin`}),`Loading diff renderer`]}),children:(0,Z.jsx)(Sy,{diff:s.diff,viewType:a})}),t[4]=a,t[5]=s.diff,t[6]=s.status,t[7]=u):u=t[7];let d;return t[8]!==o||t[9]!==c||t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(`div`,{id:o,className:`px-3 pb-2`,"data-testid":`timeline-entry-diff`,children:[c,l,u]}),t[8]=o,t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Wy(e){let t=(0,$.c)(128),{entry:n,prominent:r,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c,onToggleExpanded:l,onRestoreSuccess:u}=e,d=r===void 0?!1:r,f;t[0]===n.timestamp?f=t[1]:(f=Cy(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=Ey(n),t[2]=n,t[3]=m);let h=m,g=n.contributors.flatMap(Gy),_;t[4]===n?_=t[5]:(_=zy(n),t[4]=n,t[5]=_);let v=_,[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null),w=(0,Q.useId)(),T,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>()=>C.current?.abort(),E=[],t[6]=T,t[7]=E):(T=t[6],E=t[7]),(0,Q.useEffect)(T,E);let D;t[8]!==n.sha||t[9]!==l?(D=()=>l(n.sha),t[8]=n.sha,t[9]=l,t[10]=D):D=t[10];let O=D,k;t[11]===b?k=t[12]:(k=function(){C.current?.abort(),C.current=null,S(!1),b(!1)},t[11]=b,t[12]=k);let A=k,j;t[13]!==s||t[14]!==n.sha||t[15]!==u||t[16]!==b?(j=async function(){S(!0);let e=new AbortController;C.current=e;let t=function(){e.signal.aborted||S(!1),C.current===e&&(C.current=null)},r;try{r=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:s,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:s,sha:n.sha,err:i}),Y.error(`Restore failed — document unchanged`,{duration:4e3})),t();return}if(e.signal.aborted){t();return}if(r.ok)b(!1),u();else{let e=`HTTP ${r.status}`;try{let t=Pr.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}console.error(`[timeline] rollback failed`,{docName:s,sha:n.sha,status:r.status,detail:e}),Y.error(`Restore failed`,{description:e,duration:6e3})}t()},t[13]=s,t[14]=n.sha,t[15]=u,t[16]=b,t[17]=j):j=t[17];let M=j,N;t[18]!==n||t[19]!==i||t[20]!==d?(N=d?(()=>{let e=jy(n);return e===`bridge-merge-loss`?(0,Z.jsx)(ei,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(hc,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(pc,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(Oy,{entry:n,isDark:i}),t[18]=n,t[19]=i,t[20]=d,t[21]=N):N=t[21];let P=N,F=c?w:void 0,I=c?`bg-muted`:`hover:bg-muted/80`,L;t[22]===I?L=t[23]:(L=[`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`,I],t[22]=I,t[23]=L);let R=L.join(` `),z;t[24]===O?z=t[25]:(z=e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),O())},t[24]=O,t[25]=z);let B;t[26]===P?B=t[27]:(B=(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:P}),t[26]=P,t[27]=B);let V;t[28]!==h||t[29]!==n||t[30]!==d?(V=d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`text-xs text-foreground truncate`,children:My(n)}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground/50`,children:`·`}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:h})]}):(0,Z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:h}),t[28]=h,t[29]=n,t[30]=d,t[31]=V):V=t[31];let H;t[32]!==n.timestamp||t[33]!==p?(H=(0,Z.jsx)(`time`,{className:`ml-auto shrink-0 text-xs text-muted-foreground/80`,dateTime:n.timestamp,title:n.timestamp,children:p}),t[32]=n.timestamp,t[33]=p,t[34]=H):H=t[34];let U;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`}),t[35]=U):U=t[35];let W;t[36]===n?W=t[37]:(W=Ly(n),t[36]=n,t[37]=W);let G;t[38]===b?G=t[39]:(G=e=>{e.stopPropagation(),b(!0)},t[38]=b,t[39]=G);let te;t[40]===x?te=t[41]:(te=x?(0,Z.jsx)(ee,{className:`size-3 animate-spin`}):(0,Z.jsx)(oa,{className:`size-3`}),t[40]=x,t[41]=te);let ne;t[42]!==x||t[43]!==W||t[44]!==G||t[45]!==te?(ne=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`timeline-entry-restore`,"aria-label":W,disabled:x,onClick:G,children:te})}),t[42]=x,t[43]=W,t[44]=G,t[45]=te,t[46]=ne):ne=t[46];let re;t[47]===n?re=t[48]:(re=Ly(n),t[47]=n,t[48]=re);let ie;t[49]===re?ie=t[50]:(ie=(0,Z.jsx)(vr,{side:`top`,children:re}),t[49]=re,t[50]=ie);let ae;t[51]!==ne||t[52]!==ie?(ae=(0,Z.jsxs)(Yn,{children:[ne,ie]}),t[51]=ne,t[52]=ie,t[53]=ae):ae=t[53];let oe;t[54]!==V||t[55]!==H||t[56]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[V,H,U,ae]}),t[54]=V,t[55]=H,t[56]=ae,t[57]=oe):oe=t[57];let se;t[58]===v?se=t[59]:(se=v.length>0&&(0,Z.jsx)(By,{summaries:v}),t[58]=v,t[59]=se);let ce=g.length>0?(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:g.join(`, `),children:g.join(`, `)}):(0,Z.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,title:n.message,children:n.message}),le;t[60]!==oe||t[61]!==se||t[62]!==ce?(le=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[oe,se,ce]}),t[60]=oe,t[61]=se,t[62]=ce,t[63]=le):le=t[63];let ue;t[64]!==c||t[65]!==O||t[66]!==F||t[67]!==R||t[68]!==z||t[69]!==B||t[70]!==le?(ue=(0,Z.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":c,"aria-controls":F,"data-testid":`timeline-entry-expand`,className:R,onClick:O,onKeyDown:z,children:[B,le]}),t[64]=c,t[65]=O,t[66]=F,t[67]=R,t[68]=z,t[69]=B,t[70]=le,t[71]=ue):ue=t[71];let de;t[72]!==o||t[73]!==a||t[74]!==w||t[75]!==s||t[76]!==n.sha||t[77]!==c?(de=c&&(0,Z.jsx)(Uy,{sha:n.sha,docName:s,cache:o,diffLayout:a,panelId:w}),t[72]=o,t[73]=a,t[74]=w,t[75]=s,t[76]=n.sha,t[77]=c,t[78]=de):de=t[78];let K;t[79]!==ue||t[80]!==de?(K=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[ue,de]}),t[79]=ue,t[80]=de,t[81]=K):K=t[81];let fe;t[82]!==A||t[83]!==b?(fe=e=>{e?b(!0):A()},t[82]=A,t[83]=b,t[84]=fe):fe=t[84];let pe;t[85]===n?pe=t[86]:(pe=Ry(n),t[85]=n,t[86]=pe);let me;t[87]===pe?me=t[88]:(me=(0,Z.jsx)($t,{children:pe}),t[87]=pe,t[88]=me);let he;t[89]===n.timestamp?he=t[90]:(he=wy(n.timestamp),t[89]=n.timestamp,t[90]=he);let ge;t[91]===n.sha?ge=t[92]:(ge=Ty(n.sha),t[91]=n.sha,t[92]=ge);let _e;t[93]!==p||t[94]!==he||t[95]!==ge?(_e=(0,Z.jsxs)(`span`,{className:`font-medium text-foreground`,children:[p,` (`,he,`, `,ge,`)`]}),t[93]=p,t[94]=he,t[95]=ge,t[96]=_e):_e=t[96];let ve;t[97]===h?ve=t[98]:(ve=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[97]=h,t[98]=ve);let ye;t[99]!==_e||t[100]!==ve?(ye=(0,Z.jsxs)(Zt,{children:[`This will replace the current document content with the version from`,` `,_e,` `,`by `,ve,`. Your current content is already saved in the timeline — you can restore it anytime.`]}),t[99]=_e,t[100]=ve,t[101]=ye):ye=t[101];let be;t[102]!==me||t[103]!==ye?(be=(0,Z.jsxs)(un,{children:[me,ye]}),t[102]=me,t[103]=ye,t[104]=be):be=t[104];let xe;t[105]===A?xe=t[106]:(xe=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:A,children:`Cancel`}),t[105]=A,t[106]=xe);let Se;t[107]===M?Se=t[108]:(Se=()=>M(),t[107]=M,t[108]=Se);let Ce;t[109]===x?Ce=t[110]:(Ce=x?(0,Z.jsx)(ee,{className:`mr-2 size-4 animate-spin`}):null,t[109]=x,t[110]=Ce);let we;t[111]!==x||t[112]!==Se||t[113]!==Ce?(we=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:x,onClick:Se,children:[Ce,`Restore`]}),t[111]=x,t[112]=Se,t[113]=Ce,t[114]=we):we=t[114];let Te;t[115]!==xe||t[116]!==we?(Te=(0,Z.jsxs)(cn,{children:[xe,we]}),t[115]=xe,t[116]=we,t[117]=Te):Te=t[117];let Ee;t[118]!==be||t[119]!==Te?(Ee=(0,Z.jsxs)(rn,{children:[be,Te]}),t[118]=be,t[119]=Te,t[120]=Ee):Ee=t[120];let De;t[121]!==y||t[122]!==fe||t[123]!==Ee?(De=(0,Z.jsx)(dn,{open:y,onOpenChange:fe,children:Ee}),t[121]=y,t[122]=fe,t[123]=Ee,t[124]=De):De=t[124];let Oe;return t[125]!==K||t[126]!==De?(Oe=(0,Z.jsxs)(Z.Fragment,{children:[K,De]}),t[125]=K,t[126]=De,t[127]=Oe):Oe=t[127],Oe}function Gy(e){return e.docs}function Ky(e){let t=(0,$.c)(63),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{resolvedTheme:a}=li(),o=a===`dark`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[0]=s):s=t[0];let[c,l]=(0,Q.useState)(s),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),[h]=(0,Q.useState)(Xy),[g,_]=(0,Q.useState)(Yy),v;t[1]===h?v=t[2]:(v=()=>{_(new Set),h.clear()},t[1]=h,t[2]=v);let y;t[3]===n?y=t[4]:(y=[n],t[3]=n,t[4]=y),(0,Q.useEffect)(v,y);let b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=b):b=t[5];let x=b,S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(){_(new Set)},t[6]=S):S=t[6];let C=S,w,T;t[7]===n?(w=t[8],T=t[9]):(w=()=>{if(!n){l([]);return}let e=!1,t=async function(){if(n)try{let t=await fetch(`/api/history?docName=${encodeURIComponent(n)}&limit=100`);if(e)return;if(!t.ok){p(`History unavailable`);return}let r=await t.json();if(e)return;l(r.entries??[]),p(null)}catch(t){let n=t;if(e)return;p(`History unavailable`),console.error(`[timeline]`,n)}};return d(!0),t().finally(()=>{e||d(!1)}),m.current=setInterval(t,1e4),()=>{e=!0,m.current&&clearInterval(m.current)}},T=[n],t[7]=n,t[8]=w,t[9]=T),(0,Q.useEffect)(w,T);let E,D,O,k,A,j,M,N;if(t[10]!==h||t[11]!==r||t[12]!==n||t[13]!==c||t[14]!==f||t[15]!==g||t[16]!==o||t[17]!==u||t[18]!==i){let e=[],a=[],s=!1;for(let t of c)t.type===`checkpoint`?(a.length>0&&(e.push({kind:`wip-group`,entries:a,isPreCheckpoint:!s}),a=[]),e.push({kind:`checkpoint`,entry:t}),s=!0):a.push(t);a.length>0&&e.push({kind:`wip-group`,entries:a,isPreCheckpoint:!s});let l;t[27]===c?l=t[28]:(l=c.some(Jy),t[27]=c,t[28]=l);let d=!l,p=!u&&!f&&c.length>0;A=`flex h-full flex-col`,t[29]!==r||t[30]!==p||t[31]!==i?(j=p&&(0,Z.jsx)(`div`,{className:`flex items-center justify-end gap-1 px-2 py-1.5`,children:(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsxs)(ts,{type:`single`,value:r,onValueChange:e=>{e&&i(e)},"aria-label":`Diff layout`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-md shrink-0`,children:[(0,Z.jsx)(Qo,{value:`unified`,"aria-label":`Unified diff`,className:`size-6 px-0`,children:(0,Z.jsx)(Yc,{className:`size-3.5`})}),(0,Z.jsx)(Qo,{value:`split`,"aria-label":`Split diff`,className:`size-6 px-0`,children:(0,Z.jsx)(lc,{className:`size-3.5`})})]})}),(0,Z.jsx)(vr,{children:r===`unified`?`Unified diff`:`Split diff`})]})}),t[29]=r,t[30]=p,t[31]=i,t[32]=j):j=t[32],M=`flex-1 overflow-y-auto subtle-scrollbar scroll-fade-mask`,t[33]===u?N=t[34]:(N=u&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading timeline history`,children:[1,2,3].map(qy)}),t[33]=u,t[34]=N),t[35]!==f||t[36]!==u?(E=!u&&f&&(0,Z.jsx)(`div`,{className:`px-4 py-3`,children:(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:f})}),t[35]=f,t[36]=u,t[37]=E):E=t[37],t[38]!==c.length||t[39]!==f||t[40]!==u?(D=!u&&!f&&c.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:`No history yet`})}),t[38]=c.length,t[39]=f,t[40]=u,t[41]=D):D=t[41],t[42]!==h||t[43]!==r||t[44]!==n||t[45]!==c||t[46]!==f||t[47]!==g||t[48]!==d||t[49]!==o||t[50]!==u?(O=!u&&!f&&d&&c.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:c.map(e=>(0,Z.jsx)(Wy,{entry:e,isDark:o,diffLayout:r,cache:h,docName:n,expanded:g.has(e.sha),onToggleExpanded:x,onRestoreSuccess:C},e.sha))}),t[42]=h,t[43]=r,t[44]=n,t[45]=c,t[46]=f,t[47]=g,t[48]=d,t[49]=o,t[50]=u,t[51]=O):O=t[51],k=!u&&!f&&!d&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-1 p-2`,children:e.map((e,t)=>e.kind===`checkpoint`?(0,Z.jsx)(Wy,{entry:e.entry,prominent:!0,isDark:o,diffLayout:r,cache:h,docName:n,expanded:g.has(e.entry.sha),onToggleExpanded:x,onRestoreSuccess:C},e.entry.sha):(0,Z.jsx)(ky,{entries:e.entries,defaultExpanded:e.isPreCheckpoint,isDark:o,diffLayout:r,cache:h,docName:n,expandedShas:g,onToggleExpanded:x,onRestoreSuccess:C},e.entries[0]?.sha??`wip-${t}`))}),t[10]=h,t[11]=r,t[12]=n,t[13]=c,t[14]=f,t[15]=g,t[16]=o,t[17]=u,t[18]=i,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A,t[24]=j,t[25]=M,t[26]=N}else E=t[19],D=t[20],O=t[21],k=t[22],A=t[23],j=t[24],M=t[25],N=t[26];let P;t[52]!==E||t[53]!==D||t[54]!==O||t[55]!==k||t[56]!==M||t[57]!==N?(P=(0,Z.jsxs)(`div`,{className:M,children:[N,E,D,O,k]}),t[52]=E,t[53]=D,t[54]=O,t[55]=k,t[56]=M,t[57]=N,t[58]=P):P=t[58];let F;return t[59]!==A||t[60]!==j||t[61]!==P?(F=(0,Z.jsxs)(`div`,{className:A,children:[j,P]}),t[59]=A,t[60]=j,t[61]=P,t[62]=F):F=t[62],F}function qy(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Mo,{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)(Mo,{className:`h-3 w-28`}),(0,Z.jsx)(Mo,{className:`h-3 w-40`})]})]},e)}function Jy(e){return e.type===`checkpoint`}function Yy(){return new Set}function Xy(){return new sa(32)}var Zy=[{id:`outline`,label:`Outline`,icon:Mc},{id:`links`,label:`Links`,icon:B},{id:`graph`,label:`Graph`,icon:Fc},{id:`timeline`,label:`Timeline`,icon:ac}];function Qy(){return n(()=>import(`./GraphPanel-Btq3W8xK.js`),__vite__mapDeps([18,1,19,3,7,8,20,21,22,23,24,25,26,27,28,29,30,31]),import.meta.url)}var $y=(0,Q.lazy)(async()=>({default:(await Qy()).GraphPanel})),eb=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Dgodq1_3.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,41]),import.meta.url)).ActivityModeContent}));function tb(e){let t=(0,$.c)(13),{docName:n,isSourceMode:r,activeTab:i,onActiveTabChange:a,mode:o}=e,[s,c]=(0,Q.useState)(`unified`),l;t[0]!==i||t[1]!==o||t[2]!==a?(l=o===`doc`?(0,Z.jsx)(`div`,{className:`flex flex-row items-center justify-center gap-3 p-2`,children:(0,Z.jsx)(ts,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:Zy.map(nb)})}):null,t[0]=i,t[1]=o,t[2]=a,t[3]=l):l=t[3];let u;t[4]!==i||t[5]!==s||t[6]!==n||t[7]!==r||t[8]!==o?(u=o===`doc`?(0,Z.jsxs)(`div`,{role:`tabpanel`,id:`panel-${i}`,"aria-labelledby":`tab-${i}`,className:`min-h-0 flex-1`,children:[i===`outline`&&(0,Z.jsx)(As,{docName:n,isSourceMode:r}),i===`links`&&(0,Z.jsx)(Gv,{docName:n}),i===`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:`Loading graph`}),children:(0,Z.jsx)($y,{activeDocName:n})}),i===`timeline`&&(0,Z.jsx)(Ky,{docName:n,diffLayout:s,onDiffLayoutChange:c})]}):(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:`Loading agent activity`}),children:(0,Z.jsx)(eb,{})})}),t[4]=i,t[5]=s,t[6]=n,t[7]=r,t[8]=o,t[9]=u):u=t[9];let d;return t[10]!==l||t[11]!==u?(d=(0,Z.jsxs)(Z.Fragment,{children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function nb(e){let{id:t,label:n,icon:r}=e;return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Qo,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Z.jsx)(Wn,{children:(0,Z.jsx)(r,{})})}),(0,Z.jsx)(vr,{side:`bottom`,children:n})]},t)}function rb(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function ib(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function ab(e){return e/100*window.innerHeight}function ob(e){return e/100*window.innerWidth}function sb(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 cb({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=sb(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=ib(t,i);break;case`em`:r=rb(t,i);break;case`vh`:r=ab(i);break;case`vw`:r=ob(i);break}return r}function lb(e){return parseFloat(e.toFixed(3))}function ub({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 db(e){let{panels:t}=e,n=ub({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=lb(cb({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=lb(cb({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=lb(cb({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=lb(cb({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 fb(e,t=`Assertion error`){if(!e)throw Error(t)}function pb(e,t){return Array.from(t).sort(e===`horizontal`?mb:hb)}function mb(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function hb(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function gb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function _b(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 vb({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}=_b(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return fb(i,`No rect found`),i}var yb;function bb(){return yb===void 0&&(yb=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),yb}function xb(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=pb(n,Array.from(t.children).filter(gb).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,vb({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=bb()?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:ub({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 Sb=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)}}},Cb=new Map,wb=new Sb;function Tb(e){Cb=new Map(Cb),Cb.delete(e)}function Eb(e,t){for(let[t]of Cb)if(t.id===e)return t}function Db(e,t){for(let[t,n]of Cb)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Ob(){return Cb}function kb(e,t){return wb.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Ab(e,t){let n=Cb.get(e);Cb=new Map(Cb),Cb.set(e,t),wb.emit(`groupChange`,{group:e,prev:n,next:t})}function jb(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=_b(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 Mb(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Nb(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:zb(e),b:zb(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();fb(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Rb(Lb(n.a)),b:Rb(Lb(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 Pb=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Fb(e){let t=getComputedStyle(Bb(e)??e).display;return t===`flex`||t===`inline-flex`}function Ib(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`||Pb.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Lb(e){let t=e.length;for(;t--;){let n=e[t];if(fb(n,`Missing node`),Ib(n))return n}return null}function Rb(e){return e&&Number(getComputedStyle(e).zIndex)||0}function zb(e){let t=[];for(;e;)t.push(e),e=Bb(e);return t}function Bb(e){let{parentNode:t}=e;return Mb(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 Hb({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!gb(n)||n.contains(e)||e.contains(n))return!0;if(Nb(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 Ub(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=xb(r),a=jb(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Hb({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Wb(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 Gb(e,t,n=0){return Math.abs(lb(e)-lb(t))<=n}function Kb(e,t){return Gb(e,t)?0:e>t?1:-1}function qb({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(Kb(r,c)<0)if(a){let e=(i+c)/2;r=Kb(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=lb(r),r}function Jb({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Gb(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;fb(u!=null,`Invalid first pivot index`),fb(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];fb(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(fb(n!=null,`Previous layout not found for panel index ${t}`),Gb(n,i)){let t=o-n;Kb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];fb(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(fb(n!=null,`Previous layout not found for panel index ${t}`),Gb(n,o)){let t=n-i;Kb(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];fb(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Kb(i,c)<0)if(e>0){let t=c-o,n=t/2;Kb(i+e,c)<0&&(e=Kb(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Kb(i-e,c)<0&&(e=Kb(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];fb(e!=null,`Previous layout not found for panel index ${r}`);let a=qb({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];fb(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=qb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Gb(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(Wb(c,l))return i;{let t=e<0?d:u,r=s[t];fb(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=qb({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!Gb(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];fb(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=qb({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Gb(i,s)||(t-=s-i,l[r]=s),Gb(t,0))break;e>0?r--:r++}}}if(!Gb(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 Yb(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Kb(e[n],t[n])!==0)return!1;return!0}function Xb({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(!Gb(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];fb(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];fb(i!=null,`No layout data found for index ${e}`);let o=r[e];fb(o!=null,`No layout data found for index ${e}`);let s=qb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!Gb(a,0))for(let e=0;e<t.length;e++){let n=r[e];fb(n!=null,`No layout data found for index ${e}`);let i=n+a,o=qb({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Gb(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Zb({groupId:e,panelId:t}){let n=()=>{let t=Ob();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=Xb({layout:Jb({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});Yb(l,p)||Ab(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&&Gb(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=ub({group:t});o(lb(cb({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Qb(e){e.defaultPrevented||Ub(e,Ob()).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=Zb({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function $b(e){let t=Ob();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 ex({groupId:e}){let t=()=>{let t=Ob();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=Xb({layout:e,panelConstraints:r});return n?o:(Yb(o,c)||Ab(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function tx(e,t){let n=$b(e),r=Db(n.id,!0),i=n.separators.find(t=>t.element===e);fb(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);fb(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=ex({groupId:n.id}).getLayout(),c=Xb({layout:Jb({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Yb(s,c)||Ab(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function nx(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=$b(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&tx(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&tx(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&tx(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&tx(t,-5);break;case`End`:e.preventDefault(),tx(t,100);break;case`Enter`:{e.preventDefault();let n=$b(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Db(n.id,!0),o=n.separators.find(e=>e.element===t);fb(o,`Matching separator not found`);let s=a.get(o);fb(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(fb(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];tx(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=$b(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);fb(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(),tx(t,-100);break}}var rx={cursorFlags:0,state:`inactive`},ix=new Sb;function ax(){return rx}function ox(e){return ix.addListener(`change`,e)}function sx(e){let t=rx,n={...rx};n.cursorFlags=e,rx=n,ix.emit(`change`,{prev:t,next:n})}function cx(e){let t=rx;rx=e,ix.emit(`change`,{prev:t,next:e})}function lx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Ob(),n=Ub(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)}),cx({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var ux=e=>e,dx=()=>{},fx=1,px=2,mx=4,hx=8,gx=3,_x=12,vx;function yx(){return vx===void 0&&(vx=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(vx=!0)),vx}function bx({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&&yx()){let t=(e&fx)!==0,n=(e&px)!==0,r=(e&mx)!==0,i=(e&hx)!==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 yx()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var xx=new WeakMap;function Sx(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=xx.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=ax();switch(r.state){case`active`:case`hover`:{let e=bx({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}xx.set(e,{prevStyle:t,styleSheet:n})}function Cx({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=Jb({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Yb(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?fx:px;break;case`vertical`:s|=d<0?mx:hx;break}}else Ab(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&gx:c|=s&gx,t.movementY===0?c|=o&_x:c|=s&_x,sx(c),Sx(e)}function wx(e){let t=Ob(),n=ax();switch(n.state){case`active`:Cx({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Tx(e){if(e.defaultPrevented)return;let t=ax(),n=Ob();switch(t.state){case`active`:if(e.buttons===0){cx({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Db(e.group.id,!0);Ab(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)}Cx({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Ub(e,n);r.length===0?t.state!==`inactive`&&cx({cursorFlags:0,state:`inactive`}):cx({cursorFlags:0,hitRegions:r,state:`hover`}),Sx(e.currentTarget);break}}}function Ex(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(ax().state){case`hover`:cx({cursorFlags:0,state:`inactive`})}}function Dx(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=ax();switch(t.state){case`active`:cx({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Sx(e.currentTarget),t.hitRegions.forEach(e=>{let t=Db(e.group.id,!0);Ab(e.group,t)}),e.preventDefault())}}function Ox(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=lb(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=lb((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function kx(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=ub({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:lb(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Ax(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 jx({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=lb(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]=lb((r[e]??0)/a*l);else{let e=lb(l/c.length);for(let t of c)u[t]=e}return u}function Mx(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 Nx=new Map;function Px(e){let t=!0;fb(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=ub({group:e});if(t===0)return;let n=Db(e.id);if(!n)return;let r=db(e),i=n.defaultLayoutDeferred?Ox(r):n.layout,a=Xb({layout:jx({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Yb(n.layout,a)&&Ax(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Ab(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else kx(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{fb(!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=ub({group:e}),s=db(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Mx(e.panels,l)||(l=void 0));let u=Xb({layout:e.mutableState.layouts[c]??l??Ox(s),panelConstraints:s}),d=e.element.ownerDocument;Nx.set(d,(Nx.get(d)??0)+1);let f=new Map;return xb(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Ab(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{fb(!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`,nx)}),Nx.get(d)===1&&(d.addEventListener(`dblclick`,Qb,!0),d.addEventListener(`pointerdown`,lx,!0),d.addEventListener(`pointerleave`,wx),d.addEventListener(`pointermove`,Tx),d.addEventListener(`pointerout`,Ex),d.addEventListener(`pointerup`,Dx,!0)),function(){t=!1,Nx.set(d,Math.max(0,(Nx.get(d)??0)-1)),Tb(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,nx)}),Nx.get(d)||(d.removeEventListener(`dblclick`,Qb,!0),d.removeEventListener(`pointerdown`,lx,!0),d.removeEventListener(`pointerleave`,wx),d.removeEventListener(`pointermove`,Tx),d.removeEventListener(`pointerout`,Ex),d.removeEventListener(`pointerup`,Dx,!0)),a.disconnect()}}function Fx(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Ix(e){let t=(0,Q.useId)();return`${e??t}`}var Lx=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function Rx(e){let t=(0,Q.useRef)(e);return Lx(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function zx(...e){return Rx(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Bx(e){let t=(0,Q.useRef)({...e});return Lx(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Vx=(0,Q.createContext)(null);function Hx(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:ux});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Lx(()=>{Object.assign(n.current,ex({groupId:e}))})}function Ux({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=Rx(e=>{Yb(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Rx(e=>{Yb(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Ix(s),v=(0,Q.useRef)(null),[y,b]=Fx(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=zx(v,a);Hx(_,o);let C=Rx((e,t)=>{let r=ax(),i=Eb(e),a=Db(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=Bx({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=pb(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=pb(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=Eb(_),i=Db(_);r&&i&&Ab(r,{...i,derivedPanelConstraints:db(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 Lx(()=>{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=Px(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Db(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=kb(_,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=Gb(t.collapsedSize,i[t.panelId]),a=Gb(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=ax().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})})}Ux.displayName=`Group`;function Wx(){let e=(0,Q.useContext)(Vx);return fb(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Gx(e,t){let{id:n}=Wx(),r=(0,Q.useRef)({collapse:dx,expand:dx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:dx});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Lx(()=>{Object.assign(r.current,Zb({groupId:n,panelId:e}))})}function Kx({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=Ix(c),_=Bx({disabled:a}),v=(0,Q.useRef)(null),y=zx(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Wx(),T=d!==null,E=Rx((e,t,n)=>{d?.(e,c,n)});Lx(()=>{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]),Gx(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>kb(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:{...qx,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})})}Kx.displayName=`Panel`;var qx={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Jx(){return(0,Q.useRef)(null)}function Yx({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=Xb({layout:Jb({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Xb({layout:Jb({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Xx({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ix(a),l=Bx({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=zx(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Wx(),x=v===`horizontal`?`vertical`:`horizontal`;Lx(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=ox(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=kb(_,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(Yx({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})}Xx.displayName=`Separator`;var Zx={name:`toml`,startState:function(){return{inString:!1,stringType:``,lhs:!0,inArray:0}},token:function(e,t){let n;if(!t.inString&&(n=e.match(/^('''|"""|'|")/))&&(t.stringType=n[0],t.inString=!0),e.sol()&&!t.inString&&t.inArray===0&&(t.lhs=!0),t.inString){for(;t.inString;)if(e.match(t.stringType))t.inString=!1;else if(e.peek()===`\\`)e.next(),e.next();else if(e.eol())break;else e.match(/^.[^\\\"\']*/);return t.lhs?`property`:`string`}else if(t.inArray&&e.peek()===`]`)return e.next(),t.inArray--,`bracket`;else if(t.lhs&&e.peek()===`[`&&e.skipTo(`]`))return e.next(),e.peek()===`]`&&e.next(),`atom`;else if(e.peek()===`#`)return e.skipToEnd(),`comment`;else if(e.eatSpace())return null;else if(t.lhs&&e.eatWhile(function(e){return e!=`=`&&e!=` `}))return`property`;else if(t.lhs&&e.peek()===`=`)return e.next(),t.lhs=!1,null;else if(!t.lhs&&e.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return`atom`;else if(!t.lhs&&(e.match(`true`)||e.match(`false`)))return`atom`;else if(!t.lhs&&e.peek()===`[`)return t.inArray++,e.next(),`bracket`;else if(!t.lhs&&e.match(/^\-?\d+(?:\.\d+)?/))return`number`;else e.eatSpace()||e.next();return null},languageData:{commentTokens:{line:`#`}}},Qx=fe({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),$x=Bt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function eS(e){switch(e.toLowerCase()){case`json`:return ks().language;case`toml`:return Ts.define(Zx);default:return null}}function tS(e){let t=(0,$.c)(4),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`loading`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),a,o;return t[1]===e?(a=t[2],o=t[3]):(a=()=>{let t=!1,n=new AbortController;return i({status:`loading`}),fetch(e,{credentials:`same-origin`,signal:n.signal}).then(nS).then(e=>{t||i({status:`loaded`,content:e})}).catch(e=>{t||e instanceof Error&&e.name===`AbortError`||i({status:`error`,message:e instanceof Error?e.message:`Failed to load file`})}),()=>{t=!0,n.abort()}},o=[e],t[1]=e,t[2]=a,t[3]=o),(0,Q.useEffect)(a,o),r}async function nS(e){if(!e.ok)throw Error(`Failed to load file (HTTP ${e.status})`);return e.text()}function rS(e){let t=(0,$.c)(27),{src:n,fileName:r,extension:i}=e,a=(0,Q.useRef)(null),o=(0,Q.useRef)(null),{resolvedTheme:s}=li(),c=tS(n),l=c.status===`loaded`?c.content:null,u,d;if(t[0]!==i||t[1]!==l||t[2]!==s?(u=()=>{if(!a.current||l===null)return;let e=eS(i),t=s===`dark`?Qx:$x,n=[Ms,...e?[e]:[],xs.editable.of(!1),ds.readOnly.of(!0),xs.lineWrapping,t],r=new xs({state:ds.create({doc:l,extensions:n}),parent:a.current});return o.current=r,()=>{r.destroy(),o.current=null}},d=[l,i,s],t[0]=i,t[1]=l,t[2]=s,t[3]=u,t[4]=d):(u=t[3],d=t[4]),(0,Q.useEffect)(u,d),c.status===`loading`){let e;t[5]===r?e=t[6]:(e=(0,Z.jsxs)(`span`,{children:[`Loading `,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(c.status===`error`){let e;t[11]===r?e=t[12]:(e=(0,Z.jsxs)(`div`,{className:`font-medium text-sm`,children:[`Couldn't load `,r]}),t[11]=r,t[12]=e);let a;t[13]===c.message?a=t[14]:(a=(0,Z.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:c.message}),t[13]=c.message,t[14]=a);let o;t[15]===n?o=t[16]:(o=(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:`Open file`}),t[15]=n,t[16]=o);let s;return t[17]!==i||t[18]!==r||t[19]!==e||t[20]!==a||t[21]!==o?(s=(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,o]}),t[17]=i,t[18]=r,t[19]=e,t[20]=a,t[21]=o,t[22]=s):s=t[22],s}let f;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(`div`,{ref:a,className:`min-h-0 flex-1 overflow-auto`}),t[23]=f):f=t[23];let p;return t[24]!==i||t[25]!==r?(p=(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:f}),t[24]=i,t[25]=r,t[26]=p):p=t[26],p}function iS(e){return zi(`/api/asset?path=${encodeURIComponent(e)}`)}function aS(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function oS(e){let t=(0,$.c)(28),{assetPath:n,mediaKind:r}=e,[i,a]=(0,Q.useState)(!1),s;t[0]===n?s=t[1]:(s=iS(n),t[0]=n,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=n.split(`/`).pop()??n,t[2]=n,t[3]=l);let u=l,d,f,p;if(t[4]!==n||t[5]!==u||t[6]!==i||t[7]!==r||t[8]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=u.includes(`.`)?u.split(`.`).pop()??``:``;if(f=e.length>0?e.toUpperCase():`FILE`,d=i?`text`:r,d===`pdf`){let e;t[12]!==u||t[13]!==c?(e=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(Ne,{src:c,title:u,fillContainer:!0})}),t[12]=u,t[13]=c,t[14]=e):e=t[14];let n;t[15]!==u||t[16]!==e?(n=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:e}),t[15]=u,t[16]=e,t[17]=n):n=t[17],p=n;break bb0}if(d===`text`){let r;t[18]===n?r=t[19]:(r=aS(n),t[18]=n,t[19]=r),p=(0,Z.jsx)(rS,{src:r,fileName:u,extension:e.toLowerCase()},n);break bb0}}t[4]=n,t[5]=u,t[6]=i,t[7]=r,t[8]=c,t[9]=d,t[10]=f,t[11]=p}else d=t[9],f=t[10],p=t[11];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[20]!==d||t[21]!==f||t[22]!==u||t[23]!==c?(m=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:d===`image`?(0,Z.jsx)(o,{src:c,alt:u,draggable:!1,slotClassName:`flex h-full w-full items-center justify-center`,className:`max-h-full max-w-full`}):d===`video`?(0,Z.jsx)(`video`,{src:c,controls:!0,className:`max-h-full max-w-full`}):d===`audio`?(0,Z.jsx)(`audio`,{src:c,controls:!0,className:`w-full max-w-md`}):(0,Z.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 text-center`,children:[(0,Z.jsx)(`div`,{className:`flex size-16 items-center justify-center rounded-md border bg-muted font-medium text-muted-foreground text-sm`,children:f}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:u}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,Z.jsx)(X,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Z.jsx)(`a`,{href:c,children:`Open file`})}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>a(!0),"data-testid":`asset-preview-open-as-text`,children:`Open with built-in text editor`})]})]})}),t[20]=d,t[21]=f,t[22]=u,t[23]=c,t[24]=m):m=t[24];let h;return t[25]!==u||t[26]!==m?(h=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":u,children:m}),t[25]=u,t[26]=m,t[27]=h):h=t[27],h}function sS(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`tiptap-editor pt-10`,role:`status`,"aria-busy":`true`,"aria-label":`Loading document`,children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(Mo,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Mo,{className:`h-4 w-full`}),(0,Z.jsx)(Mo,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}var cS={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function lS(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}=li(),s=cS[r],c=s?(o===`dark`?Ir[s]:void 0)??zr[s]:void 0,l;t[5]!==c||t[6]!==a?(l=c?{...a,"--ok-brand-color":c}:a,t[5]=c,t[6]=a,t[7]=l):l=t[7];let u=l,d=c&&`[&_*]:![color:var(--ok-brand-color)]`,f;t[8]!==n||t[9]!==d?(f=Gi(d,n),t[8]=n,t[9]=d,t[10]=f):f=t[10];let p=f;if(r===`claude-cowork`||r===`claude-code`){let e;return t[11]!==p||t[12]!==u||t[13]!==i?(e=(0,Z.jsx)(aa,{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)(ia,{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)(da,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function uS(e){let{installState:t}=e;return t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null}function dS(e){let{target:t,installState:n}=e;if(n.installed===null)return{enabled:!1,tooltip:null};if(n.installed===!1){let e=t.appBrandName??t.displayName;return{enabled:!1,tooltip:{message:`Requires ${e}.`,installAction:{label:`Install ${e} →`,url:t.installUrl},...t.hasWebFallback?{webFallback:{label:`Open in claude.ai →`,url:``}}:{}}}}return{enabled:!0,tooltip:null}}function fS(e){return ki(e)}function pS(e){return`Opened ${e} in your browser.`}var mS=`claude.ai`;async function hS(e,t=xh){(await t(ki(e))).ok?Y.success(pS(mS)):Y.error(`Couldn't open ${mS} in your browser.`)}function gS(e){let t=(0,$.c)(73),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o}=e,s=e.openExternal??xh,c=e.onWebFallbackSuccess??vS,l=e.onWebFallbackError??_S,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=dS({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d=u,f;t[4]!==r||t[5]!==i||t[6]!==n?(f=uS({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=f):f=t[7];let p=f,m;t[8]!==s||t[9]!==d.tooltip?(m=()=>{d.tooltip&&s(d.tooltip.installAction.url)},t[8]=s,t[9]=d.tooltip,t[10]=m):m=t[10];let h=m,g;t[11]!==l||t[12]!==c||t[13]!==s||t[14]!==a||t[15]!==n?(g=()=>{(async()=>{let e=await s(fS(a));e.ok?c(n):l(n,e.detail??e.reason)})()},t[11]=l,t[12]=c,t[13]=s,t[14]=a,t[15]=n,t[16]=g):g=t[16];let _=g;if(d.enabled){let e=`open-in-agent-item-${n.id}`,r=`Open with AI ${n.displayName}`,i;t[17]===n.id?i=t[18]:(i=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`}),t[17]=n.id,t[18]=i);let a;t[19]===n.displayName?a=t[20]:(a=(0,Z.jsx)(`span`,{children:n.displayName}),t[19]=n.displayName,t[20]=a);let s;return t[21]!==o||t[22]!==e||t[23]!==r||t[24]!==i||t[25]!==a?(s=(0,Z.jsxs)(Ja,{onSelect:o,"data-testid":e,"aria-label":r,children:[i,a]}),t[21]=o,t[22]=e,t[23]=r,t[24]=i,t[25]=a,t[26]=s):s=t[26],s}if(!d.tooltip){let e=p?`Open with AI ${n.displayName}, ${p}`:`Open with AI ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[27]===n.id?i=t[28]:(i=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`}),t[27]=n.id,t[28]=i);let a;t[29]===n.displayName?a=t[30]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[29]=n.displayName,t[30]=a);let o;t[31]===p?o=t[32]:(o=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[31]=p,t[32]=o);let s;return t[33]!==e||t[34]!==r||t[35]!==i||t[36]!==a||t[37]!==o?(s=(0,Z.jsxs)(Ja,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[33]=e,t[34]=r,t[35]=i,t[36]=a,t[37]=o,t[38]=s):s=t[38],s}let v=p?`Open with AI ${n.displayName}, ${p}`:`Open with AI ${n.displayName}`,y=`open-in-agent-item-${n.id}`,b;t[39]===n.id?b=t[40]:(b=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[39]=n.id,t[40]=b);let x;t[41]===n.displayName?x=t[42]:(x=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[41]=n.displayName,t[42]=x);let S;t[43]===p?S=t[44]:(S=p?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:p}):null,t[43]=p,t[44]=S);let C;t[45]!==v||t[46]!==y||t[47]!==b||t[48]!==x||t[49]!==S?(C=(0,Z.jsxs)(Xa,{"data-testid":y,"data-row-disabled":``,"aria-label":v,children:[b,x,S]}),t[45]=v,t[46]=y,t[47]=b,t[48]=x,t[49]=S,t[50]=C):C=t[50];let w=`open-in-agent-submenu-${n.id}`,T=`open-in-agent-message-${n.id}`,E;t[51]!==d.tooltip.message||t[52]!==T?(E=(0,Z.jsx)(Oa,{className:`font-normal text-muted-foreground text-xs`,"data-testid":T,children:d.tooltip.message}),t[51]=d.tooltip.message,t[52]=T,t[53]=E):E=t[53];let D;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(Ma,{}),t[54]=D):D=t[54];let O=`open-in-agent-install-${n.id}`,k;t[55]===d.tooltip.installAction.label?k=t[56]:(k=(0,Z.jsx)(`span`,{children:d.tooltip.installAction.label}),t[55]=d.tooltip.installAction.label,t[56]=k);let A;t[57]!==h||t[58]!==O||t[59]!==k?(A=(0,Z.jsx)(Ja,{onSelect:h,"data-testid":O,children:k}),t[57]=h,t[58]=O,t[59]=k,t[60]=A):A=t[60];let j;t[61]!==_||t[62]!==d.tooltip.webFallback||t[63]!==n.id?(j=d.tooltip.webFallback?(0,Z.jsxs)(Ja,{onSelect:_,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${d.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:d.tooltip.webFallback.label}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser with prompt pre-filled`})]}):null,t[61]=_,t[62]=d.tooltip.webFallback,t[63]=n.id,t[64]=j):j=t[64];let M;t[65]!==E||t[66]!==A||t[67]!==j||t[68]!==w?(M=(0,Z.jsxs)(ja,{className:`min-w-[260px]`,"data-testid":w,children:[E,D,A,j]}),t[65]=E,t[66]=A,t[67]=j,t[68]=w,t[69]=M):M=t[69];let N;return t[70]!==M||t[71]!==C?(N=(0,Z.jsxs)(To,{children:[C,M]}),t[70]=M,t[71]=C,t[72]=N):N=t[72],N}function _S(){}function vS(){}function yS(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Xh(),{dispatch:a}=zh(),o=Zm(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Dh({workspace:o});t[7]===n?s=t[8]:(s=Gi(`grid w-full max-w-5xl gap-4 sm:grid-cols-3`,n),t[7]=n,t[8]=s),c=Um.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(bS,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{kh(t),i()}},t.id)}),t[0]=n,t[1]=a,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsx)(`div`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function bS(e){let t=(0,$.c)(22),{target:n,status:r,onOpen:i,onInstall:a}=e,o=r===`installed`?i:r===`missing`?a:void 0,s=r===`pending`||r===`installed`&&i===void 0,c=r===`installed`?`Open`:r===`missing`?`Install`:`Checking`,l;t[0]===n.id?l=t[1]:(l=(0,Z.jsx)(lS,{id:n.id,"aria-hidden":`true`,className:`size-4`}),t[0]=n.id,t[1]=l);let u;t[2]===n.displayName?u=t[3]:(u=(0,Z.jsx)(`h3`,{className:`text-sm font-medium leading-tight`,children:n.displayName}),t[2]=n.displayName,t[3]=u);let d;t[4]!==l||t[5]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-start sm:items-center gap-2`,children:[l,u]}),t[4]=l,t[5]=u,t[6]=d):d=t[6];let f;t[7]===n.tagline?f=t[8]:(f=n.tagline?(0,Z.jsx)(`p`,{className:`text-1sm leading-relaxed text-muted-foreground`,children:n.tagline}):null,t[7]=n.tagline,t[8]=f);let p;t[9]!==d||t[10]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[d,f]}),t[9]=d,t[10]=f,t[11]=p):p=t[11];let m;t[12]===r?m=t[13]:(m=r===`missing`?(0,Z.jsx)(Ho,{"aria-hidden":`true`,className:`size-3`}):null,t[12]=r,t[13]=m);let h;t[14]!==c||t[15]!==m?(h=(0,Z.jsxs)(`p`,{className:`mt-auto inline-flex items-center gap-1 pt-2 font-mono text-2xs uppercase tracking-wider text-muted-foreground`,children:[c,m]}),t[14]=c,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==s||t[18]!==o||t[19]!==p||t[20]!==h?(g=(0,Z.jsxs)(`button`,{type:`button`,onClick:o,disabled:s,className:`group flex h-full flex-col items-start gap-4 rounded-2xl border border-border/60 bg-card p-5 text-left transition-[border-color,box-shadow,transform] hover:border-border hover:shadow-sm focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px disabled:cursor-not-allowed disabled:opacity-60`,children:[p,h]}),t[17]=s,t[18]=o,t[19]=p,t[20]=h,t[21]=g):g=t[21],g}var xS=3100,SS=3;function CS(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??SS;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var wS={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}},TS=[`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 ES(e,t={}){let n=t.rng??Math.random,r=t.colors??TS,i=wS[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,OS=90,kS=16,AS=380,jS=.025,MS=.1,NS=.18,PS=400,FS=9.2736,IS=18.1799,LS=14.5244,RS={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function zS(e,t){let{halfWidth:n,apexLift:r}=RS[t];return`M${e-n} ${LS+.3} Q${e} ${LS-r}, ${e+n} ${LS+.3}`}function BS(e){let t=1.5,n=.3;return`M${e-t} ${LS-n} Q${e} ${LS+1.4}, ${e+t} ${LS-n}`}var VS=15,HS=15;function US(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 WS(e){let t=(0,$.c)(71),{size:n,className:r,trackMouse:i,variant:a,celebrateSignal:o}=e,s=n===void 0?48:n,c=i===void 0?!0:i,l=a===void 0?`default`:a,u=o===void 0?0:o,d=(0,Q.useRef)(null),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={x:0,y:0},t[0]=m):m=t[0];let h=(0,Q.useRef)(m),[g,_]=(0,Q.useState)(0),[v,y]=(0,Q.useState)(0),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],t[1]=b):b=t[1];let[x,S]=(0,Q.useState)(b),C=(0,Q.useRef)(0),w=(0,Q.useRef)(void 0),T=l===`sleeping`,E;t[2]!==g||t[3]!==T?(E=function(){if(T)return;let e=typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),t=C.current===0?1/0:e-C.current;C.current=e;let n=CS(g,t);_(n),y(JS),S(ES(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xS)},t[2]=g,t[3]=T,t[4]=E):E=t[4];let D=E,O,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>()=>clearTimeout(w.current),k=[],t[5]=O,t[6]=k):(O=t[5],k=t[6]),(0,Q.useEffect)(O,k);let A,j;t[7]!==u||t[8]!==T?(A=()=>{u===0||T||(_(3),y(qS),S(ES(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},xS))},j=[u,T],t[7]=u,t[8]=T,t[9]=A,t[10]=j):(A=t[9],j=t[10]),(0,Q.useEffect)(A,j);let M,N;t[11]!==T||t[12]!==c?(M=()=>{if(!c||T||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=0,t=0,n=!1,r=0,i=0,a=0,o=0,s=0,l=function(){s===0&&(s=requestAnimationFrame(m))},u=function(r){e=r.clientX,t=r.clientY,n=!0,l()};function m(){s=0;let c=f.current,u=d.current;if(!c||!u){l();return}let m=n;n=!1;let g=c.getBoundingClientRect(),_=g.left+g.width/2,v=g.top+g.height*.48,y=e-_,b=t-v,x=Math.hypot(y,b),S=Math.max(-1,Math.min(1,y/AS)),C=Math.max(-1,Math.min(1,b/AS)),w=S*kS,T=-C*kS,E=0,D=0;if(x>=1){let e=Math.min(x/OS,1)*DS;E=y/x*e,D=b/x*e}let O=Math.abs(T-r)<.01&&Math.abs(w-i)<.01&&Math.abs(E-a)<.01&&Math.abs(D-o)<.01;if(!m&&O)return;l(),r+=(T-r)*MS,i+=(w-i)*MS,u.style.transform=`perspective(${PS}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*NS,o+=(D-o)*NS;let k=i*jS,A=-r*jS,j=a+k,M=o+A;h.current.x=j,h.current.y=M,p.current?.setAttribute(`transform`,`translate(${j.toFixed(3)} ${M.toFixed(3)})`)}return document.addEventListener(`mousemove`,u,{passive:!0}),l(),()=>{document.removeEventListener(`mousemove`,u),s!==0&&cancelAnimationFrame(s),s=0,d.current&&(d.current.style.transform=``),h.current={x:0,y:0},p.current?.removeAttribute(`transform`)}},N=[c,T],t[11]=T,t[12]=c,t[13]=M,t[14]=N):(M=t[13],N=t[14]),(0,Q.useEffect)(M,N);let P;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=p.current;if(!e)return;let{x:t,y:n}=h.current;e.setAttribute(`transform`,`translate(${t.toFixed(3)} ${n.toFixed(3)})`)},t[15]=P):P=t[15],(0,Q.useLayoutEffect)(P);let F=g>0,I=F?g:1,L=F?`ok-blob-clicked-${g}`:null,R;t[16]===r?R=t[17]:(R=Gi(`ok-blob-3d-wrapper`,r),t[16]=r,t[17]=R);let z=T?`cursor-default`:`cursor-pointer`,B=`body-${v}`,V=T&&`ok-blob-sleeping`,H;t[18]!==L||t[19]!==V?(H=Gi(`ok-blob-group`,V,L),t[18]=L,t[19]=V,t[20]=H):H=t[20];let U;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(`path`,{d:`M25.2339 6.78134C25.5199 7.35734 25.8179 8.47234 26.0179 9.07834C26.0189 9.08234 26.0209 9.08634 26.0219 9.09134C26.0229 9.09534 26.0249 9.10034 26.0259 9.10434C26.0539 9.19734 26.0949 9.29533 26.1519 9.41633C26.2919 9.71133 26.5269 10.1173 27.1299 11.1683C27.3259 11.4643 27.5209 11.7693 27.7119 12.0903C29.9739 15.1623 29.3259 20.1913 27.0469 22.9153C26.7779 23.2953 26.4869 23.6043 26.1889 23.8863C26.1519 23.9253 26.1129 23.9643 26.0729 24.0033C25.3159 24.7543 24.2949 25.4673 23.6129 25.8323C22.7469 26.2983 22.1349 26.5483 21.6299 26.7463C20.3649 27.3063 19.0609 27.7733 17.6569 28.0423C15.9649 28.3513 14.1939 28.4433 12.4569 28.1373C11.4779 27.9663 10.5119 27.6663 9.60891 27.2493C8.77491 26.8663 7.99192 26.3853 7.26992 25.8403C6.83592 25.5393 6.43893 25.2343 6.08093 24.9383C5.57893 24.5223 5.15993 24.1263 4.83493 23.7793C4.04993 22.9443 3.31593 21.8893 2.80893 21.0953C2.72593 20.9663 2.64792 20.8433 2.57592 20.7293C2.56192 20.7093 2.54793 20.6893 2.53393 20.6703C2.08593 20.0263 1.71892 19.3293 1.43792 18.5993C1.42892 18.5453 1.42093 18.4903 1.41293 18.4353C1.32093 17.7443 1.08292 16.9423 1.01092 15.6333C0.984921 15.0653 0.998928 14.4013 1.12393 13.6353C1.20693 13.1413 1.31993 12.9023 1.40893 12.7113C1.43593 12.6543 1.46193 12.6023 1.48593 12.5483C1.56793 12.3653 1.59392 12.1563 1.63592 11.9083C1.68992 11.5883 1.76992 11.1943 2.04592 10.7553C2.94392 9.37934 3.36792 8.81934 3.66592 8.33934C3.75592 8.20334 3.84292 8.08134 3.94192 7.96634C4.21592 7.64634 4.67693 7.29534 5.10293 7.05734C5.16693 7.02234 5.23093 6.98834 5.29193 6.95534C5.62993 6.77834 6.22592 6.30135 6.66992 5.92035C6.83692 5.77635 7.08193 5.60735 7.37393 5.40935C7.67393 5.20535 8.02593 4.96934 8.39193 4.70234C9.32093 4.02634 9.84091 3.69134 10.2599 3.42334C10.3799 3.34734 10.4919 3.27734 10.6049 3.20834C10.9609 2.98834 11.4149 2.73034 11.8869 2.48634C12.4519 2.19334 13.0469 1.92133 13.5089 1.72233C14.7399 1.30233 16.0539 1.01333 17.4169 1.00033C18.1169 0.991333 18.7939 1.16534 19.2389 1.43034C19.6869 1.69534 19.8689 2.00335 19.8039 2.23935C19.7379 2.47835 19.4399 2.63634 19.0109 2.74734C18.5789 2.85634 18.0469 2.92035 17.4889 2.96135C16.3639 3.04235 15.2399 3.36435 14.1499 3.80835C12.8199 4.35135 11.5379 5.07133 10.2719 5.84733C9.38691 6.39133 8.51192 6.97334 7.63592 7.56834C7.54492 7.63034 7.45492 7.69135 7.36492 7.75235C6.97392 8.06635 6.58293 8.38134 6.22293 8.66334C5.97893 8.85734 5.76793 9.04834 5.59393 9.21434C5.26893 9.52334 5.02393 9.74334 4.81893 9.93934C4.67793 10.0753 4.55793 10.2013 4.45593 10.3443C4.40093 10.4213 4.32992 10.5273 4.24792 10.6593C3.90492 11.1933 3.44493 12.1693 3.15393 13.1173C3.01893 13.5363 2.87991 14.0343 2.79391 14.5253C2.66591 15.2253 2.65594 15.9053 2.71994 16.2373C2.82794 16.8193 2.95593 17.4833 3.14093 18.0553C3.31293 18.6003 3.52991 19.0583 3.70791 19.2823C3.81591 19.4183 3.90394 19.5473 3.99594 19.6913C4.09394 19.8413 4.19191 20.0073 4.31091 20.2033C4.47891 20.4803 4.68592 20.8163 5.00192 21.2493C5.36492 21.7463 5.61793 22.1043 5.83493 22.4023C6.14493 22.8243 6.38591 23.1343 6.83691 23.5033C7.33891 23.9113 7.86593 24.3113 8.26693 24.6393C8.44893 24.7883 8.66993 24.9443 8.90493 25.0963C9.21593 25.2963 9.55192 25.4893 9.85592 25.6703C10.1059 25.8203 10.3059 25.9633 10.4869 26.0863C10.5429 26.1243 10.5979 26.1603 10.6519 26.1943C10.8699 26.2803 11.0929 26.3593 11.3159 26.4283C11.3539 26.4323 11.3949 26.4353 11.4369 26.4393C11.6509 26.4573 11.9089 26.4733 12.2209 26.5133C12.7169 26.5753 13.1399 26.6603 13.6019 26.7243C13.9589 26.7733 14.3409 26.8083 14.7729 26.7893C15.0729 26.7753 15.4069 26.7353 15.7389 26.6813C16.2349 26.6023 16.7179 26.4943 17.0569 26.4473C17.1499 26.4343 17.2359 26.4343 17.3209 26.4373C17.3489 26.4393 17.3799 26.4413 17.4109 26.4433C17.4119 26.4433 17.4119 26.4433 17.4129 26.4433C17.4199 26.4433 17.4279 26.4443 17.4349 26.4443C18.2329 26.2413 19.0259 25.9433 19.7959 25.5983C19.8609 25.5633 19.9259 25.5273 19.9899 25.4913C20.3059 25.3173 20.6049 25.1383 20.7869 24.9943C20.9829 24.8393 21.5189 24.5373 22.0579 24.1853C22.4109 23.9553 22.7649 23.7053 23.0369 23.4833C23.1949 23.3553 23.3689 23.2693 23.5479 23.1773C23.7129 23.0923 23.8809 23.0013 24.0349 22.8653C24.1109 22.7983 24.1869 22.7173 24.2639 22.6303C24.3309 22.5563 24.4039 22.4723 24.4759 22.3923C24.5459 22.3153 24.7199 22.1723 24.9139 21.9793C25.0079 21.8863 25.1059 21.7783 25.1909 21.6713C25.2199 21.6323 25.2489 21.5943 25.2769 21.5553C25.5919 21.0403 25.8779 20.5003 26.1019 19.9653C26.1299 19.8403 26.1379 19.7293 26.1279 19.6373C26.1199 19.5703 26.1029 19.5113 26.0839 19.4503C26.0599 19.3643 26.0329 19.2773 26.0239 19.1723C26.0169 19.0893 26.0309 19.0043 26.0629 18.9543C26.0779 18.9323 26.0969 18.9143 26.1129 18.8993C26.1329 18.8823 26.1499 18.8673 26.1569 18.8443C26.1609 18.8273 26.1579 18.8073 26.1529 18.7833C26.1459 18.7443 26.1369 18.6943 26.1539 18.6293C26.2189 18.3853 26.2869 18.1103 26.3319 17.8383C26.3829 17.5393 26.4049 17.2433 26.3949 17.0123C26.3849 16.7493 26.3909 16.3823 26.3469 16.0003C26.3179 15.7343 26.2659 15.4663 26.1979 15.2383C26.1319 15.0143 26.0219 14.7913 25.9039 14.5783C25.7629 14.3223 25.6119 14.0783 25.5169 13.8453C25.4969 13.7983 25.4999 13.7263 25.4999 13.6323C25.5009 13.5673 25.4999 13.4913 25.4919 13.4083C25.3239 13.1243 25.1459 12.8423 24.9589 12.5483C24.9479 12.5413 24.9369 12.5333 24.9249 12.5263C24.6689 12.3503 24.3139 12.1173 24.0769 11.5503C24.0179 11.4063 24.0069 11.2983 23.9969 11.1993C23.9859 11.1013 23.9799 11.0183 23.9289 10.9093C23.8709 10.7853 23.7759 10.6583 23.6709 10.4993C23.5849 10.3703 23.4899 10.2133 23.4199 10.0423C23.3819 9.95134 23.3509 9.85734 23.3329 9.75934C23.3299 9.74334 23.3269 9.72534 23.3229 9.70634C23.2899 9.52734 23.2439 9.26534 23.2409 8.98634C23.0209 8.24434 22.8339 7.48833 22.6519 6.77633C22.3429 5.57133 22.0519 4.54234 21.3329 3.95434C20.9839 3.65334 20.5689 3.35433 20.2459 3.05433C19.9259 2.75633 19.7449 2.47534 19.8019 2.23834C19.8639 2.00634 20.1589 1.82934 20.6659 1.80534C21.1699 1.78334 21.8699 1.93235 22.5209 2.39235C23.6159 3.14235 24.2029 4.38334 24.5599 5.35734C24.5829 5.40834 24.6049 5.46034 24.6259 5.51234C24.7849 5.89434 24.9529 6.22834 25.1199 6.55534C25.1579 6.63034 25.1969 6.70834 25.2339 6.78134Z`,className:`ok-blob-body`}),t[21]=U):U=t[21];let W=(F||T)&&`ok-blob-eye-hidden`,G;t[22]===W?G=t[23]:(G=Gi(`ok-blob-eye`,W),t[22]=W,t[23]=G);let ee;t[24]===G?ee=t[25]:(ee=(0,Z.jsx)(`ellipse`,{cx:FS,cy:LS,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=ee);let te=(F||T)&&`ok-blob-eye-hidden`,ne;t[26]===te?ne=t[27]:(ne=Gi(`ok-blob-eye ok-blob-eye-right`,te),t[26]=te,t[27]=ne);let re;t[28]===ne?re=t[29]:(re=(0,Z.jsx)(`ellipse`,{cx:IS,cy:LS,rx:1.2722,ry:1.9083,className:ne}),t[28]=ne,t[29]=re);let ie;t[30]===I?ie=t[31]:(ie=zS(FS,I),t[30]=I,t[31]=ie);let ae=(!F||T)&&`ok-blob-eye-hidden`,oe;t[32]===ae?oe=t[33]:(oe=Gi(`ok-blob-happy-eye`,ae),t[32]=ae,t[33]=oe);let se;t[34]!==ie||t[35]!==oe?(se=(0,Z.jsx)(`path`,{d:ie,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:oe}),t[34]=ie,t[35]=oe,t[36]=se):se=t[36];let ce;t[37]===I?ce=t[38]:(ce=zS(IS,I),t[37]=I,t[38]=ce);let le=(!F||T)&&`ok-blob-eye-hidden`,ue;t[39]===le?ue=t[40]:(ue=Gi(`ok-blob-happy-eye`,le),t[39]=le,t[40]=ue);let de;t[41]!==ce||t[42]!==ue?(de=(0,Z.jsx)(`path`,{d:ce,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ue}),t[41]=ce,t[42]=ue,t[43]=de):de=t[43];let K;t[44]===T?K=t[45]:(K=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:BS(FS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:BS(IS),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=K);let fe;t[46]!==ee||t[47]!==re||t[48]!==se||t[49]!==de||t[50]!==K?(fe=(0,Z.jsxs)(`g`,{ref:p,children:[ee,re,se,de,K]}),t[46]=ee,t[47]=re,t[48]=se,t[49]=de,t[50]=K,t[51]=fe):fe=t[51];let pe;t[52]!==B||t[53]!==H||t[54]!==fe?(pe=(0,Z.jsxs)(`g`,{className:H,children:[U,fe]},B),t[52]=B,t[53]=H,t[54]=fe,t[55]=pe):pe=t[55];let me;t[56]===T?me=t[57]:(me=T?(0,Z.jsxs)(`g`,{children:[(0,Z.jsx)(`text`,{x:21,y:7,className:`ok-blob-z ok-blob-z-1`,children:`z`}),(0,Z.jsx)(`text`,{x:26,y:2,className:`ok-blob-z ok-blob-z-2`,children:`z`})]}):null,t[56]=T,t[57]=me);let he;t[58]!==v||t[59]!==x?(he=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(GS)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=he):he=t[60];let ge;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==pe||t[65]!==me||t[66]!==he?(ge=(0,Z.jsxs)(`svg`,{ref:f,width:s,height:s,viewBox:`0 0 30 30`,fill:`none`,overflow:`visible`,xmlns:`http://www.w3.org/2000/svg`,className:z,"aria-hidden":`true`,onClick:D,onMouseDown:KS,children:[pe,me,he]}),t[61]=D,t[62]=s,t[63]=z,t[64]=pe,t[65]=me,t[66]=he,t[67]=ge):ge=t[67];let _e;return t[68]!==R||t[69]!==ge?(_e=(0,Z.jsx)(`span`,{ref:d,className:R,children:ge}),t[68]=R,t[69]=ge,t[70]=_e):_e=t[70],_e}function GS(e){return(0,Z.jsx)(`circle`,{cx:VS+e.originDx,cy:HS+e.originDy,r:e.size,className:`ok-blob-firework`,style:US(e)},e.id)}function KS(e){return e.preventDefault()}function qS(e){return e+1}function JS(e){return e+1}function YS(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(WS,{size:64,celebrateSignal:i}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Z.jsx)(`h2`,{className:`text-2xl font-light tracking-tighter text-balance`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=r?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r}):null,t[4]=r,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Z.jsxs)(`div`,{className:`flex items-center gap-4`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function XS(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`kbd`,{"data-slot":`kbd`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZS(){let e=(0,$.c)(2),t=Ui()?`⌘ K`:`Ctrl K`,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(XS,{children:t}),e[0]=n):n=e[0];let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[n,` `,(0,Z.jsx)(`span`,{children:`Search`})]}),e[1]=r):r=e[1],r}var QS=`open-knowledge:create-top-level-file`;function $S(){window.dispatchEvent(new CustomEvent(QS))}function eC(e){let t=()=>e();return window.addEventListener(QS,t),()=>window.removeEventListener(QS,t)}function tC(){let e=(0,$.c)(14),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(void 0),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(0),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(void 0),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=!1,t=async function(){try{let t=await fetch(`/api/documents`),n=await t.json().catch(aC);if(e)return;let r=t.ok?Xr.safeParse(n):null;r?.success?(o(oC(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=Gr(e=>{e.includes(`files`)&&t()});return()=>{e=!0,n(),clearTimeout(u.current)}},f=[],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(){clearTimeout(u.current),u.current=setTimeout(()=>c(iC),500),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(rC);if(!e.ok)return;let n=Xr.safeParse(t);n.success&&o(oC(n.data.documents))}).catch(nC)},e[2]=p):p=e[2];let m=p,h=a!==null,g=a===0,_;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){n(e),e||i(void 0)},e[3]=_):_=e[3];let v=_,y;e[4]!==s||e[5]!==g||e[6]!==h?(y=h?g?(0,Z.jsx)(sC,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(cC,{celebrateSignal:s,onAddStarterPack:()=>{n(!0)}}):null,e[4]=s,e[5]=g,e[6]=h,e[7]=y):y=e[7];let b;e[8]!==r||e[9]!==t?(b=(0,Z.jsx)(Lm,{open:t,onOpenChange:v,onSeedApplied:m,initialPackId:r}),e[8]=r,e[9]=t,e[10]=b):b=e[10];let x;return e[11]!==y||e[12]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6 subtle-scrollbar`,children:[y,b]}),e[11]=y,e[12]=b,e[13]=x):x=e[13],x}function nC(){}function rC(){return null}function iC(e){return e+1}function aC(){return null}function oC(e){return wr(e).filter(e=>e.kind===`document`||e.kind===`folder`).length}function sC(e){let t=(0,$.c)(16),{celebrateSignal:n,onPackSelect:r}=e,{_:i}=Yt(),a;t[0]===i?a=t[1]:(a=i({id:`ZmGmNh`}),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i({id:`W8uemY`}),t[2]=i,t[3]=o);let s;t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(YS,{title:a,subtitle:o,celebrateSignal:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]===r?c=t[9]:(c=(0,Z.jsx)(Om,{onPackSelect:r}),t[8]=r,t[9]=c);let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:$S,children:(0,Z.jsx)(J,{id:`ensWZc`,components:{0:(0,Z.jsx)(Fa,{"aria-hidden":`true`,className:`size-3`})}})}),t[10]=l):l=t[10];let u;t[11]===c?u=t[12]:(u=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[c,l]}),t[11]=c,t[12]=u);let d;return t[13]!==s||t[14]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[s,u]}),t[13]=s,t[14]=u,t[15]=d):d=t[15],d}function cC(e){let t=(0,$.c)(19),{celebrateSignal:n,onAddStarterPack:r}=e,{_:i}=Yt(),a;t[0]===i?a=t[1]:(a=i({id:`8XS8nG`}),t[0]=i,t[1]=a);let o;t[2]===i?o=t[3]:(o=i({id:`GjElCU`}),t[2]=i,t[3]=o);let s;t[4]!==n||t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(YS,{title:a,subtitle:o,celebrateSignal:n}),t[4]=n,t[5]=a,t[6]=o,t[7]=s):s=t[7];let l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(yS,{}),t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(c,{"aria-hidden":`true`,className:`size-3`}),d=(0,Z.jsx)(J,{id:`IajAbS`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;t[11]===r?f=t[12]:(f=(0,Z.jsxs)(X,{onClick:r,variant:`link`,size:`xs`,className:`font-mono text-2xs uppercase tracking-wider text-muted-foreground font-normal hover:text-foreground hover:no-underline`,children:[u,d]}),t[11]=r,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(ZS,{}),t[13]=p):p=t[13];let m;t[14]===f?m=t[15]:(m=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[l,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[f,p]})]}),t[14]=f,t[15]=m);let h;return t[16]!==s||t[17]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[s,m]}),t[16]=s,t[17]=m,t[18]=h):h=t[18],h}function lC(e){let t=(0,$.c)(76),{folderPath:n,state:r,onChange:i}=e,{_:a}=Yt(),[o,s]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),[d,f]=(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)(dC,{}),(0,Z.jsx)(Mo,{className:`h-7 w-full`}),(0,Z.jsx)(Mo,{className:`h-7 w-full`}),(0,Z.jsx)(Mo,{className:`h-7 w-full`})]}),t[0]=e):e=t[0],e}if(r.status===`error`){let{message:e}=r,n;return t[1]===e?n=t[2]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`4UMKtb`,values:{message:e}})}),t[1]=e,t[2]=n),n}let p;t[3]===r.data.folder.frontmatter_defaults?p=t[4]:(p=r.data.folder.frontmatter_defaults??{},t[3]=r.data.folder.frontmatter_defaults,t[4]=p);let m=p,h;t[5]===r.data.frontmatterLocal?h=t[6]:(h=r.data.frontmatterLocal??{},t[5]=r.data.frontmatterLocal,t[6]=h);let g=h,_=r.data.frontmatterSources,v;t[7]===r.data.folder.path?v=t[8]:(v=zo(r.data.folder.path),t[7]=r.data.folder.path,t[8]=v);let y=v,b,x,S,C,w,T,E,D,O,k,A,j,M;if(t[9]!==a||t[10]!==l||t[11]!==o||t[12]!==y||t[13]!==n||t[14]!==g||t[15]!==m||t[16]!==i||t[17]!==d||t[18]!==_){let e=Object.keys(m),r=async function(e,t){let r=await Lo(n,{[e]:t});if(!r.ok){let{error:e}=r;Y.error(a({id:`xXo8FT`,values:{error:e}}));return}i()},c=async function(e){let t=await Lo(n,{[e]:null});if(!t.ok){let{error:e}=t;Y.error(a({id:`ZU8VV_`,values:{error:e}}));return}i()},p=function(e,t){let n=m[e];r(e,Ta(n,t))},h;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(){u({name:``,type:`text`,value:``,error:null}),s(!1)},t[32]=h):h=t[32],S=h;let v;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(e){u(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Wa[e];return{...t,type:e,value:n,error:null}})},t[33]=v):v=t[33],w=v;let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=function(e){u(t=>t&&{...t,value:e})},t[34]=N):N=t[34],T=N;let P;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){u(t=>t&&{...t,name:e,error:null})},t[35]=P):P=t[35],C=P;let F;t[36]!==a||t[37]!==l||t[38]!==n||t[39]!==m||t[40]!==i?(F=async function(){if(!l)return;let e=l.name.trim();if(!e){u({...l,error:a({id:`8_brI5`})});return}if(Object.hasOwn(m,e)){u({...l,error:a({id:`6lBXm5`,values:{trimmed:e}})});return}let t=await Lo(n,{[e]:l.value});if(!t.ok){u({...l,error:t.error});return}u(null),i()},t[36]=a,t[37]=l,t[38]=n,t[39]=m,t[40]=i,t[41]=F):F=t[41],E=F;let I=function(e){f({key:e,draft:e,error:null})},L=function(e){f(t=>t&&{...t,draft:e,error:null})},R=async function(){if(!d)return;let e=d.draft.trim();if(!e){f({...d,error:a({id:`8_brI5`})});return}if(e===d.key){f(null);return}if(Object.hasOwn(m,e)){f({...d,error:a({id:`6lBXm5`,values:{trimmed:e}})});return}let t=m[d.key],r=await Lo(n,{[d.key]:null,[e]:t});if(!r.ok){f({...d,error:r.error});return}f(null),i()},z=function(){f(null)};M=`rounded-lg border bg-card`,x=Jo,k=!o,t[42]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>s(!e),t[42]=A):A=t[42];let B=`size-3 transition-transform ${o?``:`rotate-90`}`,V;t[43]===B?V=t[44]:(V=(0,Z.jsx)(Wo,{className:B,"aria-hidden":!0}),t[43]=B,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`IX_qeH`})}),t[45]=H):H=t[45];let U;t[46]===V?U=t[47]:(U=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[V,H]}),t[46]=V,t[47]=U);let W;t[48]===y?W=t[49]:(W=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:uC,children:y}),t[48]=y,t[49]=W),t[50]!==U||t[51]!==W?(j=(0,Z.jsxs)(qo,{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:[U,W]}),t[50]=U,t[51]=W,t[52]=j):j=t[52],b=Ko,D=`px-2 py-2`,O=e.length===0&&!l?(0,Z.jsx)(`p`,{className:`px-1 py-1 text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`50Y3WA`})}):e.map(e=>{let t=m[e],n=Object.hasOwn(g,e);return(0,Z.jsx)(xa,{keyName:e,value:t,declared:Ca(t,Sr(t)),rename:n?{state:d?.key===e?d:null,onBegin:()=>I(e),onChangeDraft:L,onCommit:R,onCancel:z}:void 0,badge:n?null:(0,Z.jsx)(Fo,{source:_[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>p(e,t),onRemove:n?()=>void c(e):void 0},e)}),t[9]=a,t[10]=l,t[11]=o,t[12]=y,t[13]=n,t[14]=g,t[15]=m,t[16]=i,t[17]=d,t[18]=_,t[19]=b,t[20]=x,t[21]=S,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j,t[31]=M}else 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=t[29],j=t[30],M=t[31];let N;t[53]!==l||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==T||t[58]!==E?(N=l?(0,Z.jsx)(Ha,{draft:l,onChangeName:C,onChangeType:w,onChangeValue:T,onCommit:()=>void E(),onCancel:()=>u(null)}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:S,className:`mt-1 flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(c,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`F-NRCj`})})]}),t[53]=l,t[54]=S,t[55]=C,t[56]=w,t[57]=T,t[58]=E,t[59]=N):N=t[59];let P;t[60]!==N||t[61]!==D||t[62]!==O?(P=(0,Z.jsxs)(`div`,{className:D,children:[O,N]}),t[60]=N,t[61]=D,t[62]=O,t[63]=P):P=t[63];let F;t[64]!==b||t[65]!==P?(F=(0,Z.jsx)(b,{children:P}),t[64]=b,t[65]=P,t[66]=F):F=t[66];let I;t[67]!==x||t[68]!==F||t[69]!==k||t[70]!==A||t[71]!==j?(I=(0,Z.jsxs)(x,{open:k,onOpenChange:A,children:[j,F]}),t[67]=x,t[68]=F,t[69]=k,t[70]=A,t[71]=j,t[72]=I):I=t[72];let L;return t[73]!==I||t[74]!==M?(L=(0,Z.jsx)(`section`,{className:M,children:I}),t[73]=I,t[74]=M,t[75]=L):L=t[75],L}function uC(e){return e.stopPropagation()}function dC(){let e=(0,$.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(bc,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t,(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`IX_qeH`})})]}),e[1]=n):n=e[1],n}function fC(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function pC(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=fC(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function mC(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function hC(e,t){let n=`${e}/`,r=[...t.folderPaths].filter(e=>e.startsWith(n)).map(e=>({path:e,rel:e.slice(n.length)})).filter(e=>e.rel.length>0&&!e.rel.includes(`/`)).map(({path:e,rel:n})=>({kind:`folder`,path:e,name:n,title:pC(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:mC(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:pC(e,t.pageTitles),children:a}}function gC(e){let t=(0,$.c)(54),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,{_:o}=Yt(),[s,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v;t[0]!==o||t[1]!==i?(v=async function(e){h(!0);let t=await no(e.source_folder,e.name);if(h(!1),!t.ok){let{error:e}=t;Y.error(o({id:`yOGrCR`,values:{error:e}}));return}let{name:n}=e;Y.success(o({id:`I23A-U`,values:{name:n}})),d(null),i()},t[0]=o,t[1]=i,t[2]=v):v=t[2];let y=v;if(r.status===`idle`||r.status===`loading`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card px-3 py-2.5 space-y-3`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})})}),(0,Z.jsx)(Mo,{className:`h-12 w-full`}),(0,Z.jsx)(Mo,{className:`h-12 w-full`})]}),t[3]=e):e=t[3],e}if(r.status===`error`){let{message:e}=r,n;return t[4]===e?n=t[5]:(n=(0,Z.jsx)(`section`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive`,role:`alert`,children:(0,Z.jsx)(J,{id:`iDZtvM`,values:{message:e}})}),t[4]=e,t[5]=n),n}let b;t[6]===r.data.folder.templates_available?b=t[7]:(b=r.data.folder.templates_available??[],t[6]=r.data.folder.templates_available,t[7]=b);let x=b,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:(0,Z.jsx)(J,{id:`-QCLWk`})}),t[8]=S):S=t[8];let C;t[9]===x.length?C=t[10]:(C=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[S,(0,Z.jsx)(pe,{className:`text-xs`,variant:`secondary`,children:x.length})]}),t[9]=x.length,t[10]=C);let w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>_(!0),children:[(0,Z.jsx)(c,{className:`size-3.5`,"aria-hidden":!0}),(0,Z.jsx)(J,{id:`G1Gw0v`})]}),t[11]=w):w=t[11];let T;t[12]===C?T=t[13]:(T=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[C,w]}),t[12]=C,t[13]=T);let E;t[14]===x?E=t[15]:(E=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:x.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,Z.jsx)(J,{id:`BHW0EW`})}):(0,Z.jsx)(`ul`,{className:`space-y-1`,children:x.map(e=>(0,Z.jsx)(vC,{template:e,onCreate:()=>p(e.name),onEdit:()=>l(e),onDelete:()=>d(e)},e.path))})}),t[14]=x,t[15]=E);let D;t[16]!==T||t[17]!==E?(D=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[T,E]}),t[16]=T,t[17]=E,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{e||l(null)},t[19]=O):O=t[19];let k;t[20]!==s||t[21]!==n||t[22]!==i?(k=(0,Z.jsx)(co,{folderPath:n,template:s,onOpenChange:O,onSaved:i}),t[20]=s,t[21]=n,t[22]=i,t[23]=k):k=t[23];let A=!!u,j;t[24]===m?j=t[25]:(j=e=>{!e&&!m&&d(null)},t[24]=m,t[25]=j);let M;t[26]!==o||t[27]!==u||t[28]!==m||t[29]!==y?(M=u&&(()=>{let{name:e,path:t,scope:n}=u,r=n===`inherited`?`\n\n${o({id:`LUbzI-`})}`:``;return(0,Z.jsx)(No,{itemName:o({id:`XfzqjK`,values:{name:e}}),isSubmitting:m,onDelete:()=>y(u),customDescription:`${o({id:`JVgg1-`,values:{path:t}})}${r}`})})(),t[26]=o,t[27]=u,t[28]=m,t[29]=y,t[30]=M):M=t[30];let N;t[31]!==A||t[32]!==j||t[33]!==M?(N=(0,Z.jsx)(dn,{open:A,onOpenChange:j,children:M}),t[31]=A,t[32]=j,t[33]=M,t[34]=N):N=t[34];let P;t[35]===x?P=t[36]:(P=new Set(x.map(_C)),t[35]=x,t[36]=P);let F;t[37]!==n||t[38]!==g||t[39]!==i||t[40]!==P?(F=(0,Z.jsx)(Qa,{folderPath:n,existingNames:P,open:g,onOpenChange:_,onCreated:i}),t[37]=n,t[38]=g,t[39]=i,t[40]=P,t[41]=F):F=t[41];let I=f!==null,L;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||p(null)},t[42]=L):L=t[42];let R=f??void 0,z;t[43]!==a||t[44]!==n||t[45]!==I||t[46]!==R?(z=(0,Z.jsx)(dm,{open:I,onOpenChange:L,kind:`file`,initialDir:n,initialTemplate:R,folderConfig:a}),t[43]=a,t[44]=n,t[45]=I,t[46]=R,t[47]=z):z=t[47];let B;return t[48]!==k||t[49]!==N||t[50]!==F||t[51]!==z||t[52]!==D?(B=(0,Z.jsxs)(Z.Fragment,{children:[D,k,N,F,z]}),t[48]=k,t[49]=N,t[50]=F,t[51]=z,t[52]=D,t[53]=B):B=t[53],B}function _C(e){return e.name}function vC(e){let t=(0,$.c)(51),{template:n,onCreate:r,onEdit:i,onDelete:a}=e,{_:o}=Yt(),s=n.title&&n.title!==n.name,c=n.title??n.name,l;t[0]===c?l=t[1]:(l=(0,Z.jsx)(`span`,{className:`font-medium truncate`,children:c}),t[0]=c,t[1]=l);let u;t[2]!==s||t[3]!==n.name?(u=s?(0,Z.jsx)(`code`,{className:`font-mono text-xs text-muted-foreground shrink-0`,children:n.name}):null,t[2]=s,t[3]=n.name,t[4]=u):u=t[4];let d;t[5]!==n.name||t[6]!==n.scope||t[7]!==n.source_folder?(d=n.scope===`inherited`?(0,Z.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Z.jsx)(Fo,{source:n.source_folder,target:`templates/${n.name}.md`})}):null,t[5]=n.name,t[6]=n.scope,t[7]=n.source_folder,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[l,u,d]}),t[9]=l,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===n.description?p=t[14]:(p=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[13]=n.description,t[14]=p);let m;t[15]!==i||t[16]!==f||t[17]!==p?(m=(0,Z.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm`,children:[f,p]}),t[15]=i,t[16]=f,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==o||t[20]!==c?(h=o({id:`5m2Eho`,values:{label:c}}),t[19]=o,t[20]=c,t[21]=h):h=t[21];let g,_;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(_c,{className:`size-3.5`,"aria-hidden":!0}),_=(0,Z.jsx)(J,{id:`hYgDIe`}),t[22]=g,t[23]=_):(g=t[22],_=t[23]);let v;t[24]!==r||t[25]!==h?(v=(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`font-mono uppercase shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:r,"aria-label":h,children:[g,_]}),t[24]=r,t[25]=h,t[26]=v):v=t[26];let y;t[27]!==o||t[28]!==c?(y=o({id:`Bx4EXG`,values:{label:c}}),t[27]=o,t[28]=c,t[29]=y):y=t[29];let b;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(ya,{className:`size-4`,"aria-hidden":!0}),t[30]=b):b=t[30];let x;t[31]===y?x=t[32]:(x=(0,Z.jsx)(Ya,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":y,children:b})}),t[31]=y,t[32]=x);let S,C;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsx)(rt,{"aria-hidden":!0}),C=(0,Z.jsx)(J,{id:`ePK91l`}),t[33]=S,t[34]=C):(S=t[33],C=t[34]);let w;t[35]===i?w=t[36]:(w=(0,Z.jsxs)(Ja,{onSelect:i,children:[S,C]}),t[35]=i,t[36]=w);let T,E;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Rt,{"aria-hidden":!0}),E=(0,Z.jsx)(J,{id:`cnGeoo`}),t[37]=T,t[38]=E):(T=t[37],E=t[38]);let D;t[39]===a?D=t[40]:(D=(0,Z.jsxs)(Ja,{variant:`destructive`,onSelect:a,children:[T,E]}),t[39]=a,t[40]=D);let O;t[41]!==w||t[42]!==D?(O=(0,Z.jsxs)(Ka,{align:`end`,children:[w,D]}),t[41]=w,t[42]=D,t[43]=O):O=t[43];let k;t[44]!==x||t[45]!==O?(k=(0,Z.jsxs)(qa,{children:[x,O]}),t[44]=x,t[45]=O,t[46]=k):k=t[46];let A;return t[47]!==v||t[48]!==k||t[49]!==m?(A=(0,Z.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-2 hover:bg-muted/50 text-sm`,children:[m,v,k]}),t[47]=v,t[48]=k,t[49]=m,t[50]=A):A=t[50],A}function yC(e){let t=(0,$.c)(14),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Gi(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Gi(`w-full caption-bottom text-sm`,n),t[6]=n,t[7]=o);let s;t[8]!==i||t[9]!==o?(s=(0,Z.jsx)(`table`,{"data-slot":`table`,className:o,...i}),t[8]=i,t[9]=o,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==s?(c=(0,Z.jsx)(`div`,{"data-slot":`table-container`,className:a,children:s}),t[11]=a,t[12]=s,t[13]=c):c=t[13],c}function bC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`[&_tr]:border-b`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`thead`,{"data-slot":`table-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,noHover:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(i===void 0?!1:i)&&`hover:bg-transparent`,o;t[4]!==n||t[5]!==a?(o=Gi(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors`,a,n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==o?(s=(0,Z.jsx)(`tr`,{"data-slot":`table-row`,className:o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function CC(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scope:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`col`:i,o;t[4]===n?o=t[5]:(o=Gi(`font-mono uppercase text-xs text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`th`,{"data-slot":`table-head`,scope:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function wC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`py-3 px-4 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TC(e){if(!e)return`—`;let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<30?`${a}d ago`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function EC(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 DC(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)(ze,{className:`ml-1 size-3`}):(0,Z.jsx)(gt,{className:`ml-1 size-3`}):(0,Z.jsx)(Xs,{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)(X,{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 OC(e){let t=(0,$.c)(81),{folderPath:n}=e,{folderPaths:r,loading:i,pages:a,pageTitles:o,pageMeta:s}=Zr(),l=_o(n),{state:u,refresh:d}=l,[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(`name`),[g,_]=(0,Q.useState)(`asc`);if(i){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(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)(Mo,{className:`size-5 rounded`}),(0,Z.jsx)(Mo,{className:`h-7 w-48`})]}),(0,Z.jsx)(Mo,{className:`h-9 w-20 rounded-md`})]}),t[0]=e):e=t[0];let n;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(Mo,{className:`h-4 w-16`}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(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":`Loading folder contents`,children:(0,Z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`,children:[e,(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:[n,(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Mo,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(jC)]})]})}),t[2]=r):r=t[2],r}let v,y,b,x,S,C,w,E,D,O;if(t[3]!==u||t[4]!==l||t[5]!==n||t[6]!==r||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==d||t[11]!==g||t[12]!==m){let e=hC(n,{pages:a,pageTitles:o,pageMeta:s,folderPaths:r}),i=EC(e.children,m,g),f;t[23]===m?f=t[24]:(f=function(e){e===m?_(AC):(h(e),_(`asc`))},t[23]=m,t[24]=f);let k=f;O=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,C=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let A;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(T,{className:`size-5 text-muted-foreground`}),t[25]=A):A=t[25];let j=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[A,(0,Z.jsx)(`h1`,{className:`text-2xl font-light tracking-tight`,children:e.title})]}),M;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Z.jsxs)(X,{onClick:()=>p(!0),children:[(0,Z.jsx)(c,{className:`size-4`}),`New`]}),t[26]=M):M=t[26],t[27]===j?w=t[28]:(w=(0,Z.jsx)(`div`,{className:`flex flex-col gap-6`,children:(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[j,M]})}),t[27]=j,t[28]=w),t[29]!==u||t[30]!==n||t[31]!==d?(E=(0,Z.jsx)(lC,{folderPath:n,state:u,onChange:d}),t[29]=u,t[30]=n,t[31]=d,t[32]=E):E=t[32],t[33]!==u||t[34]!==l||t[35]!==n||t[36]!==d?(D=(0,Z.jsx)(gC,{folderPath:n,state:u,onChange:d,folderConfigHandle:l}),t[33]=u,t[34]=l,t[35]=n,t[36]=d,t[37]=D):D=t[37],S=`rounded-lg border`,y=yC;let N=m===`name`?g===`asc`?`ascending`:`descending`:`none`,P;t[38]!==k||t[39]!==g||t[40]!==m?(P=(0,Z.jsx)(DC,{label:`Name`,sortKey:`name`,activeKey:m,activeDir:g,onSort:k}),t[38]=k,t[39]=g,t[40]=m,t[41]=P):P=t[41];let F;t[42]!==N||t[43]!==P?(F=(0,Z.jsx)(CC,{"aria-sort":N,children:P}),t[42]=N,t[43]=P,t[44]=F):F=t[44];let I=m===`modified`?g===`asc`?`ascending`:`descending`:`none`,L;t[45]!==k||t[46]!==g||t[47]!==m?(L=(0,Z.jsx)(DC,{label:`Modified`,sortKey:`modified`,activeKey:m,activeDir:g,onSort:k}),t[45]=k,t[46]=g,t[47]=m,t[48]=L):L=t[48];let R;t[49]!==I||t[50]!==L?(R=(0,Z.jsx)(CC,{className:`w-32`,"aria-sort":I,children:L}),t[49]=I,t[50]=L,t[51]=R):R=t[51],t[52]!==F||t[53]!==R?(x=(0,Z.jsx)(bC,{children:(0,Z.jsxs)(SC,{children:[F,R]})}),t[52]=F,t[53]=R,t[54]=x):x=t[54],v=xC,b=i.length?i.map(kC):(0,Z.jsx)(SC,{children:(0,Z.jsx)(wC,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=u,t[4]=l,t[5]=n,t[6]=r,t[7]=s,t[8]=o,t[9]=a,t[10]=d,t[11]=g,t[12]=m,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w,t[20]=E,t[21]=D,t[22]=O}else v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],E=t[20],D=t[21],O=t[22];let k;t[55]!==v||t[56]!==b?(k=(0,Z.jsx)(v,{children:b}),t[55]=v,t[56]=b,t[57]=k):k=t[57];let A;t[58]!==y||t[59]!==x||t[60]!==k?(A=(0,Z.jsxs)(y,{children:[x,k]}),t[58]=y,t[59]=x,t[60]=k,t[61]=A):A=t[61];let j;t[62]!==A||t[63]!==S?(j=(0,Z.jsx)(`div`,{className:S,children:A}),t[62]=A,t[63]=S,t[64]=j):j=t[64];let M;t[65]!==j||t[66]!==C||t[67]!==w||t[68]!==E||t[69]!==D?(M=(0,Z.jsxs)(`div`,{className:C,children:[w,E,D,j]}),t[65]=j,t[66]=C,t[67]=w,t[68]=E,t[69]=D,t[70]=M):M=t[70];let N;t[71]!==M||t[72]!==O?(N=(0,Z.jsx)(`div`,{className:O,children:M}),t[71]=M,t[72]=O,t[73]=N):N=t[73];let P;t[74]!==f||t[75]!==l||t[76]!==n?(P=(0,Z.jsx)(dm,{open:f,onOpenChange:p,kind:`file`,initialDir:n,folderConfig:l,suggestedName:`index`}),t[74]=f,t[75]=l,t[76]=n,t[77]=P):P=t[77];let F;return t[78]!==N||t[79]!==P?(F=(0,Z.jsxs)(Z.Fragment,{children:[N,P]}),t[78]=N,t[79]=P,t[80]=F):F=t[80],F}function kC(e){return(0,Z.jsxs)(SC,{children:[(0,Z.jsx)(wC,{children:(0,Z.jsxs)(`a`,{href:qr(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)(Sc,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(L,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(wC,{className:`text-muted-foreground`,children:e.kind===`file`?TC(e.modified):`—`})]},e.path)}function AC(e){return e===`asc`?`desc`:`asc`}function jC(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)(Mo,{className:`size-4 rounded`}),(0,Z.jsx)(Mo,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Mo,{className:`h-4 w-16`})})]},e)}function MC(e){let t=(0,$.c)(7),{docName:n}=e,[r,i]=(0,Q.useState)(NC),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>zt(e=>{i(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})}),o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Q.useEffect)(a,o),!r.has(n))return null;let s;t[2]===n?s=t[3]:(s=function(){Ht(n)?.abort(),i(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t})},t[2]=n,t[3]=s);let c=s,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`span`,{children:`Still loading`}),t[4]=l):l=t[4];let u;return t[5]===c?u=t[6]:(u=(0,Z.jsxs)(`div`,{className:`absolute inset-x-0 bottom-8 z-20 flex justify-center text-xs text-muted-foreground`,children:[l,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto px-2 py-0 text-xs`,onClick:c,children:`Cancel`})]}),t[5]=c,t[6]=u),u}function NC(){return new Set}var PC=(0,Q.createContext)(null);function FC(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(IC),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)(PC,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function IC(){return new Map}function LC(){let e=(0,Q.use)(PC);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function RC(e){let t=null,n=()=>(t===null&&(t=e(),t.catch(()=>{})),t),r=(0,Q.lazy)(n);return r.preload=n,r}var zC=RC(()=>n(()=>import(`./SettingsDialogBody-E4CxiCsR.js`).then(e=>({default:e.SettingsDialogBody})),__vite__mapDeps([42,1,33,2,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,43,9,14,21,11]),import.meta.url));function BC(e){let t=(0,$.c)(9),{error:n}=e,{_:r}=Yt(),i;t[0]!==r||t[1]!==n?(i=n instanceof Error&&/dynamically imported module|Failed to fetch/i.test(n.message)?r({id:`Y8ViJx`}):r({id:`3h5zMp`}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(`h3`,{id:`settings-body-error-title`,className:`font-heading text-base leading-none font-medium`,children:(0,Z.jsx)(J,{id:`hwFOFD`})}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[o,(0,Z.jsx)(`p`,{className:`max-w-xs text-sm text-muted-foreground`,children:a})]}),t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(X,{variant:`default`,onClick:VC,children:(0,Z.jsx)(J,{id:`HpK_8d`})}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`settings-body-error-title`,"data-slot":`settings-body-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-5 p-8 text-center`,children:[s,c]}),t[7]=s,t[8]=l),l}function VC(){return window.location.reload()}function HC(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(ue,{fallbackRender:WC,onError:UC,children:n}),t[0]=n,t[1]=r),r}function UC(e,t){console.error(`[SettingsDialogErrorBoundary] rendered fallback for Settings body`,e,t.componentStack)}function WC(e){return(0,Z.jsx)(BC,{...e})}function GC(e){let t=(0,$.c)(64),{open:n,onOpenChange:r}=e,{_:i}=Yt(),{collabUrl:a}=ft(),{userBinding:o,userSynced:s,okignoreBinding:c,okignoreSynced:l}=y(),{desktopPresent:u}=uo(),[d,f]=(0,Q.useState)(`preferences`),p,m;t[0]===n?(p=t[1],m=t[2]):(p=()=>{n&&f(`preferences`)},m=[n],t[0]=n,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h=a!==null,g;t[3]===i?g=t[4]:(g=i({id:`7PzzBU`}),t[3]=i,t[4]=g);let _;t[5]===i?_=t[6]:(_=i({id:`Q6hhn8`}),t[5]=i,t[6]=_);let v;t[7]===_?v=t[8]:(v=[{id:`preferences`,label:_}],t[7]=_,t[8]=v);let b;t[9]!==g||t[10]!==v?(b={id:`user`,label:g,enabled:!0,items:v},t[9]=g,t[10]=v,t[11]=b):b=t[11];let x;t[12]===i?x=t[13]:(x=i({id:`ZWyHmq`}),t[12]=i,t[13]=x);let S;t[14]===i?S=t[15]:(S=i({id:`Nu4DdT`}),t[14]=i,t[15]=S);let C;t[16]===S?C=t[17]:(C={id:`sync`,label:S},t[16]=S,t[17]=C);let w;t[18]===i?w=t[19]:(w=i({id:`iTylMl`}),t[18]=i,t[19]=w);let T;t[20]===w?T=t[21]:(T={id:`project-templates`,label:w},t[20]=w,t[21]=T);let E;t[22]===i?E=t[23]:(E=i({id:`3zyg_A`}),t[22]=i,t[23]=E);let D;t[24]===E?D=t[25]:(D={id:`okignore`,label:E},t[24]=E,t[25]=D);let O;t[26]!==T||t[27]!==D||t[28]!==C?(O=[C,T,D],t[26]=T,t[27]=D,t[28]=C,t[29]=O):O=t[29];let k;t[30]!==h||t[31]!==O||t[32]!==x?(k={id:`project`,label:x,enabled:h,items:O},t[30]=h,t[31]=O,t[32]=x,t[33]=k):k=t[33];let A;t[34]===i?A=t[35]:(A=i({id:`nbfdhU`}),t[34]=i,t[35]=A);let j;t[36]!==i||t[37]!==u?(j=u?[{id:`claude-desktop`,label:i({id:`yvHDYG`})}]:[],t[36]=i,t[37]=u,t[38]=j):j=t[38];let M;t[39]!==A||t[40]!==j?(M={id:`integrations`,label:A,enabled:!0,items:j},t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==k||t[43]!==M||t[44]!==b?(N=[b,k,M],t[42]=k,t[43]=M,t[44]=b,t[45]=N):N=t[45];let P=N,F;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)($t,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})}),t[46]=F):F=t[46];let I;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(Zt,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`RDrXh4`})}),t[47]=I):I=t[47];let L;t[48]!==d||t[49]!==P?(L=(0,Z.jsx)(KC,{groups:P,activeId:d,onSelect:f}),t[48]=d,t[49]=P,t[50]=L):L=t[50];let R;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(JC,{}),t[51]=R):R=t[51];let z=s?o:null,B;t[52]!==d||t[53]!==c||t[54]!==l||t[55]!==z?(B=(0,Z.jsx)(`div`,{className:`min-h-0 overflow-y-auto overscroll-contain subtle-scrollbar p-6`,children:(0,Z.jsx)(HC,{children:(0,Z.jsx)(Q.Suspense,{fallback:R,children:(0,Z.jsx)(zC,{activeId:d,userBinding:z,okignoreBinding:c,okignoreSynced:l})})})}),t[52]=d,t[53]=c,t[54]=l,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==L||t[58]!==B?(V=(0,Z.jsxs)(rn,{className:`grid h-[700px] max-h-[calc(100dvh-4rem)] w-[900px] max-w-[calc(100%-2rem)] grid-cols-[220px_1fr] gap-0 overflow-hidden p-0 sm:max-w-[900px]`,"data-testid":`settings-dialog`,children:[F,I,L,B]}),t[57]=L,t[58]=B,t[59]=V):V=t[59];let H;return t[60]!==r||t[61]!==n||t[62]!==V?(H=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:V}),t[60]=r,t[61]=n,t[62]=V,t[63]=H):H=t[63],H}function KC(e){let t=(0,$.c)(12),{groups:n,activeId:r,onSelect:i}=e,{_:a}=Yt(),o;t[0]===a?o=t[1]:(o=a({id:`y1t8bQ`}),t[0]=a,t[1]=o);let s;if(t[2]!==r||t[3]!==n||t[4]!==i){let e;t[6]!==r||t[7]!==i?(e=e=>(0,Z.jsx)(qC,{group:e,activeId:r,onSelect:i},e.id),t[6]=r,t[7]=i,t[8]=e):e=t[8],s=n.map(e),t[2]=r,t[3]=n,t[4]=i,t[5]=s}else s=t[5];let c;return t[9]!==o||t[10]!==s?(c=(0,Z.jsx)(`nav`,{"aria-label":o,className:`h-full overflow-y-auto overscroll-contain subtle-scrollbar border-r bg-muted/30 px-3 py-4`,children:s}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function qC(e){let t=(0,$.c)(28),{group:n,activeId:r,onSelect:i}=e;if(n.items.length===0)return null;let a=`settings-group-${n.id}`,o=`${a}-caption`,s=n.enabled?void 0:o,c=n.enabled?`text-muted-foreground/80`:`text-muted-foreground/50`,l;t[0]===c?l=t[1]:(l=Gi(`mb-1 px-2 text-xs font-semibold uppercase tracking-wide font-mono`,c),t[0]=c,t[1]=l);let u;t[2]!==n.label||t[3]!==a||t[4]!==s||t[5]!==l?(u=(0,Z.jsx)(`h3`,{id:a,"aria-describedby":s,className:l,children:n.label}),t[2]=n.label,t[3]=a,t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==n.enabled?(d=n.enabled?null:(0,Z.jsx)(`p`,{id:o,className:`mb-1 px-2 text-xs italic text-muted-foreground/60`,children:(0,Z.jsx)(J,{id:`JWsZlx`})}),t[7]=o,t[8]=n.enabled,t[9]=d):d=t[9];let f;if(t[10]!==r||t[11]!==o||t[12]!==n.enabled||t[13]!==n.items||t[14]!==i){let e;t[16]!==r||t[17]!==o||t[18]!==n.enabled||t[19]!==i?(e=e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`button`,{type:`button`,"aria-current":r===e.id?`page`:void 0,"aria-disabled":n.enabled?void 0:!0,"aria-describedby":n.enabled?void 0:o,tabIndex:n.enabled?0:-1,disabled:!n.enabled,onClick:()=>n.enabled&&i(e.id),"data-testid":`settings-sidebar-item-${e.id}`,className:Gi(`w-full rounded px-2 py-1.5 text-left text-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,`disabled:cursor-not-allowed disabled:opacity-50`,r===e.id&&n.enabled?`bg-accent text-accent-foreground`:`hover:bg-accent/50`),children:e.label})},e.id),t[16]=r,t[17]=o,t[18]=n.enabled,t[19]=i,t[20]=e):e=t[20],f=n.items.map(e),t[10]=r,t[11]=o,t[12]=n.enabled,t[13]=n.items,t[14]=i,t[15]=f}else f=t[15];let p;t[21]!==a||t[22]!==f?(p=(0,Z.jsx)(`ul`,{"aria-labelledby":a,className:`space-y-0.5`,children:f}),t[21]=a,t[22]=f,t[23]=p):p=t[23];let m;return t[24]!==u||t[25]!==d||t[26]!==p?(m=(0,Z.jsxs)(`div`,{className:`mb-4`,children:[u,d,p]}),t[24]=u,t[25]=d,t[26]=p,t[27]=m):m=t[27],m}function JC(){let e=(0,$.c)(4),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`GsBUCk`})}),n=(0,Z.jsx)(Mo,{className:`h-5 w-32`}),r=(0,Z.jsx)(Mo,{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)(Mo,{className:`h-9 w-full`}),(0,Z.jsx)(Mo,{className:`h-9 w-full`})]})]}),e[3]=i):i=e[3],i}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=Gi(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ux,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XC(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)(Kx,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function ZC(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Gi(`relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let o;t[6]===i?o=t[7]:(o=i&&(0,Z.jsx)(`div`,{className:`z-10 flex h-6 w-1 shrink-0 rounded-lg bg-border`}),t[6]=i,t[7]=o);let s;return t[8]!==r||t[9]!==a||t[10]!==o?(s=(0,Z.jsx)(Xx,{"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 QC(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var $C=na(`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 ew(e){let t=(0,$.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=Gi($C({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:tw,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function tw(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}na(`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 nw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rw(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Go,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function iw(e){let t=(0,$.c)(119),{findInputRef:n,query:r,replacement:i,replaceOpen:a,caseSensitive:o,wholeWord:s,current:c,total:l,onQueryChange:u,onReplacementChange:d,onReplaceOpenChange:f,onCaseSensitiveChange:p,onWholeWordChange:m,onNext:h,onPrevious:g,onReplaceCurrent:_,onReplaceAll:v,onClose:y}=e,{_:b}=Yt(),x=r.length>0,S=l>0,C;t[0]!==b||t[1]!==c||t[2]!==S||t[3]!==x||t[4]!==l?(C=x?S?`${c} / ${l}`:b({id:`Ev2r9A`}):``,t[0]=b,t[1]=c,t[2]=S,t[3]=x,t[4]=l,t[5]=C):C=t[5];let w=C,T;t[6]!==y||t[7]!==h||t[8]!==g?(T=function(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?g():h()):e.key===`Escape`&&(e.preventDefault(),y())},t[6]=y,t[7]=h,t[8]=g,t[9]=T):T=t[9];let E=T,D;t[10]!==y||t[11]!==_?(D=function(e){e.key===`Enter`?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),y())},t[10]=y,t[11]=_,t[12]=D):D=t[12];let O=D,k;t[13]===b?k=t[14]:(k=b({id:`MVxpbf`}),t[13]=b,t[14]=k);let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-find-input`,children:(0,Z.jsx)(J,{id:`KujtjC`})}),t[15]=A):A=t[15];let j;t[16]===u?j=t[17]:(j=e=>u(e.target.value),t[16]=u,t[17]=j);let M;t[18]===b?M=t[19]:(M=b({id:`KujtjC`}),t[18]=b,t[19]=M);let N;t[20]!==n||t[21]!==E||t[22]!==r||t[23]!==j||t[24]!==M?(N=(0,Z.jsx)(rw,{ref:n,id:`ok-find-input`,value:r,onChange:j,onKeyDown:E,placeholder:M,autoComplete:`off`,spellCheck:!1,className:`h-7 px-2 text-sm`}),t[20]=n,t[21]=E,t[22]=r,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P;t[26]===b?P=t[27]:(P=b({id:`-8PP0T`}),t[26]=b,t[27]=P);let F;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(nc,{"aria-hidden":`true`}),t[28]=F):F=t[28];let I;t[29]!==o||t[30]!==p||t[31]!==P?(I=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(es,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":P,pressed:o,onPressedChange:p,className:`size-6 min-w-6 px-0`,children:F})}),t[29]=o,t[30]=p,t[31]=P,t[32]=I):I=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`-8PP0T`})}),t[33]=L):L=t[33];let R;t[34]===I?R=t[35]:(R=(0,Z.jsxs)(Yn,{children:[I,L]}),t[34]=I,t[35]=R);let z;t[36]===b?z=t[37]:(z=b({id:`_7UQ7y`}),t[36]=b,t[37]=z);let B;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(pl,{"aria-hidden":`true`}),t[38]=B):B=t[38];let V;t[39]!==m||t[40]!==z||t[41]!==s?(V=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(es,{type:`button`,variant:`segmented`,size:`sm`,"aria-label":z,pressed:s,onPressedChange:m,className:`size-6 min-w-6 px-0`,children:B})}),t[39]=m,t[40]=z,t[41]=s,t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`_7UQ7y`})}),t[43]=H):H=t[43];let U;t[44]===V?U=t[45]:(U=(0,Z.jsxs)(Yn,{children:[V,H]}),t[44]=V,t[45]=U);let W;t[46]!==R||t[47]!==U?(W=(0,Z.jsxs)(ew,{align:`inline-end`,className:`gap-0.5`,children:[R,U]}),t[46]=R,t[47]=U,t[48]=W):W=t[48];let G;t[49]!==W||t[50]!==N?(G=(0,Z.jsxs)(QC,{className:`h-7 w-56 rounded-[min(var(--radius-md),12px)]`,children:[N,W]}),t[49]=W,t[50]=N,t[51]=G):G=t[51];let ee;t[52]===w?ee=t[53]:(ee=(0,Z.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`min-w-14 px-1 text-right text-muted-foreground text-xs tabular-nums shrink-0`,children:w}),t[52]=w,t[53]=ee);let te;t[54]===b?te=t[55]:(te=b({id:`oqB2ez`}),t[54]=b,t[55]=te);let ne=!S,re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(At,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[56]=re):re=t[56];let ie;t[57]!==g||t[58]!==te||t[59]!==ne?(ie=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":te,disabled:ne,onClick:g,children:re})}),t[57]=g,t[58]=te,t[59]=ne,t[60]=ie):ie=t[60];let ae;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`oqB2ez`})}),t[61]=ae):ae=t[61];let oe;t[62]===ie?oe=t[63]:(oe=(0,Z.jsxs)(Yn,{children:[ie,ae]}),t[62]=ie,t[63]=oe);let se;t[64]===b?se=t[65]:(se=b({id:`SiUUCS`}),t[64]=b,t[65]=se);let ce=!S,le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)(pt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[66]=le):le=t[66];let ue;t[67]!==h||t[68]!==se||t[69]!==ce?(ue=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":se,disabled:ce,onClick:h,children:le})}),t[67]=h,t[68]=se,t[69]=ce,t[70]=ue):ue=t[70];let de;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`SiUUCS`})}),t[71]=de):de=t[71];let K;t[72]===ue?K=t[73]:(K=(0,Z.jsxs)(Yn,{children:[ue,de]}),t[72]=ue,t[73]=K);let fe=a?`secondary`:`ghost`,pe;t[74]!==b||t[75]!==a?(pe=b(a?{id:`UkQGhd`}:{id:`1RluQD`}),t[74]=b,t[75]=a,t[76]=pe):pe=t[76];let me=a?`ok-replace-input`:void 0,he;t[77]!==f||t[78]!==a?(he=()=>f(!a),t[77]=f,t[78]=a,t[79]=he):he=t[79];let ge;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,Z.jsx)(Jc,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[80]=ge):ge=t[80];let _e;t[81]!==a||t[82]!==fe||t[83]!==pe||t[84]!==me||t[85]!==he?(_e=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:fe,size:`icon-sm`,"aria-label":pe,"aria-expanded":a,"aria-controls":me,onClick:he,children:ge})}),t[81]=a,t[82]=fe,t[83]=pe,t[84]=me,t[85]=he,t[86]=_e):_e=t[86];let ve;t[87]===a?ve=t[88]:(ve=(0,Z.jsx)(vr,{side:`bottom`,children:a?(0,Z.jsx)(J,{id:`UkQGhd`}):(0,Z.jsx)(J,{id:`1RluQD`})}),t[87]=a,t[88]=ve);let ye;t[89]!==_e||t[90]!==ve?(ye=(0,Z.jsxs)(Yn,{children:[_e,ve]}),t[89]=_e,t[90]=ve,t[91]=ye):ye=t[91];let be;t[92]!==b||t[93]!==O||t[94]!==S||t[95]!==v||t[96]!==_||t[97]!==d||t[98]!==a||t[99]!==i?(be=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{className:`sr-only`,htmlFor:`ok-replace-input`,children:(0,Z.jsx)(J,{id:`fqSfXY`})}),(0,Z.jsx)(Go,{id:`ok-replace-input`,value:i,onChange:e=>d(e.target.value),onKeyDown:O,placeholder:b({id:`fqSfXY`}),autoComplete:`off`,spellCheck:!1,className:`h-7 w-48 rounded-[min(var(--radius-md),12px)] px-2 text-sm shadow-none focus-visible:ring-2`}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`bS_boY`}),disabled:!S,onClick:_,children:(0,Z.jsx)(Jc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`bS_boY`})})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b({id:`dr1vFs`}),disabled:!S,onClick:v,children:(0,Z.jsx)(qc,{"data-icon":`inline-start`,"aria-hidden":`true`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`dr1vFs`})})]})]}):null,t[92]=b,t[93]=O,t[94]=S,t[95]=v,t[96]=_,t[97]=d,t[98]=a,t[99]=i,t[100]=be):be=t[100];let xe;t[101]===b?xe=t[102]:(xe=b({id:`wJo9oS`}),t[101]=b,t[102]=xe);let Se;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Z.jsx)(Xt,{"data-icon":`inline-start`,"aria-hidden":`true`}),t[103]=Se):Se=t[103];let Ce;t[104]!==y||t[105]!==xe?(Ce=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":xe,onClick:y,children:Se})}),t[104]=y,t[105]=xe,t[106]=Ce):Ce=t[106];let we;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Z.jsx)(vr,{side:`bottom`,children:(0,Z.jsx)(J,{id:`yz7wBu`})}),t[107]=we):we=t[107];let Te;t[108]===Ce?Te=t[109]:(Te=(0,Z.jsxs)(Yn,{children:[Ce,we]}),t[108]=Ce,t[109]=Te);let Ee;return t[110]!==G||t[111]!==ee||t[112]!==oe||t[113]!==K||t[114]!==k||t[115]!==ye||t[116]!==be||t[117]!==Te?(Ee=(0,Z.jsxs)(`search`,{"data-testid":`find-replace-bar`,"aria-label":k,className:`pointer-events-auto flex max-w-[min(calc(100vw-1rem),720px)] touch-manipulation items-center gap-1 rounded-[calc(var(--radius)+2px)] border border-input bg-popover/95 p-1 text-popover-foreground shadow-md shadow-black/10 backdrop-blur`,children:[A,G,ee,oe,K,ye,be,Te]}),t[110]=G,t[111]=ee,t[112]=oe,t[113]=K,t[114]=k,t[115]=ye,t[116]=be,t[117]=Te,t[118]=Ee):Ee=t[118],Ee}var aw={current:0,total:0},ow=120,sw=100;function cw(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=()=>e?re(e):null,t[0]=e,t[1]=n),(0,Q.useSyncExternalStore)(l,n,lw)}function lw(){return null}function uw(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,`
30
28
  `,`
31
29
  `).trim();return i.length===0||i.length>ow||i.includes(`
32
30
  `)?null:i}function dw(e,t){return(Ui()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&e.key.toLocaleLowerCase()===t}function fw(e){let t=e.key.toLocaleLowerCase();return Ui()?e.metaKey&&e.altKey&&!e.ctrlKey&&t===`f`:e.ctrlKey&&!e.metaKey&&!e.altKey&&t===`h`}function pw(e){let t=nt(e.state);return{current:t.matches.length===0?0:t.activeIndex+1,total:t.matches.length}}function mw(e,t){return e.current===t.current&&e.total===t.total}function hw(e,t,n){e&&!e.isDestroyed&&(e.commands.clearFindMatches(),e.commands.focus()),t(e=>({...e,open:!1,activeIndex:0})),n(aw)}function gw(e){!e||e.isDestroyed||typeof window>`u`||window.requestAnimationFrame(()=>{if(e.isDestroyed)return;let t=p(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 _w(e){let t=(0,$.c)(81),{activeDocName:n,isSourceMode:r}=e,i=cw(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)(aw),m,h;t[1]===n?(m=t[2],h=t[3]):(m=()=>{s.current!==n&&(s.current=n,d(yw))},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(vw)},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(aw);return}if(!u.open||r){i.commands.clearFindMatches(),p(aw);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=pw(i);p(t=>mw(t,e)?t:e)},sw);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=nt(i.state),t=pw(i);p(e=>mw(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=uw(i);d(n=>({...n,open:!0,replaceOpen:e,query:t??n.query,activeIndex:0}))},t=function(t){if(!(!n||r||t.defaultPrevented)){if(dw(t,`f`)){t.preventDefault(),u.open?hw(i,d,p):e(!1);return}if(fw(t)){t.preventDefault(),e(!0);return}if(dw(t,`g`)&&u.open){t.preventDefault(),(t.shiftKey?i?.commands.selectPreviousFindMatch():i?.commands.selectNextFindMatch())&&gw(i);return}t.key===`Escape`&&u.open&&(t.preventDefault(),hw(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=nt(i.state),t=pw(i);p(e=>mw(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(){hw(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()&&gw(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()&&gw(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)&&gw(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)&&gw(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,ee,te,ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(W=e=>d(t=>({...t,query:e,activeIndex:0})),G=e=>d(t=>({...t,replacement:e})),ee=e=>d(t=>({...t,replaceOpen:e})),te=e=>d(t=>({...t,caseSensitive:e})),ne=e=>d(t=>({...t,wholeWord:e})),t[63]=W,t[64]=G,t[65]=ee,t[66]=te,t[67]=ne):(W=t[63],G=t[64],ee=t[65],te=t[66],ne=t[67]);let re;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?(re=(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)(iw,{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:ee,onCaseSensitiveChange:te,onWholeWordChange:ne,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]=re):re=t[80],re}function vw(e){return{...e,open:!1,activeIndex:0}}function yw(e){return{...e,activeIndex:0}}var bw=960,xw=1024;function Sw(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(ww),[r,i]=(0,Q.useState)(Cw),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${bw-1}px)`),t=window.matchMedia(`(max-width: ${xw-1}px)`),r=()=>{let r=e.matches;n(r?`sheet`:`panel`),i(!r&&t.matches)};return e.addEventListener(`change`,r),t.addEventListener(`change`,r),()=>{e.removeEventListener(`change`,r),t.removeEventListener(`change`,r)}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,Q.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={layout:t,autoCollapse:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Cw(){return window.innerWidth>=bw&&window.innerWidth<xw}function ww(){return window.innerWidth<bw?`sheet`:`panel`}var Tw={words:0,chars:0,tokens:0},Ew=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,Dw=/[\p{L}\p{N}]/u,Ow=new Set([`text`,`inlineCode`,`code`,`tag`]),kw=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Aw=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function jw(e,t){if(!e)return;let n=e.type;if(!kw.has(n)){if(Ow.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
33
31
  `));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)jw(n,t);if(Aw.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
34
32
  `)&&t.push(`
35
- `)}}}}function Mw(e){try{let t=se().parseToMdast(e),n=[];return jw(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function Nw(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Dw.test(n)&&t++;return t}function Pw(e){let t=globalThis.Intl.Segmenter;if(!t)return Nw(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Fw(e){let t=Ew.test(e)?1.5:4;return Math.ceil(e.length/t)}function Iw(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=ji(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=Mw(t);return n?{words:Ew.test(n)?Pw(n):Nw(n),chars:n.length,tokens:Fw(n)}:{words:0,chars:0,tokens:0}}var Lw=300;function Rw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tw),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tw);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Iw(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,Lw)};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 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=Ni;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=Fe(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)(rr);return e}function Jw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:_r(e.display_name),color:Ai(e.id,Qn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Ai(e.id,Qn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Yw(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 Xw=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(Gn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Fr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(jr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(cr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ar(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(hr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(or(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=sr(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ur){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 Ar){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():Yw(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Vi(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()}},Zw=e=>new Vr({key:typeof e.pluginKey==`string`?new Lr(e.pluginKey):e.pluginKey,view:t=>new Xw({view:t,...e})});Zn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Zw({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 Qw=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 ir(e,{textSerializers:lr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Gn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Fr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(jr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(cr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ar(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(hr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(or(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=sr(this.view,e.from,e.to);Vi({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()}},$w=e=>new Vr({key:typeof e.pluginKey==`string`?new Lr(e.pluginKey):e.pluginKey,view:t=>new Qw({view:t,...e})});Zn.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?[$w({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 eT(e,t){return e??new Lr(t)}var tT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,nT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),rT=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(`.`)),iT=new Set([`children`,`className`,`style`]),aT=new Set([`tabIndex`]),oT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),sT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function cT(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function lT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function uT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||oT.has(e)}function dT(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function fT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:sT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function pT(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 mT(e){return aT.has(e)}function hT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function gT(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 _T(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||rT.has(e)?String(t):`${t}px`}function vT(e,t){nT.has(t)||e.style.removeProperty(dT(t))}function yT(e,t,n){nT.has(t)||e.style.setProperty(dT(t),_T(t,n))}function bT(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(iT.has(r)||!uT(r)||cT(r,t[r])||cT(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=lT(r);if(a==null||a===!1){mT(r)&&gT(e,r),e.removeAttribute(o);return}if(a===!0){mT(r)&&hT(e,r,!0),e.setAttribute(o,``);return}if(mT(r)){hT(e,r,a);return}e.setAttribute(o,String(a))})}function xT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ST(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){vT(e,t);return}yT(e,t,a)}})}function CT(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(!cT(t,n))return;let{eventName:i,options:a}=fT(t),o=t=>{n(pT(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function wT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);tT(()=>{let i=n.current;return xT(e,i.className,t.className),ST(e,i.style,t.style),bT(e,i,t),r.current=CT(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 TT=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)(eT(e,`bubbleMenu`)).current;wT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Ye(),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=Zw({...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,$s.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)(eT(e,`floatingMenu`)).current;wT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Ye(),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=$w({...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,$s.createPortal)(s,u.current)});var ET=[{name:`paragraph`,label:`Text`,icon:Hc,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:O,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Se,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:d,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:ae,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:j,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:C,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:at,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function DT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:OT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=yt(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)(pt,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Ya,{asChild:!0,children:(0,Z.jsxs)(X,{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=ET.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ja,{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)(Ka,{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)(qa,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function OT(e){let t=Object.fromEntries(ET.map(t=>[t.name,t.isActive(e.editor)]));return{current:ET.find(e=>t[e.name])??ET[0],activeStates:t}}function kT(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 AT(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:qe(typeof n.src==`string`?n.src:``)}function jT(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 MT(e){let t=(0,$.c)(10),{editor:n}=e,r;if(t[0]===n?r=t[1]:(r={editor:n,selector:NT},t[0]=n,t[1]=r),yt(r)===null)return null;let i;t[2]===n?i=t[3]:(i=e=>{e.preventDefault();let t=kT(n);t&&jT(t,AT(n))},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ho,{className:`size-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Download file`,className:`text-accent-foreground`,onMouseDown:i,children:a})}),t[5]=i,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:`Download file`}),t[7]=s):s=t[7];let c;return t[8]===o?c=t[9]:(c=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Yn,{children:[o,s]})}),t[8]=o,t[9]=c),c}function NT(e){return kT(e.editor)}function PT(e){return kT(e)!==null}var FT=[{value:`left`,label:`Align left`,icon:ge},{value:`center`,label:`Align center`,icon:_},{value:`right`,label:`Align right`,icon:b}];function IT(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`img`&&n!==`CommonMarkImage`&&n!==`Embed`)return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function LT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:RT},t[0]=n,t[1]=r);let i=yt(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=FT.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(a!==`img`&&a!==`CommonMarkImage`&&a!==`Embed`||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(ur.create(u.doc,s)),Ze(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{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 RT(e){return IT(e.editor)}function zT(e){return IT(e)!==null}var BT=[{name:`bold`,icon:Qs,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘ B`},{name:`italic`,icon:Ec,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘ I`},{name:`underline`,icon:ll,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘ U`},{name:`strikethrough`,icon:al,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘ ⇧ X`},{name:`code`,icon:cc,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘ E`},{name:`highlight`,icon:Tc,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘ ⇧ H`}];function VT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:HT},t[0]=n,t[1]=r);let i=yt(r),a;t[2]!==i||t[3]!==n?(a=BT.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{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)(vr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(XS,{children:Ui()?e.shortcut:e.shortcut.replace(`⌘`,`Ctrl`)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function HT(e){return Object.fromEntries(BT.map(t=>[t.name,t.isActive(e.editor)]))}function UT(e){let t=(0,$.c)(46),{editor:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null),c;t[0]===n?c=t[1]:(c=n.isActive(`link`),t[0]=n,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=n.getAttributes(`link`).href??``,t[2]=n,t[3]=u);let d=u,f,p;t[4]===n?(f=t[5],p=t[6]):(f=()=>{let e=function(){n.state.selection.empty&&i(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},p=[n],t[4]=n,t[5]=f,t[6]=p),(0,Q.useEffect)(f,p);let m,h;t[7]!==d||t[8]!==r?(m=()=>{r&&(o(d),requestAnimationFrame(()=>s.current?.focus()))},h=[r,d],t[7]=d,t[8]=r,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,Q.useEffect)(m,h);let g;t[11]!==n||t[12]!==l||t[13]!==a?(g=function(){a.trim()?n.chain().focus().setLink({href:a.trim()}).run():l&&n.chain().focus().unsetLink().run(),i(!1)},t[11]=n,t[12]=l,t[13]=a,t[14]=g):g=t[14];let _=g,v;t[15]===n?v=t[16]:(v=function(){n.chain().focus().unsetLink().run(),i(!1)},t[15]=n,t[16]=v);let y=v,b;t[17]!==_||t[18]!==n?(b=function(e){e.key===`Enter`&&(e.preventDefault(),_()),e.key===`Escape`&&(e.preventDefault(),i(!1),n.chain().focus().run())},t[17]=_,t[18]=n,t[19]=b):b=t[19];let x=b;if(r){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>o(e.target.value),t[20]=e):e=t[20];let n;t[21]!==x||t[22]!==a?(n=(0,Z.jsx)(`input`,{ref:s,type:`url`,placeholder:`Paste link`,value:a,onChange:e,onKeyDown:x,"aria-label":`Link URL`,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[21]=x,t[22]=a,t[23]=n):n=t[23];let r;t[24]===_?r=t[25]:(r=()=>{_()},t[24]=_,t[25]=r);let i;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(fc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[26]=i):i=t[26];let c;t[27]===r?c=t[28]:(c=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Apply link`,onClick:r,children:i}),t[27]=r,t[28]=c);let u;t[29]!==n||t[30]!==c?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[n,c]}),t[29]=n,t[30]=c,t[31]=u):u=t[31];let f;t[32]!==d||t[33]!==l||t[34]!==y?(f=l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),D(d)},children:(0,Z.jsx)(Ho,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove link`,onMouseDown:e=>{e.preventDefault(),y()},children:(0,Z.jsx)(Rt,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:`Remove link`})]})]}),t[32]=d,t[33]=l,t[34]=y,t[35]=f):f=t[35];let p;return t[36]!==u||t[37]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u,f]}),t[36]=u,t[37]=f,t[38]=p):p=t[38],p}let S=l?`bg-accent text-primary`:`text-accent-foreground`,C,w;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e.preventDefault(),i(!0)},w=(0,Z.jsx)(kc,{className:`size-3.5`}),t[39]=C,t[40]=w):(C=t[39],w=t[40]);let T;t[41]===S?T=t[42]:(T=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Insert link`,className:S,onMouseDown:C,children:w})}),t[41]=S,t[42]=T);let E;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsxs)(vr,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Z.jsx)(XS,{children:Ui()?`⌘ K`:`Ctrl K`})]}),t[43]=E):E=t[43];let O;return t[44]===T?O=t[45]:(O=(0,Z.jsxs)(Yn,{children:[T,E]}),t[44]=T,t[45]=O),O}function WT({editor:e}){if(nt(e.state).query||e.isActive(`codeBlock`))return!1;if(zT(e)||PT(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 GT(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:XT},t[0]=n,t[1]=s);let c=yt(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:YT},t[2]=n,t[3]=l);let u=yt(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return sr(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=Cr(e,t,()=>{Vi(e,t,{placement:`top`,strategy:`fixed`,middleware:[jr(8),Gn(),Fr({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(JT)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(qT)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(LT,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(MT,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(DT,{editor:n}),(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(VT,{editor:n},i),(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(UT,{editor:n},`${i}-link`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(TT,{ref:r,editor:n,"data-testid":`bubble-menu-bar`,appendTo:KT,shouldShow:WT,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function KT(){return document.body}function qT(e){return e+1}function JT(){}function YT(e){return PT(e.editor)}function XT(e){return zT(e.editor)}var ZT=[{name:`addRowBefore`,icon:ze,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:gt,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:Rt,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],QT=[{name:`addColumnBefore`,icon:la,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:Fa,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:Rt,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],$T=[{name:`toggleHeaderRow`,icon:ol,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:uc,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:Cc,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function eE({editor:e}){return nt(e.state).query?!1:e.isActive(`table`)}function tE(e){let t=(0,$.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(Yn,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function nE(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=ZT.map(e=>(0,Z.jsx)(tE,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=QT.map(e=>(0,Z.jsx)(tE,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=$T.map(e=>(0,Z.jsx)(tE,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(TT,{editor:n,"data-testid":`table-controls-menu`,shouldShow:eE,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var rE=new WeakMap;function iE(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=Xn(e.color),n.textContent=e.name,t.append(n),t}var aE={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},oE=100,sE=100,cE=3,lE=250;function uE(){let e=new xr({extensions:Kr});return{mdManager:e,text:xt({mdManager:e}),html:I({mdManager:e}),paste:Ae({mdManager:e}),drop:N({mdManager:e})}}function dE(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...vt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e.name===`toggleHeadings`?e.configure({getDocName:()=>t.configuration.name??null}):e),Vw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),we.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Zn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[jt]}}),Zn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[ke(e,{cursorBuilder:iE})]}})]}function fE(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{rE.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=rE.get(e);if(rE.delete(e),r==null)return;let i=performance.now();$e(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:(e,t)=>n.drop(e,t)},extensions:Hf(dE(e))}}function pE(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=br(dE({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=Me(t.document.getXmlFragment(`default`),a);return{...fE({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var mE=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(aE),c=qw(),{principal:l,activeDocName:u}=ft(),d=n.configuration.name??``,[f]=(0,Q.useState)(uE),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new tr(pE({provider:n,placeholder:r,clipboard:f,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=f,t[1]=r,t[2]=n,t[3]=p):p=t[3];let[m]=(0,Q.useState)(p),g,_;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=x(d)??crypto.randomUUID();g=Q.use,_=h({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=g,t[8]=_}else g=t[7],_=t[8];let v=g(_),y=v.editor,b,S;t[9]===v?(b=t[10],S=t[11]):(b=()=>()=>{Le(v)},S=[v],t[9]=v,t[10]=b,t[11]=S),(0,Q.useEffect)(b,S);let C;return t[12]!==u||t[13]!==d||t[14]!==y||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(C=(0,Z.jsx)(hE,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:y,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=y,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=C):C=t[20],C},hE=e=>{let t=(0,$.c)(85),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:d,portalTarget:f}=e,m=(0,Q.useRef)(null),h,g;t[0]===f?(h=t[1],g=t[2]):(h=()=>{let e=m.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},g=[f],t[0]=f,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _;t[3]!==c||t[4]!==n.configuration.name?(_=()=>(Et(c,n.configuration.name??null),()=>{Et(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=_):_=t[5];let v;t[6]!==c||t[7]!==n?(v=[c,n],t[6]=c,t[7]=n,t[8]=v):v=t[8],(0,Q.useEffect)(_,v);let y;t[9]!==c||t[10]!==n.configuration.name?(y=()=>{let e=n.configuration.name;if(e)return ot(e,c),()=>it(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=y):y=t[11];let b;t[12]!==c||t[13]!==n?(b=[c,n],t[12]=c,t[13]=n,t[14]=b):b=t[14],(0,Q.useEffect)(y,b);let x;t[15]!==c||t[16]!==n.configuration.name?(x=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=x):x=t[17];let S;t[18]!==c||t[19]!==n?(S=[c,n],t[18]=c,t[19]=n,t[20]=S):S=t[20],(0,Q.useEffect)(x,S);let C,w;t[21]===c?(C=t[22],w=t[23]):(w=()=>{let e=gE,t=null,n=()=>{if(t||c.isDestroyed)return;let n=p(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 p(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},C=[c],t[21]=c,t[22]=C,t[23]=w),(0,Q.useEffect)(w,C);let T,E;t[24]!==i||t[25]!==c?(T=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!p(c))return;e=!0;let t=It(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})),$e(`ok/editor/selection-restore-failed`,{docName:i,message:n})}dt(i)};if(p(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},E=[c,i],t[24]=i,t[25]=c,t[26]=T,t[27]=E):(T=t[26],E=t[27]),(0,Q.useEffect)(T,E);let D,O;t[28]!==d||t[29]!==n.document||t[30]!==l?(D=()=>{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=>{d.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??``))},u=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.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)},Pi)};c(aE);let f=()=>{if(yr(e),!gr(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(),u()},e)}return}r=n,u()};e.observe(f);let p=()=>{document.visibilityState===`visible`?gr(e,t)&&(t=Date.now(),r=Date.now(),u()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},O=[n.document,d,l],t[28]=d,t[29]=n.document,t[30]=l,t[31]=D,t[32]=O):(D=t[31],O=t[32]),(0,Q.useEffect)(D,O);let k,A;t[33]!==a||t[34]!==i||t[35]!==c||t[36]!==n?(k=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<oE){e+=1,t=window.setTimeout(m,sE);return}r=null,o=null,e=0},u=function(e){let t=p(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=cE,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,lE)))};t=window.setTimeout(o,lE)};function m(){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 h=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Ei(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),m()},g=function(){if(i===a){if(r){m();return}h()}};return h(),n.on(`synced`,g),c.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},A=[n,c,i,a],t[33]=a,t[34]=i,t[35]=c,t[36]=n,t[37]=k,t[38]=A):(k=t[37],A=t[38]),(0,Q.useEffect)(k,A);let j,M;t[39]===c?(j=t[40],M=t[41]):(j=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=p(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(Ns,e),()=>window.removeEventListener(Ns,e)},M=[c],t[39]=c,t[40]=j,t[41]=M),(0,Q.useEffect)(j,M);let N;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n.awareness?(N=()=>{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[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n.awareness,t[48]=N):N=t[48];let P;t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==r||t[53]!==s||t[54]!==n?(P=[n,i,a,o,s,r],t[49]=a,t[50]=i,t[51]=o,t[52]=r,t[53]=s,t[54]=n,t[55]=P):P=t[55],(0,Q.useEffect)(N,P);let F,I;t[56]!==c||t[57]!==r?(F=()=>(Ct(c,r),()=>{Ct(c,!1)}),I=[c,r],t[56]=c,t[57]=r,t[58]=F,t[59]=I):(F=t[58],I=t[59]),(0,Q.useEffect)(F,I);let L;t[60]!==c||t[61]!==r?(L=!r&&(0,Z.jsx)(GT,{editor:c}),t[60]=c,t[61]=r,t[62]=L):L=t[62];let R;t[63]!==c||t[64]!==r?(R=!r&&(0,Z.jsx)(nE,{editor:c}),t[63]=c,t[64]=r,t[65]=R):R=t[65];let z;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(`div`,{ref:m,style:{display:`contents`}}),t[66]=z):z=t[66];let B;t[67]===c?B=t[68]:(B=(0,Z.jsx)(Nt,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[67]=c,t[68]=B);let V;t[69]!==f||t[70]!==B?(V=(0,$s.createPortal)(B,f),t[69]=f,t[70]=B,t[71]=V):V=t[71];let H;t[72]===c?H=t[73]:(H=(0,Z.jsx)(Gw,{editor:c}),t[72]=c,t[73]=H);let U;t[74]===c?U=t[75]:(U=Gt(c),t[74]=c,t[75]=U);let W;t[76]===U.store?W=t[77]:(W=(0,Z.jsx)(u,{store:U.store}),t[76]=U.store,t[77]=W);let G;return t[78]!==L||t[79]!==R||t[80]!==V||t[81]!==H||t[82]!==W||t[83]!==l?(G=(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:[L,R,z,V,H,W]}),t[78]=L,t[79]=R,t[80]=V,t[81]=H,t[82]=W,t[83]=l,t[84]=G):G=t[84],G};function gE(){return Lt()}function _E(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Mt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var vE=`__back-nav__`;function yE(e){return e instanceof He||e instanceof ht||e instanceof Re||e instanceof et||e instanceof Dt||e instanceof Ve?e.docName:null}function bE(e){return e instanceof He?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof ht?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof Re?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof et?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof Dt?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:e instanceof Ve?{title:`Cancelled`,summary:`You cancelled loading "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function xE(e){let t=(0,$.c)(27),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=bE(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(WS,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===r?v=t[13]:(v=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:`Try again`}),t[12]=r,t[13]=v);let y;t[14]!==i||t[15]!==u||t[16]!==n||t[17]!==o||t[18]!==a||t[19]!==r?(y=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(yE(n)??i),o(a),r(vE))},children:`Go back`}):null,t[14]=i,t[15]=u,t[16]=n,t[17]=o,t[18]=a,t[19]=r,t[20]=y):y=t[20];let b;t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==_?(x=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[m,_,b]}),t[24]=b,t[25]=_,t[26]=x):x=t[26],x}function SE(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)(xE,{...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]===vE){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}: ${bE(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)(ue,{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 CE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Ci(t);return{map:n,keys:ii(t),parseError:r}}function wE(e){let t=(0,$.c)(167),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>CE(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),l,u;t[2]===n?(l=t[3],u=t[4]):(l=()=>{let e=Qr(n);i(e),s(e.current());let t=e.subscribe(e=>{s(e)});return()=>{t(),e.dispose(),i(t=>t===e?null:t)}},u=[n],t[2]=n,t[3]=l,t[4]=u),(0,Q.useEffect)(l,u);let d=o.map,f=o.keys,p=o.parseError,[m,h]=(0,Q.useState)(!1),g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g={},t[5]=g):g=t[5];let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C={},t[6]=C):C=t[6];let[w,T]=(0,Q.useState)(C),E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(E={},t[7]=E):E=t[7];let[D,O]=(0,Q.useState)(E),k=n.configuration.name??``,A;t[8]===k?A=t[9]:(A=OE(k),t[8]=k,t[9]=A);let j=A,M;t[10]===k?M=t[11]:(M=EE(k),t[10]=k,t[11]=M);let N=_o(j?null:M),P;t[12]!==N||t[13]!==j?(P=!j&&N.state.status===`ready`?N.state.data.folder.frontmatter_defaults??{}:{},t[12]=N,t[13]=j,t[14]=P):P=t[14];let F=P,I;t[15]!==N||t[16]!==j?(I=!j&&N.state.status===`ready`?N.state.data.frontmatterSources:{},t[15]=N,t[16]=j,t[17]=I):I=t[17];let L=I,R;t[18]===r?R=t[19]:(R=function(e){if(!r)return{ok:!1,error:`Connecting`};let t=r.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=pi(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[18]=r,t[19]=R);let z=R,B;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){T(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[20]=B):B=t[20];let V=B,H;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e,t){if(e.ok)return;let n=e.error??`Failed to update property`,r=e.fieldErrors??{};T(e=>{let i={...e};for(let e of t)i[e]=r[e]??n;return i}),O(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[21]=H):H=t[21];let U=H,W;t[22]===z?W=t[23]:(W=function(e,t){V(e),U(z({[e]:t}),[e])},t[22]=z,t[23]=W);let G=W,ee;t[24]===z?ee=t[25]:(ee=function(e){V(e),U(z({[e]:null}),[e])},t[24]=z,t[25]=ee);let te=ee,ne;t[26]===r?ne=t[27]:(ne=function(e,t){if(!r)return{ok:!1,error:`Connecting`};if(e===t)return{ok:!0};let n=r.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let i=pi(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[26]=r,t[27]=ne);let re=ne,ie;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(ie=function(e,t){return`${e} ${t}`},t[28]=ie):ie=t[28];let ae=ie,oe;t[29]!==r||t[30]!==f?(oe=function(e){if(!r)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let i=f.map((e,t)=>ae(e,t)),a=i.indexOf(t),o=i.indexOf(n);if(a<0||o<0)return;let s=f.slice(),[c]=s.splice(a,1);if(!c)return;s.splice(o,0,c);let l=r.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[29]=r,t[30]=f,t[31]=oe):oe=t[31];let se=oe,ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ce={activationConstraint:{distance:4}},t[32]=ce):ce=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le={coordinateGetter:mo},t[33]=le):le=t[33];let ue=Vo(Va(Aa,ce),Va(Da,le)),de;t[34]!==F||t[35]!==G||t[36]!==d?(de=function(e,t){let n=d[e]??kE(F[e]);if(n===void 0)return;v(n=>({...n,[e]:t}));let r=Ta(n,t);(!Object.hasOwn(d,e)||!TE(n,r))&&G(e,r)},t[34]=F,t[35]=G,t[36]=d,t[37]=de):de=t[37];let K=de,fe;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(fe=function(){b({name:``,type:`text`,value:``,error:null}),h(!1)},t[38]=fe):fe=t[38];let pe=fe,{addPropertySignal:me,clearAddProperty:he}=LC(),ge;t[39]!==me||t[40]!==k?(ge=me.get(k)??0,t[39]=me,t[40]=k,t[41]=ge):ge=t[41];let _e=ge,ve,ye;t[42]===_e?(ve=t[43],ye=t[44]):(ve=()=>{_e>0&&(b({name:``,type:`text`,value:``,error:null}),h(!1))},ye=[_e],t[42]=_e,t[43]=ve,t[44]=ye),(0,Q.useEffect)(ve,ye);let be,xe;t[45]!==he||t[46]!==k?(be=()=>()=>he(k),xe=[k,he],t[45]=he,t[46]=k,t[47]=be,t[48]=xe):(be=t[47],xe=t[48]),(0,Q.useEffect)(be,xe);let Se;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Se=function(e){b(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Wa[e];return{...t,type:e,value:n,error:null}})},t[49]=Se):Se=t[49];let Ce=Se,we;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){b(t=>t&&{...t,value:e})},t[50]=we):we=t[50];let Te=we,Ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){b(t=>t&&{...t,name:e,error:null})},t[51]=Ee):Ee=t[51];let De=Ee,Oe;t[52]!==y||t[53]!==z||t[54]!==d?(Oe=function(){if(!y)return;let e=y.name.trim();if(!e){b({...y,error:`Name is required`});return}if(e===`frontmatter`){b({...y,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(d,e)){b({...y,error:`Property "${e}" already exists`});return}let t=z({[e]:y.value});if(t.ok){b(null);return}let n=t.fieldErrors?.[e],r=t.error??`Failed to add property`;b({...y,error:n??r})},t[52]=y,t[53]=z,t[54]=d,t[55]=Oe):Oe=t[55];let ke=Oe,Ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=function(){b(null)},t[56]=Ae):Ae=t[56];let je=Ae,Me;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Me=function(e){S({key:e,draft:e,error:null})},t[57]=Me):Me=t[57];let Ne=Me,Pe;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=function(e){S(t=>t&&{...t,draft:e,error:null})},t[58]=Pe):Pe=t[58];let Fe=Pe,Ie;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=function(){S(null)},t[59]=Ie):Ie=t[59];let Le=Ie,Re;t[60]!==d||t[61]!==re||t[62]!==x?(Re=function(){if(!x)return;let e=x.draft.trim();if(!e){S(null);return}if(e===x.key){S(null);return}if(e===`frontmatter`){S({...x,error:`"frontmatter" is a reserved property name`});return}if(Object.hasOwn(d,e)){S({...x,error:`Property "${e}" already exists`});return}let t=re(x.key,e);if(t.ok){v(t=>{if(!Object.hasOwn(t,x.key))return t;let n={...t};return n[e]=n[x.key],delete n[x.key],n}),V(x.key),S(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[x.key]??t.error??`Failed to rename property`;S({...x,error:n})},t[60]=d,t[61]=re,t[62]=x,t[63]=Re):Re=t[63];let ze=Re,q;t[64]!==d||t[65]!==f?(q=f.length>0?f:Object.keys(d),t[64]=d,t[65]=f,t[66]=q):q=t[66];let Be=q,Ve;if(t[67]!==Be){Ve=new Map;for(let e of Be)Ve.set(e,(Ve.get(e)??0)+1);t[67]=Be,t[68]=Ve}else Ve=t[68];let He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e;if(t[69]!==y||t[70]!==F||t[71]!==L||t[72]!==m||t[73]!==G||t[74]!==ze||t[75]!==Ve||t[76]!==w||t[77]!==se||t[78]!==d||t[79]!==_||t[80]!==p||t[81]!==te||t[82]!==x||t[83]!==Be||t[84]!==D||t[85]!==ue||t[86]!==K){$e=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(F).filter(e=>!Object.hasOwn(d,e)).sort();if(Be.length===0&&e.length===0&&!y&&!p){$e=null;break bb0}Ze=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,Qe=`property-panel`,Ue=Jo,Je=!m,t[99]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=e=>h(!e),t[99]=Ye):Ye=t[99];let n=!m,r;t[100]===n?r=t[101]:(r=(0,Z.jsx)(Wo,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[100]=n,t[101]=r);let i;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:`Properties`}),t[102]=i):i=t[102],t[103]===r?Xe=t[104]:(Xe=(0,Z.jsx)(qo,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[r,i]})}),t[103]=r,t[104]=Xe),He=Ko,We=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[105]===p?Ge=t[106]:(Ge=p?(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)(ei,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[`Frontmatter YAML is malformed; fix in source mode to recover.`,(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:p})]})]}):null,t[105]=p,t[106]=Ge);let a;if(t[107]!==Be){let e;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>ae(e,t),t[109]=e):e=t[109],a=Be.map(e),t[107]=Be,t[108]=a}else a=t[108];let o;if(t[110]!==G||t[111]!==ze||t[112]!==Ve||t[113]!==w||t[114]!==d||t[115]!==_||t[116]!==te||t[117]!==x||t[118]!==Be||t[119]!==D||t[120]!==K){let e;t[122]!==G||t[123]!==ze||t[124]!==Ve||t[125]!==w||t[126]!==d||t[127]!==_||t[128]!==te||t[129]!==x||t[130]!==D||t[131]!==K?(e=(e,t)=>{let n=d[e];if(n===void 0)return null;let r=_[e]??Sr(n),i=x?.key===e?x:null,a=(Ve.get(e)??0)>1;return(0,Z.jsx)(xa,{sortableId:ae(e,t),keyName:e,value:n,declared:r,error:w[e]??null,resetCounter:D[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Ne(e),onChangeDraft:Fe,onCommit:ze,onCancel:Le},onCommit:t=>G(e,t),onChangeType:t=>K(e,t),onRemove:()=>te(e)},`${e}-${t}`)},t[122]=G,t[123]=ze,t[124]=Ve,t[125]=w,t[126]=d,t[127]=_,t[128]=te,t[129]=x,t[130]=D,t[131]=K,t[132]=e):e=t[132],o=Be.map(e),t[110]=G,t[111]=ze,t[112]=Ve,t[113]=w,t[114]=d,t[115]=_,t[116]=te,t[117]=x,t[118]=Be,t[119]=D,t[120]=K,t[121]=o}else o=t[121];let s;t[133]!==a||t[134]!==o?(s=(0,Z.jsx)(La,{items:a,strategy:Ia,children:o}),t[133]=a,t[134]=o,t[135]=s):s=t[135],t[136]!==se||t[137]!==ue||t[138]!==s?(Ke=(0,Z.jsx)(za,{sensors:ue,collisionDetection:Na,onDragEnd:se,children:s}),t[136]=se,t[137]=ue,t[138]=s,t[139]=Ke):Ke=t[139];let c;t[140]!==F||t[141]!==L||t[142]!==G||t[143]!==w||t[144]!==D||t[145]!==K?(c=e=>{let t=F[e],n=kE(t),r=Sr(n),i=L[e]??``;return(0,Z.jsx)(xa,{keyName:e,value:n,declared:r,error:w[e]??null,resetCounter:D[e]??0,isInherited:!0,badge:(0,Z.jsx)(Fo,{source:i}),onCommit:t=>G(e,t),onChangeType:t=>K(e,t)},`inherited-${e}`)},t[140]=F,t[141]=L,t[142]=G,t[143]=w,t[144]=D,t[145]=K,t[146]=c):c=t[146],qe=e.map(c)}t[69]=y,t[70]=F,t[71]=L,t[72]=m,t[73]=G,t[74]=ze,t[75]=Ve,t[76]=w,t[77]=se,t[78]=d,t[79]=_,t[80]=p,t[81]=te,t[82]=x,t[83]=Be,t[84]=D,t[85]=ue,t[86]=K,t[87]=He,t[88]=Ue,t[89]=We,t[90]=Ge,t[91]=Ke,t[92]=qe,t[93]=Je,t[94]=Ye,t[95]=Xe,t[96]=Ze,t[97]=Qe,t[98]=$e}else He=t[87],Ue=t[88],We=t[89],Ge=t[90],Ke=t[91],qe=t[92],Je=t[93],Ye=t[94],Xe=t[95],Ze=t[96],Qe=t[97],$e=t[98];if($e!==Symbol.for(`react.early_return_sentinel`))return $e;let et;t[147]!==y||t[148]!==ke?(et=y?(0,Z.jsx)(Ha,{draft:y,onChangeName:De,onChangeType:Ce,onChangeValue:Te,onCommit:ke,onCancel:je}):(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)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:pe,"aria-label":`Add property`,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)(c,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add`})]})]}),t[147]=y,t[148]=ke,t[149]=et):et=t[149];let tt;t[150]!==He||t[151]!==We||t[152]!==Ge||t[153]!==Ke||t[154]!==qe||t[155]!==et?(tt=(0,Z.jsxs)(He,{className:We,children:[Ge,Ke,qe,et]}),t[150]=He,t[151]=We,t[152]=Ge,t[153]=Ke,t[154]=qe,t[155]=et,t[156]=tt):tt=t[156];let nt;t[157]!==Ue||t[158]!==Je||t[159]!==Ye||t[160]!==Xe||t[161]!==tt?(nt=(0,Z.jsxs)(Ue,{open:Je,onOpenChange:Ye,children:[Xe,tt]}),t[157]=Ue,t[158]=Je,t[159]=Ye,t[160]=Xe,t[161]=tt,t[162]=nt):nt=t[162];let rt;return t[163]!==Ze||t[164]!==Qe||t[165]!==nt?(rt=(0,Z.jsx)(`div`,{className:Ze,"data-testid":Qe,children:nt}),t[163]=Ze,t[164]=Qe,t[165]=nt,t[166]=rt):rt=t[166],rt}function TE(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function EE(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var DE=/(^|\/)\.ok\/templates\//;function OE(e){return DE.test(e)}function kE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var AE=Qe(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function jE(e){let t=e.threshold??AE;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function ME(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var NE=Qe(`ACTIVITY_MOUNT_LIMIT`,3);function PE(){return n(()=>import(`./SourceEditor-BBghYkCg.js`),__vite__mapDeps([44,1,33,2,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,45,22]),import.meta.url)}var FE=(0,Q.lazy)(async()=>({default:(await PE()).SourceEditor}));function IE(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Je(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 LE(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:`Couldn't reconnect after server restart`,summary:t.reason===`clear-data-timeout`?`Local collaboration data for "${e}" could not be cleared in time. Reload to retry.`:`Local collaboration data for "${e}" could not be cleared. Reload to retry.`,actionLabel:`Reload`}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:`Reconnecting after server restart`,summary:t.phase===`clearing-local-cache`?`Clearing local collaboration data for "${e}" before reconnecting.`:`Reopening "${e}" with a fresh local collaboration cache.`}:null}function RE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(ut,{name:`activity-pool`,children:(0,Z.jsx)(zE,{...e})}),t[0]=e,t[1]=n),n}function zE(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=Zr(),f=IE(c,n,NE),p=(0,Q.useRef)(``),m=f.map(BE).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)_e(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;v(e,t&&t.length>0?t:crypto.randomUUID())}$e(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Wt(t)},[m,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)(KE,{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 BE(e){return e.docName}function VE(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&&$e(`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&&($e(`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&&$e(`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 HE(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sS,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(FE,{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 UE(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)(Kc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ee,{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)(X,{type:`button`,onClick:WE,children:[(0,Z.jsx)(Kc,{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 WE(){return window.location.reload()}function GE(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 KE(e){let t=(0,$.c)(52),{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=LE(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p;t[3]===n.docName?p=t[4]:(p=()=>{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]=p);let[m]=(0,Q.useState)(p),h=n.provider.document.getText(`source`).length,[g,_]=(0,Q.useState)(i),[v,y]=(0,Q.useState)(!i),b,S;t[5]!==i||t[6]!==g||t[7]!==v?(b=()=>{i&&!g?_(!0):!i&&!v&&y(!0)},S=[i,g,v],t[5]=i,t[6]=g,t[7]=v,t[8]=b,t[9]=S):(b=t[8],S=t[9]),(0,Q.useEffect)(b,S);let C=jE({ytextLength:h,isSourceMode:i,visitedSource:g,visitedVisual:v}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==h?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&$e(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:h,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,h,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=h,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>It(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==h?(N=()=>{ME({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&($e(`ok/cold/first-toggle`,{docName:n.docName,mountId:x(n.docName),ytextLength:h,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,h,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=h,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.renderVisual||t[34]!==r||t[35]!==o||t[36]!==i||t[37]!==c||t[38]!==l||t[39]!==m||t[40]!==s||t[41]!==f||t[42]!==A?(R=f?(0,Z.jsx)(UE,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(SE,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(GE,{html:A}):(0,Z.jsx)(sS,{}),children:(0,Z.jsx)(_E,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(wE,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(HE,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(mE,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:m},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.renderVisual,t[34]=r,t[35]=o,t[36]=i,t[37]=c,t[38]=l,t[39]=m,t[40]=s,t[41]=f,t[42]=A,t[43]=R):R=t[43];let z;t[44]!==r||t[45]!==L||t[46]!==R?(z=(0,Z.jsx)(VE,{isActive:r,initialScrollTop:L,children:R}),t[44]=r,t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;return t[48]!==F||t[49]!==I||t[50]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[48]=F,t[49]=I,t[50]=z,t[51]=B):B=t[51],B}function qE(e){let t=(0,$.c)(27),{stats:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(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[0]=r):r=t[0];let i;t[1]===n.words?i=t[2]:(i=n.words.toLocaleString(),t[1]=n.words,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:i}),t[3]=i,t[4]=a);let o=n.words===1?`word`:`words`,s;t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`span`,{children:[a,` `,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]===n.chars?c=t[9]:(c=n.chars.toLocaleString(),t[8]=n.chars,t[9]=c);let l;t[10]===c?l=t[11]:(l=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:c}),t[10]=c,t[11]=l);let u=n.chars===1?`char`:`chars`,d;t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{children:[l,` `,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f=n.tokens>0?`~`:``,p;t[15]===n.tokens?p=t[16]:(p=n.tokens.toLocaleString(),t[15]=n.tokens,t[16]=p);let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:p}),t[17]=p,t[18]=m);let h=n.tokens===1?`token`:`tokens`,g;t[19]!==f||t[20]!==m||t[21]!==h?(g=(0,Z.jsxs)(`span`,{children:[f,m,` `,h]}),t[19]=f,t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==g||t[24]!==s||t[25]!==d?(_=(0,Z.jsxs)(`section`,{"aria-label":`Document statistics`,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[r,s,d,g]}),t[23]=g,t[24]=s,t[25]=d,t[26]=_):_=t[26],_}function JE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZE(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=Gi(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function QE(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Gi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Wo,{}),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}function $E(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}=Xe(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}a=JE,t[8]===r?c=t[9]:(c=Gi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=YE,o=`flex-nowrap gap-1 text-muted-foreground/70 text-xs`,s=u.map((e,t)=>{let n=u.slice(0,t+1).join(`/`);return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(QE,{className:`text-muted-foreground/70 [&>svg]:size-3`}),(0,Z.jsx)(XE,{className:`min-w-0`,children:(0,Z.jsx)(ZE,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e,children:e})})]},n)})}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}var eD={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`},tD=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`,...eD,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},nD=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)(tD,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},rD=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)(tD,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function iD(e){let t=(0,$.c)(42),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,u;t[0]===n?u=t[1]:(u=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-end self-end`,children:(0,Z.jsx)($E,{docName:n})}),t[0]=n,t[1]=u);let d=r?`source`:`wysiwyg`,f;t[2]===a?f=t[3]:(f=e=>{e&&a(e)},t[2]=a,t[3]=f);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Qo,{value:`wysiwyg`,"aria-label":`Visual editor`,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:(0,Z.jsx)(Wn,{children:(0,Z.jsx)(rD,{className:`size-4`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:`Visual`})]}),t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(nD,{className:`size-4`}),t[5]=m):m=t[5];let h;t[6]===i?h=t[7]:(h=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Qo,{value:`source`,"aria-label":`Markdown source`,disabled:i,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:m})})}),t[6]=i,t[7]=h);let g=i?`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`:`Markdown`,_;t[8]===g?_=t[9]:(_=(0,Z.jsx)(vr,{side:`bottom`,children:g}),t[8]=g,t[9]=_);let v;t[10]!==h||t[11]!==_?(v=(0,Z.jsxs)(Yn,{children:[h,_]}),t[10]=h,t[11]=_,t[12]=v):v=t[12];let y;t[13]!==d||t[14]!==f||t[15]!==v?(y=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(ts,{type:`single`,value:d,onValueChange:f,"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[p,v]})}),t[13]=d,t[14]=f,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==s||t[18]!==o?(b=o&&(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Wn,{children:(0,Z.jsx)(jc,{})})}),(0,Z.jsx)(vr,{side:`bottom`,children:`Add properties`})]}),t[17]=s,t[18]=o,t[19]=b):b=t[19];let x=!c,S=c?`Show panel`:`Hide panel`,C;t[20]===c?C=t[21]:(C=(0,Z.jsx)(Wn,{children:c?(0,Z.jsx)(Bc,{}):(0,Z.jsx)(zc,{})}),t[20]=c,t[21]=C);let w;t[22]!==l||t[23]!==x||t[24]!==S||t[25]!==C?(w=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:l,"aria-expanded":x,"aria-label":S,asChild:!0,children:C}),t[22]=l,t[23]=x,t[24]=S,t[25]=C,t[26]=w):w=t[26];let T=c?`Show panel`:`Hide panel`,E;t[27]===T?E=t[28]:(E=(0,Z.jsx)(vr,{side:`bottom`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,Z.jsxs)(Yn,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==b||t[33]!==D?(O=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex items-center justify-end gap-1`,children:[b,D]}),t[32]=b,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==u||t[36]!==y||t[37]!==O?(k=(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:[u,y,O]})}),t[35]=u,t[36]=y,t[37]=O,t[38]=k):k=t[38];let A;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[39]=A):A=t[39];let j;return t[40]===k?j=t[41]:(j=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[k,A]}),t[40]=k,t[41]=j),j}function aD(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var oD=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Dgodq1_3.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,41]),import.meta.url)).ActivityModeContent}));function sD(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(lD,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(cD,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(ut,{name:`editor-area`,children:(0,Z.jsxs)(FC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function cD(){let e=(0,$.c)(5),t=Jm(),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)(GC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function lD(e){let t=(0,$.c)(104),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a}=e,{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelAgentId:d,docPanelExpandSignal:f}=ft(),{openDocumentTransition:p}=wt(),{requestAddProperty:m}=LC(),h=Rw(s,o),g=zw(s),_=g===`connected`||g===`synced`,v=(0,Q.useDeferredValue)(o),y=c?.kind===`missing`,b=!!o&&c?.kind!==`folder`,x=y?`Start writing to create this page`:void 0,S=Jx(),[C,w]=(0,Q.useState)(!1),{layout:T,autoCollapse:E}=Sw(),D=T===`sheet`,[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(!1),j,M;t[0]!==E||t[1]!==T||t[2]!==S?(j=()=>{if(T!==`panel`)return;let e=requestAnimationFrame(()=>{E?(A.current=!1,S.current?.collapse()):A.current||S.current?.expand()});return()=>cancelAnimationFrame(e)},M=[E,T,S],t[0]=E,t[1]=T,t[2]=S,t[3]=j,t[4]=M):(j=t[3],M=t[4]),(0,Q.useEffect)(j,M);let N,P;t[5]!==D||t[6]!==a||t[7]!==S?(N=()=>{let e=e=>{a(e),D?k(!0):(A.current=!1,S.current?.expand())},t=Zp();return t&&e(t),$p(t=>{Zp(),e(t)})},P=[D,a,S],t[5]=D,t[6]=a,t[7]=S,t[8]=N,t[9]=P):(N=t[8],P=t[9]),(0,Q.useEffect)(N,P);let F,I;t[10]!==f||t[11]!==D||t[12]!==S?(F=()=>{f!==0&&(D?k(!0):(A.current=!1,S.current?.expand()))},I=[f,D,S],t[10]=f,t[11]=D,t[12]=S,t[13]=F,t[14]=I):(F=t[13],I=t[14]),(0,Q.useEffect)(F,I);let L=(0,Q.useRef)(null),[R,z]=(0,Q.useState)(null),B,V;if(t[15]===o?(B=t[16],V=t[17]):(B=()=>{if(o&&o!==L.current){let e=L.current;L.current=o,z(e)}},V=[o],t[15]=o,t[16]=B,t[17]=V),(0,Q.useEffect)(B,V),c?.kind===`folder`){if(!(u===`agent`&&d!==null)){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(OC,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}let e;t[20]===c.folderPath?e=t[21]:(e=(0,Z.jsx)(XC,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(OC,{folderPath:c.folderPath})}),t[20]=c.folderPath,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ZC,{withHandle:!0}),t[22]=n):n=t[22];let r;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(XC,{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:`Loading agent activity`}),children:(0,Z.jsx)(oD,{showBackButton:!1})})}),t[23]=r):r=t[23];let i;return t[24]===e?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(YC,{orientation:`horizontal`,children:[e,n,r]})}),t[24]=e,t[25]=i),i}if(c?.kind===`asset`){let e;return t[26]!==c.assetPath||t[27]!==c.mediaKind?(e=(0,Z.jsx)(oS,{assetPath:c.assetPath,mediaKind:c.mediaKind},c.assetPath),t[26]=c.assetPath,t[27]=c.mediaKind,t[28]=e):e=t[28],e}if(!s||!o){if((typeof window<`u`?wi(window.location.hash):null)!==null){let e;return t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sS,{}),t[29]=e):e=t[29],e}let e;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tC,{}),t[30]=e):e=t[30],e}let H=n===`source`,U=!_,W=D?!O:C,G;t[31]!==o||t[32]!==m?(G=function(){o&&m(o)},t[31]=o,t[32]=m,t[33]=G):G=t[33];let ee=G,te;t[34]!==C||t[35]!==D||t[36]!==S?(te=function(){D?k(uD):C?(A.current=!1,S.current?.expand()):(A.current=!0,S.current?.collapse())},t[34]=C,t[35]=D,t[36]=S,t[37]=te):te=t[37];let ne=te,re=v??o,ie=R??void 0,ae;t[38]===p?ae=t[39]:(ae=e=>{let t=qr(e);window.location.hash===t?p(e):window.location.hash=t},t[38]=p,t[39]=ae);let oe;t[40]!==x||t[41]!==H||t[42]!==l||t[43]!==re||t[44]!==ie||t[45]!==ae?(oe=(0,Z.jsx)(RE,{activeDocName:re,isSourceMode:H,editorPlaceholder:x,previousDocName:ie,onNavigateBack:ae,onRecycle:l}),t[40]=x,t[41]=H,t[42]=l,t[43]=re,t[44]=ie,t[45]=ae,t[46]=oe):oe=t[46];let se;t[47]!==o||t[48]!==H?(se=(0,Z.jsx)(_w,{activeDocName:o,isSourceMode:H}),t[47]=o,t[48]=H,t[49]=se):se=t[49];let ce;t[50]!==o||t[51]!==v?(ce=aD({activeDocName:o,deferredActiveDocName:v,mountResolved:o!==null&&me(o),syncResolved:o!==null&&We(o)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(sS,{}),o===null?null:(0,Z.jsx)(MC,{docName:o})]}):null,t[50]=o,t[51]=v,t[52]=ce):ce=t[52];let le;t[53]!==oe||t[54]!==se||t[55]!==ce?(le=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[oe,se,ce]}),t[53]=oe,t[54]=se,t[55]=ce,t[56]=le):le=t[56];let ue=!H,de;t[57]!==o||t[58]!==W||t[59]!==H||t[60]!==r||t[61]!==ee||t[62]!==U||t[63]!==ue||t[64]!==ne?(de=(0,Z.jsx)(iD,{activeDocName:o,isSourceMode:H,sourceDisabled:U,onModeChange:r,showAddPropertyButton:ue,onAddProperty:ee,isPanelCollapsed:W,onTogglePanel:ne}),t[57]=o,t[58]=W,t[59]=H,t[60]=r,t[61]=ee,t[62]=U,t[63]=ue,t[64]=ne,t[65]=de):de=t[65];let K;t[66]!==le||t[67]!==de?(K=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[le,de]}),t[66]=le,t[67]=de,t[68]=K):K=t[68];let fe;t[69]!==b||t[70]!==h?(fe=b&&(0,Z.jsx)(qE,{stats:h}),t[69]=b,t[70]=h,t[71]=fe):fe=t[71];let pe;t[72]!==K||t[73]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[K,fe]}),t[72]=K,t[73]=fe,t[74]=pe):pe=t[74];let he=pe,ge=D?`100%`:`30%`,_e=D?`100%`:`75%`,ve;t[75]!==he||t[76]!==ge||t[77]!==_e?(ve=(0,Z.jsx)(XC,{minSize:ge,defaultSize:_e,children:he}),t[75]=he,t[76]=ge,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]===D?ye=t[80]:(ye=D?null:(0,Z.jsx)(ZC,{withHandle:!0}),t[79]=D,t[80]=ye);let be;t[81]!==o||t[82]!==i||t[83]!==u||t[84]!==D||t[85]!==H||t[86]!==a||t[87]!==S?(be=D?null:(0,Z.jsx)(XC,{panelRef:S,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>w(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(tb,{docName:o,isSourceMode:H,activeTab:i,onActiveTabChange:a,mode:u})}),t[81]=o,t[82]=i,t[83]=u,t[84]=D,t[85]=H,t[86]=a,t[87]=S,t[88]=be):be=t[88];let xe;t[89]!==ve||t[90]!==ye||t[91]!==be?(xe=(0,Z.jsxs)(YC,{orientation:`horizontal`,children:[ve,ye,be]}),t[89]=ve,t[90]=ye,t[91]=be,t[92]=xe):xe=t[92];let Se;t[93]!==o||t[94]!==i||t[95]!==u||t[96]!==D||t[97]!==H||t[98]!==a||t[99]!==O?(Se=D?(0,Z.jsx)(bv,{open:O,onOpenChange:k,children:(0,Z.jsxs)(Cv,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(wv,{className:`sr-only`,children:(0,Z.jsx)(Tv,{children:`Document panel`})}),(0,Z.jsx)(tb,{docName:o,isSourceMode:H,activeTab:i,onActiveTabChange:a,mode:u})]})}):null,t[93]=o,t[94]=i,t[95]=u,t[96]=D,t[97]=H,t[98]=a,t[99]=O,t[100]=Se):Se=t[100];let Ce;return t[101]!==xe||t[102]!==Se?(Ce=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[xe,Se]}),t[101]=xe,t[102]=Se,t[103]=Ce):Ce=t[103],Ce}function uD(e){return!e}var dD=1280;function fD(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(pD),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${dD-1}px)`),t=()=>{n(window.innerWidth<dD)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function pD(){return window.innerWidth<dD}function mD(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function hD(e){let{value:t,unit:n}=mD(e);return n===`rem`?t*16:t}function gD(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var _D=3600*24*7;function vD(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?yD:m,O=g===void 0?_D: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,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let te=hD(b),ne;t[6]===x?ne=t[7]:(ne=hD(x),t[6]=x,t[7]=ne);let re=ne,ie;t[8]!==E||t[9]!==k?(ie=function(e){P.current=!0,E&&(j.current=H.current?0:hD(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]=ie):ie=t[10];let ae=ie,oe,se;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==re||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(oe=()=>{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}=mD(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<=te*w;else if(e<=te){let n=te*(w-1);t=te-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>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(re,t)),u=gD(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(te,Math.min(re,u)),f=gD(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)}},se=[i,a,D,te,re,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]=re,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=oe,t[25]=se):(oe=t[24],se=t[25]),(0,Q.useEffect)(oe,se);let ce;return t[26]===ae?ce=t[27]:(ce={dragRef:A,isDragging:N,handleMouseDown:ae},t[26]=ae,t[27]=ce),ce}function yD(){}var bD=`sidebar_state`,xD=3600*24*7,SD=`18rem`,CD=`3rem`,wD=`\\`,TD=`app-file-sidebar`,ED=`14.625rem`,DD=`22rem`,OD=`sidebar_width`,kD=/^\d+(?:\.\d+)?(?:rem|px)$/,AD=Q.createContext(null);function jD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${OD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return kD.test(n)?n:e}function MD(){let e=Q.use(AD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ND(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?SD:l,f=fD(),p;t[9]===d?p=t[10]:(p=()=>jD(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${bD}=${t}; path=/; max-age=${xD}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(FD):D(PD)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]===k?(N=t[20],P=t[21]):(N=()=>{let e=e=>{e.key===wD&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},P=[k],t[19]=k,t[20]=N,t[21]=P),Q.useEffect(N,P);let F,I;t[22]!==f||t[23]!==g?(F=()=>{if(!f||!g)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[f,g],t[22]=f,t[23]=g,t[24]=F,t[25]=I):(F=t[24],I=t[25]),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":CD,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Gi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let ee;return t[50]!==V||t[51]!==G?(ee=(0,Z.jsx)(AD.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=ee):ee=t[52],ee}function PD(e){return!e}function FD(e){return!e}function ID(e){let t=(0,$.c)(51),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{isMobile:d,state:f,openMobile:p,isDraggingRail:m}=MD();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Gi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}if(d){let e=p?`expanded`:`collapsed`,a=l===`floating`||l===`inset`?`p-2`:``,o;t[14]!==r||t[15]!==a?(o=Gi(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,a,r),t[14]=r,t[15]=a,t[16]=o):o=t[16];let s;t[17]===n?s=t[18]:(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[17]=n,t[18]=s);let u;t[19]!==i||t[20]!==c||t[21]!==o||t[22]!==s?(u=(0,Z.jsx)(`nav`,{id:TD,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:o,...i,children:s}),t[19]=i,t[20]=c,t[21]=o,t[22]=s,t[23]=u):u=t[23];let d;return t[24]!==e||t[25]!==c||t[26]!==u||t[27]!==l?(d=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-mobile":`true`,children:u}),t[24]=e,t[25]=c,t[26]=u,t[27]=l,t[28]=d):d=t[28],d}let h=f===`collapsed`?u:``,g=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[29]===g?_=t[30]:(_=Gi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[29]=g,t[30]=_);let v;t[31]===_?v=t[32]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[31]=_,t[32]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[33]!==r||t[34]!==y?(b=Gi(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[33]=r,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n?x=t[37]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[36]=n,t[37]=x);let S;t[38]!==i||t[39]!==c||t[40]!==x||t[41]!==b?(S=(0,Z.jsx)(`nav`,{id:TD,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[38]=i,t[39]=c,t[40]=x,t[41]=b,t[42]=S):S=t[42];let C;return t[43]!==m||t[44]!==c||t[45]!==f||t[46]!==S||t[47]!==h||t[48]!==v||t[49]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":f,"data-collapsible":h,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":m,children:[v,S]}),t[43]=m,t[44]=c,t[45]=f,t[46]=S,t[47]=h,t[48]=v,t[49]=l,t[50]=C):C=t[50],C}function LD(e){let t=(0,$.c)(18),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a,state:o}=MD(),s=o===`expanded`,c=o===`expanded`?`Hide Files`:`Show Files`,l;t[4]===n?l=t[5]:(l=Gi(n),t[4]=n,t[5]=l);let u;t[6]!==r||t[7]!==a?(u=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=u):u=t[8];let d;t[9]===o?d=t[10]:(d=o===`expanded`?(0,Z.jsx)(U,{}):(0,Z.jsx)(Rc,{}),t[9]=o,t[10]=d);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Z.jsx)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":TD,"aria-label":c,className:l,onClick:u,...i,children:d}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function RD(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{toggleSidebar:l,setWidth:u,state:d,width:f,setIsDraggingRail:p}=MD(),m=d===`collapsed`,h;t[6]!==s||t[7]!==c||t[8]!==p||t[9]!==u||t[10]!==m||t[11]!==l||t[12]!==f?(h={direction:`right`,enableDrag:s,enableToggle:c,onResize:u,onToggle:l,currentWidth:f,isCollapsed:m,minResizeWidth:ED,maxResizeWidth:DD,setIsDraggingRail:p,widthCookieName:OD,widthCookieMaxAge:xD},t[6]=s,t[7]=c,t[8]=p,t[9]=u,t[10]=m,t[11]=l,t[12]=f,t[13]=h):h=t[13];let{dragRef:g,handleMouseDown:_}=vD(h),v=d===`expanded`?`Hide Files`:`Show Files`,y;t[14]!==_||t[15]!==r?(y=e=>{r?.(e),e.defaultPrevented||_(e)},t[14]=_,t[15]=r,t[16]=y):y=t[16];let b=d===`expanded`?`Hide Files`:`Show Files`,x;t[17]===n?x=t[18]:(x=Gi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[17]=n,t[18]=x);let S;return t[19]!==g||t[20]!==i||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==x?(S=(0,Z.jsx)(`button`,{ref:g,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":v,tabIndex:-1,onMouseDown:y,title:b,className:x,...i}),t[19]=g,t[20]=i,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function zD(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=MD(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=Gi(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function BD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`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 GD=na(`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 KD(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?Yi:`button`,{isMobile:m,state:h}=MD(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Gi(GD({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)(Wn,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(vr,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(Yn,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function qD(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 JD(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 YD=1e3,XD=!1;function ZD(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function QD(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:ha(i)?a=i:(a=void 0,XD||(XD=!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`&&(ZD({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=JD(i),{current:c,crossDoc:l}=a?ua(a,n,Date.now()):{current:[],crossDoc:[]},u=$D,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>qD(e.current,p)&&qD(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,YD);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 $D(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var eO=`sync-status`;function tO(e,t){let n=(0,$.c)(4),r=(0,Q.useRef)(!1),i=(0,Q.useRef)(!1),a=(0,Q.useRef)(t),o,s;n[0]!==t||n[1]!==e?(o=()=>{a.current!==t&&(a.current=t,r.current=!1,i.current=!1),t&&(e===`synced`&&(r.current=!0),e===`disconnected`&&r.current?(i.current=!0,Y.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:eO,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,Y.success(`Reconnected`,{id:eO,duration:3e3})))},s=[e,t],n[0]=t,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,Q.useEffect)(o,s)}var nO=4,rO=3,iO={Bird:Zs,Cat:rc,Dog:mc,Fish:vc,Mouse:Gc,Rabbit:Wc,Shrimp:$c,Snail:el,Squirrel:rl,Turtle:cl};Object.freeze(Object.keys(iO));function aO(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(iO,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var oO={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function sO(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=aO(n),o=a.kind===`animal`?iO[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Tr(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Xn(n.color),t[2]=n.color,t[3]=l);let u=l,d=i>1?`${n.name} · ${i} tabs`:n.name,f=i>1?`${n.name}, ${i} concurrent tabs`:n.name,p;t[4]===n.color?p=t[5]:(p={backgroundColor:n.color},t[4]=n.color,t[5]=p);let m;t[6]!==o||t[7]!==u||t[8]!==c?(m=o?(0,Z.jsx)(o,{size:18,color:u,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:u},children:c}),t[6]=o,t[7]=u,t[8]=c,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==r||t[12]!==p||t[13]!==m?(h=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":f,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:p,children:m})}),t[10]=f,t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===d?g=t[16]:(g=(0,Z.jsx)(vr,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(Yn,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function cO(e){let t=oO[e.icon];return e.displayName||t||`Agent`}function lO(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 uO(e){let t=(0,$.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=cO(o),t[0]=o,t[1]=c);let l=c,u=lO(o.mode),d=!r&&u,f=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,p=d&&!i?`ring-primary/40 animate-pulse`:``,m;t[2]!==f||t[3]!==p?(m=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,f,p].filter(Boolean),t[2]=f,t[3]=p,t[4]=m):m=t[4];let h=m.join(` `),g=r?`true`:void 0,_=i?`true`:void 0,v;t[5]!==o.mode||t[6]!==g||t[7]!==_?(v={"data-presence-badge":`agent`,"data-presence-mode":o.mode,"data-presence-crossdoc":g,"data-presence-scoped":_},t[5]=o.mode,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=o.currentDoc&&o.currentDoc!==`(connected)`?o.currentDoc:null,x=r&&b?`Open activity panel for ${l}, editing ${b}`:`Open activity panel for ${l}`,S;t[9]===o.color?S=t[10]:(S={backgroundColor:o.color},t[9]=o.color,t[10]=S);let C;t[11]!==s||t[12]!==a?(C=()=>a(s),t[11]=s,t[12]=a,t[13]=C):C=t[13];let w;t[14]===o.icon?w=t[15]:(w=(0,Z.jsx)(pa,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=w);let T;t[16]!==x||t[17]!==y||t[18]!==h||t[19]!==w||t[20]!==S||t[21]!==C?(T=(0,Z.jsx)(`button`,{type:`button`,...y,"aria-label":x,className:h,style:S,onClick:C,children:w}),t[16]=x,t[17]=y,t[18]=h,t[19]=w,t[20]=S,t[21]=C,t[22]=T):T=t[22];let E=T,D;t[23]===E?D=t[24]:(D=(0,Z.jsx)(Wn,{asChild:!0,children:E}),t[23]=E,t[24]=D);let O;t[25]===l?O=t[26]:(O=(0,Z.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=O);let k;t[27]!==r||t[28]!==b?(k=r&&b?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,b,`]]`]}):null,t[27]=r,t[28]=b,t[29]=k):k=t[29];let A;t[30]!==O||t[31]!==k?(A=(0,Z.jsxs)(vr,{className:`flex flex-col gap-0.5`,children:[O,k]}),t[30]=O,t[31]=k,t[32]=A):A=t[32];let j;return t[33]!==D||t[34]!==A?(j=(0,Z.jsxs)(Yn,{children:[D,A]}),t[33]=D,t[34]=A,t[35]=j):j=t[35],j}function dO(e){let t=(0,$.c)(18),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s=i?`true`:void 0,c=`${n} more ${i?`cross-doc `:``}${n===1?`participant`:`participants`}`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":s,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[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;if(t[4]!==i||t[5]!==o||t[6]!==r||t[7]!==a){let e;t[9]!==i||t[10]!==o||t[11]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(sO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uO,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[9]=i,t[10]=o,t[11]=a,t[12]=e):e=t[12],u=r.map(e),t[4]=i,t[5]=o,t[6]=r,t[7]=a,t[8]=u}else u=t[8];let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(Be,{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:u})}),t[13]=u,t[14]=d);let f;return t[15]!==l||t[16]!==d?(f=(0,Z.jsxs)(Ft,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function fO(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(sO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uO,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function pO(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=QD(t,r,n);if(tO(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,nO),n;e[6]===s?n=e[7]:(n=s.slice(nO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,rO),d;e[8]===c?d=e[9]:(d=c.slice(rO),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>fO(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)(dO,{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=>fO(e,p,!0,m)),f.length>0?(0,Z.jsx)(dO,{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 mO=`.md`,hO=/\.(md|mdx)$/i;function gO(e,t=mO){return`${e}${t}`}function _O(e){return FO(e).replace(hO,``)}function vO(e){return Or(e)?xO(e.path):Jn(e)?e.path:gO(e.docName,e.docExt)}function yO(e){let t=FO(e).match(hO);return t?`.${t[1].toLowerCase()}`:void 0}function bO(e){return FO(e)}function xO(e){let t=FO(e.trim());return t?`${t}/`:``}function SO(e){return e.endsWith(`/`)?bO(e):_O(e)}function CO(e){return e.map(vO)}function wO(e){return[...e].sort().join(`\0`)}function TO(e){return wO(CO(e))}function EO(e){let t=new Set;for(let n of e){if(Or(n)){let e=xO(n.path);e&&t.add(e)}let e=(Or(n)||Jn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Or(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function DO(e){if(!e)return[];let t=FO(e.replace(hO,``)).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 OO(e){let t=e.kind===`directory`,n=t?bO(e.path):_O(e.path),r=t?void 0:yO(e.path);return{kind:t?`folder`:`file`,name:FO(PO(e.path)).replace(hO,``),path:n,treePath:AO(e.path,t),docExt:r}}function kO(e){return e.kind===`directory`?bO(e.path):e.path}function AO(e,t){return t?xO(e):hO.test(e)?e:`${e}${mO}`}function jO(e,t,n){let r=xO(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}${mO}`;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 MO(e,t){return e===`file`?AO(t,!1):`${bO(t)}/index${mO}`}function NO(e,t){return t.kind===`root`||t.directoryPath==null?PO(e):`${t.directoryPath}${PO(e)}`}function PO(e){let t=FO(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function IO(e,t){return t.trim()}function LO(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function RO(e,t){let n=IO(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function zO(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>Mi(e)?{...e,docName:r.get(e.docName)??e.docName}:Or(e)||Jn(e)?{...e,path:GO(e.path,n)}:e)}function BO(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Mi(e)?!r.has(e.docName)&&!YO(e.docName,n):Or(e)||Jn(e)?!YO(e.path,n):!0)}function VO(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>KO(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Mi(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=>Or(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(Mi(i)){let e=JO(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Or(i)){let e=qO(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function HO(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function UO(e,t){return e.flatMap(e=>t===e.toDocName?[e.fromDocName]:[e.fromDocName,e.toDocName])}function WO(e,t){let n=e.kind===`folder`||e.docExt===void 0?e.path:gO(e.path,e.docExt);return wh(t.contentDir,n,t.pathSeparator)}function GO(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 KO(e,t){return Mi(e)&&Mi(t)?e.docName===t.docName:Or(e)&&Or(t)||Jn(e)&&Jn(t)?e.path===t.path:!1}function qO(e,t,n){return e===t?n:JO(e,t,n)}function JO(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function YO(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function XO(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)(mu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function ZO(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(hu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QO(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)(Su,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function $O(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(gu,{children:(0,Z.jsx)(_u,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ek(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Gi(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(vu,{"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 tk(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Gi(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Wo,{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)(Cu,{"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 nk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rk(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=Gi(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(bu,{children:(0,Z.jsx)(Jt,{})})}),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)(yu,{"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 ik(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`-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)(xu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ak=[`.md`,`.mdx`],ok=`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`,sk=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,ck=Gi(sk,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),lk=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,uk=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:opacity-100`;function dk(e){return Gi(uk,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function fk(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function pk(e){let t=qr(e);window.location.hash!==t&&(window.location.hash=t)}function mk(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function hk(e,t){let n=[t,...ak].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 gk(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Pa(s),m;t[9]===d?m=t[10]:(m=ba.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function _k(e){let t=(0,$.c)(48),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=Ot(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=Ot(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y=l.length?`Close all unpinned`:`Close all`,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(ZO,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==u?(x=()=>r(u),t[15]=r,t[16]=u,t[17]=x):x=t[17];let S;t[18]!==m||t[19]!==x?(S=(0,Z.jsx)(ek,{disabled:m,onSelect:x,children:`Close`}),t[18]=m,t[19]=x,t[20]=S):S=t[20];let C=g.length===0,w;t[21]!==i||t[22]!==g?(w=()=>{i(g)},t[21]=i,t[22]=g,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==C?(T=(0,Z.jsx)(ek,{disabled:C,onSelect:w,children:`Close others`}),t[24]=w,t[25]=C,t[26]=T):T=t[26];let E=v.length===0,D;t[27]!==v||t[28]!==i?(D=()=>{i(v)},t[27]=v,t[28]=i,t[29]=D):D=t[29];let O;t[30]!==y||t[31]!==E||t[32]!==D?(O=(0,Z.jsx)(ek,{disabled:E,onSelect:D,children:y}),t[30]=y,t[31]=E,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==m||t[36]!==c||t[37]!==u||t[38]!==d?(k=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ik,{}),(0,Z.jsx)(ek,{onSelect:()=>m?d(u):c(u),children:m?`Unpin tab`:`Pin tab`})]}),t[34]=f,t[35]=m,t[36]=c,t[37]=u,t[38]=d,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==O||t[42]!==k||t[43]!==S?(A=(0,Z.jsxs)($O,{className:`min-w-40`,children:[S,T,O,k]}),t[40]=T,t[41]=O,t[42]=k,t[43]=S,t[44]=A):A=t[44];let j;return t[45]!==A||t[46]!==b?(j=(0,Z.jsxs)(XO,{children:[b,A]}),t[45]=A,t[46]=b,t[47]=j):j=t[47],j}function vk(e){let t=(0,$.c)(14),{accessibleLabel:n,closeTab:r,isPinned:i,tabId:a,unpinTab:o}=e;if(i){let e=`Unpin ${n}`,r;t[0]!==a||t[1]!==o?(r=e=>{e.stopPropagation(),o(a)},t[0]=a,t[1]=o,t[2]=r):r=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Uc,{"aria-hidden":`true`}),t[3]=i):i=t[3];let s;return t[4]!==e||t[5]!==r?(s=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[4]=e,t[5]=r,t[6]=s):s=t[6],s}let s=`Close ${n}`,c;t[7]!==r||t[8]!==a?(c=e=>{e.stopPropagation(),r(a)},t[7]=r,t[8]=a,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Xt,{"aria-hidden":`true`}),t[10]=l):l=t[10];let u;return t[11]!==s||t[12]!==c?(u=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":s,className:`mr-1.5`,onClick:c,children:l}),t[11]=s,t[12]=c,t[13]=u):u=t[13],u}function yk(){let e=(0,$.c)(66),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,isNewTabActive:p,newTabIds:m,openNewTab:h,openTabs:g,pinTab:_,pinnedTabIds:v,remapTabsForRename:y,reorderTabs:b,unpinTab:x,visibleTabIds:S}=ft(),{pageMeta:C}=Zr(),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(t),B;e[0]!==n||e[1]!==t||e[2]!==i?(B=n??(i?Ke(i):t?_t(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=B):B=e[3];let V=B,H;e[4]!==r||e[5]!==V||e[6]!==p||e[7]!==m||e[8]!==g?(H=p?`${r??`__new-tab__`}\u0000${g.join(`\0`)}\u0000${m.join(`\0`)}`:V?`${V}\u0000${g.join(`\0`)}`:``,e[4]=r,e[5]=V,e[6]=p,e[7]=m,e[8]=g,e[9]=H):H=e[9];let U=H,W,G;e[10]===t?(W=e[11],G=e[12]):(W=()=>{z.current=t},G=[t],e[10]=t,e[11]=W,e[12]=G),(0,Q.useEffect)(W,G);let ee,te;e[13]===U?(ee=e[14],te=e[15]):(ee=()=>{U&&(T.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},te=[U],e[13]=U,e[14]=ee,e[15]=te),(0,Q.useEffect)(ee,te);let ne,re;e[16]===E?(ne=e[17],re=e[18]):(ne=()=>{E&&(F.current?.focus(),F.current?.select())},re=[E],e[16]=E,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==g||e[20]!==E?(ie=()=>{!E||g.includes(E.tabId)||(L.current=!0,R.current=null,D(null),k(``),j(null),P(!1))},ae=[g,E],e[19]=g,e[20]=E,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(`/`);L.current=!1,R.current=null,D({docName:t,tabId:e}),k(n[n.length-1]),j(null)},se=function(){L.current=!0,R.current=null,D(null),k(``),j(null),P(!1)},ce=async function(){if(L.current){L.current=!1;return}if(I.current)return;let e=E?.docName;if(!e){se();return}let t=IO(`file`,hk(O,C.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===R.current){F.current?.focus();return}if(!LO(t)){j(`Name can’t be empty, ".", "..", or contain / or \\`),F.current?.focus();return}let i=RO({kind:`file`,path:e,name:r},t);I.current=!0,P(!0),j(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(L.current){P(!1),I.current=!1;return}let r=await w(n,`Server error (HTTP ${n.status})`);if(!r.ok){j(r.title),P(!1),I.current=!1,R.current=t,F.current?.focus();return}let a=M(Mr,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=z.current,c=HO(o,a);bt(a);let l=!0;try{let e=UO(a,f());await Promise.all(e.map(e=>s(e))),y(a),ci([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Y.error(`Rename succeeded but the tabstrip may be out of date — refresh to resync`)}L.current=!0,D(null),k(``),j(null),P(!1),I.current=!1,R.current=null,l&&c&&c!==o&&pk(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),j(`Network error — please try again`),P(!1),I.current=!1,R.current=t,F.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===m?ue=e[24]:(ue=new Set(m),e[23]=m,e[24]=ue);let de=ue,K;e[25]!==l||e[26]!==d||e[27]!==de?(K=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[25]=l,e[26]=d,e[27]=de,e[28]=K):K=e[28];let fe=K,pe;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:8}},e[29]=pe):pe=e[29];let me;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:mo},e[30]=me):me=e[30];let he=Vo(Va(Aa,pe),Va(Da,me)),ge;e[31]!==b||e[32]!==S?(ge=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=S.indexOf(t),i=S.indexOf(n);r<0||i<0||r===i||b(go([...S],r,i),t)},e[31]=b,e[32]=S,e[33]=ge):ge=e[33];let _e=ge,ve=le?``:void 0,ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye=Gi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[34]=ye):ye=e[34];let be=mk,xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=Gi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[35]=xe):xe=e[35];let Se=za,Ce=Na,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we={container:typeof document<`u`?document.body:void 0},e[36]=we):we=e[36];let Te=La,Ee;e[37]===S?Ee=e[38]:(Ee=[...S],e[37]=S,e[38]=Ee);let De=va,Oe=S.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(_k,{tabId:e,canPin:!1,openTabs:S,closeTab:l,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsxs)(gk,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Gi(ok,t?sk:ck),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Activate new tab`,className:lk,onClick:()=>o(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:`New tab`})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close new tab`,className:dk(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Xt,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ct(e),n=e===V,i=v.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=Xe(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(_k,{tabId:e,openTabs:S,closeTab:u,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsxs)(gk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(ok,n?sk:ck),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:lk,onClick:()=>{a(e)},children:[s&&(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Gi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(vk,{accessibleLabel:c,closeTab:u,isPinned:i,tabId:e,unpinTab:x})]})},e)}if(t.kind===`asset`){let{baseName:r,label:o,prefix:s}=Xe(t.assetPath,``),c=`${s}${o}`;return(0,Z.jsx)(_k,{tabId:e,openTabs:S,closeTab:u,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsxs)(gk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(ok,n?sk:ck),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:lk,onClick:()=>{a(e)},children:[s?(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Gi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(vk,{accessibleLabel:c,closeTab:u,isPinned:i,tabId:e,unpinTab:x})]})},e)}let s=t.docName,c=C.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Xe(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,y=E?.tabId===e,b=`editor-tab-rename-error-${fk(s)}`;return(0,Z.jsx)(_k,{disabled:y,tabId:e,openTabs:S,closeTab:u,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsx)(gk,{tabId:e,disabled:y,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(ok,n?sk:ck,y&&A&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(QC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(rw,{ref:F,value:O,disabled:N,"aria-label":`Rename ${p}`,"aria-invalid":A?!0:void 0,"aria-describedby":A?b:void 0,"aria-busy":N||void 0,title:A??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{k(hk(e.target.value,c)),j(null),R.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ew,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(nw,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),A?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:A}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":h,title:h,className:lk,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,s)},children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})}),(0,Z.jsx)(vk,{accessibleLabel:h,closeTab:u,isPinned:i,tabId:e,unpinTab:x})]})})},e)}),ke;e[39]!==Te||e[40]!==Ee||e[41]!==De||e[42]!==Oe?(ke=(0,Z.jsx)(Te,{items:Ee,strategy:De,children:Oe}),e[39]=Te,e[40]=Ee,e[41]=De,e[42]=Oe,e[43]=ke):ke=e[43];let Ae;e[44]!==Se||e[45]!==_e||e[46]!==he||e[47]!==Ce||e[48]!==we||e[49]!==ke?(Ae=(0,Z.jsx)(Se,{sensors:he,collisionDetection:Ce,onDragEnd:_e,accessibility:we,children:ke}),e[44]=Se,e[45]=_e,e[46]=he,e[47]=Ce,e[48]=we,e[49]=ke,e[50]=Ae):Ae=e[50];let je;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(c,{"aria-hidden":`true`}),e[51]=je):je=e[51];let Me;e[52]===h?Me=e[53]:(Me=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`New tab`,className:`first:mb-3 mb-1.5`,onClick:h,children:je})}),e[52]=h,e[53]=Me);let Ne;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(vr,{children:`New tab`}),e[54]=Ne):Ne=e[54];let Pe;e[55]===Me?Pe=e[56]:(Pe=(0,Z.jsxs)(Yn,{children:[Me,Ne]}),e[55]=Me,e[56]=Pe);let Fe;e[57]!==xe||e[58]!==Ae||e[59]!==Pe?(Fe=(0,Z.jsxs)(`div`,{className:xe,children:[Ae,Pe]}),e[57]=xe,e[58]=Ae,e[59]=Pe,e[60]=Fe):Fe=e[60];let Ie;return e[61]!==ve||e[62]!==ye||e[63]!==be||e[64]!==Fe?(Ie=(0,Z.jsx)(`div`,{ref:T,"data-electron-drag":ve,className:ye,onWheel:be,children:Fe}),e[61]=ve,e[62]=ye,e[63]=be,e[64]=Fe,e[65]=Ie):Ie=e[65],Ie}function bk(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 xk(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 Sk=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:tt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Hd},{label:`Website`,href:`https://openknowledge.ai/`,icon:ni},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:bk},{label:`Twitter`,href:`https://x.com/inkeep`,icon:xk}],Ck=()=>{let e=(0,$.c)(5),[t,n]=(0,Q.useState)(!1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(s,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Resources`})]})})}),(0,Z.jsx)(vr,{children:`Resources`})]}),e[0]=r):r=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Resources`}),e[1]=i):i=e[1];let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(Be,{align:`end`,className:`w-64 p-3`,children:[i,(0,Z.jsx)(`nav`,{"aria-label":`Resources`,children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:Sk.map(wk)})})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Z.jsxs)(Ft,{open:t,onOpenChange:n,children:[r,a]}),e[3]=t,e[4]=o),o};function wk(e){let{label:t,href:n,icon:r}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ra(e,n),onAuxClick:e=>Ra(e,n),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)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t]})},n)}function Tk(e){let t=(0,$.c)(60),{input:n}=e,{states:r,refresh:i}=Xh(),{dispatch:a}=zh(),[o,s]=(0,Q.useState)(!1),c=typeof window<`u`&&window.okDesktop!=null,l;t[0]===i?l=t[1]:(l=e=>{s(e),e&&i()},t[0]=i,t[1]=l);let u=l,d=n===null,f;t[2]===n?f=t[3]:(f=n!==null&&n.docContext!==null?Yr(n.docContext.relativePath):``,t[2]=n,t[3]=f);let p=f,m;t[4]!==a||t[5]!==n?(m=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=m):m=t[6];let h=m,g,_,v,y,b,x,S,C,w,T,E,D;if(t[7]!==u||t[8]!==h||t[9]!==n||t[10]!==o||t[11]!==p||t[12]!==r||t[13]!==d){let e;t[26]===r?e=t[27]:(e=e=>r[e.id]?.installed===!0,t[26]=r,t[27]=e);let i=Um.filter(e);v=r[`claude-code`]?.installed===!0;let a;t[28]!==n||t[29]!==p?(a=()=>{n!==null&&hS(p)},t[28]=n,t[29]=p,t[30]=a):a=t[30],y=a,_=qa,D=o,b=u;let s;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(fa,{className:`size-4`}),t[31]=s):s=t[31];let l;t[32]===d?l=t[33]:(l=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(Ya,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open with AI`,disabled:d,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:s})})}),t[32]=d,t[33]=l);let f;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vr,{children:`Open with AI`}),t[34]=f):f=t[34],t[35]===l?x=t[36]:(x=(0,Z.jsxs)(Yn,{children:[l,f]}),t[35]=l,t[36]=x),g=Ka,S=`end`,C=`min-w-[220px]`,w=`open-in-agent-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Oa,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open with AI`}),t[37]=T):T=t[37];let m;t[38]!==h||t[39]!==p||t[40]!==r?(m=e=>{let t=r[e.id];return(0,Z.jsx)(gS,{target:e,installState:t,isElectronHost:c,prompt:p,onSelect:()=>h(e)},e.id)},t[38]=h,t[39]=p,t[40]=r,t[41]=m):m=t[41],E=i.map(m),t[7]=u,t[8]=h,t[9]=n,t[10]=o,t[11]=p,t[12]=r,t[13]=d,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D}else g=t[14],_=t[15],v=t[16],y=t[17],b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25];let O;t[42]!==v||t[43]!==y||t[44]!==n?(O=v?null:(0,Z.jsxs)(Ja,{onSelect:y,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(je,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}),t[42]=v,t[43]=y,t[44]=n,t[45]=O):O=t[45];let k;t[46]!==g||t[47]!==O||t[48]!==S||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==E?(k=(0,Z.jsxs)(g,{align:S,className:C,"data-testid":w,children:[T,E,O]}),t[46]=g,t[47]=O,t[48]=S,t[49]=C,t[50]=w,t[51]=T,t[52]=E,t[53]=k):k=t[53];let A;return t[54]!==_||t[55]!==b||t[56]!==x||t[57]!==k||t[58]!==D?(A=(0,Z.jsxs)(_,{open:D,onOpenChange:b,children:[x,k]}),t[54]=_,t[55]=b,t[56]=x,t[57]=k,t[58]=D,t[59]=A):A=t[59],A}var Ek=`/api/share/publish/owners`,Dk=`/api/share/publish/name-check`,Ok=`/api/share/publish`,kk=/[A-Za-z0-9._-]/g;function Ak(e){return(e.match(kk)?.join(``)??``).replace(/[-.]{2,}/g,e=>e[0]??`-`).replace(/^[-.]+/,``).replace(/[-.]+$/,``)}function jk(e){if(!e)return``;let t=e.replace(/[/\\]+$/g,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}function Mk(e){return`https://github.com/orgs/${encodeURIComponent(e)}/policies/applications`}function Nk(e,t,n){switch(e){case`name-conflict`:return{banner:`${t}/${n} already exists. Pick a different name.`,next:{kind:`edit-name`}};case`saml-sso`:return{banner:`GitHub denied the request. You may need to authorize Open Knowledge for ${t} in your browser.`,next:{kind:`authorize-org`,authorizeUrl:Mk(t)}};case`push-failed`:return{banner:`Created ${t}/${n}, push failed.`,next:{kind:`retry-push`}};case`auth-required`:return{banner:`GitHub sign-in expired. Sign in again to continue.`,next:{kind:`reauth`}};case`init-failed`:return{banner:`Couldn't prepare this project for publish.`,next:{kind:`edit-form`}};case`network`:return{banner:`Couldn't reach GitHub. Try again?`,next:{kind:`edit-form`}};case`no-project`:return{banner:`Open a project first.`,next:{kind:`edit-form`}}}}async function Pk(e=fetch){let t=await e(Ek,{method:`GET`});if(!t.ok)throw Error(`owners transport ${t.status}`);let n=await t.json(),r=Rr.safeParse(n);if(!r.success)throw Error(`owners response shape mismatch`);return r.data}async function Fk(e,t,n=fetch){let r=await n(`${Dk}?owner=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{method:`GET`});if(!r.ok)throw Error(`name-check transport ${r.status}`);let i=await r.json(),a=Hr.safeParse(i);if(!a.success)throw Error(`name-check response shape mismatch`);return a.data}async function Ik(e,t=fetch){let n=await t(Ok,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`publish transport ${n.status}`);let r=await n.json(),i=Wr.safeParse(r);if(!i.success)throw Error(`publish response shape mismatch`);return i.data}function Lk(e,t,n){return e.ok?e.available?{kind:`available`}:{kind:`taken`,owner:t,name:n}:e.error===`auth-required`?{kind:`error`,banner:`GitHub sign-in expired. Sign in again to continue.`}:{kind:`error`,banner:`Couldn't reach GitHub. Try again?`}}function Rk(e){return e.submitting||e.owner===null||e.sanitizedName.length===0?!1:e.nameCheck.kind===`available`}async function zk(e,t){await t.runShareAction({docName:e,hasRemote:!0,onClickWhenNoRemote:()=>{}},{clipboardWrite:t.clipboardWrite,toastSuccess:t.toastSuccess,toastError:t.toastError,logEvent:t.logEvent,fetchFn:t.fetchFn})}var Bk=`/api/share/construct-url`,Vk=`Could not construct share URL.`,Hk=`Link ready but could not copy to clipboard.`;async function Uk(e,t=fetch){let n=await t(Bk,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docPath:e})});if(!n.ok)throw Error(`construct-url transport ${n.status}`);let r=await n.json(),i=dr.safeParse(r);if(!i.success)throw Error(`construct-url response shape mismatch`);return i.data}function Wk(e,t){switch(e){case`detached-head`:return`Switch to a branch to share.`;case`branch-not-on-origin`:return t?`Push ${t} to GitHub before sharing.`:`Push this branch to GitHub before sharing.`;case`non-github-remote`:return`Sharing supports GitHub remotes only.`;case`invalid-path`:return`Can't share this path.`;case`no-remote`:return`This project has no GitHub remote.`}}async function Gk(e,t){if(!e.hasRemote)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let n=bi(e.docName),r;try{r=await Uk(n,t.fetchFn)}catch{return t.toastError(Vk),{kind:`transport-error`}}if(r.ok){try{await t.clipboardWrite(r.shareUrl)}catch{return t.toastError(Hk),t.logEvent(`[share] action=link-construct result=clipboard-failed`),{kind:`clipboard-failed`,shareUrl:r.shareUrl}}return t.toastSuccess(`Link copied.`),t.logEvent(`[share] action=link-construct`),{kind:`copied`,shareUrl:r.shareUrl,branch:r.branch}}if(r.error===`no-remote`)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let i=r.branch;return t.toastError(Wk(r.error,i)),{kind:`business-error`,error:r.error,branch:i}}var Kk=500;function qk(e){let t=(0,$.c)(105),{open:n,onOpenChange:r}=e,{_:i}=Yt(),a=Zm(),{activeDocName:o}=ft(),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(`private`),[y,b]=(0,Q.useState)(``),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={kind:`idle`},t[0]=x):x=t[0];let[S,C]=(0,Q.useState)(x),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),j=(0,Q.useRef)(null),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P;t[1]===h?P=t[2]:(P=Ak(h),t[1]=h,t[2]=P);let F=P,I=s?.find(e=>e.login===p)??null,L;t[3]!==i||t[4]!==p?(L=async function(){u(!0),f(null);try{let e=await Pk();if(!e.ok){e.error===`auth-required`?(k(!0),f(i({id:`HP5ML3`}))):f(i({id:`UVLlMV`})),u(!1);return}c(e.owners),e.owners.length>0&&p===``&&m(e.owners[0]?.login??``)}catch{f(i({id:`UVLlMV`}))}u(!1)},t[3]=i,t[4]=p,t[5]=L):L=t[5];let R=L,B;t[6]!==R||t[7]!==n||t[8]!==s||t[9]!==p||t[10]!==a?.contentDir?(B=()=>{n&&(C({kind:`idle`}),D(null),T(!1),f(null),g(Ak(jk(a?.contentDir??``))),v(`private`),b(``),s===null?R():p===``&&s.length>0&&m(s[0]?.login??``))},t[6]=R,t[7]=n,t[8]=s,t[9]=p,t[10]=a?.contentDir,t[11]=B):B=t[11];let V;t[12]===n?V=t[13]:(V=[n],t[12]=n,t[13]=V),(0,Q.useEffect)(B,V);let H,U;t[14]!==i||t[15]!==n||t[16]!==F||t[17]!==p?(H=()=>{if(n){if(j.current!==null&&clearTimeout(j.current),p===``||F===``){C({kind:`idle`});return}return C({kind:`pending`}),j.current=setTimeout(async()=>{let e=p,t=F;M.current=`${e}|${t}`,C({kind:`checking`});try{let n=await Fk(e,t);if(M.current!==`${e}|${t}`)return;C(Lk(n,e,t))}catch{if(M.current!==`${e}|${t}`)return;C({kind:`error`,banner:i({id:`UVLlMV`})})}},Kk),()=>{j.current!==null&&(clearTimeout(j.current),j.current=null)}}},U=[n,p,F,i],t[14]=i,t[15]=n,t[16]=F,t[17]=p,t[18]=H,t[19]=U):(H=t[18],U=t[19]),(0,Q.useEffect)(H,U);let W;t[20]===R?W=t[21]:(W=function(){k(!1),f(null),R()},t[20]=R,t[21]=W);let te=W,ne=async function(){if(Rk({owner:I,sanitizedName:F,nameCheck:S,submitting:w})){T(!0),D(null);try{let e=await Ik({owner:p,name:F,visibility:_,description:y.trim().length>0?y.trim():void 0});if(e.ok){if(r(!1),o)await zk(o,{runShareAction:Gk,clipboardWrite:Qk,toastSuccess:Zk,toastError:Xk,logEvent:Yk});else{let t=e.ownerLogin,n=e.repoName;Y.success(i({id:`rEnIww`,values:{ownerLogin:t,repoName:n}}))}T(!1);return}let t=Nk(e.error,p,F);D({message:t.banner,next:t.next}),t.next.kind===`edit-name`?(N.current?.focus(),N.current?.select()):t.next.kind===`reauth`&&k(!0)}catch{D({message:i({id:`UVLlMV`}),next:{kind:`edit-form`}})}T(!1)}},re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e){let t=window.okDesktop?.shell?.openExternal;t?t(e):window.open(e,`_blank`,`noopener`)},t[22]=re):re=t[22];let ae=re,oe;t[23]===r?oe=t[24]:(oe=function(){r(!1)},t[23]=r,t[24]=oe);let se=oe,ce=!Rk({owner:I,sanitizedName:F,nameCheck:S,submitting:w}),le;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`qXsafh`})}),t[25]=le):le=t[25];let ue;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsxs)(un,{children:[le,(0,Z.jsx)(Zt,{children:(0,Z.jsx)(J,{id:`Z1LF1M`})})]}),t[26]=ue):ue=t[26];let de;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(ns,{htmlFor:`publish-owner`,children:(0,Z.jsx)(J,{id:`LtI9AS`})}),t[27]=de):de=t[27];let K;t[28]!==i||t[29]!==R||t[30]!==s||t[31]!==d||t[32]!==l||t[33]!==p?(K=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[de,l&&s===null?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(J,{id:`Z3FXyt`})]}):d?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-destructive`,children:d}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(),children:(0,Z.jsx)(J,{id:`6gRgw8`})})]}):(0,Z.jsxs)(G,{value:p,onValueChange:m,children:[(0,Z.jsx)(A,{id:`publish-owner`,"data-testid":`publish-owner-trigger`,"aria-label":i({id:`LtI9AS`}),children:(0,Z.jsx)(z,{placeholder:i({id:`8XQ7Ib`})})}),(0,Z.jsx)(ie,{children:(s??[]).map(Jk)})]})]}),t[28]=i,t[29]=R,t[30]=s,t[31]=d,t[32]=l,t[33]=p,t[34]=K):K=t[34];let fe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(ns,{htmlFor:`publish-name`,children:(0,Z.jsx)(J,{id:`0xnmlQ`})}),t[35]=fe):fe=t[35];let pe,me;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>g(e.target.value),me=()=>{M.current=null},t[36]=pe,t[37]=me):(pe=t[36],me=t[37]);let he;t[38]===h?he=t[39]:(he=(0,Z.jsx)(Go,{id:`publish-name`,ref:N,"data-testid":`publish-name`,value:h,onChange:pe,onBlur:me,placeholder:`my-knowledge-base`,autoComplete:`off`,spellCheck:!1}),t[38]=h,t[39]=he);let ge;t[40]===F?ge=t[41]:(ge=(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:F?(0,Z.jsx)(J,{id:`Nn4GgW`,values:{sanitizedName:F},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`Oxyd5f`})}),t[40]=F,t[41]=ge);let _e;t[42]===S?_e=t[43]:(_e=(0,Z.jsx)(eA,{status:S}),t[42]=S,t[43]=_e);let ve;t[44]!==ge||t[45]!==_e?(ve=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs`,"aria-live":`polite`,children:[ge,_e]}),t[44]=ge,t[45]=_e,t[46]=ve):ve=t[46];let ye;t[47]!==he||t[48]!==ve?(ye=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[fe,he,ve]}),t[47]=he,t[48]=ve,t[49]=ye):ye=t[49];let be;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(ns,{children:(0,Z.jsx)(J,{id:`2q_Q7x`})}),t[50]=be):be=t[50];let xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>v(e===`public`?`public`:`private`),t[51]=xe):xe=t[51];let Se;t[52]===i?Se=t[53]:(Se=i({id:`2q_Q7x`}),t[52]=i,t[53]=Se);let Ce,we;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Fm,{value:`private`,id:`publish-visibility-private`,"data-testid":`publish-visibility-private`}),we=(0,Z.jsx)(J,{id:`zwBp5t`}),t[54]=Ce,t[55]=we):(Ce=t[54],we=t[55]);let Te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsxs)(ns,{htmlFor:`publish-visibility-private`,className:`flex cursor-pointer items-center gap-2 rounded-md border border-input p-2 text-sm font-normal has-data-checked:border-primary`,children:[Ce,(0,Z.jsxs)(`span`,{children:[we,(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`D8OV7J`})})]})]}),t[56]=Te):Te=t[56];let Ee,De;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Fm,{value:`public`,id:`publish-visibility-public`,"data-testid":`publish-visibility-public`}),De=(0,Z.jsx)(J,{id:`7d1a0d`}),t[57]=Ee,t[58]=De):(Ee=t[57],De=t[58]);let Oe;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsxs)(ns,{htmlFor:`publish-visibility-public`,className:`flex cursor-pointer items-center gap-2 rounded-md border border-input p-2 text-sm font-normal has-data-checked:border-primary`,children:[Ee,(0,Z.jsxs)(`span`,{children:[De,(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4jDd0j`})})]})]}),t[59]=Oe):Oe=t[59];let ke;t[60]!==Se||t[61]!==_?(ke=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[be,(0,Z.jsxs)(Pm,{value:_,onValueChange:xe,className:`grid-cols-2`,"aria-label":Se,children:[Te,Oe]})]}),t[60]=Se,t[61]=_,t[62]=ke):ke=t[62];let Ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(ns,{htmlFor:`publish-description`,children:(0,Z.jsx)(J,{id:`Fxf4jq`})}),t[63]=Ae):Ae=t[63];let je;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>b(e.target.value),t[64]=je):je=t[64];let Me;t[65]===i?Me=t[66]:(Me=i({id:`c5rF4v`}),t[65]=i,t[66]=Me);let Ne;t[67]!==y||t[68]!==Me?(Ne=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[Ae,(0,Z.jsx)(Ps,{id:`publish-description`,"data-testid":`publish-description`,rows:2,value:y,onChange:je,placeholder:Me})]}),t[67]=y,t[68]=Me,t[69]=Ne):Ne=t[69];let Pe;t[70]!==E||t[71]!==ae||t[72]!==ne?(Pe=E&&(0,Z.jsx)($k,{banner:E,onAuthorize:ae,onRetryPush:ne}),t[70]=E,t[71]=ae,t[72]=ne,t[73]=Pe):Pe=t[73];let Fe;t[74]!==K||t[75]!==ye||t[76]!==ke||t[77]!==Ne||t[78]!==Pe?(Fe=(0,Z.jsxs)(sn,{className:`flex flex-col gap-4`,children:[K,ye,ke,Ne,Pe]}),t[74]=K,t[75]=ye,t[76]=ke,t[77]=Ne,t[78]=Pe,t[79]=Fe):Fe=t[79];let Ie;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(J,{id:`dEgA5A`}),t[80]=Ie):Ie=t[80];let Le;t[81]===se?Le=t[82]:(Le=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,onClick:se,children:Ie}),t[81]=se,t[82]=Le);let Re;t[83]===w?Re=t[84]:(Re=w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(J,{id:`Bdha5y`})]}):(0,Z.jsx)(J,{id:`iMCW9z`}),t[83]=w,t[84]=Re);let ze;t[85]!==ne||t[86]!==ce||t[87]!==Re?(ze=(0,Z.jsx)(X,{type:`button`,onClick:ne,disabled:ce,"data-testid":`publish-submit`,children:Re}),t[85]=ne,t[86]=ce,t[87]=Re,t[88]=ze):ze=t[88];let q;t[89]!==Le||t[90]!==ze?(q=(0,Z.jsxs)(cn,{children:[Le,ze]}),t[89]=Le,t[90]=ze,t[91]=q):q=t[91];let Be;t[92]!==Fe||t[93]!==q?(Be=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,showCloseButton:!1,children:[ue,Fe,q]}),t[92]=Fe,t[93]=q,t[94]=Be):Be=t[94];let Ve;t[95]!==r||t[96]!==n||t[97]!==Be?(Ve=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:Be}),t[95]=r,t[96]=n,t[97]=Be,t[98]=Ve):Ve=t[98];let He;t[99]!==O||t[100]!==te?(He=(0,Z.jsx)(od,{open:O,onOpenChange:k,onSuccess:te}),t[99]=O,t[100]=te,t[101]=He):He=t[101];let Ue;return t[102]!==Ve||t[103]!==He?(Ue=(0,Z.jsxs)(Z.Fragment,{children:[Ve,He]}),t[102]=Ve,t[103]=He,t[104]=Ue):Ue=t[104],Ue}function Jk(e){return(0,Z.jsx)(S,{value:e.login,"data-testid":`publish-owner-option-${e.login}`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.avatarUrl?(0,Z.jsx)(`img`,{src:e.avatarUrl,alt:``,"aria-hidden":!0,className:`size-4 rounded-full`}):null,(0,Z.jsx)(`span`,{children:e.login}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.kind===`user`?(0,Z.jsx)(J,{id:`av_PD9`}):(0,Z.jsx)(J,{id:`_N2eSU`})})]})},e.login)}function Yk(e){return console.log(e)}function Xk(e){return Y.error(e)}function Zk(e){return Y.success(e)}function Qk(e){return navigator.clipboard.writeText(e)}function $k(e){let t=(0,$.c)(13),{banner:n,onAuthorize:r,onRetryPush:i}=e,a=n.next,o;t[0]===n.message?o=t[1]:(o=(0,Z.jsx)(`span`,{children:n.message}),t[0]=n.message,t[1]=o);let s;t[2]!==a.authorizeUrl||t[3]!==a.kind||t[4]!==r?(s=a.kind===`authorize-org`&&(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-authorize-org`,onClick:()=>r(a.authorizeUrl),children:[(0,Z.jsx)(J,{id:`FyW0WO`}),` `,(0,Z.jsx)(je,{className:`ml-1 size-3`,"aria-hidden":!0})]}),t[2]=a.authorizeUrl,t[3]=a.kind,t[4]=r,t[5]=s):s=t[5];let c;t[6]!==a.kind||t[7]!==i?(c=a.kind===`retry-push`&&(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-retry-push`,onClick:i,children:(0,Z.jsx)(J,{id:`NOHyEE`})}),t[6]=a.kind,t[7]=i,t[8]=c):c=t[8];let l;return t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`publish-banner`,className:`flex flex-col gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm`,children:[o,s,c]}),t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12],l}function eA(e){let t=(0,$.c)(12),{status:n}=e;if(n.kind===`available`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xi,{className:`size-3.5`,"aria-hidden":!0}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`available`,className:`flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[e,` `,(0,Z.jsx)(J,{id:`csDS2L`})]}),t[1]=n):n=t[1],n}if(n.kind===`taken`){let{owner:e,name:r}=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),t[2]=i):i=t[2];let a;return t[3]!==r||t[4]!==e?(a=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`taken`,className:`flex items-center gap-1 text-destructive`,children:[i,` `,(0,Z.jsx)(J,{id:`LRgZAt`,values:{owner:e,name:r}})]}),t[3]=r,t[4]=e,t[5]=a):a=t[5],a}if(n.kind===`checking`||n.kind===`pending`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),t[6]=e):e=t[6];let r;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(J,{id:`pWT04I`}),t[7]=r):r=t[7];let i;return t[8]===n.kind?i=t[9]:(i=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":n.kind,className:`flex items-center gap-1 text-muted-foreground`,children:[e,` `,r]}),t[8]=n.kind,t[9]=i),i}if(n.kind===`error`){let e;return t[10]===n.banner?e=t[11]:(e=(0,Z.jsx)(`span`,{"data-testid":`publish-name-check`,"data-status":`error`,className:`text-destructive`,children:n.banner}),t[10]=n.banner,t[11]=e),e}return null}var tA=50,nA=()=>{let e=(0,$.c)(5),t=(0,Q.useRef)(null),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=()=>{t.current===null&&(t.current=setTimeout(()=>{t.current=null,zC.preload()},tA))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsxs)(X,{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:()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Wm)},children:[(0,Z.jsx)(Zc,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Z.jsx)(vr,{children:`Settings`})]}),e[4]=c):c=e[4],c};function rA(e){let t=(0,$.c)(12),{onClickWhenNoRemote:n}=e,{activeDocName:r}=ft(),{status:i}=bo(),[a,o]=(0,Q.useState)(!1);if(!r)return null;let s=i?.hasRemote===!0,c;t[0]!==r||t[1]!==a||t[2]!==s||t[3]!==n?(c=async function(){if(!a&&r){o(!0);try{await Gk({docName:r,hasRemote:s,onClickWhenNoRemote:n},{clipboardWrite:sA,toastSuccess:oA,toastError:aA,logEvent:iA})}catch{Y.error(`Could not construct share URL.`)}o(!1)}},t[0]=r,t[1]=a,t[2]=s,t[3]=n,t[4]=c):c=t[4];let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Qc,{className:`size-3.5`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;t[6]!==a||t[7]!==l?(d=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":`Share doc`,onClick:l,disabled:a,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[u,`Share`]})}),t[6]=a,t[7]=l,t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vr,{children:`Share`}),t[9]=f):f=t[9];let p;return t[10]===d?p=t[11]:(p=(0,Z.jsxs)(Yn,{children:[d,f]}),t[10]=d,t[11]=p),p}function iA(e){return console.log(e)}function aA(e){return Y.error(e)}function oA(e){return Y.success(e)}function sA(e){return navigator.clipboard.writeText(e)}function cA(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}async function lA(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function uA(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sc,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Kc,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sc,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Kc,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ei,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(oc,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Pc,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ei,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sc,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function dA(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function fA(e){switch(e){case`dormant`:return`No git remote`;case`idle`:return`Synced`;case`fetching`:return`Fetching`;case`pulling`:return`Pulling`;case`pushing`:return`Pushing`;case`conflict`:return`Conflict`;case`offline`:return`Offline`;case`auth-error`:return`Sign in required`;case`disabled`:return`Sync disabled`;default:return e}}function pA(e){switch(e){case`external-changes-pending`:return`External changes pending`;case`dirty-tree`:return`Working tree has uncommitted changes`;case`detached-head`:return`Detached HEAD — checkout a branch to resume`;case`auth-error`:return`Sign in required`;case`protected-branch`:return`Protected branch — cannot push`;default:return e}}function mA(e){return e.syncEnabled?e.state===`idle`?e.ahead>0&&e.behind>0?`${e.ahead} ahead, ${e.behind} behind`:e.ahead>0?`${e.ahead} ahead`:e.behind>0?`${e.behind} behind`:`Synced`:e.state===`conflict`&&e.conflictCount>0?`${e.conflictCount} conflict${e.conflictCount===1?``:`s`}`:fA(e.state):`Sync off`}function hA(e){let t=(0,$.c)(76),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,{projectLocalConfig:o,projectLocalSynced:s}=y(),c=o?.autoSync?.enabled??!1,{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=Za(Ba()),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(uA,{status:n}),t[0]=n,t[1]=p);let m;t[2]===n.state?m=t[3]:(m=fA(n.state),t[2]=n.state,t[3]=m);let h;t[4]===m?h=t[5]:(h=(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:m}),t[4]=m,t[5]=h);let g;t[6]!==p||t[7]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[p,h]}),t[6]=p,t[7]=h,t[8]=g):g=t[8];let _=!s,v=c?`Disable sync`:`Enable sync`,b;t[9]!==c||t[10]!==d||t[11]!==_||t[12]!==v?(b=(0,Z.jsx)(H,{checked:c,disabled:_,onCheckedChange:d,"aria-label":v}),t[9]=c,t[10]=d,t[11]=_,t[12]=v,t[13]=b):b=t[13];let x;t[14]!==g||t[15]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[g,b]}),t[14]=g,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==l||t[18]!==f||t[19]!==u?(S=(0,Z.jsx)(vo,{open:l,onOpenChange:u,onConfirm:f}),t[17]=l,t[18]=f,t[19]=u,t[20]=S):S=t[20];let C;t[21]===n.error?C=t[22]:(C=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[21]=n.error,t[22]=C);let w;t[23]===n.pausedReason?w=t[24]:(w=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:pA(n.pausedReason)}),t[23]=n.pausedReason,t[24]=w);let T;t[25]===n.state?T=t[26]:(T=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:`Sync paused — resolve conflicts to resume.`}),t[25]=n.state,t[26]=T);let E;t[27]!==c||t[28]!==n.lastSyncUtc||t[29]!==n.state?(E=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,cA(n.lastSyncUtc)]}),t[27]=c,t[28]=n.lastSyncUtc,t[29]=n.state,t[30]=E):E=t[30];let D;t[31]===n.ahead?D=t[32]:(D=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[31]=n.ahead,t[32]=D);let O;t[33]===n.behind?O=t[34]:(O=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[33]=n.behind,t[34]=O);let k;t[35]===n.conflictCount?k=t[36]:(k=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[35]=n.conflictCount,t[36]=k);let A;t[37]===c?A=t[38]:(A=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[37]=c,t[38]=A);let j;t[39]!==E||t[40]!==D||t[41]!==O||t[42]!==k||t[43]!==A?(j=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[E,D,O,k,A]}),t[39]=E,t[40]=D,t[41]=O,t[42]=k,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==a||t[46]!==n.identityUnresolved?(M=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(dl,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:`Git identity isn't set — commits use a default author. Set yours so teammates see your name.`}),(0,Z.jsx)(X,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:`Set identity`})]})]}),t[45]=a,t[46]=n.identityUnresolved,t[47]=M):M=t[47];let N;t[48]!==c||t[49]!==n.state?(N=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:_A,children:`Sync now`}),t[48]=c,t[49]=n.state,t[50]=N):N=t[50];let P;t[51]!==c||t[52]!==r||t[53]!==n.state?(P=c&&n.state===`auth-error`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[51]=c,t[52]=r,t[53]=n.state,t[54]=P):P=t[54];let F;t[55]!==c||t[56]!==n.state?(F=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:gA,children:`Retry`}),t[55]=c,t[56]=n.state,t[57]=F):F=t[57];let I;t[58]!==c||t[59]!==i||t[60]!==n.state?(I=c&&n.state===`conflict`&&i&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[58]=c,t[59]=i,t[60]=n.state,t[61]=I):I=t[61];let L;t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[N,P,F,I]}),t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L):L=t[66];let R;return t[67]!==C||t[68]!==w||t[69]!==T||t[70]!==j||t[71]!==M||t[72]!==L||t[73]!==x||t[74]!==S?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[x,S,C,w,T,j,M,L]}),t[67]=C,t[68]=w,t[69]=T,t[70]=j,t[71]=M,t[72]=L,t[73]=x,t[74]=S,t[75]=R):R=t[75],R}function gA(){lA(`sync`)}function _A(){lA(`sync`)}function vA(e){let t=(0,$.c)(36),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=n,{status:o,fetchError:s}=bo();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":`Sync status unavailable`,disabled:!0,children:(0,Z.jsx)(oc,{className:`size-3.5`})})}),t[2]=e):e=t[2];let n=s===`network`?`Sync status unavailable — server unreachable.`:`Sync status unavailable — server error.`,r;return t[3]===n?r=t[4]:(r=(0,Z.jsxs)(Yn,{children:[e,(0,Z.jsx)(vr,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason)return null;let c;t[5]===o?c=t[6]:(c=dA(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=fA(o.state),t[7]=o.state,t[8]=d);let f=`Sync status: ${d}${u?` — git identity unset`:``}`,p;t[9]===o?p=t[10]:(p=(0,Z.jsx)(uA,{status:o}),t[9]=o,t[10]=p);let m;t[11]===l?m=t[12]:(m=l&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==l||t[14]!==u?(h=!l&&u&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[13]=l,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground relative`,"aria-label":f,children:[p,m,h]})})}),t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;t[21]===o?_=t[22]:(_=mA(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(vr,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(Yn,{children:[g,v]}),t[25]=v,t[26]=g,t[27]=y):y=t[27];let b;t[28]!==i||t[29]!==a||t[30]!==r||t[31]!==o?(b=(0,Z.jsx)(Be,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(hA,{status:o,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a})}),t[28]=i,t[29]=a,t[30]=r,t[31]=o,t[32]=b):b=t[32];let x;return t[33]!==y||t[34]!==b?(x=(0,Z.jsxs)(Ft,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}function yA(e){let t=(0,$.c)(45),{onSaveVersion:n,saving:r,onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}=e,{activeDocName:s,activeTarget:c}=ft(),{state:l}=MD(),u=Zm(),[d,f]=(0,Q.useState)(!1),p;bb0:{if(c===null){let e;t[0]===u?e=t[1]:(e=Dh({workspace:u}),t[0]=u,t[1]=e),p=e;break bb0}if(c.kind===`folder`){if(!u){p=null;break bb0}let e;t[2]!==c.folderPath||t[3]!==u?(e=Oh({folderRelativePath:c.folderPath,workspace:u}),t[2]=c.folderPath,t[3]=u,t[4]=e):e=t[4],p=e;break bb0}let e;t[5]!==s||t[6]!==u?(e=Eh({docName:s,workspace:u}),t[5]=s,t[6]=u,t[7]=e):e=t[7],p=e}let m=p,h=typeof window<`u`&&window.okDesktop!=null,g=h&&l===`collapsed`&&`pl-[78px]`,_;t[8]===g?_=t[9]:(_=Gi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,h&&`[-webkit-app-region:drag]`,g,h&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[8]=g,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(LD,{className:Gi(`-ml-1 shrink-0 text-muted-foreground`,h&&`[-webkit-app-region:no-drag]`)})}),t[10]=v):v=t[10];let y=l===`expanded`?`Hide Files`:`Show Files`,b;t[11]===y?b=t[12]:(b=(0,Z.jsxs)(Yn,{children:[v,(0,Z.jsx)(vr,{children:y})]}),t[11]=y,t[12]=b);let x,S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(io,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),S=(0,Z.jsx)(yk,{}),t[13]=x,t[14]=S):(x=t[13],S=t[14]);let C;t[15]===b?C=t[16]:(C=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[b,x,S]}),t[15]=b,t[16]=C);let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=Gi(`flex shrink-0 items-center justify-end gap-2 px-3`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=w):w=t[17];let T;t[18]!==s||t[19]!==n||t[20]!==r?(T=s&&(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:n,disabled:r,className:`text-muted-foreground`,children:(0,Z.jsx)(Xc,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{children:r?`Saving`:`Checkpoint version`})]}),t[18]=s,t[19]=n,t[20]=r,t[21]=T):T=t[21];let E;t[22]===m?E=t[23]:(E=(0,Z.jsx)(Tk,{input:m}),t[22]=m,t[23]=E);let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(rA,{onClickWhenNoRemote:()=>f(!0)}),t[24]=D):D=t[24];let O;t[25]===d?O=t[26]:(O=(0,Z.jsx)(qk,{open:d,onOpenChange:f}),t[25]=d,t[26]=O);let k;t[27]!==o||t[28]!==a||t[29]!==i?(k=(0,Z.jsx)(vA,{onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}),t[27]=o,t[28]=a,t[29]=i,t[30]=k):k=t[30];let A,j,M,N,P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(pO,{}),j=(0,Z.jsx)(io,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(ud,{}),N=(0,Z.jsx)(nA,{}),P=(0,Z.jsx)(Ck,{}),t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P):(A=t[31],j=t[32],M=t[33],N=t[34],P=t[35]);let F;t[36]!==T||t[37]!==E||t[38]!==O||t[39]!==k?(F=(0,Z.jsxs)(`div`,{className:w,children:[T,E,D,O,k,A,j,M,N,P]}),t[36]=T,t[37]=E,t[38]=O,t[39]=k,t[40]=F):F=t[40];let I;return t[41]!==F||t[42]!==_||t[43]!==C?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":h?``:void 0,className:_,children:[C,F]}),t[41]=F,t[42]=_,t[43]=C,t[44]=I):I=t[44],I}function bA(){let e=(0,$.c)(32),[t,n]=Eg(),[r,i]=(0,Q.useState)(t),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(`auth`),[d,f]=(0,Q.useState)(Zy[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=Ao(),{projectLocalConfig:v,projectLocalSynced:b}=y(),{activeDocName:x}=ft(),S=!h&&_?.hasRemote===!0&&b===!0&&v!==null&&v.autoSync?.enabled===null,C,w;e[0]===x?(C=e[1],w=e[2]):(C=()=>{let e=function(e){let t=e.detail;t&&x&&js(x,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(vg,e),()=>window.removeEventListener(vg,e)},w=[x],e[0]=x,e[1]=C,e[2]=w),(0,Q.useEffect)(C,w);let T;e[3]===n?T=e[4]:(T=function(e){i(e),n(e)},e[3]=n,e[4]=T);let E=T,D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?Y.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),Y.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),Y.error(`Checkpoint failed — try again`)}m(!1)},e[5]=D):D=e[5];let O=D,k;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(kg,{onOpenResolver:()=>o(!0)}),e[6]=k):k=e[6];let A,j,M;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{u(`auth`),c(!0)},j=()=>{u(`identity`),c(!0)},M=()=>o(!0),e[7]=A,e[8]=j,e[9]=M):(A=e[7],j=e[8],M=e[9]);let N;e[10]===p?N=e[11]:(N=(0,Z.jsx)(yA,{onSaveVersion:O,saving:p,onSignIn:A,onSetIdentity:j,onOpenConflictResolver:M}),e[10]=p,e[11]=N);let P;e[12]!==d||e[13]!==r||e[14]!==E?(P=(0,Z.jsx)(sD,{editorMode:r,onModeChange:E,activeTab:d,onActiveTabChange:f}),e[12]=d,e[13]=r,e[14]=E,e[15]=P):P=e[15];let F;e[16]===a?F=e[17]:(F=(0,Z.jsx)(jv,{open:a,onOpenChange:o}),e[16]=a,e[17]=F);let I=l===`identity`,L;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{c(!1)},e[18]=L):L=e[18];let R;e[19]!==s||e[20]!==I?(R=(0,Z.jsx)(od,{open:s,onOpenChange:c,identityPrompt:I,onSuccess:L}),e[19]=s,e[20]=I,e[21]=R):R=e[21];let z;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>g(!0),e[22]=z):z=e[22];let B;e[23]===S?B=e[24]:(B=(0,Z.jsx)(Dg,{open:S,onResolved:z}),e[23]=S,e[24]=B);let V;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(hg,{}),e[25]=V):V=e[25];let H;return e[26]!==F||e[27]!==R||e[28]!==B||e[29]!==N||e[30]!==P?(H=(0,Z.jsxs)(Z.Fragment,{children:[k,N,P,F,R,B,V]}),e[26]=F,e[27]=R,e[28]=B,e[29]=N,e[30]=P,e[31]=H):H=e[31],H}var xA=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
33
+ `)}}}}function Mw(e){try{let t=se().parseToMdast(e),n=[];return jw(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function Nw(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Dw.test(n)&&t++;return t}function Pw(e){let t=globalThis.Intl.Segmenter;if(!t)return Nw(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Fw(e){let t=Ew.test(e)?1.5:4;return Math.ceil(e.length/t)}function Iw(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=ji(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=Mw(t);return n?{words:Ew.test(n)?Pw(n):Nw(n),chars:n.length,tokens:Fw(n)}:{words:0,chars:0,tokens:0}}var Lw=300;function Rw(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(Tw),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(Tw);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(Iw(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,Lw)};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 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=Ni;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=Fe(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)(rr);return e}function Jw({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:_r(e.display_name),color:Ai(e.id,Qn),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Ai(e.id,Qn),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function Yw(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 Xw=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(Gn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Fr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(jr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(cr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ar(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(hr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(or(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=sr(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof ur){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 Ar){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():Yw(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&Vi(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()}},Zw=e=>new Vr({key:typeof e.pluginKey==`string`?new Lr(e.pluginKey):e.pluginKey,view:t=>new Xw({view:t,...e})});Zn.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Zw({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 Qw=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 ir(e,{textSerializers:lr(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Gn(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Fr(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(jr(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(cr(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(ar(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(hr(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Nr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(or(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=sr(this.view,e.from,e.to);Vi({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()}},$w=e=>new Vr({key:typeof e.pluginKey==`string`?new Lr(e.pluginKey):e.pluginKey,view:t=>new Qw({view:t,...e})});Zn.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?[$w({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 eT(e,t){return e??new Lr(t)}var tT=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,nT=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),rT=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(`.`)),iT=new Set([`children`,`className`,`style`]),aT=new Set([`tabIndex`]),oT=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),sT={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function cT(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function lT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function uT(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||oT.has(e)}function dT(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function fT(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:sT[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function pT(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 mT(e){return aT.has(e)}function hT(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function gT(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 _T(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||rT.has(e)?String(t):`${t}px`}function vT(e,t){nT.has(t)||e.style.removeProperty(dT(t))}function yT(e,t,n){nT.has(t)||e.style.setProperty(dT(t),_T(t,n))}function bT(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(iT.has(r)||!uT(r)||cT(r,t[r])||cT(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=lT(r);if(a==null||a===!1){mT(r)&&gT(e,r),e.removeAttribute(o);return}if(a===!0){mT(r)&&hT(e,r,!0),e.setAttribute(o,``);return}if(mT(r)){hT(e,r,a);return}e.setAttribute(o,String(a))})}function xT(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function ST(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){vT(e,t);return}yT(e,t,a)}})}function CT(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(!cT(t,n))return;let{eventName:i,options:a}=fT(t),o=t=>{n(pT(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function wT(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);tT(()=>{let i=n.current;return xT(e,i.className,t.className),ST(e,i.style,t.style),bT(e,i,t),r.current=CT(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 TT=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)(eT(e,`bubbleMenu`)).current;wT(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Ye(),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=Zw({...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,$s.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)(eT(e,`floatingMenu`)).current;wT(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Ye(),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=$w({...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,$s.createPortal)(s,u.current)});var ET=[{name:`paragraph`,label:`Text`,icon:Hc,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:O,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:Se,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:d,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:ae,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:j,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:C,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:at,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:tl,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function DT(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:OT},t[0]=n,t[1]=r);let{current:i,activeStates:a}=yt(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)(pt,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Ya,{asChild:!0,children:(0,Z.jsxs)(X,{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=ET.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(Ja,{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)(Ka,{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)(qa,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function OT(e){let t=Object.fromEntries(ET.map(t=>[t.name,t.isActive(e.editor)]));return{current:ET.find(e=>t[e.name])??ET[0],activeStates:t}}function kT(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 AT(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:qe(typeof n.src==`string`?n.src:``)}function jT(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 MT(e){let t=(0,$.c)(10),{editor:n}=e,r;if(t[0]===n?r=t[1]:(r={editor:n,selector:NT},t[0]=n,t[1]=r),yt(r)===null)return null;let i;t[2]===n?i=t[3]:(i=e=>{e.preventDefault();let t=kT(n);t&&jT(t,AT(n))},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ho,{className:`size-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Download file`,className:`text-accent-foreground`,onMouseDown:i,children:a})}),t[5]=i,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:`Download file`}),t[7]=s):s=t[7];let c;return t[8]===o?c=t[9]:(c=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:(0,Z.jsxs)(Yn,{children:[o,s]})}),t[8]=o,t[9]=c),c}function NT(e){return kT(e.editor)}function PT(e){return kT(e)!==null}var FT=[{value:`left`,label:`Align left`,icon:ge},{value:`center`,label:`Align center`,icon:_},{value:`right`,label:`Align right`,icon:b}];function IT(e){let t=e.state.selection.node;if(!t||t.type.name!==`jsxComponent`)return null;let n=t.attrs.componentName;if(n!==`img`&&n!==`CommonMarkImage`&&n!==`Embed`)return null;let r=(t.attrs.props??{}).align;return r===`left`||r===`right`||r===`center`?r:`center`}function LT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:RT},t[0]=n,t[1]=r);let i=yt(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=FT.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":r,"aria-pressed":o,className:o?`bg-accent text-primary`:`text-accent-foreground`,onMouseDown:e=>{e.preventDefault();let r=n.state.selection,i=r.node;if(!i||i.type.name!==`jsxComponent`)return;let a=String(i.attrs.componentName??``);if(a!==`img`&&a!==`CommonMarkImage`&&a!==`Embed`||i.attrs.kind!==`element`)return;let o=a===`CommonMarkImage`,s=r.from,c={...i.attrs.props??{},align:t},l=o?{...i.attrs,componentName:`img`,props:c,sourceDirty:!0}:{...i.attrs,props:c,sourceDirty:!0},u=n.state.tr.setNodeMarkup(s,null,l);u.setSelection(ur.create(u.doc,s)),Ze(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{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 RT(e){return IT(e.editor)}function zT(e){return IT(e)!==null}var BT=[{name:`bold`,icon:Qs,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘ B`},{name:`italic`,icon:Ec,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘ I`},{name:`underline`,icon:ll,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘ U`},{name:`strikethrough`,icon:al,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘ ⇧ X`},{name:`code`,icon:cc,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘ E`},{name:`highlight`,icon:Tc,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘ ⇧ H`}];function VT(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:HT},t[0]=n,t[1]=r);let i=yt(r),a;t[2]!==i||t[3]!==n?(a=BT.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{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)(vr,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(XS,{children:Ui()?e.shortcut:e.shortcut.replace(`⌘`,`Ctrl`)})]})]},e.name)}),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`flex items-center gap-0.5`,children:a}),t[5]=a,t[6]=o),o}function HT(e){return Object.fromEntries(BT.map(t=>[t.name,t.isActive(e.editor)]))}function UT(e){let t=(0,$.c)(46),{editor:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null),c;t[0]===n?c=t[1]:(c=n.isActive(`link`),t[0]=n,t[1]=c);let l=c,u;t[2]===n?u=t[3]:(u=n.getAttributes(`link`).href??``,t[2]=n,t[3]=u);let d=u,f,p;t[4]===n?(f=t[5],p=t[6]):(f=()=>{let e=function(){n.state.selection.empty&&i(!1)};return n.on(`selectionUpdate`,e),()=>{n.off(`selectionUpdate`,e)}},p=[n],t[4]=n,t[5]=f,t[6]=p),(0,Q.useEffect)(f,p);let m,h;t[7]!==d||t[8]!==r?(m=()=>{r&&(o(d),requestAnimationFrame(()=>s.current?.focus()))},h=[r,d],t[7]=d,t[8]=r,t[9]=m,t[10]=h):(m=t[9],h=t[10]),(0,Q.useEffect)(m,h);let g;t[11]!==n||t[12]!==l||t[13]!==a?(g=function(){a.trim()?n.chain().focus().setLink({href:a.trim()}).run():l&&n.chain().focus().unsetLink().run(),i(!1)},t[11]=n,t[12]=l,t[13]=a,t[14]=g):g=t[14];let _=g,v;t[15]===n?v=t[16]:(v=function(){n.chain().focus().unsetLink().run(),i(!1)},t[15]=n,t[16]=v);let y=v,b;t[17]!==_||t[18]!==n?(b=function(e){e.key===`Enter`&&(e.preventDefault(),_()),e.key===`Escape`&&(e.preventDefault(),i(!1),n.chain().focus().run())},t[17]=_,t[18]=n,t[19]=b):b=t[19];let x=b;if(r){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>o(e.target.value),t[20]=e):e=t[20];let n;t[21]!==x||t[22]!==a?(n=(0,Z.jsx)(`input`,{ref:s,type:`url`,placeholder:`Paste link`,value:a,onChange:e,onKeyDown:x,"aria-label":`Link URL`,className:`h-5 w-44 bg-transparent text-sm border-none outline-none placeholder:text-muted-foreground`}),t[21]=x,t[22]=a,t[23]=n):n=t[23];let r;t[24]===_?r=t[25]:(r=()=>{_()},t[24]=_,t[25]=r);let i;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(fc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[26]=i):i=t[26];let c;t[27]===r?c=t[28]:(c=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Apply link`,onClick:r,children:i}),t[27]=r,t[28]=c);let u;t[29]!==n||t[30]!==c?(u=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2 py-1`,children:[n,c]}),t[29]=n,t[30]=c,t[31]=u):u=t[31];let f;t[32]!==d||t[33]!==l||t[34]!==y?(f=l&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),D(d)},children:(0,Z.jsx)(Ho,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove link`,onMouseDown:e=>{e.preventDefault(),y()},children:(0,Z.jsx)(Rt,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:`Remove link`})]})]}),t[32]=d,t[33]=l,t[34]=y,t[35]=f):f=t[35];let p;return t[36]!==u||t[37]!==f?(p=(0,Z.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[u,f]}),t[36]=u,t[37]=f,t[38]=p):p=t[38],p}let S=l?`bg-accent text-primary`:`text-accent-foreground`,C,w;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{e.preventDefault(),i(!0)},w=(0,Z.jsx)(kc,{className:`size-3.5`}),t[39]=C,t[40]=w):(C=t[39],w=t[40]);let T;t[41]===S?T=t[42]:(T=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Insert link`,className:S,onMouseDown:C,children:w})}),t[41]=S,t[42]=T);let E;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsxs)(vr,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Z.jsx)(XS,{children:Ui()?`⌘ K`:`Ctrl K`})]}),t[43]=E):E=t[43];let O;return t[44]===T?O=t[45]:(O=(0,Z.jsxs)(Yn,{children:[T,E]}),t[44]=T,t[45]=O),O}function WT({editor:e}){if(nt(e.state).query||e.isActive(`codeBlock`))return!1;if(zT(e)||PT(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 GT(e){let t=(0,$.c)(22),{editor:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(0),o=(0,Q.useRef)(null),s;t[0]===n?s=t[1]:(s={editor:n,selector:XT},t[0]=n,t[1]=s);let c=yt(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:YT},t[2]=n,t[3]=l);let u=yt(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return sr(n.view,e,t)}catch{return new DOMRect}},t[4]=n.state,t[5]=n.view,t[6]=d):d=t[6];let f;if(t[7]!==n.view.dom||t[8]!==d){let e={getBoundingClientRect:d,contextElement:n.view.dom};f=()=>{let t=r.current;t&&(o.current?.(),o.current=Cr(e,t,()=>{Vi(e,t,{placement:`top`,strategy:`fixed`,middleware:[jr(8),Gn(),Fr({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(JT)}))},t[7]=n.view.dom,t[8]=d,t[9]=f}else f=t[9];let p=f,m;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{o.current?.(),o.current=null,a(qT)},t[10]=m):m=t[10];let h=m,g;t[11]===p?g=t[12]:(g={onShow:p,onHide:h,strategy:`fixed`},t[11]=p,t[12]=g);let _;t[13]!==n||t[14]!==u||t[15]!==c||t[16]!==i?(_=c?(0,Z.jsx)(LT,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(MT,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(DT,{editor:n}),(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(VT,{editor:n},i),(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(UT,{editor:n},`${i}-link`)]}),t[13]=n,t[14]=u,t[15]=c,t[16]=i,t[17]=_):_=t[17];let v;return t[18]!==n||t[19]!==g||t[20]!==_?(v=(0,Z.jsx)(TT,{ref:r,editor:n,"data-testid":`bubble-menu-bar`,appendTo:KT,shouldShow:WT,updateDelay:250,options:g,className:`z-50 flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:_}),t[18]=n,t[19]=g,t[20]=_,t[21]=v):v=t[21],v}function KT(){return document.body}function qT(e){return e+1}function JT(){}function YT(e){return PT(e.editor)}function XT(e){return zT(e.editor)}var ZT=[{name:`addRowBefore`,icon:ze,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:gt,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:Rt,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],QT=[{name:`addColumnBefore`,icon:la,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:Fa,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:Rt,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],$T=[{name:`toggleHeaderRow`,icon:ol,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:uc,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:Cc,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function eE({editor:e}){return nt(e.state).query?!1:e.isActive(`table`)}function tE(e){let t=(0,$.c)(14),{action:n,editor:r}=e,i=n.icon,a;t[0]!==n||t[1]!==r?(a=e=>{e.preventDefault(),n.command(r)},t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=(0,Z.jsx)(i,{className:`size-3.5`}),t[3]=i,t[4]=o);let s;t[5]!==n.label||t[6]!==a||t[7]!==o?(s=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":n.label,className:`text-muted-foreground`,onMouseDown:a,children:o})}),t[5]=n.label,t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;t[9]===n.label?c=t[10]:(c=(0,Z.jsx)(vr,{side:`bottom`,sideOffset:8,children:n.label}),t[9]=n.label,t[10]=c);let l;return t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(Yn,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function nE(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=ZT.map(e=>(0,Z.jsx)(tE,{action:e,editor:n},e.name)),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=QT.map(e=>(0,Z.jsx)(tE,{action:e,editor:n},e.name)),t[3]=n,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(io,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),t[5]=o):o=t[5];let s;t[6]===n?s=t[7]:(s=$T.map(e=>(0,Z.jsx)(tE,{action:e,editor:n},e.name)),t[6]=n,t[7]=s);let c;return t[8]!==n||t[9]!==r||t[10]!==a||t[11]!==s?(c=(0,Z.jsxs)(TT,{editor:n,"data-testid":`table-controls-menu`,shouldShow:eE,updateDelay:100,className:`flex items-center gap-0.5 rounded-lg border bg-background p-1 shadow-md`,children:[r,i,a,o,s]}),t[8]=n,t[9]=r,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}var rE=new WeakMap;function iE(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=Xn(e.color),n.textContent=e.name,t.append(n),t}var aE={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null},oE=100,sE=100,cE=3,lE=250;function uE(){let e=new xr({extensions:Kr});return{mdManager:e,text:xt({mdManager:e}),html:I({mdManager:e}),paste:Ae({mdManager:e}),drop:N({mdManager:e})}}function dE(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...vt.map(e=>e.name===`link`||e.name===`wikiLink`||e.name===`jsxComponent`?e.configure({docName:t.configuration.name??``}):e.name===`toggleHeadings`?e.configure({getDocName:()=>t.configuration.name??null}):e),Vw.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),we.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Zn.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[jt]}}),Zn.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[ke(e,{cursorBuilder:iE})]}})]}function fE(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{rE.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=rE.get(e);if(rE.delete(e),r==null)return;let i=performance.now();$e(`ok/editor/create-tiptap`,{docName:t.configuration.name??`unknown`,ytextLength:t.document.getText(`source`).length},{startTime:r,duration:Math.max(0,i-r)})},editorProps:{attributes:{class:`pt-4 pb-4 h-full`},clipboardTextParser:(e,t,r,i)=>{let a=n.mdManager.parse(e);return i.state.schema.nodeFromJSON(a).content},clipboardTextSerializer:(e,t)=>n.text(e,t),clipboardSerializer:n.html.serializer,handlePaste:(e,t)=>n.paste(e,t),handleDrop:(e,t)=>n.drop(e,t)},extensions:Hf(dE(e))}}function pE(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=br(dE({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=Me(t.document.getXmlFragment(`default`),a);return{...fE({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var mE=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(aE),c=qw(),{principal:l,activeDocName:u}=ft(),d=n.configuration.name??``,[f]=(0,Q.useState)(uE),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new tr(pE({provider:n,placeholder:r,clipboard:f,ctorStart:performance.now()})),ydoc:n.document,ytext:n.document.getText(`source`),provider:n}),t[0]=f,t[1]=r,t[2]=n,t[3]=p):p=t[3];let[m]=(0,Q.useState)(p),g,_;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=x(d)??crypto.randomUUID();g=Q.use,_=h({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=g,t[8]=_}else g=t[7],_=t[8];let v=g(_),y=v.editor,b,S;t[9]===v?(b=t[10],S=t[11]):(b=()=>()=>{Le(v)},S=[v],t[9]=v,t[10]=b,t[11]=S),(0,Q.useEffect)(b,S);let C;return t[12]!==u||t[13]!==d||t[14]!==y||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(C=(0,Z.jsx)(hE,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:y,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=y,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=C):C=t[20],C},hE=e=>{let t=(0,$.c)(85),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:d,portalTarget:f}=e,m=(0,Q.useRef)(null),h,g;t[0]===f?(h=t[1],g=t[2]):(h=()=>{let e=m.current;if(e)return e.appendChild(f),()=>{f.parentNode===e&&e.removeChild(f)}},g=[f],t[0]=f,t[1]=h,t[2]=g),(0,Q.useLayoutEffect)(h,g);let _;t[3]!==c||t[4]!==n.configuration.name?(_=()=>(Et(c,n.configuration.name??null),()=>{Et(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=_):_=t[5];let v;t[6]!==c||t[7]!==n?(v=[c,n],t[6]=c,t[7]=n,t[8]=v):v=t[8],(0,Q.useEffect)(_,v);let y;t[9]!==c||t[10]!==n.configuration.name?(y=()=>{let e=n.configuration.name;if(e)return ot(e,c),()=>it(e,c)},t[9]=c,t[10]=n.configuration.name,t[11]=y):y=t[11];let b;t[12]!==c||t[13]!==n?(b=[c,n],t[12]=c,t[13]=n,t[14]=b):b=t[14],(0,Q.useEffect)(y,b);let x;t[15]!==c||t[16]!==n.configuration.name?(x=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=x):x=t[17];let S;t[18]!==c||t[19]!==n?(S=[c,n],t[18]=c,t[19]=n,t[20]=S):S=t[20],(0,Q.useEffect)(x,S);let C,w;t[21]===c?(C=t[22],w=t[23]):(w=()=>{let e=gE,t=null,n=()=>{if(t||c.isDestroyed)return;let n=p(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 p(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},C=[c],t[21]=c,t[22]=C,t[23]=w),(0,Q.useEffect)(w,C);let T,E;t[24]!==i||t[25]!==c?(T=()=>{let e=!1,t=()=>{if(e||c.isDestroyed||!p(c))return;e=!0;let t=It(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})),$e(`ok/editor/selection-restore-failed`,{docName:i,message:n})}dt(i)};if(p(c)){t();return}return c.on(`create`,t),()=>{c.off(`create`,t)}},E=[c,i],t[24]=i,t[25]=c,t[26]=T,t[27]=E):(T=t[26],E=t[27]),(0,Q.useEffect)(T,E);let D,O;t[28]!==d||t[29]!==n.document||t[30]!==l?(D=()=>{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=>{d.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??``))},u=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(d.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)},Pi)};c(aE);let f=()=>{if(yr(e),!gr(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(),u()},e)}return}r=n,u()};e.observe(f);let p=()=>{document.visibilityState===`visible`?gr(e,t)&&(t=Date.now(),r=Date.now(),u()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},O=[n.document,d,l],t[28]=d,t[29]=n.document,t[30]=l,t[31]=D,t[32]=O):(D=t[31],O=t[32]),(0,Q.useEffect)(D,O);let k,A;t[33]!==a||t[34]!==i||t[35]!==c||t[36]!==n?(k=()=>{let e=0,t,r=null,o=null,s=null,l=function(){if(e<oE){e+=1,t=window.setTimeout(m,sE);return}r=null,o=null,e=0},u=function(e){let t=p(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=cE,o=()=>{t=void 0,!(i!==a||window.location.hash!==n)&&(d(e),--r,r>0&&(t=window.setTimeout(o,lE)))};t=window.setTimeout(o,lE)};function m(){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 h=function(){if(i!==a)return;let n=window.location.hash;if(!r&&s===n)return;let c=Ei(n);if(!c){s=n;return}r=c,o=n,e=0,t!==void 0&&(clearTimeout(t),t=void 0),m()},g=function(){if(i===a){if(r){m();return}h()}};return h(),n.on(`synced`,g),c.on(`transaction`,g),window.addEventListener(`hashchange`,h),()=>{t!==void 0&&clearTimeout(t),n.off(`synced`,g),c.off(`transaction`,g),window.removeEventListener(`hashchange`,h)}},A=[n,c,i,a],t[33]=a,t[34]=i,t[35]=c,t[36]=n,t[37]=k,t[38]=A):(k=t[37],A=t[38]),(0,Q.useEffect)(k,A);let j,M;t[39]===c?(j=t[40],M=t[41]):(j=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=p(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(Ns,e),()=>window.removeEventListener(Ns,e)},M=[c],t[39]=c,t[40]=j,t[41]=M),(0,Q.useEffect)(j,M);let N;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n.awareness?(N=()=>{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[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n.awareness,t[48]=N):N=t[48];let P;t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==r||t[53]!==s||t[54]!==n?(P=[n,i,a,o,s,r],t[49]=a,t[50]=i,t[51]=o,t[52]=r,t[53]=s,t[54]=n,t[55]=P):P=t[55],(0,Q.useEffect)(N,P);let F,I;t[56]!==c||t[57]!==r?(F=()=>(Ct(c,r),()=>{Ct(c,!1)}),I=[c,r],t[56]=c,t[57]=r,t[58]=F,t[59]=I):(F=t[58],I=t[59]),(0,Q.useEffect)(F,I);let L;t[60]!==c||t[61]!==r?(L=!r&&(0,Z.jsx)(GT,{editor:c}),t[60]=c,t[61]=r,t[62]=L):L=t[62];let R;t[63]!==c||t[64]!==r?(R=!r&&(0,Z.jsx)(nE,{editor:c}),t[63]=c,t[64]=r,t[65]=R):R=t[65];let z;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(`div`,{ref:m,style:{display:`contents`}}),t[66]=z):z=t[66];let B;t[67]===c?B=t[68]:(B=(0,Z.jsx)(Nt,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[67]=c,t[68]=B);let V;t[69]!==f||t[70]!==B?(V=(0,$s.createPortal)(B,f),t[69]=f,t[70]=B,t[71]=V):V=t[71];let H;t[72]===c?H=t[73]:(H=(0,Z.jsx)(Gw,{editor:c}),t[72]=c,t[73]=H);let U;t[74]===c?U=t[75]:(U=Gt(c),t[74]=c,t[75]=U);let W;t[76]===U.store?W=t[77]:(W=(0,Z.jsx)(u,{store:U.store}),t[76]=U.store,t[77]=W);let G;return t[78]!==L||t[79]!==R||t[80]!==V||t[81]!==H||t[82]!==W||t[83]!==l?(G=(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:[L,R,z,V,H,W]}),t[78]=L,t[79]=R,t[80]=V,t[81]=H,t[82]=W,t[83]=l,t[84]=G):G=t[84],G};function gE(){return Lt()}function _E(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(Mt(n,r));let a;return t[0]===i?a=t[1]:(a=(0,Z.jsx)(Z.Fragment,{children:i}),t[0]=i,t[1]=a),a}var vE=`__back-nav__`;function yE(e){return e instanceof He||e instanceof ht||e instanceof Re||e instanceof et||e instanceof Dt||e instanceof Ve?e.docName:null}function bE(e){return e instanceof He?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof ht?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof Re?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof et?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof Dt?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:e instanceof Ve?{title:`Cancelled`,summary:`You cancelled loading "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function xE(e){let t=(0,$.c)(27),{error:n,resetErrorBoundary:r,activeDocName:i,previousDocName:a,onNavigateBack:o}=e,s;t[0]===n?s=t[1]:(s=bE(n),t[0]=n,t[1]=s);let{title:c,summary:l}=s,u=!!a&&!!o,d=(0,Q.useRef)(null),f,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{d.current?.focus()},p=[],t[2]=f,t[3]=p):(f=t[2],p=t[3]),(0,Q.useEffect)(f,p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(WS,{size:80,variant:`sleeping`}),t[4]=m):m=t[4];let h;t[5]===c?h=t[6]:(h=(0,Z.jsx)(`h2`,{id:`document-error-title`,className:`text-2xl font-light tracking-tighter text-balance`,children:c}),t[5]=c,t[6]=h);let g;t[7]===l?g=t[8]:(g=(0,Z.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:l}),t[7]=l,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===r?v=t[13]:(v=(0,Z.jsx)(X,{ref:d,variant:`default`,onClick:r,children:`Try again`}),t[12]=r,t[13]=v);let y;t[14]!==i||t[15]!==u||t[16]!==n||t[17]!==o||t[18]!==a||t[19]!==r?(y=u?(0,Z.jsx)(X,{variant:`ghost`,className:`font-mono uppercase`,onClick:()=>{!a||!o||(st(yE(n)??i),o(a),r(vE))},children:`Go back`}):null,t[14]=i,t[15]=u,t[16]=n,t[17]=o,t[18]=a,t[19]=r,t[20]=y):y=t[20];let b;t[21]!==v||t[22]!==y?(b=(0,Z.jsxs)(`div`,{className:`mt-1 flex gap-2`,children:[v,y]}),t[21]=v,t[22]=y,t[23]=b):b=t[23];let x;return t[24]!==b||t[25]!==_?(x=(0,Z.jsxs)(`div`,{role:`alert`,"aria-labelledby":`document-error-title`,"data-slot":`document-error-boundary`,className:`flex h-full flex-col items-center justify-center gap-8 p-8 text-center`,children:[m,_,b]}),t[24]=b,t[25]=_,t[26]=x):x=t[26],x}function SE(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)(xE,{...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]===vE){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}: ${bE(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)(ue,{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 CE(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=Ci(t);return{map:n,keys:ii(t),parseError:r}}function wE(e){let t=(0,$.c)(175),{provider:n}=e,{_:r}=Yt(),[i,a]=(0,Q.useState)(null),o;t[0]===n?o=t[1]:(o=()=>CE(n),t[0]=n,t[1]=o);let[s,l]=(0,Q.useState)(o),u,d;t[2]===n?(u=t[3],d=t[4]):(u=()=>{let e=Qr(n);a(e),l(e.current());let t=e.subscribe(e=>{l(e)});return()=>{t(),e.dispose(),a(t=>t===e?null:t)}},d=[n],t[2]=n,t[3]=u,t[4]=d),(0,Q.useEffect)(u,d);let f=s.map,p=s.keys,m=s.parseError,[h,g]=(0,Q.useState)(!1),_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={},t[5]=_):_=t[5];let[v,y]=(0,Q.useState)(_),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w={},t[6]=w):w=t[6];let[T,E]=(0,Q.useState)(w),D;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(D={},t[7]=D):D=t[7];let[O,k]=(0,Q.useState)(D),A=n.configuration.name??``,j;t[8]===A?j=t[9]:(j=OE(A),t[8]=A,t[9]=j);let M=j,N;t[10]===A?N=t[11]:(N=EE(A),t[10]=A,t[11]=N);let P=_o(M?null:N),F;t[12]!==P||t[13]!==M?(F=!M&&P.state.status===`ready`?P.state.data.folder.frontmatter_defaults??{}:{},t[12]=P,t[13]=M,t[14]=F):F=t[14];let I=F,L;t[15]!==P||t[16]!==M?(L=!M&&P.state.status===`ready`?P.state.data.frontmatterSources:{},t[15]=P,t[16]=M,t[17]=L):L=t[17];let R=L,z;t[18]!==r||t[19]!==i?(z=function(e){if(!i)return{ok:!1,error:r({id:`9zb2WA`})};let t=i.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=pi(t.error);return{ok:!1,error:t.error.issues[0]?.message??r({id:`8fRyLo`}),fieldErrors:Object.keys(n).length>0?n:void 0}},t[18]=r,t[19]=i,t[20]=z):z=t[20];let B=z,V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){E(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[21]=V):V=t[21];let H=V,U;t[22]===r?U=t[23]:(U=function(e,t){if(e.ok)return;let n=e.error??r({id:`4g19V6`}),i=e.fieldErrors??{};E(e=>{let r={...e};for(let e of t)r[e]=i[e]??n;return r}),k(e=>{let n={...e};for(let e of t)n[e]=(n[e]??0)+1;return n})},t[22]=r,t[23]=U);let W=U,G;t[24]!==B||t[25]!==W?(G=function(e,t){H(e),W(B({[e]:t}),[e])},t[24]=B,t[25]=W,t[26]=G):G=t[26];let ee=G,te;t[27]!==B||t[28]!==W?(te=function(e){H(e),W(B({[e]:null}),[e])},t[27]=B,t[28]=W,t[29]=te):te=t[29];let ne=te,re;t[30]!==r||t[31]!==i?(re=function(e,t){if(!i)return{ok:!1,error:r({id:`9zb2WA`})};if(e===t)return{ok:!0};let n=i.rename(e,t);if(n.ok)return{ok:!0};if(n.error.code===`WRITE_ERROR`)return{ok:!1,error:n.error.detail};let a=pi(n.error);return{ok:!1,error:n.error.issues[0]?.message??r({id:`I1gRhX`}),fieldErrors:Object.keys(a).length>0?a:void 0}},t[30]=r,t[31]=i,t[32]=re):re=t[32];let ie=re,ae;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ae=function(e,t){return`${e} ${t}`},t[33]=ae):ae=t[33];let oe=ae,se;t[34]!==i||t[35]!==p?(se=function(e){if(!i)return;let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=p.map((e,t)=>oe(e,t)),a=r.indexOf(t),o=r.indexOf(n);if(a<0||o<0)return;let s=p.slice(),[c]=s.splice(a,1);if(!c)return;s.splice(o,0,c);let l=i.reorder(s);l.ok||console.warn(`[PropertyPanel] reorder failed:`,l.error)},t[34]=i,t[35]=p,t[36]=se):se=t[36];let ce=se,le;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(le={activationConstraint:{distance:4}},t[37]=le):le=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue={coordinateGetter:mo},t[38]=ue):ue=t[38];let de=Vo(Va(Aa,le),Va(Da,ue)),K;t[39]!==I||t[40]!==ee||t[41]!==f?(K=function(e,t){let n=f[e]??kE(I[e]);if(n===void 0)return;y(n=>({...n,[e]:t}));let r=Ta(n,t);(!Object.hasOwn(f,e)||!TE(n,r))&&ee(e,r)},t[39]=I,t[40]=ee,t[41]=f,t[42]=K):K=t[42];let fe=K,pe;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(pe=function(){x({name:``,type:`text`,value:``,error:null}),g(!1)},t[43]=pe):pe=t[43];let me=pe,{addPropertySignal:he,clearAddProperty:ge}=LC(),_e;t[44]!==he||t[45]!==A?(_e=he.get(A)??0,t[44]=he,t[45]=A,t[46]=_e):_e=t[46];let ve=_e,ye,be;t[47]===ve?(ye=t[48],be=t[49]):(ye=()=>{ve>0&&(x({name:``,type:`text`,value:``,error:null}),g(!1))},be=[ve],t[47]=ve,t[48]=ye,t[49]=be),(0,Q.useEffect)(ye,be);let xe,Se;t[50]!==ge||t[51]!==A?(xe=()=>()=>ge(A),Se=[A,ge],t[50]=ge,t[51]=A,t[52]=xe,t[53]=Se):(xe=t[52],Se=t[53]),(0,Q.useEffect)(xe,Se);let Ce;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=function(e){x(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):Wa[e];return{...t,type:e,value:n,error:null}})},t[54]=Ce):Ce=t[54];let we=Ce,Te;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){x(t=>t&&{...t,value:e})},t[55]=Te):Te=t[55];let Ee=Te,De;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(De=function(e){x(t=>t&&{...t,name:e,error:null})},t[56]=De):De=t[56];let Oe=De,ke;t[57]!==r||t[58]!==b||t[59]!==B||t[60]!==f?(ke=function(){if(!b)return;let e=b.name.trim();if(!e){x({...b,error:r({id:`8_brI5`})});return}if(e===`frontmatter`){x({...b,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(f,e)){x({...b,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=B({[e]:b.value});if(t.ok){x(null);return}let n=t.fieldErrors?.[e],i=t.error??r({id:`OJeiSH`});x({...b,error:n??i})},t[57]=r,t[58]=b,t[59]=B,t[60]=f,t[61]=ke):ke=t[61];let Ae=ke,je;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(){x(null)},t[62]=je):je=t[62];let Me=je,Ne;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){C({key:e,draft:e,error:null})},t[63]=Ne):Ne=t[63];let Pe=Ne,Fe;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(e){C(t=>t&&{...t,draft:e,error:null})},t[64]=Fe):Fe=t[64];let Ie=Fe,Le;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Le=function(){C(null)},t[65]=Le):Le=t[65];let Re=Le,ze;t[66]!==r||t[67]!==f||t[68]!==ie||t[69]!==S?(ze=function(){if(!S)return;let e=S.draft.trim();if(!e){C(null);return}if(e===S.key){C(null);return}if(e===`frontmatter`){C({...S,error:r({id:`dURmlQ`})});return}if(Object.hasOwn(f,e)){C({...S,error:r({id:`njU86j`,values:{trimmed:e}})});return}let t=ie(S.key,e);if(t.ok){y(t=>{if(!Object.hasOwn(t,S.key))return t;let n={...t};return n[e]=n[S.key],delete n[S.key],n}),H(S.key),C(null);return}let n=t.fieldErrors?.[e]??t.fieldErrors?.[S.key]??t.error??r({id:`2ryd91`});C({...S,error:n})},t[66]=r,t[67]=f,t[68]=ie,t[69]=S,t[70]=ze):ze=t[70];let q=ze,Be;t[71]!==f||t[72]!==p?(Be=p.length>0?p:Object.keys(f),t[71]=f,t[72]=p,t[73]=Be):Be=t[73];let Ve=Be,He;if(t[74]!==Ve){He=new Map;for(let e of Ve)He.set(e,(He.get(e)??0)+1);t[74]=Ve,t[75]=He}else He=t[75];let Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et;if(t[76]!==b||t[77]!==I||t[78]!==R||t[79]!==h||t[80]!==ee||t[81]!==q||t[82]!==He||t[83]!==T||t[84]!==ce||t[85]!==f||t[86]!==v||t[87]!==m||t[88]!==ne||t[89]!==S||t[90]!==Ve||t[91]!==O||t[92]!==de||t[93]!==fe){et=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Object.keys(I).filter(e=>!Object.hasOwn(f,e)).sort();if(Ve.length===0&&e.length===0&&!b&&!m){et=null;break bb0}Qe=`property-panel editor-content-aligned pt-4 pb-4 text-sm`,$e=`property-panel`,We=Jo,Ye=!h,t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=e=>g(!e),t[106]=Xe):Xe=t[106];let n=!h,r;t[107]===n?r=t[108]:(r=(0,Z.jsx)(Wo,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[107]=n,t[108]=r);let i;t[109]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`l_UFPv`})}),t[109]=i):i=t[109],t[110]===r?Ze=t[111]:(Ze=(0,Z.jsx)(qo,{asChild:!0,children:(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,className:`mb-1.5 flex h-auto w-fit bg-transparent! items-center gap-1 px-1 py-0.5 text-base font-medium text-foreground hover:bg-transparent hover:text-foreground`,children:[r,i]})}),t[110]=r,t[111]=Ze),Ue=Ko,Ge=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[112]===m?Ke=t[113]:(Ke=m?(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)(ei,{className:`size-3.5 shrink-0 mt-0.5`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(J,{id:`UG-Phk`}),(0,Z.jsx)(`span`,{className:`block text-[10px] opacity-80`,children:m})]})]}):null,t[112]=m,t[113]=Ke);let a;if(t[114]!==Ve){let e;t[116]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>oe(e,t),t[116]=e):e=t[116],a=Ve.map(e),t[114]=Ve,t[115]=a}else a=t[115];let o;if(t[117]!==ee||t[118]!==q||t[119]!==He||t[120]!==T||t[121]!==f||t[122]!==v||t[123]!==ne||t[124]!==S||t[125]!==Ve||t[126]!==O||t[127]!==fe){let e;t[129]!==ee||t[130]!==q||t[131]!==He||t[132]!==T||t[133]!==f||t[134]!==v||t[135]!==ne||t[136]!==S||t[137]!==O||t[138]!==fe?(e=(e,t)=>{let n=f[e];if(n===void 0)return null;let r=v[e]??Sr(n),i=S?.key===e?S:null,a=(He.get(e)??0)>1;return(0,Z.jsx)(xa,{sortableId:oe(e,t),keyName:e,value:n,declared:r,error:T[e]??null,resetCounter:O[e]??0,isDuplicate:a,rename:{state:i,onBegin:()=>Pe(e),onChangeDraft:Ie,onCommit:q,onCancel:Re},onCommit:t=>ee(e,t),onChangeType:t=>fe(e,t),onRemove:()=>ne(e)},`${e}-${t}`)},t[129]=ee,t[130]=q,t[131]=He,t[132]=T,t[133]=f,t[134]=v,t[135]=ne,t[136]=S,t[137]=O,t[138]=fe,t[139]=e):e=t[139],o=Ve.map(e),t[117]=ee,t[118]=q,t[119]=He,t[120]=T,t[121]=f,t[122]=v,t[123]=ne,t[124]=S,t[125]=Ve,t[126]=O,t[127]=fe,t[128]=o}else o=t[128];let s;t[140]!==a||t[141]!==o?(s=(0,Z.jsx)(La,{items:a,strategy:Ia,children:o}),t[140]=a,t[141]=o,t[142]=s):s=t[142],t[143]!==ce||t[144]!==de||t[145]!==s?(qe=(0,Z.jsx)(za,{sensors:de,collisionDetection:Na,onDragEnd:ce,children:s}),t[143]=ce,t[144]=de,t[145]=s,t[146]=qe):qe=t[146];let c;t[147]!==I||t[148]!==R||t[149]!==ee||t[150]!==T||t[151]!==O||t[152]!==fe?(c=e=>{let t=I[e],n=kE(t),r=Sr(n),i=R[e]??``;return(0,Z.jsx)(xa,{keyName:e,value:n,declared:r,error:T[e]??null,resetCounter:O[e]??0,isInherited:!0,badge:(0,Z.jsx)(Fo,{source:i}),onCommit:t=>ee(e,t),onChangeType:t=>fe(e,t)},`inherited-${e}`)},t[147]=I,t[148]=R,t[149]=ee,t[150]=T,t[151]=O,t[152]=fe,t[153]=c):c=t[153],Je=e.map(c)}t[76]=b,t[77]=I,t[78]=R,t[79]=h,t[80]=ee,t[81]=q,t[82]=He,t[83]=T,t[84]=ce,t[85]=f,t[86]=v,t[87]=m,t[88]=ne,t[89]=S,t[90]=Ve,t[91]=O,t[92]=de,t[93]=fe,t[94]=Ue,t[95]=We,t[96]=Ge,t[97]=Ke,t[98]=qe,t[99]=Je,t[100]=Ye,t[101]=Xe,t[102]=Ze,t[103]=Qe,t[104]=$e,t[105]=et}else Ue=t[94],We=t[95],Ge=t[96],Ke=t[97],qe=t[98],Je=t[99],Ye=t[100],Xe=t[101],Ze=t[102],Qe=t[103],$e=t[104],et=t[105];if(et!==Symbol.for(`react.early_return_sentinel`))return et;let tt;t[154]!==r||t[155]!==b||t[156]!==Ae?(tt=b?(0,Z.jsx)(Ha,{draft:b,onChangeName:Oe,onChangeType:we,onChangeValue:Ee,onCommit:Ae,onCancel:Me}):(0,Z.jsxs)(`div`,{className:`mt-1 flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}),(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:me,"aria-label":r({id:`F-NRCj`}),className:`flex items-center gap-1.5 rounded px-2 py-1 font-medium text-sm hover:bg-muted/50 hover:text-foreground`,children:[(0,Z.jsx)(c,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:(0,Z.jsx)(J,{id:`m16xKo`})})]})]}),t[154]=r,t[155]=b,t[156]=Ae,t[157]=tt):tt=t[157];let nt;t[158]!==Ue||t[159]!==Ge||t[160]!==Ke||t[161]!==qe||t[162]!==Je||t[163]!==tt?(nt=(0,Z.jsxs)(Ue,{className:Ge,children:[Ke,qe,Je,tt]}),t[158]=Ue,t[159]=Ge,t[160]=Ke,t[161]=qe,t[162]=Je,t[163]=tt,t[164]=nt):nt=t[164];let rt;t[165]!==We||t[166]!==Ye||t[167]!==Xe||t[168]!==Ze||t[169]!==nt?(rt=(0,Z.jsxs)(We,{open:Ye,onOpenChange:Xe,children:[Ze,nt]}),t[165]=We,t[166]=Ye,t[167]=Xe,t[168]=Ze,t[169]=nt,t[170]=rt):rt=t[170];let it;return t[171]!==Qe||t[172]!==$e||t[173]!==rt?(it=(0,Z.jsx)(`div`,{className:Qe,"data-testid":$e,children:rt}),t[171]=Qe,t[172]=$e,t[173]=rt,t[174]=it):it=t[174],it}function TE(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function EE(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}var DE=/(^|\/)\.ok\/templates\//;function OE(e){return DE.test(e)}function kE(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:Array.isArray(e)?e.map(e=>typeof e==`string`?e:JSON.stringify(e)):e==null?``:JSON.stringify(e)}var AE=Qe(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function jE(e){let t=e.threshold??AE;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function ME(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var NE=Qe(`ACTIVITY_MOUNT_LIMIT`,3);function PE(){return n(()=>import(`./SourceEditor-BBghYkCg.js`),__vite__mapDeps([44,1,33,2,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,45,22]),import.meta.url)}var FE=(0,Q.lazy)(async()=>({default:(await PE()).SourceEditor}));function IE(e,t,n){if(n<=0)return[];let r=e.filter(e=>!Je(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 LE(e,t){return t.kind===`idle`?null:t.kind===`failed`&&t.failedDocNames.includes(e)?{kind:`failed`,title:`Couldn't reconnect after server restart`,summary:t.reason===`clear-data-timeout`?`Local collaboration data for "${e}" could not be cleared in time. Reload to retry.`:`Local collaboration data for "${e}" could not be cleared. Reload to retry.`,actionLabel:`Reload`}:t.kind===`recovering`&&t.docNames.includes(e)?{kind:`recovering`,title:`Reconnecting after server restart`,summary:t.phase===`clearing-local-cache`?`Clearing local collaboration data for "${e}" before reconnecting.`:`Reopening "${e}" with a fresh local collaboration cache.`}:null}function RE(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(ut,{name:`activity-pool`,children:(0,Z.jsx)(zE,{...e})}),t[0]=e,t[1]=n),n}function zE(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=ft(),{pages:u,loading:d}=Zr(),f=IE(c,n,NE),p=(0,Q.useRef)(``),m=f.map(BE).join(`,`),h=(0,Q.useRef)(c),g,_;t[0]===c?(g=t[1],_=t[2]):(g=()=>{h.current=c},_=[c],t[0]=c,t[1]=g,t[2]=_),(0,Q.useLayoutEffect)(g,_),(0,Q.useLayoutEffect)(()=>{if(p.current===m)return;let e=p.current?p.current.split(`,`):[],t=m?m.split(`,`):[],r=e.filter(e=>!t.includes(e)),i=t.filter(t=>!e.includes(t));for(let e of r)_e(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;v(e,t&&t.length>0?t:crypto.randomUUID())}$e(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Wt(t)},[m,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)(KE,{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 BE(e){return e.docName}function VE(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&&$e(`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&&($e(`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&&$e(`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 HE(e){let t=(0,$.c)(12),{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a}=e,o=r&&i,[s,c]=(0,Q.useState)(o),l,u;if(t[0]===o?(l=t[1],u=t[2]):(l=()=>{o&&c(!0)},u=[o],t[0]=o,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u),!s&&!o)return null;let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(sS,{}),t[3]=d):d=t[3];let f=n.docName,p;t[4]===n.provider.document?p=t[5]:(p=n.provider.document.getText(`source`),t[4]=n.provider.document,t[5]=p);let m;return t[6]!==a||t[7]!==n.docName||t[8]!==n.provider||t[9]!==o||t[10]!==p?(m=(0,Z.jsx)(Q.Suspense,{fallback:d,children:(0,Z.jsx)(FE,{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 UE(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)(Kc,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(ee,{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)(X,{type:`button`,onClick:WE,children:[(0,Z.jsx)(Kc,{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 WE(){return window.location.reload()}function GE(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 KE(e){let t=(0,$.c)(52),{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=LE(n.docName,u),t[0]=n.docName,t[1]=u,t[2]=d):d=t[2];let f=d,p;t[3]===n.docName?p=t[4]:(p=()=>{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]=p);let[m]=(0,Q.useState)(p),h=n.provider.document.getText(`source`).length,[g,_]=(0,Q.useState)(i),[v,y]=(0,Q.useState)(!i),b,S;t[5]!==i||t[6]!==g||t[7]!==v?(b=()=>{i&&!g?_(!0):!i&&!v&&y(!0)},S=[i,g,v],t[5]=i,t[6]=g,t[7]=v,t[8]=b,t[9]=S):(b=t[8],S=t[9]),(0,Q.useEffect)(b,S);let C=jE({ytextLength:h,isSourceMode:i,visitedSource:g,visitedVisual:v}),w=(0,Q.useRef)(``),T=`${C.isLarge}-${C.renderSource}-${C.renderVisual}`,E,D;t[10]!==n.docName||t[11]!==C.isLarge||t[12]!==C.renderSource||t[13]!==C.renderVisual||t[14]!==T||t[15]!==i||t[16]!==h?(E=()=>{w.current!==T&&(w.current=T,C.isLarge&&$e(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:h,isSourceMode:i,renderSource:C.renderSource,renderVisual:C.renderVisual}))},D=[T,C.isLarge,C.renderSource,C.renderVisual,n.docName,h,i],t[10]=n.docName,t[11]=C.isLarge,t[12]=C.renderSource,t[13]=C.renderVisual,t[14]=T,t[15]=i,t[16]=h,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,Q.useEffect)(E,D);let O;t[19]===n.docName?O=t[20]:(O=()=>It(n.docName),t[19]=n.docName,t[20]=O);let[k]=(0,Q.useState)(O),A=k?.html??null,[j,M]=(0,Q.useState)(!1),N,P;t[21]!==n.docName||t[22]!==C.isLarge||t[23]!==C.renderSource||t[24]!==C.renderVisual||t[25]!==j||t[26]!==i||t[27]!==h?(N=()=>{ME({isLarge:C.isLarge,renderSource:C.renderSource,renderVisual:C.renderVisual,hasEmittedFirstToggle:j})&&($e(`ok/cold/first-toggle`,{docName:n.docName,mountId:x(n.docName),ytextLength:h,modeEnteredFirst:i?`source`:`visual`}),M(!0))},P=[j,C.isLarge,C.renderSource,C.renderVisual,n.docName,h,i],t[21]=n.docName,t[22]=C.isLarge,t[23]=C.renderSource,t[24]=C.renderVisual,t[25]=j,t[26]=i,t[27]=h,t[28]=N,t[29]=P):(N=t[28],P=t[29]),(0,Q.useEffect)(N,P);let F=r?`visible`:`hidden`,I=`editor:${n.docName}`,L=k?.scrollTop,R;t[30]!==a||t[31]!==n||t[32]!==C.renderSource||t[33]!==C.renderVisual||t[34]!==r||t[35]!==o||t[36]!==i||t[37]!==c||t[38]!==l||t[39]!==m||t[40]!==s||t[41]!==f||t[42]!==A?(R=f?(0,Z.jsx)(UE,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(SE,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:A?(0,Z.jsx)(GE,{html:A}):(0,Z.jsx)(sS,{}),children:(0,Z.jsx)(_E,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(wE,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[C.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(HE,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,C.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(mE,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:m},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[30]=a,t[31]=n,t[32]=C.renderSource,t[33]=C.renderVisual,t[34]=r,t[35]=o,t[36]=i,t[37]=c,t[38]=l,t[39]=m,t[40]=s,t[41]=f,t[42]=A,t[43]=R):R=t[43];let z;t[44]!==r||t[45]!==L||t[46]!==R?(z=(0,Z.jsx)(VE,{isActive:r,initialScrollTop:L,children:R}),t[44]=r,t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;return t[48]!==F||t[49]!==I||t[50]!==z?(B=(0,Z.jsx)(Q.Activity,{mode:F,name:I,children:z}),t[48]=F,t[49]=I,t[50]=z,t[51]=B):B=t[51],B}function qE(e){let t=(0,$.c)(27),{stats:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(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[0]=r):r=t[0];let i;t[1]===n.words?i=t[2]:(i=n.words.toLocaleString(),t[1]=n.words,t[2]=i);let a;t[3]===i?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:i}),t[3]=i,t[4]=a);let o=n.words===1?`word`:`words`,s;t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`span`,{children:[a,` `,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7];let c;t[8]===n.chars?c=t[9]:(c=n.chars.toLocaleString(),t[8]=n.chars,t[9]=c);let l;t[10]===c?l=t[11]:(l=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:c}),t[10]=c,t[11]=l);let u=n.chars===1?`char`:`chars`,d;t[12]!==l||t[13]!==u?(d=(0,Z.jsxs)(`span`,{children:[l,` `,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f=n.tokens>0?`~`:``,p;t[15]===n.tokens?p=t[16]:(p=n.tokens.toLocaleString(),t[15]=n.tokens,t[16]=p);let m;t[17]===p?m=t[18]:(m=(0,Z.jsx)(`span`,{className:`tabular-nums`,children:p}),t[17]=p,t[18]=m);let h=n.tokens===1?`token`:`tokens`,g;t[19]!==f||t[20]!==m||t[21]!==h?(g=(0,Z.jsxs)(`span`,{children:[f,m,` `,h]}),t[19]=f,t[20]=m,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==g||t[24]!==s||t[25]!==d?(_=(0,Z.jsxs)(`section`,{"aria-label":`Document statistics`,className:`relative flex h-6 shrink-0 items-center justify-end gap-3 bg-background px-3 text-2xs text-muted-foreground`,children:[r,s,d,g]}),t[23]=g,t[24]=s,t[25]=d,t[26]=_):_=t[26],_}function JE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function YE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function XE(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`inline-flex items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ZE(e){let t=(0,$.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({current:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0||i?`page`:void 0,o;t[4]===n?o=t[5]:(o=Gi(`font-normal text-foreground`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(`span`,{"data-slot":`breadcrumb-page`,"aria-current":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function QE(e){let t=(0,$.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({children:n,className:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Gi(`[&>svg]:size-3.5`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=n??(0,Z.jsx)(Wo,{}),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}function $E(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}=Xe(n,``);if(!e){l=null;break bb0}let u=e.replace(/\/$/,``).split(`/`).filter(Boolean);if(u.length===0){l=null;break bb0}a=JE,t[8]===r?c=t[9]:(c=Gi(`flex min-w-0 items-center`,r),t[8]=r,t[9]=c),i=YE,o=`flex-nowrap gap-1 text-muted-foreground/70 text-xs`,s=u.map((e,t)=>{let n=u.slice(0,t+1).join(`/`);return(0,Z.jsxs)(Q.Fragment,{children:[t>0&&(0,Z.jsx)(QE,{className:`text-muted-foreground/70 [&>svg]:size-3`}),(0,Z.jsx)(XE,{className:`min-w-0`,children:(0,Z.jsx)(ZE,{current:!1,className:`min-w-0 truncate font-normal text-muted-foreground/70`,title:e,children:e})})]},n)})}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}var eD={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`},tD=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`,...eD,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},nD=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)(tD,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},rD=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)(tD,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function iD(e){let t=(0,$.c)(42),{activeDocName:n,isSourceMode:r,sourceDisabled:i,onModeChange:a,showAddPropertyButton:o,onAddProperty:s,isPanelCollapsed:c,onTogglePanel:l}=e,u;t[0]===n?u=t[1]:(u=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex min-w-0 items-end self-end`,children:(0,Z.jsx)($E,{docName:n})}),t[0]=n,t[1]=u);let d=r?`source`:`wysiwyg`,f;t[2]===a?f=t[3]:(f=e=>{e&&a(e)},t[2]=a,t[3]=f);let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Qo,{value:`wysiwyg`,"aria-label":`Visual editor`,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:(0,Z.jsx)(Wn,{children:(0,Z.jsx)(rD,{className:`size-4`})})}),(0,Z.jsx)(vr,{side:`bottom`,children:`Visual`})]}),t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(nD,{className:`size-4`}),t[5]=m):m=t[5];let h;t[6]===i?h=t[7]:(h=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Qo,{value:`source`,"aria-label":`Markdown source`,disabled:i,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:m})})}),t[6]=i,t[7]=h);let g=i?`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`:`Markdown`,_;t[8]===g?_=t[9]:(_=(0,Z.jsx)(vr,{side:`bottom`,children:g}),t[8]=g,t[9]=_);let v;t[10]!==h||t[11]!==_?(v=(0,Z.jsxs)(Yn,{children:[h,_]}),t[10]=h,t[11]=_,t[12]=v):v=t[12];let y;t[13]!==d||t[14]!==f||t[15]!==v?(y=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(ts,{type:`single`,value:d,onValueChange:f,"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[p,v]})}),t[13]=d,t[14]=f,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==s||t[18]!==o?(b=o&&(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:s,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(Wn,{children:(0,Z.jsx)(jc,{})})}),(0,Z.jsx)(vr,{side:`bottom`,children:`Add properties`})]}),t[17]=s,t[18]=o,t[19]=b):b=t[19];let x=!c,S=c?`Show panel`:`Hide panel`,C;t[20]===c?C=t[21]:(C=(0,Z.jsx)(Wn,{children:c?(0,Z.jsx)(Bc,{}):(0,Z.jsx)(zc,{})}),t[20]=c,t[21]=C);let w;t[22]!==l||t[23]!==x||t[24]!==S||t[25]!==C?(w=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:l,"aria-expanded":x,"aria-label":S,asChild:!0,children:C}),t[22]=l,t[23]=x,t[24]=S,t[25]=C,t[26]=w):w=t[26];let T=c?`Show panel`:`Hide panel`,E;t[27]===T?E=t[28]:(E=(0,Z.jsx)(vr,{side:`bottom`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,Z.jsxs)(Yn,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let O;t[32]!==b||t[33]!==D?(O=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex items-center justify-end gap-1`,children:[b,D]}),t[32]=b,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==u||t[36]!==y||t[37]!==O?(k=(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:[u,y,O]})}),t[35]=u,t[36]=y,t[37]=O,t[38]=k):k=t[38];let A;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[39]=A):A=t[39];let j;return t[40]===k?j=t[41]:(j=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[k,A]}),t[40]=k,t[41]=j),j}function aD(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var oD=(0,Q.lazy)(async()=>({default:(await n(()=>import(`./ActivityModeContent-Dgodq1_3.js`),__vite__mapDeps([32,1,2,33,34,35,20,36,37,38,39,19,3,7,8,6,4,10,40,41]),import.meta.url)).ActivityModeContent}));function sD(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(lD,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(cD,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(ut,{name:`editor-area`,children:(0,Z.jsxs)(FC,{children:[n,r]})}),t[3]=n,t[4]=i),i}function cD(){let e=(0,$.c)(5),t=Jm(),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)(GC,{open:t.open,onOpenChange:n}),e[2]=t.open,e[3]=n,e[4]=r):r=e[4],r}function lD(e){let t=(0,$.c)(104),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a}=e,{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelAgentId:d,docPanelExpandSignal:f}=ft(),{openDocumentTransition:p}=wt(),{requestAddProperty:m}=LC(),h=Rw(s,o),g=zw(s),_=g===`connected`||g===`synced`,v=(0,Q.useDeferredValue)(o),y=c?.kind===`missing`,b=!!o&&c?.kind!==`folder`,x=y?`Start writing to create this page`:void 0,S=Jx(),[C,w]=(0,Q.useState)(!1),{layout:T,autoCollapse:E}=Sw(),D=T===`sheet`,[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(!1),j,M;t[0]!==E||t[1]!==T||t[2]!==S?(j=()=>{if(T!==`panel`)return;let e=requestAnimationFrame(()=>{E?(A.current=!1,S.current?.collapse()):A.current||S.current?.expand()});return()=>cancelAnimationFrame(e)},M=[E,T,S],t[0]=E,t[1]=T,t[2]=S,t[3]=j,t[4]=M):(j=t[3],M=t[4]),(0,Q.useEffect)(j,M);let N,P;t[5]!==D||t[6]!==a||t[7]!==S?(N=()=>{let e=e=>{a(e),D?k(!0):(A.current=!1,S.current?.expand())},t=Zp();return t&&e(t),$p(t=>{Zp(),e(t)})},P=[D,a,S],t[5]=D,t[6]=a,t[7]=S,t[8]=N,t[9]=P):(N=t[8],P=t[9]),(0,Q.useEffect)(N,P);let F,I;t[10]!==f||t[11]!==D||t[12]!==S?(F=()=>{f!==0&&(D?k(!0):(A.current=!1,S.current?.expand()))},I=[f,D,S],t[10]=f,t[11]=D,t[12]=S,t[13]=F,t[14]=I):(F=t[13],I=t[14]),(0,Q.useEffect)(F,I);let L=(0,Q.useRef)(null),[R,z]=(0,Q.useState)(null),B,V;if(t[15]===o?(B=t[16],V=t[17]):(B=()=>{if(o&&o!==L.current){let e=L.current;L.current=o,z(e)}},V=[o],t[15]=o,t[16]=B,t[17]=V),(0,Q.useEffect)(B,V),c?.kind===`folder`){if(!(u===`agent`&&d!==null)){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(OC,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}let e;t[20]===c.folderPath?e=t[21]:(e=(0,Z.jsx)(XC,{minSize:`30%`,defaultSize:`75%`,children:(0,Z.jsx)(OC,{folderPath:c.folderPath})}),t[20]=c.folderPath,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(ZC,{withHandle:!0}),t[22]=n):n=t[22];let r;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(XC,{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:`Loading agent activity`}),children:(0,Z.jsx)(oD,{showBackButton:!1})})}),t[23]=r):r=t[23];let i;return t[24]===e?i=t[25]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,Z.jsxs)(YC,{orientation:`horizontal`,children:[e,n,r]})}),t[24]=e,t[25]=i),i}if(c?.kind===`asset`){let e;return t[26]!==c.assetPath||t[27]!==c.mediaKind?(e=(0,Z.jsx)(oS,{assetPath:c.assetPath,mediaKind:c.mediaKind},c.assetPath),t[26]=c.assetPath,t[27]=c.mediaKind,t[28]=e):e=t[28],e}if(!s||!o){if((typeof window<`u`?wi(window.location.hash):null)!==null){let e;return t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sS,{}),t[29]=e):e=t[29],e}let e;return t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(tC,{}),t[30]=e):e=t[30],e}let H=n===`source`,U=!_,W=D?!O:C,G;t[31]!==o||t[32]!==m?(G=function(){o&&m(o)},t[31]=o,t[32]=m,t[33]=G):G=t[33];let ee=G,te;t[34]!==C||t[35]!==D||t[36]!==S?(te=function(){D?k(uD):C?(A.current=!1,S.current?.expand()):(A.current=!0,S.current?.collapse())},t[34]=C,t[35]=D,t[36]=S,t[37]=te):te=t[37];let ne=te,re=v??o,ie=R??void 0,ae;t[38]===p?ae=t[39]:(ae=e=>{let t=qr(e);window.location.hash===t?p(e):window.location.hash=t},t[38]=p,t[39]=ae);let oe;t[40]!==x||t[41]!==H||t[42]!==l||t[43]!==re||t[44]!==ie||t[45]!==ae?(oe=(0,Z.jsx)(RE,{activeDocName:re,isSourceMode:H,editorPlaceholder:x,previousDocName:ie,onNavigateBack:ae,onRecycle:l}),t[40]=x,t[41]=H,t[42]=l,t[43]=re,t[44]=ie,t[45]=ae,t[46]=oe):oe=t[46];let se;t[47]!==o||t[48]!==H?(se=(0,Z.jsx)(_w,{activeDocName:o,isSourceMode:H}),t[47]=o,t[48]=H,t[49]=se):se=t[49];let ce;t[50]!==o||t[51]!==v?(ce=aD({activeDocName:o,deferredActiveDocName:v,mountResolved:o!==null&&me(o),syncResolved:o!==null&&We(o)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(sS,{}),o===null?null:(0,Z.jsx)(MC,{docName:o})]}):null,t[50]=o,t[51]=v,t[52]=ce):ce=t[52];let le;t[53]!==oe||t[54]!==se||t[55]!==ce?(le=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[oe,se,ce]}),t[53]=oe,t[54]=se,t[55]=ce,t[56]=le):le=t[56];let ue=!H,de;t[57]!==o||t[58]!==W||t[59]!==H||t[60]!==r||t[61]!==ee||t[62]!==U||t[63]!==ue||t[64]!==ne?(de=(0,Z.jsx)(iD,{activeDocName:o,isSourceMode:H,sourceDisabled:U,onModeChange:r,showAddPropertyButton:ue,onAddProperty:ee,isPanelCollapsed:W,onTogglePanel:ne}),t[57]=o,t[58]=W,t[59]=H,t[60]=r,t[61]=ee,t[62]=U,t[63]=ue,t[64]=ne,t[65]=de):de=t[65];let K;t[66]!==le||t[67]!==de?(K=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[le,de]}),t[66]=le,t[67]=de,t[68]=K):K=t[68];let fe;t[69]!==b||t[70]!==h?(fe=b&&(0,Z.jsx)(qE,{stats:h}),t[69]=b,t[70]=h,t[71]=fe):fe=t[71];let pe;t[72]!==K||t[73]!==fe?(pe=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[K,fe]}),t[72]=K,t[73]=fe,t[74]=pe):pe=t[74];let he=pe,ge=D?`100%`:`30%`,_e=D?`100%`:`75%`,ve;t[75]!==he||t[76]!==ge||t[77]!==_e?(ve=(0,Z.jsx)(XC,{minSize:ge,defaultSize:_e,children:he}),t[75]=he,t[76]=ge,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]===D?ye=t[80]:(ye=D?null:(0,Z.jsx)(ZC,{withHandle:!0}),t[79]=D,t[80]=ye);let be;t[81]!==o||t[82]!==i||t[83]!==u||t[84]!==D||t[85]!==H||t[86]!==a||t[87]!==S?(be=D?null:(0,Z.jsx)(XC,{panelRef:S,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>w(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(tb,{docName:o,isSourceMode:H,activeTab:i,onActiveTabChange:a,mode:u})}),t[81]=o,t[82]=i,t[83]=u,t[84]=D,t[85]=H,t[86]=a,t[87]=S,t[88]=be):be=t[88];let xe;t[89]!==ve||t[90]!==ye||t[91]!==be?(xe=(0,Z.jsxs)(YC,{orientation:`horizontal`,children:[ve,ye,be]}),t[89]=ve,t[90]=ye,t[91]=be,t[92]=xe):xe=t[92];let Se;t[93]!==o||t[94]!==i||t[95]!==u||t[96]!==D||t[97]!==H||t[98]!==a||t[99]!==O?(Se=D?(0,Z.jsx)(bv,{open:O,onOpenChange:k,children:(0,Z.jsxs)(Cv,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(wv,{className:`sr-only`,children:(0,Z.jsx)(Tv,{children:`Document panel`})}),(0,Z.jsx)(tb,{docName:o,isSourceMode:H,activeTab:i,onActiveTabChange:a,mode:u})]})}):null,t[93]=o,t[94]=i,t[95]=u,t[96]=D,t[97]=H,t[98]=a,t[99]=O,t[100]=Se):Se=t[100];let Ce;return t[101]!==xe||t[102]!==Se?(Ce=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[xe,Se]}),t[101]=xe,t[102]=Se,t[103]=Ce):Ce=t[103],Ce}function uD(e){return!e}var dD=1280;function fD(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(pD),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${dD-1}px)`),t=()=>{n(window.innerWidth<dD)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i),t}function pD(){return window.innerWidth<dD}function mD(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function hD(e){let{value:t,unit:n}=mD(e);return n===`rem`?t*16:t}function gD(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var _D=3600*24*7;function vD(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?yD:m,O=g===void 0?_D: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,ee;t[3]===y?(G=t[4],ee=t[5]):(G=()=>{H.current=y},ee=[y],t[3]=y,t[4]=G,t[5]=ee),(0,Q.useEffect)(G,ee);let te=hD(b),ne;t[6]===x?ne=t[7]:(ne=hD(x),t[6]=x,t[7]=ne);let re=ne,ie;t[8]!==E||t[9]!==k?(ie=function(e){P.current=!0,E&&(j.current=H.current?0:hD(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]=ie):ie=t[10];let ae=ie,oe,se;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==re||t[18]!==te||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(oe=()=>{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}=mD(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<=te*w;else if(e<=te){let n=te*(w-1);t=te-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>te*T){a();let t=n(r,M.current,j.current,s),c=Math.max(te,Math.min(re,t)),u=gD(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(te,Math.min(re,u)),f=gD(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)}},se=[i,a,D,te,re,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]=re,t[18]=te,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=oe,t[25]=se):(oe=t[24],se=t[25]),(0,Q.useEffect)(oe,se);let ce;return t[26]===ae?ce=t[27]:(ce={dragRef:A,isDragging:N,handleMouseDown:ae},t[26]=ae,t[27]=ce),ce}function yD(){}var bD=`sidebar_state`,xD=3600*24*7,SD=`18rem`,CD=`3rem`,wD=`\\`,TD=`app-file-sidebar`,ED=`14.625rem`,DD=`22rem`,OD=`sidebar_width`,kD=/^\d+(?:\.\d+)?(?:rem|px)$/,AD=Q.createContext(null);function jD(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${OD}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return kD.test(n)?n:e}function MD(){let e=Q.use(AD);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ND(e){let t=(0,$.c)(53),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,defaultWidth:l,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=c===void 0?!0:c,d=l===void 0?SD:l,f=fD(),p;t[9]===d?p=t[10]:(p=()=>jD(d),t[9]=d,t[10]=p);let[m,h]=Q.useState(p),[g,_]=Q.useState(!1),v=Q.useRef(g),[y,b]=Q.useState(!1),[x,S]=Q.useState(!1),[C,w]=Q.useState(u),T=i??C,E;t[11]!==T||t[12]!==o?(E=e=>{let t=typeof e==`function`?e(T):e;o?o(t):w(t),document.cookie=`${bD}=${t}; path=/; max-age=${xD}`},t[11]=T,t[12]=o,t[13]=E):E=t[13];let D=E,O;t[14]===D?O=t[15]:(O=function(){return window.innerWidth<1280?_(FD):D(PD)},t[14]=D,t[15]=O);let k=O,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=function(){window.innerWidth>=1280||v.current&&(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||S(!0))},t[16]=A):A=t[16];let j=A,M;t[17]===g?M=t[18]:(M=()=>{v.current=g},t[17]=g,t[18]=M),Q.useLayoutEffect(M);let N,P;t[19]===k?(N=t[20],P=t[21]):(N=()=>{let e=e=>{e.key===wD&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),k())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},P=[k],t[19]=k,t[20]=N,t[21]=P),Q.useEffect(N,P);let F,I;t[22]!==f||t[23]!==g?(F=()=>{if(!f||!g)return;let e=e=>{e.key===`Escape`&&(document.querySelector(`[data-state="open"][role="dialog"], [data-state="open"][role="alertdialog"], [data-state="open"][role="menu"], [data-state="open"][role="listbox"], [data-radix-popper-content-wrapper] [data-state="open"]`)||_(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},I=[f,g],t[22]=f,t[23]=g,t[24]=F,t[25]=I):(F=t[24],I=t[25]),Q.useEffect(F,I);let L=Q.useRef(f),R,z;t[26]!==f||t[27]!==T?(R=()=>{!L.current&&f&&_(T),L.current=f},z=[f,T],t[26]=f,t[27]=T,t[28]=R,t[29]=z):(R=t[28],z=t[29]),Q.useEffect(R,z);let B=f?g?`expanded`:`collapsed`:T?`expanded`:`collapsed`,V;t[30]!==y||t[31]!==f||t[32]!==T||t[33]!==g||t[34]!==D||t[35]!==x||t[36]!==B||t[37]!==k||t[38]!==m?(V={state:B,open:T,setOpen:D,isMobile:f,openMobile:g,setOpenMobile:_,toggleSidebar:k,width:m,setWidth:h,isDraggingRail:y,setIsDraggingRail:b,showPushPulse:x,setShowPushPulse:S,notifySidebarFileSelected:j},t[30]=y,t[31]=f,t[32]=T,t[33]=g,t[34]=D,t[35]=x,t[36]=B,t[37]=k,t[38]=m,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==m?(H={"--sidebar-width":m,"--sidebar-width-icon":CD,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Gi(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let ee;return t[50]!==V||t[51]!==G?(ee=(0,Z.jsx)(AD.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=ee):ee=t[52],ee}function PD(e){return!e}function FD(e){return!e}function ID(e){let t=(0,$.c)(51),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offcanvas`:s,{isMobile:d,state:f,openMobile:p,isDraggingRail:m}=MD();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Gi(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e||t[12]!==l?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,"data-variant":l,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=l,t[13]=a):a=t[13],a}if(d){let e=p?`expanded`:`collapsed`,a=l===`floating`||l===`inset`?`p-2`:``,o;t[14]!==r||t[15]!==a?(o=Gi(`fixed inset-y-0 z-30 flex h-svh w-(--sidebar-width)`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`data-[side=left]:left-0 data-[side=right]:right-0`,`group-data-[state=collapsed]:data-[side=left]:-translate-x-full`,`group-data-[state=collapsed]:data-[side=right]:translate-x-full`,a,r),t[14]=r,t[15]=a,t[16]=o):o=t[16];let s;t[17]===n?s=t[18]:(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[17]=n,t[18]=s);let u;t[19]!==i||t[20]!==c||t[21]!==o||t[22]!==s?(u=(0,Z.jsx)(`nav`,{id:TD,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:o,...i,children:s}),t[19]=i,t[20]=c,t[21]=o,t[22]=s,t[23]=u):u=t[23];let d;return t[24]!==e||t[25]!==c||t[26]!==u||t[27]!==l?(d=(0,Z.jsx)(`div`,{className:`group peer text-sidebar-foreground`,"data-state":e,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-mobile":`true`,children:u}),t[24]=e,t[25]=c,t[26]=u,t[27]=l,t[28]=d):d=t[28],d}let h=f===`collapsed`?u:``,g=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,_;t[29]===g?_=t[30]:(_=Gi(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,g,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`),t[29]=g,t[30]=_);let v;t[31]===_?v=t[32]:(v=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:_}),t[31]=_,t[32]=v);let y=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,b;t[33]!==r||t[34]!==y?(b=Gi(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex`,y,`group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:!duration-0`,r),t[33]=r,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n?x=t[37]:(x=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border`,children:n}),t[36]=n,t[37]=x);let S;t[38]!==i||t[39]!==c||t[40]!==x||t[41]!==b?(S=(0,Z.jsx)(`nav`,{id:TD,"aria-label":`File sidebar`,"data-slot":`sidebar-container`,"data-side":c,className:b,...i,children:x}),t[38]=i,t[39]=c,t[40]=x,t[41]=b,t[42]=S):S=t[42];let C;return t[43]!==m||t[44]!==c||t[45]!==f||t[46]!==S||t[47]!==h||t[48]!==v||t[49]!==l?(C=(0,Z.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":f,"data-collapsible":h,"data-variant":l,"data-side":c,"data-slot":`sidebar`,"data-dragging":m,children:[v,S]}),t[43]=m,t[44]=c,t[45]=f,t[46]=S,t[47]=h,t[48]=v,t[49]=l,t[50]=C):C=t[50],C}function LD(e){let t=(0,$.c)(18),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a,state:o}=MD(),s=o===`expanded`,c=o===`expanded`?`Hide Files`:`Show Files`,l;t[4]===n?l=t[5]:(l=Gi(n),t[4]=n,t[5]=l);let u;t[6]!==r||t[7]!==a?(u=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=u):u=t[8];let d;t[9]===o?d=t[10]:(d=o===`expanded`?(0,Z.jsx)(U,{}):(0,Z.jsx)(Rc,{}),t[9]=o,t[10]=d);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Z.jsx)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":TD,"aria-label":c,className:l,onClick:u,...i,children:d}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function RD(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,enableDrag:a,enableToggle:o,onMouseDown:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?!0:a,c=o===void 0?!0:o,{toggleSidebar:l,setWidth:u,state:d,width:f,setIsDraggingRail:p}=MD(),m=d===`collapsed`,h;t[6]!==s||t[7]!==c||t[8]!==p||t[9]!==u||t[10]!==m||t[11]!==l||t[12]!==f?(h={direction:`right`,enableDrag:s,enableToggle:c,onResize:u,onToggle:l,currentWidth:f,isCollapsed:m,minResizeWidth:ED,maxResizeWidth:DD,setIsDraggingRail:p,widthCookieName:OD,widthCookieMaxAge:xD},t[6]=s,t[7]=c,t[8]=p,t[9]=u,t[10]=m,t[11]=l,t[12]=f,t[13]=h):h=t[13];let{dragRef:g,handleMouseDown:_}=vD(h),v=d===`expanded`?`Hide Files`:`Show Files`,y;t[14]!==_||t[15]!==r?(y=e=>{r?.(e),e.defaultPrevented||_(e)},t[14]=_,t[15]=r,t[16]=y):y=t[16];let b=d===`expanded`?`Hide Files`:`Show Files`,x;t[17]===n?x=t[18]:(x=Gi(`absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2`,`in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,`md:group-data-[variant=inset]:after:inset-y-5`,n),t[17]=n,t[18]=x);let S;return t[19]!==g||t[20]!==i||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==x?(S=(0,Z.jsx)(`button`,{ref:g,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":v,tabIndex:-1,onMouseDown:y,title:b,className:x,...i}),t[19]=g,t[20]=i,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S):S=t[25],S}function zD(e){let t=(0,$.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onClick:i,onAnimationEnd:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{isMobile:o,openMobile:s,setOpenMobile:c,showPushPulse:l,setShowPushPulse:u}=MD(),d;t[5]!==o||t[6]!==i||t[7]!==s||t[8]!==c?(d=e=>{i?.(e),!e.defaultPrevented&&(!o||!s||e.target?.closest(`[data-sidebar="trigger"]`)||c(!1))},t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=d):d=t[9];let f=d,p;t[10]!==r||t[11]!==u?(p=e=>{r?.(e),e.animationName===`sidebar-push-pulse`&&u(!1)},t[10]=r,t[11]=u,t[12]=p):p=t[12];let m=p,h=l?``:void 0,g;t[13]===n?g=t[14]:(g=Gi(`relative flex w-full flex-1 flex-col bg-background peer-data-[variant=inset]:m-2 peer-data-[variant=inset]:ml-0 peer-data-[variant=inset]:rounded-xl peer-data-[variant=inset]:shadow-sm peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2`,`transition-transform duration-200 ease-linear motion-reduce:transition-none`,`peer-data-[mobile=true]:peer-data-[state=expanded]:translate-x-(--sidebar-width)`,n),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==f||t[17]!==a||t[18]!==h||t[19]!==g?(_=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,"data-push-pulse":h,onClick:f,onAnimationEnd:m,className:g,...a}),t[15]=m,t[16]=f,t[17]=a,t[18]=h,t[19]=g,t[20]=_):_=t[20],_}function BD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function VD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex flex-col gap-2 p-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-footer`,"data-sidebar":`footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function HD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function UD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`flex w-full min-w-0 flex-col gap-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function WD(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`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 GD=na(`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 KD(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?Yi:`button`,{isMobile:m,state:h}=MD(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Gi(GD({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,Z.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,Z.jsx)(Wn,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,Z.jsx)(vr,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,Z.jsxs)(Yn,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function qD(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 JD(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 YD=1e3,XD=!1;function ZD(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function QD(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:ha(i)?a=i:(a=void 0,XD||(XD=!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`&&(ZD({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=JD(i),{current:c,crossDoc:l}=a?ua(a,n,Date.now()):{current:[],crossDoc:[]},u=$D,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>qD(e.current,p)&&qD(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,YD);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 $D(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var eO=`sync-status`;function tO(e,t){let n=(0,$.c)(4),r=(0,Q.useRef)(!1),i=(0,Q.useRef)(!1),a=(0,Q.useRef)(t),o,s;n[0]!==t||n[1]!==e?(o=()=>{a.current!==t&&(a.current=t,r.current=!1,i.current=!1),t&&(e===`synced`&&(r.current=!0),e===`disconnected`&&r.current?(i.current=!0,Y.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:eO,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,Y.success(`Reconnected`,{id:eO,duration:3e3})))},s=[e,t],n[0]=t,n[1]=e,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,Q.useEffect)(o,s)}var nO=4,rO=3,iO={Bird:Zs,Cat:rc,Dog:mc,Fish:vc,Mouse:Gc,Rabbit:Wc,Shrimp:$c,Snail:el,Squirrel:rl,Turtle:cl};Object.freeze(Object.keys(iO));function aO(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(iO,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var oO={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function sO(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=aO(n),o=a.kind===`animal`?iO[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Tr(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Xn(n.color),t[2]=n.color,t[3]=l);let u=l,d=i>1?`${n.name} · ${i} tabs`:n.name,f=i>1?`${n.name}, ${i} concurrent tabs`:n.name,p;t[4]===n.color?p=t[5]:(p={backgroundColor:n.color},t[4]=n.color,t[5]=p);let m;t[6]!==o||t[7]!==u||t[8]!==c?(m=o?(0,Z.jsx)(o,{size:18,color:u,strokeWidth:1.5}):(0,Z.jsx)(`span`,{className:`font-mono text-2xs font-semibold leading-none`,style:{color:u},children:c}),t[6]=o,t[7]=u,t[8]=c,t[9]=m):m=t[9];let h;t[10]!==f||t[11]!==r||t[12]!==p||t[13]!==m?(h=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(`div`,{"data-presence-badge":`human`,"data-presence-mode":r,role:`img`,"aria-label":f,className:`inline-flex size-7 shrink-0 cursor-default items-center justify-center rounded-full ring-2 ring-background`,style:p,children:m})}),t[10]=f,t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===d?g=t[16]:(g=(0,Z.jsx)(vr,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(Yn,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function cO(e){let t=oO[e.icon];return e.displayName||t||`Agent`}function lO(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 uO(e){let t=(0,$.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=cO(o),t[0]=o,t[1]=c);let l=c,u=lO(o.mode),d=!r&&u,f=i?`ring-primary ring-offset-2 ring-offset-background`:`ring-background`,p=d&&!i?`ring-primary/40 animate-pulse`:``,m;t[2]!==f||t[3]!==p?(m=[`inline-flex size-7 shrink-0 items-center justify-center rounded-full ring-2 cursor-pointer`,f,p].filter(Boolean),t[2]=f,t[3]=p,t[4]=m):m=t[4];let h=m.join(` `),g=r?`true`:void 0,_=i?`true`:void 0,v;t[5]!==o.mode||t[6]!==g||t[7]!==_?(v={"data-presence-badge":`agent`,"data-presence-mode":o.mode,"data-presence-crossdoc":g,"data-presence-scoped":_},t[5]=o.mode,t[6]=g,t[7]=_,t[8]=v):v=t[8];let y=v,b=o.currentDoc&&o.currentDoc!==`(connected)`?o.currentDoc:null,x=r&&b?`Open activity panel for ${l}, editing ${b}`:`Open activity panel for ${l}`,S;t[9]===o.color?S=t[10]:(S={backgroundColor:o.color},t[9]=o.color,t[10]=S);let C;t[11]!==s||t[12]!==a?(C=()=>a(s),t[11]=s,t[12]=a,t[13]=C):C=t[13];let w;t[14]===o.icon?w=t[15]:(w=(0,Z.jsx)(pa,{icon:o.icon,width:16,height:16,className:`text-white`}),t[14]=o.icon,t[15]=w);let T;t[16]!==x||t[17]!==y||t[18]!==h||t[19]!==w||t[20]!==S||t[21]!==C?(T=(0,Z.jsx)(`button`,{type:`button`,...y,"aria-label":x,className:h,style:S,onClick:C,children:w}),t[16]=x,t[17]=y,t[18]=h,t[19]=w,t[20]=S,t[21]=C,t[22]=T):T=t[22];let E=T,D;t[23]===E?D=t[24]:(D=(0,Z.jsx)(Wn,{asChild:!0,children:E}),t[23]=E,t[24]=D);let O;t[25]===l?O=t[26]:(O=(0,Z.jsx)(`span`,{className:`font-medium`,children:l}),t[25]=l,t[26]=O);let k;t[27]!==r||t[28]!==b?(k=r&&b?(0,Z.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`editing [[`,b,`]]`]}):null,t[27]=r,t[28]=b,t[29]=k):k=t[29];let A;t[30]!==O||t[31]!==k?(A=(0,Z.jsxs)(vr,{className:`flex flex-col gap-0.5`,children:[O,k]}),t[30]=O,t[31]=k,t[32]=A):A=t[32];let j;return t[33]!==D||t[34]!==A?(j=(0,Z.jsxs)(Yn,{children:[D,A]}),t[33]=D,t[34]=A,t[35]=j):j=t[35],j}function dO(e){let t=(0,$.c)(18),{count:n,remainder:r,crossDoc:i,scopedAgentId:a,onClickAgent:o}=e,s=i?`true`:void 0,c=`${n} more ${i?`cross-doc `:``}${n===1?`participant`:`participants`}`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`presence-overflow`,"data-presence-crossdoc":s,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[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u;if(t[4]!==i||t[5]!==o||t[6]!==r||t[7]!==a){let e;t[9]!==i||t[10]!==o||t[11]!==a?(e=e=>e.kind===`human`?(0,Z.jsx)(sO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uO,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[9]=i,t[10]=o,t[11]=a,t[12]=e):e=t[12],u=r.map(e),t[4]=i,t[5]=o,t[6]=r,t[7]=a,t[8]=u}else u=t[8];let d;t[13]===u?d=t[14]:(d=(0,Z.jsx)(Be,{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:u})}),t[13]=u,t[14]=d);let f;return t[15]!==l||t[16]!==d?(f=(0,Z.jsxs)(Ft,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function fO(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(sO,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(uO,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function pO(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=ft(),{current:s,crossDoc:c}=QD(t,r,n);if(tO(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,nO),n;e[6]===s?n=e[7]:(n=s.slice(nO),e[6]=s,e[7]=n);let r=n,u=c.slice(0,rO),d;e[8]===c?d=e[9]:(d=c.slice(rO),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>fO(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)(dO,{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=>fO(e,p,!0,m)),f.length>0?(0,Z.jsx)(dO,{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 mO=`.md`,hO=/\.(md|mdx)$/i;function gO(e,t=mO){return`${e}${t}`}function _O(e){return FO(e).replace(hO,``)}function vO(e){return Or(e)?xO(e.path):Jn(e)?e.path:gO(e.docName,e.docExt)}function yO(e){let t=FO(e).match(hO);return t?`.${t[1].toLowerCase()}`:void 0}function bO(e){return FO(e)}function xO(e){let t=FO(e.trim());return t?`${t}/`:``}function SO(e){return e.endsWith(`/`)?bO(e):_O(e)}function CO(e){return e.map(vO)}function wO(e){return[...e].sort().join(`\0`)}function TO(e){return wO(CO(e))}function EO(e){let t=new Set;for(let n of e){if(Or(n)){let e=xO(n.path);e&&t.add(e)}let e=(Or(n)||Jn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Or(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function DO(e){if(!e)return[];let t=FO(e.replace(hO,``)).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 OO(e){let t=e.kind===`directory`,n=t?bO(e.path):_O(e.path),r=t?void 0:yO(e.path);return{kind:t?`folder`:`file`,name:FO(PO(e.path)).replace(hO,``),path:n,treePath:AO(e.path,t),docExt:r}}function kO(e){return e.kind===`directory`?bO(e.path):e.path}function AO(e,t){return t?xO(e):hO.test(e)?e:`${e}${mO}`}function jO(e,t,n){let r=xO(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}${mO}`;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 MO(e,t){return e===`file`?AO(t,!1):`${bO(t)}/index${mO}`}function NO(e,t){return t.kind===`root`||t.directoryPath==null?PO(e):`${t.directoryPath}${PO(e)}`}function PO(e){let t=FO(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function FO(e){return e.endsWith(`/`)?e.slice(0,-1):e}function IO(e,t){return t.trim()}function LO(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function RO(e,t){let n=IO(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function zO(e,t,n=[]){if(t.length===0&&n.length===0)return e;let r=new Map(t.map(e=>[e.fromDocName,e.toDocName]));return e.map(e=>Mi(e)?{...e,docName:r.get(e.docName)??e.docName}:Or(e)||Jn(e)?{...e,path:GO(e.path,n)}:e)}function BO(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Mi(e)?!r.has(e.docName)&&!YO(e.docName,n):Or(e)||Jn(e)?!YO(e.path,n):!0)}function VO(e,t,n,r=new Date().toISOString()){let i=!1,a=[...e],o=e=>{a.some(t=>KO(t,e))||(a.push(e),i=!0)};if(n.kind===`file`){let s=e.find(e=>Mi(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=>Or(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(Mi(i)){let e=JO(i.docName,t.path,n.path);e&&c.has(e)&&o({...i,docName:e,modified:r});continue}if(Or(i)){let e=qO(i.path,t.path,n.path);e&&o({...i,path:e,modified:r})}}return i?a:e}function HO(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function UO(e,t){return e.flatMap(e=>t===e.toDocName?[e.fromDocName]:[e.fromDocName,e.toDocName])}function WO(e,t){let n=e.kind===`folder`||e.docExt===void 0?e.path:gO(e.path,e.docExt);return wh(t.contentDir,n,t.pathSeparator)}function GO(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 KO(e,t){return Mi(e)&&Mi(t)?e.docName===t.docName:Or(e)&&Or(t)||Jn(e)&&Jn(t)?e.path===t.path:!1}function qO(e,t,n){return e===t?n:JO(e,t,n)}function JO(e,t,n){return e.startsWith(`${t}/`)?`${n}${e.slice(t.length)}`:null}function YO(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function XO(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)(mu,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function ZO(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(hu,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function QO(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)(Su,{"data-slot":`context-menu-sub`,...n}),t[2]=n,t[3]=r),r}function $O(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(gu,{children:(0,Z.jsx)(_u,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ek(e){let t=(0,$.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Gi(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,Z.jsx)(vu,{"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 tk(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Gi(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(Wo,{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)(Cu,{"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 nk(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:duration-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(wu,{"data-slot":`context-menu-sub-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rk(e){let t=(0,$.c)(15),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:i,children:r,checked:n,inset:a,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===i?s=t[7]:(s=Gi(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,i),t[6]=i,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(`span`,{className:`pointer-events-none absolute right-2`,children:(0,Z.jsx)(bu,{children:(0,Z.jsx)(Jt,{})})}),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)(yu,{"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 ik(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Gi(`-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)(xu,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ak=[`.md`,`.mdx`],ok=`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`,sk=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,ck=Gi(sk,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),lk=`flex h-full min-w-0 flex-1 cursor-pointer items-center overflow-hidden px-3 text-left text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,uk=`mr-1.5 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none transition hover:bg-foreground/10 hover:text-foreground hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:opacity-100`;function dk(e){return Gi(uk,e?`opacity-100`:`pointer-events-none opacity-0 group-focus-within:pointer-events-auto group-focus-within:opacity-100 group-hover:pointer-events-auto group-hover:opacity-100`)}function fk(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function pk(e){let t=qr(e);window.location.hash!==t&&(window.location.hash=t)}function mk(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function hk(e,t){let n=[t,...ak].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 gk(e){let t=(0,$.c)(26),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({tabId:o,disabled:n,ref:r,style:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]!==n||t[7]!==o?(s={id:o,disabled:n},t[6]=n,t[7]=o,t[8]=s):s=t[8];let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Pa(s),m;t[9]===d?m=t[10]:(m=ba.Transform.toString(d),t[9]=d,t[10]=m);let h=p?.5:i?.opacity,g=p?1:i?.zIndex,_;t[11]!==i||t[12]!==m||t[13]!==h||t[14]!==g||t[15]!==f?(_={...i,transform:m,transition:f,opacity:h,zIndex:g},t[11]=i,t[12]=m,t[13]=h,t[14]=g,t[15]=f,t[16]=_):_=t[16];let v=_,y;t[17]!==r||t[18]!==u?(y=function(e){u(e),typeof r==`function`?r(e):r&&`current`in r&&(r.current=e)},t[17]=r,t[18]=u,t[19]=y):y=t[19];let b=y,x;return t[20]!==c||t[21]!==b||t[22]!==l||t[23]!==a||t[24]!==v?(x=(0,Z.jsx)(`div`,{ref:b,style:v,...a,...c,...l}),t[20]=c,t[21]=b,t[22]=l,t[23]=a,t[24]=v,t[25]=x):x=t[25],x}function _k(e){let t=(0,$.c)(48),{children:n,closeTab:r,closeTabs:i,canPin:a,disabled:o,openTabs:s,pinTab:c,pinnedTabIds:l,tabId:u,unpinTab:d}=e,f=a===void 0?!0:a;if(o!==void 0&&o)return n;let p;t[0]!==f||t[1]!==l||t[2]!==u?(p=f&&l.includes(u),t[0]=f,t[1]=l,t[2]=u,t[3]=p):p=t[3];let m=p,h;if(t[4]!==s||t[5]!==l||t[6]!==u){let e;t[8]===u?e=t[9]:(e=e=>e!==u,t[8]=u,t[9]=e),h=Ot(s.filter(e),l),t[4]=s,t[5]=l,t[6]=u,t[7]=h}else h=t[7];let g=h,_;t[10]!==s||t[11]!==l?(_=Ot(s,l),t[10]=s,t[11]=l,t[12]=_):_=t[12];let v=_,y=l.length?`Close all unpinned`:`Close all`,b;t[13]===n?b=t[14]:(b=(0,Z.jsx)(ZO,{asChild:!0,children:n}),t[13]=n,t[14]=b);let x;t[15]!==r||t[16]!==u?(x=()=>r(u),t[15]=r,t[16]=u,t[17]=x):x=t[17];let S;t[18]!==m||t[19]!==x?(S=(0,Z.jsx)(ek,{disabled:m,onSelect:x,children:`Close`}),t[18]=m,t[19]=x,t[20]=S):S=t[20];let C=g.length===0,w;t[21]!==i||t[22]!==g?(w=()=>{i(g)},t[21]=i,t[22]=g,t[23]=w):w=t[23];let T;t[24]!==w||t[25]!==C?(T=(0,Z.jsx)(ek,{disabled:C,onSelect:w,children:`Close others`}),t[24]=w,t[25]=C,t[26]=T):T=t[26];let E=v.length===0,D;t[27]!==v||t[28]!==i?(D=()=>{i(v)},t[27]=v,t[28]=i,t[29]=D):D=t[29];let O;t[30]!==y||t[31]!==E||t[32]!==D?(O=(0,Z.jsx)(ek,{disabled:E,onSelect:D,children:y}),t[30]=y,t[31]=E,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==f||t[35]!==m||t[36]!==c||t[37]!==u||t[38]!==d?(k=f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ik,{}),(0,Z.jsx)(ek,{onSelect:()=>m?d(u):c(u),children:m?`Unpin tab`:`Pin tab`})]}),t[34]=f,t[35]=m,t[36]=c,t[37]=u,t[38]=d,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==O||t[42]!==k||t[43]!==S?(A=(0,Z.jsxs)($O,{className:`min-w-40`,children:[S,T,O,k]}),t[40]=T,t[41]=O,t[42]=k,t[43]=S,t[44]=A):A=t[44];let j;return t[45]!==A||t[46]!==b?(j=(0,Z.jsxs)(XO,{children:[b,A]}),t[45]=A,t[46]=b,t[47]=j):j=t[47],j}function vk(e){let t=(0,$.c)(14),{accessibleLabel:n,closeTab:r,isPinned:i,tabId:a,unpinTab:o}=e;if(i){let e=`Unpin ${n}`,r;t[0]!==a||t[1]!==o?(r=e=>{e.stopPropagation(),o(a)},t[0]=a,t[1]=o,t[2]=r):r=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Uc,{"aria-hidden":`true`}),t[3]=i):i=t[3];let s;return t[4]!==e||t[5]!==r?(s=(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,type:`button`,"aria-label":e,className:`mr-1.5 text-primary! hover:bg-primary/10!`,onClick:r,children:i}),t[4]=e,t[5]=r,t[6]=s):s=t[6],s}let s=`Close ${n}`,c;t[7]!==r||t[8]!==a?(c=e=>{e.stopPropagation(),r(a)},t[7]=r,t[8]=a,t[9]=c):c=t[9];let l;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Xt,{"aria-hidden":`true`}),t[10]=l):l=t[10];let u;return t[11]!==s||t[12]!==c?(u=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":s,className:`mr-1.5`,onClick:c,children:l}),t[11]=s,t[12]=c,t[13]=u):u=t[13],u}function yk(){let e=(0,$.c)(66),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:l,closeTab:u,closeTabs:d,getPoolActiveDocName:f,isNewTabActive:p,newTabIds:m,openNewTab:h,openTabs:g,pinTab:_,pinnedTabIds:v,remapTabsForRename:y,reorderTabs:b,unpinTab:x,visibleTabIds:S}=ft(),{pageMeta:C}=Zr(),T=(0,Q.useRef)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(``),[A,j]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(!1),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(t),B;e[0]!==n||e[1]!==t||e[2]!==i?(B=n??(i?Ke(i):t?_t(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=B):B=e[3];let V=B,H;e[4]!==r||e[5]!==V||e[6]!==p||e[7]!==m||e[8]!==g?(H=p?`${r??`__new-tab__`}\u0000${g.join(`\0`)}\u0000${m.join(`\0`)}`:V?`${V}\u0000${g.join(`\0`)}`:``,e[4]=r,e[5]=V,e[6]=p,e[7]=m,e[8]=g,e[9]=H):H=e[9];let U=H,W,G;e[10]===t?(W=e[11],G=e[12]):(W=()=>{z.current=t},G=[t],e[10]=t,e[11]=W,e[12]=G),(0,Q.useEffect)(W,G);let ee,te;e[13]===U?(ee=e[14],te=e[15]):(ee=()=>{U&&(T.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},te=[U],e[13]=U,e[14]=ee,e[15]=te),(0,Q.useEffect)(ee,te);let ne,re;e[16]===E?(ne=e[17],re=e[18]):(ne=()=>{E&&(F.current?.focus(),F.current?.select())},re=[E],e[16]=E,e[17]=ne,e[18]=re),(0,Q.useEffect)(ne,re);let ie,ae;e[19]!==g||e[20]!==E?(ie=()=>{!E||g.includes(E.tabId)||(L.current=!0,R.current=null,D(null),k(``),j(null),P(!1))},ae=[g,E],e[19]=g,e[20]=E,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(`/`);L.current=!1,R.current=null,D({docName:t,tabId:e}),k(n[n.length-1]),j(null)},se=function(){L.current=!0,R.current=null,D(null),k(``),j(null),P(!1)},ce=async function(){if(L.current){L.current=!1;return}if(I.current)return;let e=E?.docName;if(!e){se();return}let t=IO(`file`,hk(O,C.get(e)?.docExt??`.md`)),n=e.split(`/`),r=n[n.length-1];if(t===r){se();return}if(t===R.current){F.current?.focus();return}if(!LO(t)){j(`Name can’t be empty, ".", "..", or contain / or \\`),F.current?.focus();return}let i=RO({kind:`file`,path:e,name:r},t);I.current=!0,P(!0),j(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(L.current){P(!1),I.current=!1;return}let r=await w(n,`Server error (HTTP ${n.status})`);if(!r.ok){j(r.title),P(!1),I.current=!1,R.current=t,F.current?.focus();return}let a=M(Mr,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=z.current,c=HO(o,a);bt(a);let l=!0;try{let e=UO(a,f());await Promise.all(e.map(e=>s(e))),y(a),ci([`files`,`backlinks`,`graph`])}catch(n){let r=n;l=!1,console.warn(`[EditorTabs] post-rename reconciliation failed`,{err:r,docName:e,newDocName:i,normalized:t}),Y.error(`Rename succeeded but the tabstrip may be out of date — refresh to resync`)}L.current=!0,D(null),k(``),j(null),P(!1),I.current=!1,R.current=null,l&&c&&c!==o&&pk(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:i,normalized:t}),j(`Network error — please try again`),P(!1),I.current=!1,R.current=t,F.current?.focus()}},le=typeof window<`u`&&window.okDesktop!=null,ue;e[23]===m?ue=e[24]:(ue=new Set(m),e[23]=m,e[24]=ue);let de=ue,K;e[25]!==l||e[26]!==d||e[27]!==de?(K=function(e){let t=[],n=[];for(let r of e)de.has(r)?n.push(r):t.push(r);t.length>0&&d(t);for(let e of n)l(e)},e[25]=l,e[26]=d,e[27]=de,e[28]=K):K=e[28];let fe=K,pe;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(pe={activationConstraint:{distance:8}},e[29]=pe):pe=e[29];let me;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(me={coordinateGetter:mo},e[30]=me):me=e[30];let he=Vo(Va(Aa,pe),Va(Da,me)),ge;e[31]!==b||e[32]!==S?(ge=function(e){let t=String(e.active.id),n=e.over?String(e.over.id):null;if(!n||t===n)return;let r=S.indexOf(t),i=S.indexOf(n);r<0||i<0||r===i||b(go([...S],r,i),t)},e[31]=b,e[32]=S,e[33]=ge):ge=e[33];let _e=ge,ve=le?``:void 0,ye;e[34]===Symbol.for(`react.memo_cache_sentinel`)?(ye=Gi(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,le&&`[-webkit-app-region:drag]`),e[34]=ye):ye=e[34];let be=mk,xe;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(xe=Gi(`flex items-end gap-1`,le&&`[-webkit-app-region:no-drag]`),e[35]=xe):xe=e[35];let Se=za,Ce=Na,we;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(we={container:typeof document<`u`?document.body:void 0},e[36]=we):we=e[36];let Te=La,Ee;e[37]===S?Ee=e[38]:(Ee=[...S],e[37]=S,e[38]=Ee);let De=va,Oe=S.map(e=>{if(de.has(e)){let t=e===r;return(0,Z.jsx)(_k,{tabId:e,canPin:!1,openTabs:S,closeTab:l,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsxs)(gk,{tabId:e,"aria-current":t?`page`:void 0,"data-active-tab":t?`true`:void 0,className:Gi(ok,t?sk:ck),onAuxClick:t=>{t.button===1&&(t.preventDefault(),l(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Activate new tab`,className:lk,onClick:()=>o(e),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:`New tab`})}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close new tab`,className:dk(t),onClick:t=>{t.stopPropagation(),l(e)},children:(0,Z.jsx)(Xt,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let t=ct(e),n=e===V,i=v.includes(e);if(t.kind===`folder`){let{baseName:r,label:o,prefix:s}=Xe(t.folderPath,`/`),c=`${s}${o}`;return(0,Z.jsx)(_k,{tabId:e,openTabs:S,closeTab:u,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsxs)(gk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(ok,n?sk:ck),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:lk,onClick:()=>{a(e)},children:[s&&(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate`,n&&`text-muted-foreground`),children:s}),(0,Z.jsxs)(`span`,{className:Gi(`flex min-w-0 items-center`,s?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:r}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(vk,{accessibleLabel:c,closeTab:u,isPinned:i,tabId:e,unpinTab:x})]})},e)}if(t.kind===`asset`){let{baseName:r,label:o,prefix:s}=Xe(t.assetPath,``),c=`${s}${o}`;return(0,Z.jsx)(_k,{tabId:e,openTabs:S,closeTab:u,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsxs)(gk,{tabId:e,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(ok,n?sk:ck),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":c,className:lk,onClick:()=>{a(e)},children:[s?(0,Z.jsx)(`span`,{className:Gi(`min-w-0 flex-1 truncate text-muted-foreground/60`,n&&`text-muted-foreground`),children:s}):null,(0,Z.jsx)(`span`,{className:Gi(`min-w-0 truncate`,s?`max-w-[70%] shrink-0`:`flex-1`),children:r})]}),(0,Z.jsx)(vk,{accessibleLabel:c,closeTab:u,isPinned:i,tabId:e,unpinTab:x})]})},e)}let s=t.docName,c=C.get(s)?.docExt??`.md`,{baseName:d,extension:f,label:p,prefix:m}=Xe(s,c),h=`${m}${p}`,g=c===`.md`||c===`.mdx`,y=E?.tabId===e,b=`editor-tab-rename-error-${fk(s)}`;return(0,Z.jsx)(_k,{disabled:y,tabId:e,openTabs:S,closeTab:u,closeTabs:fe,pinTab:_,pinnedTabIds:v,unpinTab:x,children:(0,Z.jsx)(gk,{tabId:e,disabled:y,"aria-current":n?`page`:void 0,"data-active-tab":n?`true`:void 0,className:Gi(ok,n?sk:ck,y&&A&&`border-destructive`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!i&&u(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(QC,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(rw,{ref:F,value:O,disabled:N,"aria-label":`Rename ${p}`,"aria-invalid":A?!0:void 0,"aria-describedby":A?b:void 0,"aria-busy":N||void 0,title:A??s,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{k(hk(e.target.value,c)),j(null),R.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ce()):e.key===`Escape`&&(e.preventDefault(),se())},onBlur:ce}),(0,Z.jsx)(ew,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(nw,{className:`text-muted-foreground/60 text-xs`,children:c})})]}),A?(0,Z.jsx)(`span`,{id:b,role:`alert`,className:`sr-only`,children:A}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":h,title:h,className:lk,onClick:()=>{a(e)},onDoubleClick:t=>{t.preventDefault(),t.stopPropagation(),oe(e,s)},children:(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),!g&&(0,Z.jsx)(`span`,{className:`shrink-0`,children:f})]})}),(0,Z.jsx)(vk,{accessibleLabel:h,closeTab:u,isPinned:i,tabId:e,unpinTab:x})]})})},e)}),ke;e[39]!==Te||e[40]!==Ee||e[41]!==De||e[42]!==Oe?(ke=(0,Z.jsx)(Te,{items:Ee,strategy:De,children:Oe}),e[39]=Te,e[40]=Ee,e[41]=De,e[42]=Oe,e[43]=ke):ke=e[43];let Ae;e[44]!==Se||e[45]!==_e||e[46]!==he||e[47]!==Ce||e[48]!==we||e[49]!==ke?(Ae=(0,Z.jsx)(Se,{sensors:he,collisionDetection:Ce,onDragEnd:_e,accessibility:we,children:ke}),e[44]=Se,e[45]=_e,e[46]=he,e[47]=Ce,e[48]=we,e[49]=ke,e[50]=Ae):Ae=e[50];let je;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Z.jsx)(c,{"aria-hidden":`true`}),e[51]=je):je=e[51];let Me;e[52]===h?Me=e[53]:(Me=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`New tab`,className:`first:mb-3 mb-1.5`,onClick:h,children:je})}),e[52]=h,e[53]=Me);let Ne;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,Z.jsx)(vr,{children:`New tab`}),e[54]=Ne):Ne=e[54];let Pe;e[55]===Me?Pe=e[56]:(Pe=(0,Z.jsxs)(Yn,{children:[Me,Ne]}),e[55]=Me,e[56]=Pe);let Fe;e[57]!==xe||e[58]!==Ae||e[59]!==Pe?(Fe=(0,Z.jsxs)(`div`,{className:xe,children:[Ae,Pe]}),e[57]=xe,e[58]=Ae,e[59]=Pe,e[60]=Fe):Fe=e[60];let Ie;return e[61]!==ve||e[62]!==ye||e[63]!==be||e[64]!==Fe?(Ie=(0,Z.jsx)(`div`,{ref:T,"data-electron-drag":ve,className:ye,onWheel:be,children:Fe}),e[61]=ve,e[62]=ye,e[63]=be,e[64]=Fe,e[65]=Ie):Ie=e[65],Ie}function bk(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 xk(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 Sk=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:tt},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Hd},{label:`Website`,href:`https://openknowledge.ai/`,icon:ni},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:bk},{label:`Twitter`,href:`https://x.com/inkeep`,icon:xk}],Ck=()=>{let e=(0,$.c)(5),[t,n]=(0,Q.useState)(!1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(s,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Resources`})]})})}),(0,Z.jsx)(vr,{children:`Resources`})]}),e[0]=r):r=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`p`,{className:`font-mono tracking-wide uppercase text-muted-foreground text-xs mb-1`,children:`Resources`}),e[1]=i):i=e[1];let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(Be,{align:`end`,className:`w-64 p-3`,children:[i,(0,Z.jsx)(`nav`,{"aria-label":`Resources`,children:(0,Z.jsx)(`ul`,{className:`space-y-0.5`,children:Sk.map(wk)})})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Z.jsxs)(Ft,{open:t,onOpenChange:n,children:[r,a]}),e[3]=t,e[4]=o),o};function wk(e){let{label:t,href:n,icon:r}=e;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Ra(e,n),onAuxClick:e=>Ra(e,n),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)(r,{"aria-hidden":`true`,className:`size-4 shrink-0`}),t]})},n)}function Tk(e){let t=(0,$.c)(60),{input:n}=e,{states:r,refresh:i}=Xh(),{dispatch:a}=zh(),[o,s]=(0,Q.useState)(!1),c=typeof window<`u`&&window.okDesktop!=null,l;t[0]===i?l=t[1]:(l=e=>{s(e),e&&i()},t[0]=i,t[1]=l);let u=l,d=n===null,f;t[2]===n?f=t[3]:(f=n!==null&&n.docContext!==null?Yr(n.docContext.relativePath):``,t[2]=n,t[3]=f);let p=f,m;t[4]!==a||t[5]!==n?(m=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=m):m=t[6];let h=m,g,_,v,y,b,x,S,C,w,T,E,D;if(t[7]!==u||t[8]!==h||t[9]!==n||t[10]!==o||t[11]!==p||t[12]!==r||t[13]!==d){let e;t[26]===r?e=t[27]:(e=e=>r[e.id]?.installed===!0,t[26]=r,t[27]=e);let i=Um.filter(e);v=r[`claude-code`]?.installed===!0;let a;t[28]!==n||t[29]!==p?(a=()=>{n!==null&&hS(p)},t[28]=n,t[29]=p,t[30]=a):a=t[30],y=a,_=qa,D=o,b=u;let s;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(fa,{className:`size-4`}),t[31]=s):s=t[31];let l;t[32]===d?l=t[33]:(l=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(Ya,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Open with AI`,disabled:d,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:s})})}),t[32]=d,t[33]=l);let f;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vr,{children:`Open with AI`}),t[34]=f):f=t[34],t[35]===l?x=t[36]:(x=(0,Z.jsxs)(Yn,{children:[l,f]}),t[35]=l,t[36]=x),g=Ka,S=`end`,C=`min-w-[220px]`,w=`open-in-agent-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(Oa,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open with AI`}),t[37]=T):T=t[37];let m;t[38]!==h||t[39]!==p||t[40]!==r?(m=e=>{let t=r[e.id];return(0,Z.jsx)(gS,{target:e,installState:t,isElectronHost:c,prompt:p,onSelect:()=>h(e)},e.id)},t[38]=h,t[39]=p,t[40]=r,t[41]=m):m=t[41],E=i.map(m),t[7]=u,t[8]=h,t[9]=n,t[10]=o,t[11]=p,t[12]=r,t[13]=d,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S,t[21]=C,t[22]=w,t[23]=T,t[24]=E,t[25]=D}else g=t[14],_=t[15],v=t[16],y=t[17],b=t[18],x=t[19],S=t[20],C=t[21],w=t[22],T=t[23],E=t[24],D=t[25];let O;t[42]!==v||t[43]!==y||t[44]!==n?(O=v?null:(0,Z.jsxs)(Ja,{onSelect:y,disabled:n===null,"data-testid":`open-in-agent-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(je,{className:`size-4`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:`Open in claude.ai →`}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:`opens in browser`})]}),t[42]=v,t[43]=y,t[44]=n,t[45]=O):O=t[45];let k;t[46]!==g||t[47]!==O||t[48]!==S||t[49]!==C||t[50]!==w||t[51]!==T||t[52]!==E?(k=(0,Z.jsxs)(g,{align:S,className:C,"data-testid":w,children:[T,E,O]}),t[46]=g,t[47]=O,t[48]=S,t[49]=C,t[50]=w,t[51]=T,t[52]=E,t[53]=k):k=t[53];let A;return t[54]!==_||t[55]!==b||t[56]!==x||t[57]!==k||t[58]!==D?(A=(0,Z.jsxs)(_,{open:D,onOpenChange:b,children:[x,k]}),t[54]=_,t[55]=b,t[56]=x,t[57]=k,t[58]=D,t[59]=A):A=t[59],A}var Ek=`/api/share/publish/owners`,Dk=`/api/share/publish/name-check`,Ok=`/api/share/publish`,kk=/[A-Za-z0-9._-]/g;function Ak(e){return(e.match(kk)?.join(``)??``).replace(/[-.]{2,}/g,e=>e[0]??`-`).replace(/^[-.]+/,``).replace(/[-.]+$/,``)}function jk(e){if(!e)return``;let t=e.replace(/[/\\]+$/g,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n<0?t:t.slice(n+1)}function Mk(e){return`https://github.com/orgs/${encodeURIComponent(e)}/policies/applications`}function Nk(e,t,n){switch(e){case`name-conflict`:return{banner:`${t}/${n} already exists. Pick a different name.`,next:{kind:`edit-name`}};case`saml-sso`:return{banner:`GitHub denied the request. You may need to authorize Open Knowledge for ${t} in your browser.`,next:{kind:`authorize-org`,authorizeUrl:Mk(t)}};case`push-failed`:return{banner:`Created ${t}/${n}, push failed.`,next:{kind:`retry-push`}};case`auth-required`:return{banner:`GitHub sign-in expired. Sign in again to continue.`,next:{kind:`reauth`}};case`init-failed`:return{banner:`Couldn't prepare this project for publish.`,next:{kind:`edit-form`}};case`network`:return{banner:`Couldn't reach GitHub. Try again?`,next:{kind:`edit-form`}};case`no-project`:return{banner:`Open a project first.`,next:{kind:`edit-form`}}}}async function Pk(e=fetch){let t=await e(Ek,{method:`GET`});if(!t.ok)throw Error(`owners transport ${t.status}`);let n=await t.json(),r=Rr.safeParse(n);if(!r.success)throw Error(`owners response shape mismatch`);return r.data}async function Fk(e,t,n=fetch){let r=await n(`${Dk}?owner=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`,{method:`GET`});if(!r.ok)throw Error(`name-check transport ${r.status}`);let i=await r.json(),a=Hr.safeParse(i);if(!a.success)throw Error(`name-check response shape mismatch`);return a.data}async function Ik(e,t=fetch){let n=await t(Ok,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok)throw Error(`publish transport ${n.status}`);let r=await n.json(),i=Wr.safeParse(r);if(!i.success)throw Error(`publish response shape mismatch`);return i.data}function Lk(e,t,n){return e.ok?e.available?{kind:`available`}:{kind:`taken`,owner:t,name:n}:e.error===`auth-required`?{kind:`error`,banner:`GitHub sign-in expired. Sign in again to continue.`}:{kind:`error`,banner:`Couldn't reach GitHub. Try again?`}}function Rk(e){return e.submitting||e.owner===null||e.sanitizedName.length===0?!1:e.nameCheck.kind===`available`}async function zk(e,t){await t.runShareAction({docName:e,hasRemote:!0,onClickWhenNoRemote:()=>{}},{clipboardWrite:t.clipboardWrite,toastSuccess:t.toastSuccess,toastError:t.toastError,logEvent:t.logEvent,fetchFn:t.fetchFn})}var Bk=`/api/share/construct-url`,Vk=`Could not construct share URL.`,Hk=`Link ready but could not copy to clipboard.`;async function Uk(e,t=fetch){let n=await t(Bk,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docPath:e})});if(!n.ok)throw Error(`construct-url transport ${n.status}`);let r=await n.json(),i=dr.safeParse(r);if(!i.success)throw Error(`construct-url response shape mismatch`);return i.data}function Wk(e,t){switch(e){case`detached-head`:return`Switch to a branch to share.`;case`branch-not-on-origin`:return t?`Push ${t} to GitHub before sharing.`:`Push this branch to GitHub before sharing.`;case`non-github-remote`:return`Sharing supports GitHub remotes only.`;case`invalid-path`:return`Can't share this path.`;case`no-remote`:return`This project has no GitHub remote.`}}async function Gk(e,t){if(!e.hasRemote)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let n=bi(e.docName),r;try{r=await Uk(n,t.fetchFn)}catch{return t.toastError(Vk),{kind:`transport-error`}}if(r.ok){try{await t.clipboardWrite(r.shareUrl)}catch{return t.toastError(Hk),t.logEvent(`[share] action=link-construct result=clipboard-failed`),{kind:`clipboard-failed`,shareUrl:r.shareUrl}}return t.toastSuccess(`Link copied.`),t.logEvent(`[share] action=link-construct`),{kind:`copied`,shareUrl:r.shareUrl,branch:r.branch}}if(r.error===`no-remote`)return e.onClickWhenNoRemote(),{kind:`opened-wizard`};let i=r.branch;return t.toastError(Wk(r.error,i)),{kind:`business-error`,error:r.error,branch:i}}var Kk=500;function qk(e){let t=(0,$.c)(105),{open:n,onOpenChange:r}=e,{_:i}=Yt(),a=Zm(),{activeDocName:o}=ft(),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(`private`),[y,b]=(0,Q.useState)(``),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x={kind:`idle`},t[0]=x):x=t[0];let[S,C]=(0,Q.useState)(x),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),j=(0,Q.useRef)(null),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P;t[1]===h?P=t[2]:(P=Ak(h),t[1]=h,t[2]=P);let F=P,I=s?.find(e=>e.login===p)??null,L;t[3]!==i||t[4]!==p?(L=async function(){u(!0),f(null);try{let e=await Pk();if(!e.ok){e.error===`auth-required`?(k(!0),f(i({id:`HP5ML3`}))):f(i({id:`UVLlMV`})),u(!1);return}c(e.owners),e.owners.length>0&&p===``&&m(e.owners[0]?.login??``)}catch{f(i({id:`UVLlMV`}))}u(!1)},t[3]=i,t[4]=p,t[5]=L):L=t[5];let R=L,B;t[6]!==R||t[7]!==n||t[8]!==s||t[9]!==p||t[10]!==a?.contentDir?(B=()=>{n&&(C({kind:`idle`}),D(null),T(!1),f(null),g(Ak(jk(a?.contentDir??``))),v(`private`),b(``),s===null?R():p===``&&s.length>0&&m(s[0]?.login??``))},t[6]=R,t[7]=n,t[8]=s,t[9]=p,t[10]=a?.contentDir,t[11]=B):B=t[11];let V;t[12]===n?V=t[13]:(V=[n],t[12]=n,t[13]=V),(0,Q.useEffect)(B,V);let H,U;t[14]!==i||t[15]!==n||t[16]!==F||t[17]!==p?(H=()=>{if(n){if(j.current!==null&&clearTimeout(j.current),p===``||F===``){C({kind:`idle`});return}return C({kind:`pending`}),j.current=setTimeout(async()=>{let e=p,t=F;M.current=`${e}|${t}`,C({kind:`checking`});try{let n=await Fk(e,t);if(M.current!==`${e}|${t}`)return;C(Lk(n,e,t))}catch{if(M.current!==`${e}|${t}`)return;C({kind:`error`,banner:i({id:`UVLlMV`})})}},Kk),()=>{j.current!==null&&(clearTimeout(j.current),j.current=null)}}},U=[n,p,F,i],t[14]=i,t[15]=n,t[16]=F,t[17]=p,t[18]=H,t[19]=U):(H=t[18],U=t[19]),(0,Q.useEffect)(H,U);let W;t[20]===R?W=t[21]:(W=function(){k(!1),f(null),R()},t[20]=R,t[21]=W);let te=W,ne=async function(){if(Rk({owner:I,sanitizedName:F,nameCheck:S,submitting:w})){T(!0),D(null);try{let e=await Ik({owner:p,name:F,visibility:_,description:y.trim().length>0?y.trim():void 0});if(e.ok){if(r(!1),o)await zk(o,{runShareAction:Gk,clipboardWrite:Qk,toastSuccess:Zk,toastError:Xk,logEvent:Yk});else{let t=e.ownerLogin,n=e.repoName;Y.success(i({id:`rEnIww`,values:{ownerLogin:t,repoName:n}}))}T(!1);return}let t=Nk(e.error,p,F);D({message:t.banner,next:t.next}),t.next.kind===`edit-name`?(N.current?.focus(),N.current?.select()):t.next.kind===`reauth`&&k(!0)}catch{D({message:i({id:`UVLlMV`}),next:{kind:`edit-form`}})}T(!1)}},re;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e){let t=window.okDesktop?.shell?.openExternal;t?t(e):window.open(e,`_blank`,`noopener`)},t[22]=re):re=t[22];let ae=re,oe;t[23]===r?oe=t[24]:(oe=function(){r(!1)},t[23]=r,t[24]=oe);let se=oe,ce=!Rk({owner:I,sanitizedName:F,nameCheck:S,submitting:w}),le;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Z.jsx)($t,{children:(0,Z.jsx)(J,{id:`qXsafh`})}),t[25]=le):le=t[25];let ue;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,Z.jsxs)(un,{children:[le,(0,Z.jsx)(Zt,{children:(0,Z.jsx)(J,{id:`Z1LF1M`})})]}),t[26]=ue):ue=t[26];let de;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Z.jsx)(ns,{htmlFor:`publish-owner`,children:(0,Z.jsx)(J,{id:`LtI9AS`})}),t[27]=de):de=t[27];let K;t[28]!==i||t[29]!==R||t[30]!==s||t[31]!==d||t[32]!==l||t[33]!==p?(K=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[de,l&&s===null?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(J,{id:`Z3FXyt`})]}):d?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-sm text-destructive`,children:d}),(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>R(),children:(0,Z.jsx)(J,{id:`6gRgw8`})})]}):(0,Z.jsxs)(G,{value:p,onValueChange:m,children:[(0,Z.jsx)(A,{id:`publish-owner`,"data-testid":`publish-owner-trigger`,"aria-label":i({id:`LtI9AS`}),children:(0,Z.jsx)(z,{placeholder:i({id:`8XQ7Ib`})})}),(0,Z.jsx)(ie,{children:(s??[]).map(Jk)})]})]}),t[28]=i,t[29]=R,t[30]=s,t[31]=d,t[32]=l,t[33]=p,t[34]=K):K=t[34];let fe;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(ns,{htmlFor:`publish-name`,children:(0,Z.jsx)(J,{id:`0xnmlQ`})}),t[35]=fe):fe=t[35];let pe,me;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(pe=e=>g(e.target.value),me=()=>{M.current=null},t[36]=pe,t[37]=me):(pe=t[36],me=t[37]);let he;t[38]===h?he=t[39]:(he=(0,Z.jsx)(Go,{id:`publish-name`,ref:N,"data-testid":`publish-name`,value:h,onChange:pe,onBlur:me,placeholder:`my-knowledge-base`,autoComplete:`off`,spellCheck:!1}),t[38]=h,t[39]=he);let ge;t[40]===F?ge=t[41]:(ge=(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:F?(0,Z.jsx)(J,{id:`Nn4GgW`,values:{sanitizedName:F},components:{0:(0,Z.jsx)(`code`,{className:`font-mono`})}}):(0,Z.jsx)(J,{id:`Oxyd5f`})}),t[40]=F,t[41]=ge);let _e;t[42]===S?_e=t[43]:(_e=(0,Z.jsx)(eA,{status:S}),t[42]=S,t[43]=_e);let ve;t[44]!==ge||t[45]!==_e?(ve=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs`,"aria-live":`polite`,children:[ge,_e]}),t[44]=ge,t[45]=_e,t[46]=ve):ve=t[46];let ye;t[47]!==he||t[48]!==ve?(ye=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[fe,he,ve]}),t[47]=he,t[48]=ve,t[49]=ye):ye=t[49];let be;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,Z.jsx)(ns,{children:(0,Z.jsx)(J,{id:`2q_Q7x`})}),t[50]=be):be=t[50];let xe;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>v(e===`public`?`public`:`private`),t[51]=xe):xe=t[51];let Se;t[52]===i?Se=t[53]:(Se=i({id:`2q_Q7x`}),t[52]=i,t[53]=Se);let Ce,we;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Z.jsx)(Fm,{value:`private`,id:`publish-visibility-private`,"data-testid":`publish-visibility-private`}),we=(0,Z.jsx)(J,{id:`zwBp5t`}),t[54]=Ce,t[55]=we):(Ce=t[54],we=t[55]);let Te;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Z.jsxs)(ns,{htmlFor:`publish-visibility-private`,className:`flex cursor-pointer items-center gap-2 rounded-md border border-input p-2 text-sm font-normal has-data-checked:border-primary`,children:[Ce,(0,Z.jsxs)(`span`,{children:[we,(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`D8OV7J`})})]})]}),t[56]=Te):Te=t[56];let Ee,De;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(Fm,{value:`public`,id:`publish-visibility-public`,"data-testid":`publish-visibility-public`}),De=(0,Z.jsx)(J,{id:`7d1a0d`}),t[57]=Ee,t[58]=De):(Ee=t[57],De=t[58]);let Oe;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,Z.jsxs)(ns,{htmlFor:`publish-visibility-public`,className:`flex cursor-pointer items-center gap-2 rounded-md border border-input p-2 text-sm font-normal has-data-checked:border-primary`,children:[Ee,(0,Z.jsxs)(`span`,{children:[De,(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:(0,Z.jsx)(J,{id:`4jDd0j`})})]})]}),t[59]=Oe):Oe=t[59];let ke;t[60]!==Se||t[61]!==_?(ke=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[be,(0,Z.jsxs)(Pm,{value:_,onValueChange:xe,className:`grid-cols-2`,"aria-label":Se,children:[Te,Oe]})]}),t[60]=Se,t[61]=_,t[62]=ke):ke=t[62];let Ae;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(ns,{htmlFor:`publish-description`,children:(0,Z.jsx)(J,{id:`Fxf4jq`})}),t[63]=Ae):Ae=t[63];let je;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>b(e.target.value),t[64]=je):je=t[64];let Me;t[65]===i?Me=t[66]:(Me=i({id:`c5rF4v`}),t[65]=i,t[66]=Me);let Ne;t[67]!==y||t[68]!==Me?(Ne=(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-1.5`,children:[Ae,(0,Z.jsx)(Ps,{id:`publish-description`,"data-testid":`publish-description`,rows:2,value:y,onChange:je,placeholder:Me})]}),t[67]=y,t[68]=Me,t[69]=Ne):Ne=t[69];let Pe;t[70]!==E||t[71]!==ae||t[72]!==ne?(Pe=E&&(0,Z.jsx)($k,{banner:E,onAuthorize:ae,onRetryPush:ne}),t[70]=E,t[71]=ae,t[72]=ne,t[73]=Pe):Pe=t[73];let Fe;t[74]!==K||t[75]!==ye||t[76]!==ke||t[77]!==Ne||t[78]!==Pe?(Fe=(0,Z.jsxs)(sn,{className:`flex flex-col gap-4`,children:[K,ye,ke,Ne,Pe]}),t[74]=K,t[75]=ye,t[76]=ke,t[77]=Ne,t[78]=Pe,t[79]=Fe):Fe=t[79];let Ie;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,Z.jsx)(J,{id:`dEgA5A`}),t[80]=Ie):Ie=t[80];let Le;t[81]===se?Le=t[82]:(Le=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,onClick:se,children:Ie}),t[81]=se,t[82]=Le);let Re;t[83]===w?Re=t[84]:(Re=w?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),` `,(0,Z.jsx)(J,{id:`Bdha5y`})]}):(0,Z.jsx)(J,{id:`iMCW9z`}),t[83]=w,t[84]=Re);let ze;t[85]!==ne||t[86]!==ce||t[87]!==Re?(ze=(0,Z.jsx)(X,{type:`button`,onClick:ne,disabled:ce,"data-testid":`publish-submit`,children:Re}),t[85]=ne,t[86]=ce,t[87]=Re,t[88]=ze):ze=t[88];let q;t[89]!==Le||t[90]!==ze?(q=(0,Z.jsxs)(cn,{children:[Le,ze]}),t[89]=Le,t[90]=ze,t[91]=q):q=t[91];let Be;t[92]!==Fe||t[93]!==q?(Be=(0,Z.jsxs)(rn,{className:`sm:max-w-lg`,showCloseButton:!1,children:[ue,Fe,q]}),t[92]=Fe,t[93]=q,t[94]=Be):Be=t[94];let Ve;t[95]!==r||t[96]!==n||t[97]!==Be?(Ve=(0,Z.jsx)(dn,{open:n,onOpenChange:r,children:Be}),t[95]=r,t[96]=n,t[97]=Be,t[98]=Ve):Ve=t[98];let He;t[99]!==O||t[100]!==te?(He=(0,Z.jsx)(od,{open:O,onOpenChange:k,onSuccess:te}),t[99]=O,t[100]=te,t[101]=He):He=t[101];let Ue;return t[102]!==Ve||t[103]!==He?(Ue=(0,Z.jsxs)(Z.Fragment,{children:[Ve,He]}),t[102]=Ve,t[103]=He,t[104]=Ue):Ue=t[104],Ue}function Jk(e){return(0,Z.jsx)(S,{value:e.login,"data-testid":`publish-owner-option-${e.login}`,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.avatarUrl?(0,Z.jsx)(`img`,{src:e.avatarUrl,alt:``,"aria-hidden":!0,className:`size-4 rounded-full`}):null,(0,Z.jsx)(`span`,{children:e.login}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.kind===`user`?(0,Z.jsx)(J,{id:`av_PD9`}):(0,Z.jsx)(J,{id:`_N2eSU`})})]})},e.login)}function Yk(e){return console.log(e)}function Xk(e){return Y.error(e)}function Zk(e){return Y.success(e)}function Qk(e){return navigator.clipboard.writeText(e)}function $k(e){let t=(0,$.c)(13),{banner:n,onAuthorize:r,onRetryPush:i}=e,a=n.next,o;t[0]===n.message?o=t[1]:(o=(0,Z.jsx)(`span`,{children:n.message}),t[0]=n.message,t[1]=o);let s;t[2]!==a.authorizeUrl||t[3]!==a.kind||t[4]!==r?(s=a.kind===`authorize-org`&&(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-authorize-org`,onClick:()=>r(a.authorizeUrl),children:[(0,Z.jsx)(J,{id:`FyW0WO`}),` `,(0,Z.jsx)(je,{className:`ml-1 size-3`,"aria-hidden":!0})]}),t[2]=a.authorizeUrl,t[3]=a.kind,t[4]=r,t[5]=s):s=t[5];let c;t[6]!==a.kind||t[7]!==i?(c=a.kind===`retry-push`&&(0,Z.jsx)(X,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,"data-testid":`publish-retry-push`,onClick:i,children:(0,Z.jsx)(J,{id:`NOHyEE`})}),t[6]=a.kind,t[7]=i,t[8]=c):c=t[8];let l;return t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,Z.jsxs)(`div`,{role:`alert`,"data-testid":`publish-banner`,className:`flex flex-col gap-2 rounded-md border border-destructive/50 bg-destructive/5 p-3 text-sm`,children:[o,s,c]}),t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12],l}function eA(e){let t=(0,$.c)(12),{status:n}=e;if(n.kind===`available`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(xi,{className:`size-3.5`,"aria-hidden":!0}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`available`,className:`flex items-center gap-1 text-emerald-600 dark:text-emerald-400`,children:[e,` `,(0,Z.jsx)(J,{id:`csDS2L`})]}),t[1]=n):n=t[1],n}if(n.kind===`taken`){let{owner:e,name:r}=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0}),t[2]=i):i=t[2];let a;return t[3]!==r||t[4]!==e?(a=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":`taken`,className:`flex items-center gap-1 text-destructive`,children:[i,` `,(0,Z.jsx)(J,{id:`LRgZAt`,values:{owner:e,name:r}})]}),t[3]=r,t[4]=e,t[5]=a):a=t[5],a}if(n.kind===`checking`||n.kind===`pending`){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ee,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),t[6]=e):e=t[6];let r;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(J,{id:`pWT04I`}),t[7]=r):r=t[7];let i;return t[8]===n.kind?i=t[9]:(i=(0,Z.jsxs)(`span`,{"data-testid":`publish-name-check`,"data-status":n.kind,className:`flex items-center gap-1 text-muted-foreground`,children:[e,` `,r]}),t[8]=n.kind,t[9]=i),i}if(n.kind===`error`){let e;return t[10]===n.banner?e=t[11]:(e=(0,Z.jsx)(`span`,{"data-testid":`publish-name-check`,"data-status":`error`,className:`text-destructive`,children:n.banner}),t[10]=n.banner,t[11]=e),e}return null}var tA=50,nA=()=>{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,zC.preload()},tA))},e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{t.current!==null&&(clearTimeout(t.current),t.current=null)},e[1]=i):i=e[1];let a=i,o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>()=>{t.current!==null&&clearTimeout(t.current)},s=[],e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,Q.useEffect)(o,s);let c,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{a(),window.location.hash!==`#settings`&&(window.location.hash=Wm)},l=(0,Z.jsx)(Zc,{className:`size-4`}),e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,"data-testid":`header-settings-button`,onMouseEnter:r,onMouseLeave:a,onFocus:r,onBlur:a,onClick:c,children:[l,(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]})}),e[6]=u):u=e[6];let d;return e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsxs)(Yn,{children:[u,(0,Z.jsx)(vr,{children:(0,Z.jsx)(J,{id:`Tz0i8g`})})]}),e[7]=d):d=e[7],d};function rA(e){let t=(0,$.c)(12),{onClickWhenNoRemote:n}=e,{activeDocName:r}=ft(),{status:i}=bo(),[a,o]=(0,Q.useState)(!1);if(!r)return null;let s=i?.hasRemote===!0,c;t[0]!==r||t[1]!==a||t[2]!==s||t[3]!==n?(c=async function(){if(!a&&r){o(!0);try{await Gk({docName:r,hasRemote:s,onClickWhenNoRemote:n},{clipboardWrite:sA,toastSuccess:oA,toastError:aA,logEvent:iA})}catch{Y.error(`Could not construct share URL.`)}o(!1)}},t[0]=r,t[1]=a,t[2]=s,t[3]=n,t[4]=c):c=t[4];let l=c,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Qc,{className:`size-3.5`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;t[6]!==a||t[7]!==l?(d=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`sm`,"aria-label":`Share doc`,onClick:l,disabled:a,className:`gap-1.5 text-muted-foreground px-1.5`,"data-testid":`share-button`,children:[u,`Share`]})}),t[6]=a,t[7]=l,t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vr,{children:`Share`}),t[9]=f):f=t[9];let p;return t[10]===d?p=t[11]:(p=(0,Z.jsxs)(Yn,{children:[d,f]}),t[10]=d,t[11]=p),p}function iA(e){return console.log(e)}function aA(e){return Y.error(e)}function oA(e){return Y.success(e)}function sA(e){return navigator.clipboard.writeText(e)}function cA(e){if(!e)return`never`;let t=Date.now()-new Date(e).getTime();return t<6e4?`just now`:t<36e5?`${Math.floor(t/6e4)} min ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:new Date(e).toLocaleDateString()}async function lA(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function uA(e){let t=(0,$.c)(9),{status:n}=e;switch(n.state){case`dormant`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sc,{className:`size-3.5 text-muted-foreground`}),t[0]=e):e=t[0],e}case`idle`:{if(n.ahead>0||n.behind>0){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Kc,{className:`size-3.5 text-muted-foreground`}),t[1]=e):e=t[1],e}let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sc,{className:`size-3.5 text-muted-foreground`}),t[2]=e):e=t[2],e}case`fetching`:case`pulling`:case`pushing`:{let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Kc,{className:`size-3.5 text-muted-foreground animate-spin`}),t[3]=e):e=t[3],e}case`conflict`:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ei,{className:`size-3.5 text-amber-500`}),t[4]=e):e=t[4],e}case`offline`:{let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(oc,{className:`size-3.5 text-muted-foreground`}),t[5]=e):e=t[5],e}case`auth-error`:{let e;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Pc,{className:`size-3.5 text-destructive`}),t[6]=e):e=t[6],e}case`disabled`:{let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ei,{className:`size-3.5 text-amber-500`}),t[7]=e):e=t[7],e}default:{let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(sc,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function dA(e){switch(e.state){case`idle`:return e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function fA(e){switch(e){case`dormant`:return`No git remote`;case`idle`:return`Synced`;case`fetching`:return`Fetching`;case`pulling`:return`Pulling`;case`pushing`:return`Pushing`;case`conflict`:return`Conflict`;case`offline`:return`Offline`;case`auth-error`:return`Sign in required`;case`disabled`:return`Sync disabled`;default:return e}}function pA(e){switch(e){case`external-changes-pending`:return`External changes pending`;case`dirty-tree`:return`Working tree has uncommitted changes`;case`detached-head`:return`Detached HEAD — checkout a branch to resume`;case`auth-error`:return`Sign in required`;case`protected-branch`:return`Protected branch — cannot push`;default:return e}}function mA(e){return e.syncEnabled?e.state===`idle`?e.ahead>0&&e.behind>0?`${e.ahead} ahead, ${e.behind} behind`:e.ahead>0?`${e.ahead} ahead`:e.behind>0?`${e.behind} behind`:`Synced`:e.state===`conflict`&&e.conflictCount>0?`${e.conflictCount} conflict${e.conflictCount===1?``:`s`}`:fA(e.state):`Sync off`}function hA(e){let t=(0,$.c)(76),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,{projectLocalConfig:o,projectLocalSynced:s}=y(),c=o?.autoSync?.enabled??!1,{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=Za(Ba()),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(uA,{status:n}),t[0]=n,t[1]=p);let m;t[2]===n.state?m=t[3]:(m=fA(n.state),t[2]=n.state,t[3]=m);let h;t[4]===m?h=t[5]:(h=(0,Z.jsx)(`span`,{className:`text-sm font-medium truncate`,children:m}),t[4]=m,t[5]=h);let g;t[6]!==p||t[7]!==h?(g=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[p,h]}),t[6]=p,t[7]=h,t[8]=g):g=t[8];let _=!s,v=c?`Disable sync`:`Enable sync`,b;t[9]!==c||t[10]!==d||t[11]!==_||t[12]!==v?(b=(0,Z.jsx)(H,{checked:c,disabled:_,onCheckedChange:d,"aria-label":v}),t[9]=c,t[10]=d,t[11]=_,t[12]=v,t[13]=b):b=t[13];let x;t[14]!==g||t[15]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[g,b]}),t[14]=g,t[15]=b,t[16]=x):x=t[16];let S;t[17]!==l||t[18]!==f||t[19]!==u?(S=(0,Z.jsx)(vo,{open:l,onOpenChange:u,onConfirm:f}),t[17]=l,t[18]=f,t[19]=u,t[20]=S):S=t[20];let C;t[21]===n.error?C=t[22]:(C=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[21]=n.error,t[22]=C);let w;t[23]===n.pausedReason?w=t[24]:(w=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:pA(n.pausedReason)}),t[23]=n.pausedReason,t[24]=w);let T;t[25]===n.state?T=t[26]:(T=n.state===`conflict`&&(0,Z.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400`,children:`Sync paused — resolve conflicts to resume.`}),t[25]=n.state,t[26]=T);let E;t[27]!==c||t[28]!==n.lastSyncUtc||t[29]!==n.state?(E=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,cA(n.lastSyncUtc)]}),t[27]=c,t[28]=n.lastSyncUtc,t[29]=n.state,t[30]=E):E=t[30];let D;t[31]===n.ahead?D=t[32]:(D=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[31]=n.ahead,t[32]=D);let O;t[33]===n.behind?O=t[34]:(O=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[33]=n.behind,t[34]=O);let k;t[35]===n.conflictCount?k=t[36]:(k=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[35]=n.conflictCount,t[36]=k);let A;t[37]===c?A=t[38]:(A=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[37]=c,t[38]=A);let j;t[39]!==E||t[40]!==D||t[41]!==O||t[42]!==k||t[43]!==A?(j=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[E,D,O,k,A]}),t[39]=E,t[40]=D,t[41]=O,t[42]=k,t[43]=A,t[44]=j):j=t[44];let M;t[45]!==a||t[46]!==n.identityUnresolved?(M=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(dl,{className:`size-3.5 mt-0.5 text-muted-foreground shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground leading-snug`,children:`Git identity isn't set — commits use a default author. Set yours so teammates see your name.`}),(0,Z.jsx)(X,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:`Set identity`})]})]}),t[45]=a,t[46]=n.identityUnresolved,t[47]=M):M=t[47];let N;t[48]!==c||t[49]!==n.state?(N=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:_A,children:`Sync now`}),t[48]=c,t[49]=n.state,t[50]=N):N=t[50];let P;t[51]!==c||t[52]!==r||t[53]!==n.state?(P=c&&n.state===`auth-error`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:r,children:`Sign in`}),t[51]=c,t[52]=r,t[53]=n.state,t[54]=P):P=t[54];let F;t[55]!==c||t[56]!==n.state?(F=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:gA,children:`Retry`}),t[55]=c,t[56]=n.state,t[57]=F):F=t[57];let I;t[58]!==c||t[59]!==i||t[60]!==n.state?(I=c&&n.state===`conflict`&&i&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:i,children:`Review conflicts`}),t[58]=c,t[59]=i,t[60]=n.state,t[61]=I):I=t[61];let L;t[62]!==N||t[63]!==P||t[64]!==F||t[65]!==I?(L=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[N,P,F,I]}),t[62]=N,t[63]=P,t[64]=F,t[65]=I,t[66]=L):L=t[66];let R;return t[67]!==C||t[68]!==w||t[69]!==T||t[70]!==j||t[71]!==M||t[72]!==L||t[73]!==x||t[74]!==S?(R=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[x,S,C,w,T,j,M,L]}),t[67]=C,t[68]=w,t[69]=T,t[70]=j,t[71]=M,t[72]=L,t[73]=x,t[74]=S,t[75]=R):R=t[75],R}function gA(){lA(`sync`)}function _A(){lA(`sync`)}function vA(e){let t=(0,$.c)(36),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=n,{status:o,fetchError:s}=bo();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":`Sync status unavailable`,disabled:!0,children:(0,Z.jsx)(oc,{className:`size-3.5`})})}),t[2]=e):e=t[2];let n=s===`network`?`Sync status unavailable — server unreachable.`:`Sync status unavailable — server error.`,r;return t[3]===n?r=t[4]:(r=(0,Z.jsxs)(Yn,{children:[e,(0,Z.jsx)(vr,{children:n})]}),t[3]=n,t[4]=r),r}return null}if(o.state===`dormant`&&!o.hasRemote||o.state===`disabled`&&!o.pausedReason)return null;let c;t[5]===o?c=t[6]:(c=dA(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=fA(o.state),t[7]=o.state,t[8]=d);let f=`Sync status: ${d}${u?` — git identity unset`:``}`,p;t[9]===o?p=t[10]:(p=(0,Z.jsx)(uA,{status:o}),t[9]=o,t[10]=p);let m;t[11]===l?m=t[12]:(m=l&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:l}),t[11]=l,t[12]=m);let h;t[13]!==l||t[14]!==u?(h=!l&&u&&(0,Z.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-amber-500 ring-2 ring-background`,"aria-hidden":!0}),t[13]=l,t[14]=u,t[15]=h):h=t[15];let g;t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h?(g=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(Vt,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground relative`,"aria-label":f,children:[p,m,h]})})}),t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;t[21]===o?_=t[22]:(_=mA(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(vr,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(Yn,{children:[g,v]}),t[25]=v,t[26]=g,t[27]=y):y=t[27];let b;t[28]!==i||t[29]!==a||t[30]!==r||t[31]!==o?(b=(0,Z.jsx)(Be,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(hA,{status:o,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a})}),t[28]=i,t[29]=a,t[30]=r,t[31]=o,t[32]=b):b=t[32];let x;return t[33]!==y||t[34]!==b?(x=(0,Z.jsxs)(Ft,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}function yA(e){let t=(0,$.c)(45),{onSaveVersion:n,saving:r,onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}=e,{activeDocName:s,activeTarget:c}=ft(),{state:l}=MD(),u=Zm(),[d,f]=(0,Q.useState)(!1),p;bb0:{if(c===null){let e;t[0]===u?e=t[1]:(e=Dh({workspace:u}),t[0]=u,t[1]=e),p=e;break bb0}if(c.kind===`folder`){if(!u){p=null;break bb0}let e;t[2]!==c.folderPath||t[3]!==u?(e=Oh({folderRelativePath:c.folderPath,workspace:u}),t[2]=c.folderPath,t[3]=u,t[4]=e):e=t[4],p=e;break bb0}let e;t[5]!==s||t[6]!==u?(e=Eh({docName:s,workspace:u}),t[5]=s,t[6]=u,t[7]=e):e=t[7],p=e}let m=p,h=typeof window<`u`&&window.okDesktop!=null,g=h&&l===`collapsed`&&`pl-[78px]`,_;t[8]===g?_=t[9]:(_=Gi(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,h&&`[-webkit-app-region:drag]`,g,h&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[8]=g,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(LD,{className:Gi(`-ml-1 shrink-0 text-muted-foreground`,h&&`[-webkit-app-region:no-drag]`)})}),t[10]=v):v=t[10];let y=l===`expanded`?`Hide Files`:`Show Files`,b;t[11]===y?b=t[12]:(b=(0,Z.jsxs)(Yn,{children:[v,(0,Z.jsx)(vr,{children:y})]}),t[11]=y,t[12]=b);let x,S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(io,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),S=(0,Z.jsx)(yk,{}),t[13]=x,t[14]=S):(x=t[13],S=t[14]);let C;t[15]===b?C=t[16]:(C=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[b,x,S]}),t[15]=b,t[16]=C);let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=Gi(`flex shrink-0 items-center justify-end gap-2 px-3`,h&&`[&>*]:[-webkit-app-region:no-drag]`),t[17]=w):w=t[17];let T;t[18]!==s||t[19]!==n||t[20]!==r?(T=s&&(0,Z.jsxs)(Yn,{children:[(0,Z.jsx)(Wn,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Checkpoint version`,onClick:n,disabled:r,className:`text-muted-foreground`,children:(0,Z.jsx)(Xc,{className:`size-3.5`})})}),(0,Z.jsx)(vr,{children:r?`Saving`:`Checkpoint version`})]}),t[18]=s,t[19]=n,t[20]=r,t[21]=T):T=t[21];let E;t[22]===m?E=t[23]:(E=(0,Z.jsx)(Tk,{input:m}),t[22]=m,t[23]=E);let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(rA,{onClickWhenNoRemote:()=>f(!0)}),t[24]=D):D=t[24];let O;t[25]===d?O=t[26]:(O=(0,Z.jsx)(qk,{open:d,onOpenChange:f}),t[25]=d,t[26]=O);let k;t[27]!==o||t[28]!==a||t[29]!==i?(k=(0,Z.jsx)(vA,{onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}),t[27]=o,t[28]=a,t[29]=i,t[30]=k):k=t[30];let A,j,M,N,P;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(pO,{}),j=(0,Z.jsx)(io,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),M=(0,Z.jsx)(ud,{}),N=(0,Z.jsx)(nA,{}),P=(0,Z.jsx)(Ck,{}),t[31]=A,t[32]=j,t[33]=M,t[34]=N,t[35]=P):(A=t[31],j=t[32],M=t[33],N=t[34],P=t[35]);let F;t[36]!==T||t[37]!==E||t[38]!==O||t[39]!==k?(F=(0,Z.jsxs)(`div`,{className:w,children:[T,E,D,O,k,A,j,M,N,P]}),t[36]=T,t[37]=E,t[38]=O,t[39]=k,t[40]=F):F=t[40];let I;return t[41]!==F||t[42]!==_||t[43]!==C?(I=(0,Z.jsxs)(`header`,{"data-electron-drag":h?``:void 0,className:_,children:[C,F]}),t[41]=F,t[42]=_,t[43]=C,t[44]=I):I=t[44],I}function bA(){let e=(0,$.c)(32),[t,n]=Eg(),[r,i]=(0,Q.useState)(t),[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(`auth`),[d,f]=(0,Q.useState)(Zy[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=Ao(),{projectLocalConfig:v,projectLocalSynced:b}=y(),{activeDocName:x}=ft(),S=!h&&_?.hasRemote===!0&&b===!0&&v!==null&&v.autoSync?.enabled===null,C,w;e[0]===x?(C=e[1],w=e[2]):(C=()=>{let e=function(e){let t=e.detail;t&&x&&js(x,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(vg,e),()=>window.removeEventListener(vg,e)},w=[x],e[0]=x,e[1]=C,e[2]=w),(0,Q.useEffect)(C,w);let T;e[3]===n?T=e[4]:(T=function(e){i(e),n(e)},e[3]=n,e[4]=T);let E=T,D;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(D=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?Y.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),Y.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),Y.error(`Checkpoint failed — try again`)}m(!1)},e[5]=D):D=e[5];let O=D,k;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(kg,{onOpenResolver:()=>o(!0)}),e[6]=k):k=e[6];let A,j,M;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>{u(`auth`),c(!0)},j=()=>{u(`identity`),c(!0)},M=()=>o(!0),e[7]=A,e[8]=j,e[9]=M):(A=e[7],j=e[8],M=e[9]);let N;e[10]===p?N=e[11]:(N=(0,Z.jsx)(yA,{onSaveVersion:O,saving:p,onSignIn:A,onSetIdentity:j,onOpenConflictResolver:M}),e[10]=p,e[11]=N);let P;e[12]!==d||e[13]!==r||e[14]!==E?(P=(0,Z.jsx)(sD,{editorMode:r,onModeChange:E,activeTab:d,onActiveTabChange:f}),e[12]=d,e[13]=r,e[14]=E,e[15]=P):P=e[15];let F;e[16]===a?F=e[17]:(F=(0,Z.jsx)(jv,{open:a,onOpenChange:o}),e[16]=a,e[17]=F);let I=l===`identity`,L;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{c(!1)},e[18]=L):L=e[18];let R;e[19]!==s||e[20]!==I?(R=(0,Z.jsx)(od,{open:s,onOpenChange:c,identityPrompt:I,onSuccess:L}),e[19]=s,e[20]=I,e[21]=R):R=e[21];let z;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>g(!0),e[22]=z):z=e[22];let B;e[23]===S?B=e[24]:(B=(0,Z.jsx)(Dg,{open:S,onResolved:z}),e[23]=S,e[24]=B);let V;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(hg,{}),e[25]=V):V=e[25];let H;return e[26]!==F||e[27]!==R||e[28]!==B||e[29]!==N||e[30]!==P?(H=(0,Z.jsxs)(Z.Fragment,{children:[k,N,P,F,R,B,V]}),e[26]=F,e[27]=R,e[28]=B,e[29]=N,e[30]=P,e[31]=H):H=e[31],H}var xA=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
36
34
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
37
35
  <path d="M3.47 5.47a.75.75 0 0 1 1.06 0L8 8.94l3.47-3.47a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 0 1 0-1.06" fill="currentcolor"/>
38
36
  </symbol>