@inkeep/open-knowledge 0.5.0-beta.16 → 0.5.0-beta.17

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-C6x9yckj.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-BYenkRKt.js","./button-C1nwPVFQ.js","./compiler-runtime-CVnuRdak.js","./dialog-Blv3p5PJ.js","./input-hZk8Tm0e.js","./textarea-gXd-JXvQ.js","./project-paths-hiY0fNWB.js","./McpConsentDialogBody-CEvkljQ2.js","./mcp-consent-store-DZ1pCmhN.js","./dist-Bej94Urx.js","./dist-Cg-Qaqw_.js","./label-Dv_9VZWz.js","./ActivityPanelDiffView-EaCFURAu.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DwQX9Gl9.js","./doc-hash-kxo-uZOQ.js","./w3c-keyname-B5t0fahT.js","./toggle-group-KbPGx9kK.js","./tooltip-C-s5R-Gs.js","./panel-8fydlQgn.js","./min-VayDM1tY.js","./src-BYmEUJ3I.js","./colors-BbIH8S-B.js","./ordinal-C6wHcby9.js","./init-gbiKrEzm.js","./isObjectLike-BNNgtFA6.js","./now--RAZR_wd.js","./isSymbol-CiN6ou2H.js","./target-navigation-intent-Bc974sw4.js","./ActivityModeContent-BMLTkwc9.js","./DocumentContext-BIHXIA3J.js","./dist-Cp-iTcML.js","./dist-D2RGH7XO.js","./dist-BiYnsAMa.js","./dist-B3L7cm0M.js","./dist-CATLRngz.js","./stex-J8UMaf7u.js","./agent-presence-BrTlNKmt.js","./SourceEditor-CSsFAy0n.js","./typing-burst-detector-D-ghtRdu.js","./SettingsDialog-x6fsBA_3.js","./config-validation-events-DCCNVo39.js"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t,t as n}from"./chunk-CFjPhJqf.js";import{t as r}from"./preload-helper-2ej06EnG.js";import{n as i,r as a,t as o}from"./compiler-runtime-CVnuRdak.js";import{$ as s,$t as c,An as l,At as u,B as d,C as f,Cn as p,Ct as m,Dn as h,Dt as g,E as _,En as v,Et as y,F as b,Ft as x,G as S,H as C,I as w,It as T,J as E,K as D,L as O,Lt as k,M as A,Mn as j,Mt as M,N,Nn as P,Nt as F,On as I,Ot as L,P as R,Pn as z,Pt as B,Q as V,Qt as H,R as U,S as W,Sn as G,St as K,T as q,Tn as ee,Tt as te,V as ne,W as re,X as ie,Y as ae,Z as oe,Zt as se,_ as ce,_n as le,_t as ue,a as de,an as fe,at as pe,bn as me,bt as he,c as ge,cn as _e,ct as ve,d as ye,dn as be,dt as xe,en as Se,et as Ce,f as we,fn as J,ft as Te,g as Ee,gn as De,gt as Oe,h as ke,hn as Ae,ht as je,i as Me,in as Ne,it as Pe,j as Fe,jn as Ie,jt as Le,kt as Re,l as ze,ln as Be,m as Ve,mn as He,mt as Ue,n as We,nn as Ge,nt as Ke,o as qe,on as Je,ot as Ye,p as Xe,pn as Ze,pt as Qe,q as $e,r as et,rn as tt,rt as nt,s as rt,sn as it,st as at,t as ot,tn as st,tt as ct,u as lt,un as ut,vn as dt,vt as ft,w as pt,wn as mt,wt as ht,x as gt,xn as _t,xt as vt,yn as yt,yt as bt,z as xt,zt as St}from"./DocumentContext-BIHXIA3J.js";import{A as Ct,C as wt,D as Tt,E as Et,O as Dt,S as Ot,T as kt,_ as At,a as jt,b as Mt,c as Nt,d as Pt,f as Ft,g as It,h as Lt,i as Rt,k as zt,l as Bt,m as Vt,n as Ht,p as Ut,r as Wt,s as Gt,t as Kt,u as qt,v as Jt,w as Yt,x as Xt,y as Zt}from"./panel-8fydlQgn.js";import{A as Qt,B as $t,Cn as en,D as tn,Dr as nn,E as rn,F as an,Fn as on,Gr as sn,H as cn,Hn as ln,I as un,It as dn,K as fn,Kn as pn,Kr as mn,M as hn,Mn as gn,N as _n,Nt as vn,O as yn,Or as bn,P as xn,Qn as Sn,Qt as Cn,Sn as wn,Tr as Tn,V as En,Wr as Dn,Wt as On,Xn as kn,Xt as An,Yn as jn,Yt as Mn,Zn as Nn,Zt as Pn,_ as Fn,_t as In,a as Ln,an as Rn,ar as zn,b as Bn,bn as Vn,c as Hn,cn as Un,dn as Wn,dt as Gn,f as Kn,ft as qn,g as Jn,gn as Yn,gr as Xn,gt as Zn,hr as Qn,ht as $n,i as er,in as tr,ir as nr,j as rr,jt as ir,k as ar,kr as or,l as sr,ln as cr,mn as lr,mr as ur,mt as dr,n as fr,nr as pr,o as mr,or as hr,ot as gr,p as _r,qn as vr,qr as yr,qt as br,r as xr,rn as Sr,rt as Cr,s as wr,sr as Tr,st as Er,t as Dr,un as Or,ut as kr,v as Ar,vn as jr,wt as Mr,xr as Nr,y as Pr,yr as Fr}from"./doc-hash-kxo-uZOQ.js";import{C as Ir,S as Lr,_ as Rr,f as zr,h as Br,i as Vr,l as Hr,m as Ur,n as Wr,r as Y,s as Gr,t as X,u as Kr,w as qr,x as Jr}from"./button-C1nwPVFQ.js";import{a as Yr,c as Xr,d as Zr,f as Qr,i as $r,l as ei,m as ti,n as ni,o as ri,p as ii,r as ai,s as oi,t as si,u as ci}from"./agent-presence-BrTlNKmt.js";import{$ as li,A as ui,B as di,C as fi,Ct as pi,D as mi,Dt as hi,E as gi,Et as _i,F as vi,G as yi,H as bi,I as xi,J as Si,K as Ci,L as wi,M as Ti,N as Ei,O as Di,Ot as Oi,P as ki,Q as Ai,R as ji,S as Mi,St as Ni,T as Pi,Tt as Fi,U as Ii,V as Li,W as Ri,X as zi,Y as Bi,Z as Vi,_ as Hi,_t as Ui,a as Wi,at as Gi,b as Ki,bt as qi,ct as Ji,dt as Yi,et as Xi,f as Zi,ft as Qi,g as $i,gt as ea,h as ta,ht as na,it as ra,j as ia,k as aa,kt as oa,l as sa,lt as ca,m as la,mt as ua,nt as da,ot as fa,p as pa,pt as ma,q as ha,r as ga,rt as _a,st as va,t as ya,tt as ba,ut as xa,v as Sa,vt as Ca,w as wa,wt as Ta,x as Ea,xt as Da,y as Oa,yt as ka,z as Aa}from"./config-validation-events-DCCNVo39.js";import{n as ja,r as Ma,t as Na}from"./target-navigation-intent-Bc974sw4.js";import{t as Pa}from"./dist-Bej94Urx.js";import{S as Fa,a as Ia,b as La,c as Ra,f as za,h as Ba,i as Va,l as Ha,m as Ua,n as Wa,o as Ga,p as Ka,s as qa,t as Ja,u as Ya,x as Xa}from"./dialog-Blv3p5PJ.js";import{t as Za}from"./dist-Cg-Qaqw_.js";import{n as Qa,r as $a,t as eo}from"./mcp-consent-store-DZ1pCmhN.js";import{a as to,i as no,n as ro,r as io,t as ao}from"./toggle-group-KbPGx9kK.js";import{t as oo}from"./label-Dv_9VZWz.js";import{i as so,n as co,r as lo,t as uo}from"./tooltip-C-s5R-Gs.js";import{t as fo}from"./input-hZk8Tm0e.js";import{i as po,n as mo,r as ho}from"./project-paths-hiY0fNWB.js";import{$ as go,At as _o,Ct as vo,Dt as yo,Ft as bo,I as xo,It as So,J as Co,Mt as wo,Ot as To,Pt as Eo,Q as Do,Tt as Oo,X as ko,Z as Ao,at as jo,bt as Mo,jt as No,k as Po,w as Fo}from"./dist-D2RGH7XO.js";import{n as Io,o as Lo,r as Ro,t as zo}from"./typing-burst-detector-D-ghtRdu.js";import"./textarea-gXd-JXvQ.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 Bo(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&r(()=>import(`./telemetry-impl-C6x9yckj.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Vo(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=>{It(e,()=>t.signal,()=>n=!0)},u=Zt(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?Jt:At;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Uo:Ho,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:Ho(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 Ho(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 Uo(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Wo=class extends Ft{#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||Go(),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=Ut({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),Lt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Go(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ko=class extends Ct{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 Wo({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=qo(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=qo(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=qo(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=qo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Lt.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=>wt(t,e))}findAll(e={}){return this.getAll().filter(t=>wt(e,t))}notify(e){Lt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Lt.batch(()=>Promise.all(e.map(e=>e.continue().catch(kt))))}};function qo(e){return e.options.scope?.id}var Jo=class extends Ct{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Ot(r,t),a=this.get(i);return a||(a=new Pt({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(){Lt.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=>Yt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Yt(e,t)):t}notify(e){Lt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Lt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Lt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Yo=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Jo,this.#t=e.mutationCache||new Ko,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=zt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Vt.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(Tt(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=Mt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Lt.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;Lt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Lt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Lt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(kt).catch(kt)}invalidateQueries(e,t={}){return Lt.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=Lt.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(kt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Tt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kt).catch(kt)}fetchInfiniteQuery(e){return e.behavior=Vo(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kt).catch(kt)}ensureInfiniteQueryData(e){return e.behavior=Vo(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vt.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(Xt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Et(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Xt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Et(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||=Ot(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===Dt&&(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()}},Xo=n((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}}}})),Zo=n(((e,t)=>{t.exports=Xo()})),Qo=n((e=>{var t=Zo(),n=i(),r=qr();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=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function ee(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 te(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./telemetry-impl-C6x9yckj.js","./chunk-CFjPhJqf.js","./preload-helper-2ej06EnG.js","./trace-api-CiCjX4Sz.js","./propagation-api-3kmMXRwS.js","./ConsentDialogBody-BYenkRKt.js","./button-C1nwPVFQ.js","./compiler-runtime-CVnuRdak.js","./dialog-Blv3p5PJ.js","./input-hZk8Tm0e.js","./textarea-gXd-JXvQ.js","./project-paths-hiY0fNWB.js","./McpConsentDialogBody-CEvkljQ2.js","./mcp-consent-store-DZ1pCmhN.js","./dist-Bej94Urx.js","./dist-Cg-Qaqw_.js","./label-Dv_9VZWz.js","./ActivityPanelDiffView-EaCFURAu.js","./ActivityPanelDiffView-legcy4jI.css","./GraphPanel-DwQX9Gl9.js","./doc-hash-kxo-uZOQ.js","./w3c-keyname-B5t0fahT.js","./toggle-group-KbPGx9kK.js","./tooltip-C-s5R-Gs.js","./panel-8fydlQgn.js","./min-VayDM1tY.js","./src-BYmEUJ3I.js","./colors-BbIH8S-B.js","./ordinal-C6wHcby9.js","./init-gbiKrEzm.js","./isObjectLike-BNNgtFA6.js","./now--RAZR_wd.js","./isSymbol-CiN6ou2H.js","./target-navigation-intent-Bc974sw4.js","./ActivityModeContent-BMLTkwc9.js","./DocumentContext-BIHXIA3J.js","./dist-Cp-iTcML.js","./dist-D2RGH7XO.js","./dist-BiYnsAMa.js","./dist-B3L7cm0M.js","./dist-CATLRngz.js","./stex-J8UMaf7u.js","./agent-presence-BrTlNKmt.js","./SourceEditor-CSsFAy0n.js","./typing-burst-detector-D-ghtRdu.js","./SettingsDialog-CV-8Vjqz.js","./config-validation-events-MJXadIVB.js"])))=>i.map(i=>d[i]);
2
+ import{o as e,r as t,t as n}from"./chunk-CFjPhJqf.js";import{t as r}from"./preload-helper-2ej06EnG.js";import{n as i,r as a,t as o}from"./compiler-runtime-CVnuRdak.js";import{$ as s,$t as c,An as l,At as u,B as d,C as f,Cn as p,Ct as m,Dn as h,Dt as g,E as _,En as v,Et as y,F as b,Ft as x,G as S,H as C,I as w,It as T,J as E,K as D,L as O,Lt as k,M as A,Mn as j,Mt as M,N,Nn as P,Nt as F,On as I,Ot as L,P as R,Pn as z,Pt as B,Q as V,Qt as H,R as U,S as W,Sn as G,St as K,T as q,Tn as ee,Tt as te,V as ne,W as re,X as ie,Y as ae,Z as oe,Zt as se,_ as ce,_n as le,_t as ue,a as de,an as fe,at as pe,bn as me,bt as he,c as ge,cn as _e,ct as ve,d as ye,dn as be,dt as xe,en as Se,et as Ce,f as we,fn as J,ft as Te,g as Ee,gn as De,gt as Oe,h as ke,hn as Ae,ht as je,i as Me,in as Ne,it as Pe,j as Fe,jn as Ie,jt as Le,kt as Re,l as ze,ln as Be,m as Ve,mn as He,mt as Ue,n as We,nn as Ge,nt as Ke,o as qe,on as Je,ot as Ye,p as Xe,pn as Ze,pt as Qe,q as $e,r as et,rn as tt,rt as nt,s as rt,sn as it,st as at,t as ot,tn as st,tt as ct,u as lt,un as ut,vn as dt,vt as ft,w as pt,wn as mt,wt as ht,x as gt,xn as _t,xt as vt,yn as yt,yt as bt,z as xt,zt as St}from"./DocumentContext-BIHXIA3J.js";import{A as Ct,C as wt,D as Tt,E as Et,O as Dt,S as Ot,T as kt,_ as At,a as jt,b as Mt,c as Nt,d as Pt,f as Ft,g as It,h as Lt,i as Rt,k as zt,l as Bt,m as Vt,n as Ht,p as Ut,r as Wt,s as Gt,t as Kt,u as qt,v as Jt,w as Yt,x as Xt,y as Zt}from"./panel-8fydlQgn.js";import{A as Qt,B as $t,Cn as en,D as tn,Dr as nn,E as rn,F as an,Fn as on,Gr as sn,H as cn,Hn as ln,I as un,It as dn,K as fn,Kn as pn,Kr as mn,M as hn,Mn as gn,N as _n,Nt as vn,O as yn,Or as bn,P as xn,Qn as Sn,Qt as Cn,Sn as wn,Tr as Tn,V as En,Wr as Dn,Wt as On,Xn as kn,Xt as An,Yn as jn,Yt as Mn,Zn as Nn,Zt as Pn,_ as Fn,_t as In,a as Ln,an as Rn,ar as zn,b as Bn,bn as Vn,c as Hn,cn as Un,dn as Wn,dt as Gn,f as Kn,ft as qn,g as Jn,gn as Yn,gr as Xn,gt as Zn,hr as Qn,ht as $n,i as er,in as tr,ir as nr,j as rr,jt as ir,k as ar,kr as or,l as sr,ln as cr,mn as lr,mr as ur,mt as dr,n as fr,nr as pr,o as mr,or as hr,ot as gr,p as _r,qn as vr,qr as yr,qt as br,r as xr,rn as Sr,rt as Cr,s as wr,sr as Tr,st as Er,t as Dr,un as Or,ut as kr,v as Ar,vn as jr,wt as Mr,xr as Nr,y as Pr,yr as Fr}from"./doc-hash-kxo-uZOQ.js";import{C as Ir,S as Lr,_ as Rr,f as zr,h as Br,i as Vr,l as Hr,m as Ur,n as Wr,r as Y,s as Gr,t as X,u as Kr,w as qr,x as Jr}from"./button-C1nwPVFQ.js";import{a as Yr,c as Xr,d as Zr,f as Qr,i as $r,l as ei,m as ti,n as ni,o as ri,p as ii,r as ai,s as oi,t as si,u as ci}from"./agent-presence-BrTlNKmt.js";import{$ as li,A as ui,B as di,C as fi,Ct as pi,D as mi,Dt as hi,E as gi,Et as _i,F as vi,G as yi,H as bi,I as xi,J as Si,K as Ci,L as wi,M as Ti,N as Ei,O as Di,Ot as Oi,P as ki,Q as Ai,R as ji,S as Mi,St as Ni,T as Pi,Tt as Fi,U as Ii,V as Li,W as Ri,X as zi,Y as Bi,Z as Vi,_ as Hi,_t as Ui,a as Wi,at as Gi,b as Ki,bt as qi,ct as Ji,dt as Yi,et as Xi,f as Zi,ft as Qi,g as $i,gt as ea,h as ta,ht as na,it as ra,j as ia,k as aa,kt as oa,l as sa,lt as ca,m as la,mt as ua,nt as da,ot as fa,p as pa,pt as ma,q as ha,r as ga,rt as _a,st as va,t as ya,tt as ba,ut as xa,v as Sa,vt as Ca,w as wa,wt as Ta,x as Ea,xt as Da,y as Oa,yt as ka,z as Aa}from"./config-validation-events-MJXadIVB.js";import{n as ja,r as Ma,t as Na}from"./target-navigation-intent-Bc974sw4.js";import{t as Pa}from"./dist-Bej94Urx.js";import{S as Fa,a as Ia,b as La,c as Ra,f as za,h as Ba,i as Va,l as Ha,m as Ua,n as Wa,o as Ga,p as Ka,s as qa,t as Ja,u as Ya,x as Xa}from"./dialog-Blv3p5PJ.js";import{t as Za}from"./dist-Cg-Qaqw_.js";import{n as Qa,r as $a,t as eo}from"./mcp-consent-store-DZ1pCmhN.js";import{a as to,i as no,n as ro,r as io,t as ao}from"./toggle-group-KbPGx9kK.js";import{t as oo}from"./label-Dv_9VZWz.js";import{i as so,n as co,r as lo,t as uo}from"./tooltip-C-s5R-Gs.js";import{t as fo}from"./input-hZk8Tm0e.js";import{i as po,n as mo,r as ho}from"./project-paths-hiY0fNWB.js";import{$ as go,At as _o,Ct as vo,Dt as yo,Ft as bo,I as xo,It as So,J as Co,Mt as wo,Ot as To,Pt as Eo,Q as Do,Tt as Oo,X as ko,Z as Ao,at as jo,bt as Mo,jt as No,k as Po,w as Fo}from"./dist-D2RGH7XO.js";import{n as Io,o as Lo,r as Ro,t as zo}from"./typing-burst-detector-D-ghtRdu.js";import"./textarea-gXd-JXvQ.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 Bo(){({BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1})?.VITE_OTEL_ENABLED===`true`&&r(()=>import(`./telemetry-impl-C6x9yckj.js`).then(e=>e.install()),__vite__mapDeps([0,1,2,3,4]),import.meta.url)}function Vo(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=>{It(e,()=>t.signal,()=>n=!0)},u=Zt(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?Jt:At;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?Uo:Ho,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:Ho(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 Ho(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 Uo(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Wo=class extends Ft{#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||Go(),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=Ut({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),Lt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Go(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ko=class extends Ct{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 Wo({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=qo(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=qo(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=qo(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=qo(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Lt.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=>wt(t,e))}findAll(e={}){return this.getAll().filter(t=>wt(e,t))}notify(e){Lt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Lt.batch(()=>Promise.all(e.map(e=>e.continue().catch(kt))))}};function qo(e){return e.options.scope?.id}var Jo=class extends Ct{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??Ot(r,t),a=this.get(i);return a||(a=new Pt({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(){Lt.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=>Yt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Yt(e,t)):t}notify(e){Lt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Lt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Lt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Yo=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Jo,this.#t=e.mutationCache||new Ko,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=zt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Vt.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(Tt(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=Mt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Lt.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;Lt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Lt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Lt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(kt).catch(kt)}invalidateQueries(e,t={}){return Lt.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=Lt.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(kt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(kt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Tt(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(kt).catch(kt)}fetchInfiniteQuery(e){return e.behavior=Vo(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(kt).catch(kt)}ensureInfiniteQueryData(e){return e.behavior=Vo(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vt.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(Xt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Et(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Xt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Et(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||=Ot(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===Dt&&(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()}},Xo=n((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}}}})),Zo=n(((e,t)=>{t.exports=Xo()})),Qo=n((e=>{var t=Zo(),n=i(),r=qr();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=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var H=z(null),U=z(null),W=z(null),G=z(null);function K(e,t){switch(V(W,t),V(U,e),V(H,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(H),V(H,e)}function q(){B(H),B(U),B(W)}function ee(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 te(e){U.current===e&&(B(H),B(U)),G.current===e&&(B(G),Qf._currentValue=I)}var ne,re;function ie(e){if(ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||``,re=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+ne+e+re}var ae=!1;function oe(e,t){if(!e||ae)return``;ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -10,28 +10,28 @@ 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===``||Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Nt(e,``+r);break;case`className`:_t(e,`class`,r);break;case`tabIndex`:_t(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:_t(e,n,r);break;case`style`:It(e,r,o);break;case`data`:if(t!==`object`){_t(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=Bt(``+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=Bt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Vt);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=Bt(``+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),gt(e,`popover`,r);break;case`xlinkActuate`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:vt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:vt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:gt(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=Rt.get(n)||n,gt(e,n,r))}}function Nd(e,t,n,r,i,o){switch(n){case`style`:It(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`?Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Nt(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=Vt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!lt.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[Ye]||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,``):gt(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)}}Ot(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&&At(e,!!r,n,!0):At(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)}Mt(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(Lt(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)}}Dt(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?At(e,!!n,n?[]:``,!1):At(e,!!n,t,!0)):At(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)}jt(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(Lt(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[tt]||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),nt(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[tt])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]);nt(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=it(e);t!==null&&t.tag===5&&t.type===`form`?gs(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=Et(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),st(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="`+Et(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Et(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Et(n.imageSizes)+`"]`)):i+=`[href="`+Et(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),st(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="`+Et(r)+`"][href="`+Et(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),st(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=ot(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`);st(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=ot(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`),st(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=ot(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`),st(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=ot(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=ot(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=ot(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="`+Et(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),st(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Et(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~="`+Et(n.href)+`"]`);if(r)return t.instance=r,st(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`),st(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,st(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),st(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,st(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),st(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[tt]||a[Je]||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,st(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),st(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=Le(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Le(0),this.hiddenUpdates=Le(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=Kr,e):Kr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=ja(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ma(e,r,t),n!==null&&(fu(n,e,t),Na(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Y(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=Ue(t);var n=Y(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=it(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Me(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Te(o);s.entanglements[1]|=c,o&=~c}td(a),!(jl&6)&&(Ql=me()+500,nd(0,!1))}}break;case 31:case 13:s=Y(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=Ut(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=rt(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(he()){case ge:return 2;case _e:return 8;case ve:case ye:return 32;case be: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=it(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=rt(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,Ke(e.priority,function(){op(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,Ke(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);Ht=r,n.target.dispatchEvent(r),Ht=null}else return t=it(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=it(n);a!==null&&(e.splice(t,3),t-=3,ms(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[Ye]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Ye]||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[Xe]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ge();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{Ce=zp.inject(Rp),we=zp}catch{}}e.createRoot=function(e,t){if(!o(e))throw Error(a(299));var n=!1,r=``,i=Ls,s=Rs,c=zs;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[Xe]=t.current,xd(e),new Fp(t)}})),$o=n(((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=Qo()})),es=Ir(`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`}]]),ts=Ir(`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`}]]),ns=Ir(`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`}]]),rs=Ir(`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=a(),Q=e(i(),1),is=e(qr(),1),as=$o(),$=o(),os=[[`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`}]];Ir(`bot`,os);var ss=Ir(`calendar`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}]]),cs=Ir(`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`}]]),ls=Ir(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),us=Ir(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ds=Ir(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),fs=Ir(`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`}]]),ps=Ir(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),ms=Ir(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),hs=Ir(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),gs=Ir(`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`}]]),_s=Ir(`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`}]]),vs=Ir(`contrast`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 18a6 6 0 0 0 0-12v12z`,key:`j4l70d`}]]),ys=Ir(`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`}]]),bs=Ir(`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`}]]),xs=Ir(`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`}]]),Ss=Ir(`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`}]]),Cs=Ir(`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`}]]),ws=Ir(`file-text`,[[`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:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ts=Ir(`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`}]]),Es=Ir(`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`}]]),Ds=Ir(`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`}]]),Os=Ir(`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`}]]),ks=Ir(`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`}]]),As=Ir(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),js=Ir(`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`}]]),Ms=Ir(`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`}]]),Ns=Ir(`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`}]]),Ps=Ir(`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`}]]),Fs=Ir(`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`}]]),Is=Ir(`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`}]]),Ls=[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]],Rs=Ir(`link-2`,Ls),zs=Ir(`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`}]]),Bs=Ir(`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`}]]),Vs=Ir(`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`}]]),Hs=Ir(`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`}]]),Us=Ir(`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`}]]),Ws=Ir(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Gs=Ir(`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`}]]),Ks=Ir(`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`}]]),qs=Ir(`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`}]]),Js=Ir(`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`}]]),Ys=Ir(`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`}]]),Xs=Ir(`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`}]]),Zs=Ir(`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`}]]),Qs=Ir(`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`}]]),$s=Ir(`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`}]]),ec=Ir(`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`}]]),tc=Ir(`rows-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}]]),nc=Ir(`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`}]]),rc=Ir(`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`}]]),ic=Ir(`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`}]]),ac=Ir(`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`}]]),oc=Ir(`square-check`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),sc=Ir(`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`}]]),cc=Ir(`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`}]]),lc=Ir(`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`}]]),uc=Ir(`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`}]]),dc=Ir(`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`}]]),fc=Ir(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),pc=Ir(`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`}]]),mc=Ir(`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`}]]),hc=Ir(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),gc=Ir(`underline`,[[`path`,{d:`M6 4v6a6 6 0 0 0 12 0V4`,key:`9kb039`}],[`line`,{x1:`4`,x2:`20`,y1:`20`,y2:`20`,key:`nun2al`}]]),_c=Ir(`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`}]]),vc=Ir(`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`}]]),yc=Ir(`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`}]]);function bc(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(null),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=typeof window<`u`?window.okDesktop:void 0;if(!e)return;let t=!1;return e.state.query().then(e=>{t||n(e.channel)}).catch(xc),()=>{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 xc(e){console.warn(`[use-update-channel] bridge.state.query() failed`,e)}function Sc(e,t){return e instanceof Error&&e.message?e.message:t}async function Cc(e,t,n,r=`action`){try{n(null),await e()}catch(e){console.error(`[${r}] action failed:`,e),n(Sc(e,t))}}async function wc(e,t,n=Xa,r=`action`){await Cc(e,t,e=>{e!==null&&n.error(e)},r)}async function Tc(e){try{let t=await e.json(),n=ir.safeParse(t);if(n.success)return n.data.title}catch{}}async function Ec(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}function Dc(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 Oc(){return{async status(e){let t=e?.host??`github.com`,n=await Ec(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Tc(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t;return r.authenticated===!0&&typeof r.login==`string`?{authenticated:!0,host:i,login:r.login,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0}:{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0}},async repos(e){let t=e?.host??`github.com`,n=await Ec(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Tc(n)??`Failed to fetch repositories`};let r=Dc(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 kc(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Ac(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 jc(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 Mc(){return{start(){return jc((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=ir.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 Ac(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 Nc(e){return{start(){return e.localOp.auth.start()}}}function Pc(){return{start(e){return jc((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=ir.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 Fc(e){return{start(t){return e.localOp.clone.start(t)}}}var Ic=`ContextMenu`,[Lc,Rc]=Ur(Ic,[Ni]),zc=Ni(),[Bc,Vc]=Lc(Ic),Hc=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=zc(t),l=Gr(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Bc,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Ui,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Hc.displayName=Ic;var Uc=`ContextMenuTrigger`,Wc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Vc(Uc,n),o=zc(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)(fa,{...o,virtualRef:c}),(0,Z.jsx)(Br.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:zr(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:zr(e.onPointerDown,yl(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:zr(e.onPointerMove,yl(u)),onPointerCancel:r?e.onPointerCancel:zr(e.onPointerCancel,yl(u)),onPointerUp:r?e.onPointerUp:zr(e.onPointerUp,yl(u))})]})});Wc.displayName=Uc;var Gc=`ContextMenuPortal`,Kc=e=>{let{__scopeContextMenu:t,...n}=e,r=zc(t);return(0,Z.jsx)(ua,{...r,...n})};Kc.displayName=Gc;var qc=`ContextMenuContent`,Jc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Vc(qc,n),a=zc(n),o=Q.useRef(!1);return(0,Z.jsx)(ca,{...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)`}})});Jc.displayName=qc;var Yc=`ContextMenuGroup`,Xc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(xa,{...i,...r,ref:t})});Xc.displayName=Yc;var Zc=`ContextMenuLabel`,Qc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(ma,{...i,...r,ref:t})});Qc.displayName=Zc;var $c=`ContextMenuItem`,el=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Yi,{...i,...r,ref:t})});el.displayName=$c;var tl=`ContextMenuCheckboxItem`,nl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Ji,{...i,...r,ref:t})});nl.displayName=tl;var rl=`ContextMenuRadioGroup`,il=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(na,{...i,...r,ref:t})});il.displayName=rl;var al=`ContextMenuRadioItem`,ol=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(ea,{...i,...r,ref:t})});ol.displayName=al;var sl=`ContextMenuItemIndicator`,cl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Qi,{...i,...r,ref:t})});cl.displayName=sl;var ll=`ContextMenuSeparator`,ul=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Ca,{...i,...r,ref:t})});ul.displayName=ll;var dl=`ContextMenuArrow`,fl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(va,{...i,...r,ref:t})});fl.displayName=dl;var pl=`ContextMenuSub`,ml=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=zc(t),[s,c]=Kr({prop:i,defaultProp:a??!1,onChange:r,caller:pl});return(0,Z.jsx)(ka,{...o,open:s,onOpenChange:c,children:n})};ml.displayName=pl;var hl=`ContextMenuSubTrigger`,gl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Da,{...i,...r,ref:t})});gl.displayName=hl;var _l=`ContextMenuSubContent`,vl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(qi,{...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)`}})});vl.displayName=_l;function yl(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var bl=Hc,xl=Wc,Sl=Kc,Cl=Jc,wl=el,Tl=ul,El=`Radio`,[Dl,Ol]=Ur(El),[kl,Al]=Dl(El),jl=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=Jr(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(kl,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(Br.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Il(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:zr(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(Fl,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});jl.displayName=El;var Ml=`RadioIndicator`,Nl=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=Al(Ml,n);return(0,Z.jsx)(Hr,{present:r||a.checked,children:(0,Z.jsx)(Br.span,{"data-state":Il(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Nl.displayName=Ml;var Pl=`RadioBubbleInput`,Fl=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=Jr(o,a),c=Pa(n),l=Za(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)(Br.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}})});Fl.displayName=Pl;function Il(e){return e?`checked`:`unchecked`}var Ll=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Rl=`RadioGroup`,[zl,Bl]=Ur(Rl,[to,Ol]),Vl=to(),Hl=Ol(),[Ul,Wl]=zl(Rl),Gl=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=Vl(n),m=un(l),[h,g]=Kr({prop:a,defaultProp:i??null,onChange:d,caller:Rl});return(0,Z.jsx)(Ul,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(no,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(Br.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});Gl.displayName=Rl;var Kl=`RadioGroupItem`,ql=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Wl(Kl,n),o=a.disabled||r,s=Vl(n),c=Hl(n),l=Q.useRef(null),u=Jr(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{Ll.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)(io,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(jl,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:zr(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:zr(i.onFocus,()=>{f.current&&l.current?.click()})})})});ql.displayName=Kl;var Jl=`RadioGroupIndicator`,Yl=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(Nl,{...Hl(n),...r,ref:t})});Yl.displayName=Jl;var Xl=Gl,Zl=ql,Ql=Yl;async function $l(e){try{await navigator.clipboard.writeText(e)}catch{}}var eu=120*1e3;function tu(e){let t=(0,$.c)(26),{onSuccess:n,onCancel:r,transport:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`https://github.com/login/device`),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(eu),_=(0,Q.useRef)(null),v=(0,Q.useRef)(null),y;t[0]!==n||t[1]!==i?(y=async function(){f(null),m(!0);try{let e=i.start();_.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,a=await t.next();for(;!a.done;){let e=a.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),g(e.expires_in*1e3),$l(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){r=!0,m(!1),n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,f(e.message),m(!1);break}a=await t.next()}r||(f(`Sign-in stream ended without confirmation — please try again`),m(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(`Connection error — try again`),m(!1)}},t[0]=n,t[1]=i,t[2]=y):y=t[2];let b=y,x;t[3]===b?x=t[4]:(x=()=>{let e=!1;return queueMicrotask(()=>{e||b()}),()=>{e=!0,_.current?.(),_.current=null,v.current&&clearInterval(v.current)}},t[3]=b,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[5]=S):S=t[5],(0,Q.useEffect)(x,S);let C,w;t[6]===a?(C=t[7],w=t[8]):(C=()=>{if(!a)return;let e=Date.now();return v.current=setInterval(()=>{let t=eu-(Date.now()-e);t<=0?(g(0),v.current&&clearInterval(v.current),f(`Code expired — please try again`)):g(t)},1e3),()=>{v.current&&clearInterval(v.current)}},w=[a],t[6]=a,t[7]=C,t[8]=w),(0,Q.useEffect)(C,w);let T=Math.floor(h/6e4),E=Math.floor(h%6e4/1e3),D;t[9]===E?D=t[10]:(D=E.toString().padStart(2,`0`),t[9]=E,t[10]=D);let O=`${T}:${D}`,k;t[11]!==l||t[12]!==d||t[13]!==O||t[14]!==a||t[15]!==s?(k=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Open`,` `,(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>pi(e,s),onAuxClick:e=>pi(e,s),className:`underline underline-offset-2`,children:s}),` `,`and enter this code:`]}),(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:a}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void $l(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),children:l?`Copied!`:`Copy`})]}),(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`}),`Waiting for authorization`]}),(0,Z.jsxs)(`span`,{children:[`Expires in `,O]})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:`Starting sign-in flow`}),t[11]=l,t[12]=d,t[13]=O,t[14]=a,t[15]=s,t[16]=k):k=t[16];let A;t[17]===d?A=t[18]:(A=d&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),t[17]=d,t[18]=A);let j;t[19]!==r||t[20]!==p?(j=p&&(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),t[19]=r,t[20]=p,t[21]=j):j=t[21];let M;return t[22]!==k||t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[k,A,j]}),t[22]=k,t[23]=A,t[24]=j,t[25]=M):M=t[25],M}function nu(e){let t=(0,$.c)(32),{onSuccess:n,onCancel:r}=e,[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{u.current?.abort()},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,Q.useEffect)(d,f);let p;t[2]!==n||t[3]!==i?(p=async function(){if(!i.trim()){l(`Paste a personal access token`);return}u.current?.abort();let e=new AbortController;u.current=e,s(!0),l(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:i.trim()}),signal:e.signal});if(!t.ok){let e=`Invalid token — check that it has repo scope`;try{let n=await t.json(),r=ir.safeParse(n);r.success&&(e=r.data.title)}catch{}l(e),s(!1);return}if(!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await Ac(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}),s(!1),`terminal`):`continue`})||l(`No response — try again`)}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&l(`Connection error — try again`)}s(!1)},t[2]=n,t[3]=i,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noopener noreferrer`,onClick:iu,onAuxClick:ru,className:`underline underline-offset-2`,children:`github.com/settings/tokens`}),t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Create a token at`,` `,h,` `,`with `,(0,Z.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`repo`}),` scope.`]}),t[6]=g):g=t[6];let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>a(e.target.value),t[7]=_):_=t[7];let v;t[8]===m?v=t[9]:(v=e=>{e.key===`Enter`&&m()},t[8]=m,t[9]=v);let y;t[10]!==o||t[11]!==i||t[12]!==v?(y=(0,Z.jsx)(fo,{type:`password`,"aria-label":`Personal access token`,placeholder:`ghp_…`,value:i,onChange:_,disabled:o,onKeyDown:v}),t[10]=o,t[11]=i,t[12]=v,t[13]=y):y=t[13];let b;t[14]===c?b=t[15]:(b=c&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),t[14]=c,t[15]=b);let x;t[16]===m?x=t[17]:(x=()=>void m(),t[16]=m,t[17]=x);let S=o?`Validating`:`Add token`,C;t[18]!==o||t[19]!==x||t[20]!==S?(C=(0,Z.jsx)(X,{className:`flex-1`,onClick:x,disabled:o,children:S}),t[18]=o,t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==o||t[23]!==r?(w=(0,Z.jsx)(X,{variant:`ghost`,onClick:r,disabled:o,children:`Cancel`}),t[22]=o,t[23]=r,t[24]=w):w=t[24];let T;t[25]!==C||t[26]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==y||t[30]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,y,b,T]}),t[28]=T,t[29]=y,t[30]=b,t[31]=E):E=t[31],E}function ru(e){return pi(e,`https://github.com/settings/tokens`)}function iu(e){return pi(e,`https://github.com/settings/tokens`)}function au(e){let t=(0,$.c)(27),{login:n,onSave:r,onSkip:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Before syncing, set your identity for git commits:`}),t[0]=l):l=t[0];let u=`Name (e.g. ${n})`,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[1]=d):d=t[1];let f;t[2]!==a||t[3]!==u?(f=(0,Z.jsx)(fo,{"aria-label":`Name`,placeholder:u,value:a,onChange:d}),t[2]=a,t[3]=u,t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>c(e.target.value),t[5]=p):p=t[5];let m;t[6]===s?m=t[7]:(m=(0,Z.jsx)(fo,{type:`email`,"aria-label":`Email`,placeholder:`Email`,value:s,onChange:p}),t[6]=s,t[7]=m);let h;t[8]!==s||t[9]!==a||t[10]!==r?(h=()=>r(a.trim(),s.trim()),t[8]=s,t[9]=a,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==s||t[13]!==a?(g=!a.trim()||!s.trim(),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==h||t[16]!==g?(_=(0,Z.jsx)(X,{className:`flex-1`,onClick:h,disabled:g,children:`Save`}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]===i?v=t[19]:(v=(0,Z.jsx)(X,{variant:`ghost`,onClick:i,children:`Skip`}),t[18]=i,t[19]=v);let y;t[20]!==v||t[21]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[_,v]}),t[20]=v,t[21]=_,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==f||t[25]!==m?(b=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,f,m,y]}),t[23]=y,t[24]=f,t[25]=m,t[26]=b):b=t[26],b}function ou(e){let t=(0,$.c)(42),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s}=e,c;t[0]===s?c=t[1]:(c=s??Mc(),t[0]=s,t[1]=c);let l=c,[u,d]=(0,Q.useState)(`device`),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(null),g,_;t[2]===n?(g=t[3],_=t[4]):(g=()=>{n&&(d(`device`),p(`auth`),h(null))},_=[n],t[2]=n,t[3]=g,t[4]=_),(0,Q.useEffect)(g,_);let v;t[5]!==a||t[6]!==r||t[7]!==i?(v=function(e){h(e),a&&(!e.name||!e.email)?p(`identity`):(p(`done`),i?.(e),r(!1),Xa.success(`Signed in as @${e.login}`))},t[5]=a,t[6]=r,t[7]=i,t[8]=v):v=t[8];let y=v,b;t[9]!==m||t[10]!==r||t[11]!==i?(b=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(su);let n={...m??{login:``},name:e,email:t};p(`done`),i?.(n),r(!1),Xa.success(`Signed in as @${n.login}`)},t[9]=m,t[10]=r,t[11]=i,t[12]=b):b=t[12];let x=b,S;t[13]!==m||t[14]!==r||t[15]!==i?(S=function(){m&&(p(`done`),i?.(m),r(!1),Xa.success(`Signed in as @${m.login}`))},t[13]=m,t[14]=r,t[15]=i,t[16]=S):S=t[16];let C=S,w;t[17]===r?w=t[18]:(w=function(){r(!1)},t[17]=r,t[18]=w);let T=w,E=o?`Re-authenticate with GitHub`:`Sign in to GitHub`,D;t[19]===E?D=t[20]:(D=(0,Z.jsx)(qa,{children:(0,Z.jsx)(Ra,{children:E})}),t[19]=E,t[20]=D);let O;t[21]!==y||t[22]!==T||t[23]!==l||t[24]!==f||t[25]!==u?(O=f===`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:u===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`device`),children:`GitHub App`}),(0,Z.jsx)(X,{variant:u===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`pat`),children:`Token`})]}),u===`device`?(0,Z.jsx)(tu,{onSuccess:y,onCancel:T,transport:l}):(0,Z.jsx)(nu,{onSuccess:y,onCancel:T})]}),t[21]=y,t[22]=T,t[23]=l,t[24]=f,t[25]=u,t[26]=O):O=t[26];let k;t[27]!==m||t[28]!==x||t[29]!==C||t[30]!==f?(k=f===`identity`&&m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Signed in as @`,m.login]}),(0,Z.jsx)(au,{login:m.login,onSave:x,onSkip:C})]}),t[27]=m,t[28]=x,t[29]=C,t[30]=f,t[31]=k):k=t[31];let A;t[32]!==k||t[33]!==O?(A=(0,Z.jsxs)(Wa,{children:[O,k]}),t[32]=k,t[33]=O,t[34]=A):A=t[34];let j;t[35]!==A||t[36]!==D?(j=(0,Z.jsxs)(Va,{className:`sm:max-w-md`,children:[D,A]}),t[35]=A,t[36]=D,t[37]=j):j=t[37];let M;return t[38]!==r||t[39]!==n||t[40]!==j?(M=(0,Z.jsx)(Ja,{open:n,onOpenChange:r,children:j}),t[38]=r,t[39]=n,t[40]=j,t[41]=M):M=t[41],M}function su(){}function cu(e){let t=(0,$.c)(2),{className:n}=e,{channel:r}=bc();if(r!==`beta`)return null;let i;return t[0]===n?i=t[1]:(i=(0,Z.jsx)(Ne,{variant:`secondary`,"aria-label":`Beta channel`,"data-testid":`beta-badge`,className:n,children:`BETA`}),t[0]=n,t[1]=i),i}function lu(e){switch(e){case`receiving`:return`Receiving objects`;case`resolving`:return`Resolving deltas`;case`checking`:return`Checking out files`;case`init`:return`Initializing project`;case`done`:return`Complete`;default:return`Cloning`}}function uu(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function du(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c}=e,l;t[0]===o?l=t[1]:(l=o??Pc(),t[0]=o,t[1]=l);let u=l,d;t[2]===s?d=t[3]:(d=s??Oc(),t[2]=s,t[3]=d);let f=d,p=c!==void 0,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A;t[4]!==n||t[5]!==f?(A=()=>{if(!n)return;let e=!1;return f.status().then(t=>{e||T(t.authenticated)}).catch(()=>{e||T(!1)}),()=>{e=!0}},t[4]=n,t[5]=f,t[6]=A):A=t[6];let j;t[7]===n?j=t[8]:(j=[n],t[7]=n,t[8]=j),(0,Q.useEffect)(A,j);let M;t[9]!==w||t[10]!==n||t[11]!==f?(M=()=>{if(!w||!n)return;let e=!1;return x(!0),f.repos().then(t=>{e||(y(t.ok?t.repos:[]),x(!1))}).catch(()=>{e||(y([]),x(!1))}),()=>{e=!0}},t[9]=w,t[10]=n,t[11]=f,t[12]=M):M=t[12];let N;t[13]!==w||t[14]!==n?(N=[w,n],t[13]=w,t[14]=n,t[15]=N):N=t[15],(0,Q.useEffect)(M,N);let P;t[16]===p?P=t[17]:(P=function(e){if(h(e),p)return;let t=uu(e);t&&_(`~/Documents/${t}`)},t[16]=p,t[17]=P);let F=P,I;t[18]===p?I=t[19]:(I=function(e){if(h(e.clone_url),p)return;let t=e.full_name.split(`/`)[1];_(`~/Documents/${t}`)},t[18]=p,t[19]=I);let L=I,R;t[20]!==g||t[21]!==a||t[22]!==r||t[23]!==c||t[24]!==u||t[25]!==m?(R=async function(){let e=m.trim();if(!e){Xa.error(`Enter a repository URL or owner/repo`);return}let t=g||``;if(c){D(!0);let n=await c();if(!n){D(!1);return}let r=uu(e);t=`${n.replace(/\/$/,``)}/${r}`}else D(!0);let n=Xa.loading(`Starting clone`,{duration:1/0});k.current=n;let i=u.start({url:e,dir:t});O.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`)Xa.loading(`${lu(i.phase)} — ${i.pct}%`,{id:n});else if(i.type===`complete`){Xa.success(`Clone complete — opening project`,{id:n}),r(!1),D(!1),O.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`){Xa.error(`Clone failed: ${i.message}`,{id:n}),D(!1),O.current=null;return}t=await e.next()}Xa.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:n}),D(!1),O.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Xa.error(`Clone failed — connection error`,{id:n}),D(!1),O.current=null}},t[20]=g,t[21]=a,t[22]=r,t[23]=c,t[24]=u,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){O.current?.(),O.current=null,D(!1),Xa.dismiss(k.current??void 0)},t[27]=B):B=t[27];let V=B,H;t[28]!==E||t[29]!==r||t[30]!==p?(H=function(e){E||(r(e),e||(h(``),p||_(``),C(``)))},t[28]=E,t[29]=r,t[30]=p,t[31]=H):H=t[31];let U=H,W,G,K,q,ee,te,ne,re,ie,ae;if(t[32]!==E||t[33]!==U||t[34]!==L||t[35]!==F||t[36]!==w||t[37]!==b||t[38]!==n||t[39]!==S||t[40]!==v||t[41]!==m){let e=v?.filter(e=>e.full_name.toLowerCase().includes(S.toLowerCase()));K=Ja,ie=n,ae=U,G=Va,ne=`sm:max-w-lg`,t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(qa,{children:(0,Z.jsx)(Ra,{children:`Clone from GitHub`})}),t[52]=re):re=t[52],W=Wa,q=`flex flex-col gap-4`;let r;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`label`,{htmlFor:`clone-url`,className:`text-sm font-medium`,children:`Repository URL or owner/repo`}),t[53]=r):r=t[53];let i;t[54]===F?i=t[55]:(i=e=>F(e.target.value),t[54]=F,t[55]=i),t[56]!==E||t[57]!==i||t[58]!==m?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Z.jsx)(fo,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:m,onChange:i,disabled:E})]}),t[56]=E,t[57]=i,t[58]=m,t[59]=ee):ee=t[59],te=w&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`repo-filter`,className:`text-sm font-medium`,children:`Your repositories`}),(0,Z.jsx)(fo,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories`,value:S,onChange:e=>C(e.target.value),disabled:E||b&&v===null}),(0,Z.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":b&&v===null,children:b&&v===null?(0,Z.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Z.jsx)(Gi,{className:`h-4 w-2/3`}),(0,Z.jsx)(Gi,{className:`h-4 w-1/2`}),(0,Z.jsx)(Gi,{className:`h-4 w-3/4`}),(0,Z.jsx)(Gi,{className:`h-4 w-2/5`}),(0,Z.jsx)(Gi,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v?.length===0?`No repositories found.`:`No matches.`}):e?.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`w-full text-left px-3 py-1.5 text-sm hover:bg-muted flex items-center gap-2 truncate disabled:opacity-50`,onClick:()=>L(e),disabled:E,children:[e.private&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[32]=E,t[33]=U,t[34]=L,t[35]=F,t[36]=w,t[37]=b,t[38]=n,t[39]=S,t[40]=v,t[41]=m,t[42]=W,t[43]=G,t[44]=K,t[45]=q,t[46]=ee,t[47]=te,t[48]=ne,t[49]=re,t[50]=ie,t[51]=ae}else W=t[42],G=t[43],K=t[44],q=t[45],ee=t[46],te=t[47],ne=t[48],re=t[49],ie=t[50],ae=t[51];let oe;t[60]!==E||t[61]!==w||t[62]!==i?(oe=!w&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:`Browse your repos:`}),(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:E,children:`Sign in to GitHub`})]}),t[60]=E,t[61]=w,t[62]=i,t[63]=oe):oe=t[63];let se;t[64]!==E||t[65]!==g||t[66]!==p?(se=!p&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),(0,Z.jsx)(fo,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:g,onChange:e=>_(e.target.value),disabled:E})]}),t[64]=E,t[65]=g,t[66]=p,t[67]=se):se=t[67];let ce;t[68]!==q||t[69]!==ee||t[70]!==te||t[71]!==oe||t[72]!==se?(ce=(0,Z.jsxs)(`div`,{className:q,children:[ee,te,oe,se]}),t[68]=q,t[69]=ee,t[70]=te,t[71]=oe,t[72]=se,t[73]=ce):ce=t[73];let le;t[74]!==W||t[75]!==ce?(le=(0,Z.jsx)(W,{children:ce}),t[74]=W,t[75]=ce,t[76]=le):le=t[76];let ue;t[77]!==E||t[78]!==z||t[79]!==U||t[80]!==m||t[81]!==p?(ue=(0,Z.jsx)(Ga,{children:E?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:V,children:`Cancel`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>U(!1),children:`Cancel`}),(0,Z.jsx)(X,{onClick:()=>void z(),disabled:!m.trim(),"aria-describedby":p?`clone-picker-hint`:void 0,children:`Clone`}),p&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:`Opens a folder picker to choose where to clone the repository.`})]})}),t[77]=E,t[78]=z,t[79]=U,t[80]=m,t[81]=p,t[82]=ue):ue=t[82];let de;t[83]!==G||t[84]!==ne||t[85]!==re||t[86]!==le||t[87]!==ue?(de=(0,Z.jsxs)(G,{className:ne,children:[re,le,ue]}),t[83]=G,t[84]=ne,t[85]=re,t[86]=le,t[87]=ue,t[88]=de):de=t[88];let fe;return t[89]!==K||t[90]!==ie||t[91]!==ae||t[92]!==de?(fe=(0,Z.jsx)(K,{open:ie,onOpenChange:ae,children:de}),t[89]=K,t[90]=ie,t[91]=ae,t[92]=de,t[93]=fe):fe=t[93],fe}var fu=(0,Q.lazy)(()=>r(()=>import(`./ConsentDialogBody-BYenkRKt.js`),__vite__mapDeps([5,1,6,7,8,9,10,11]),import.meta.url));function pu(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(ho.subscribe,hu,mu))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)(fu,{})}),e[0]=t):t=e[0],t}function mu(){return!1}function hu(){return ho.getSnapshot()!==null}var gu=180;function _u(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function vu(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function yu(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 bu(e){let t=e instanceof Error?e.message:String(e);for(let e of Cr)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 xu(e){switch(e.reason){case`nested-project`:return`A project already exists at this location. Pick a different parent folder.`;case`target-not-empty`:return`A non-empty folder with this name already exists. Use a different name.`;case`invalid-args`:return`Invalid input — please check the name and try again.`;case`mkdir-failed`:return`Could not create the project folder. Try a different name or location.`;case`git-init-failed`:return`Project folder created, but git init failed. Try again.`;case`init-failed`:return`Could not write project files. Try a different location.`;case`discovery-failed`:return`Could not finalize project setup. Try again.`;case`unknown`:return`Could not create project. Try again or pick a different location.`}}function Su(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,bridge:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(Tu),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)(!1),[v,y]=(0,Q.useState)(null),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=new Map,t[1]=b):b=t[1];let x=(0,Q.useRef)(b),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=new Set,t[2]=S):S=t[2];let C=(0,Q.useRef)(S),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D,O;t[3]!==i||t[4]!==n?(D=()=>{if(!n)return;x.current.clear(),C.current.clear(),y(null),h({kind:`idle`}),_(!1),o(``),f(new Set(cn));let e=!1;u(!0),i.fs.defaultProjectsRoot().then(t=>{e||c(t)}).catch(wu).finally(()=>{e||u(!1)});let t=requestAnimationFrame(()=>{E.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},O=[n,i],t[3]=i,t[4]=n,t[5]=D,t[6]=O):(D=t[5],O=t[6]),(0,Q.useEffect)(D,O);let k,A;t[7]!==i||t[8]!==a||t[9]!==n||t[10]!==s?(k=()=>{if(!n)return;T.current!==null&&clearTimeout(T.current),w.current!==null&&w.current.abort();let e=jn(a);if(s===``||e===``){h({kind:`idle`});return}let t=_u(s,e),r=x.current.get(t);if(r!==void 0){h(yu({parent:s,sanitizedName:e,enclosingProject:r.enclosingProject,enclosingGit:r.enclosingGit,targetState:r.targetState}));return}h({kind:`pending`});let o=new AbortController;return w.current=o,T.current=setTimeout(()=>{Promise.all([i.fs.findEnclosingProjectRoot(s),i.fs.findEnclosingGitRoot(s),i.fs.folderState(t)]).then(n=>{let[r,i,a]=n;o.signal.aborted||(x.current.set(t,{enclosingProject:r,enclosingGit:i,targetState:a}),h(yu({parent:s,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:a})))}).catch(e=>{o.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),h({kind:`free`}))})},gu),()=>{T.current!==null&&clearTimeout(T.current),o.abort()}},A=[n,a,s,i],t[7]=i,t[8]=a,t[9]=n,t[10]=s,t[11]=k,t[12]=A):(k=t[11],A=t[12]),(0,Q.useEffect)(k,A);let j,M;t[13]!==i||t[14]!==m||t[15]!==n?(j=()=>{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&&(C.current.has(e)||(C.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Cu)))},M=[n,m,i],t[13]=i,t[14]=m,t[15]=n,t[16]=j,t[17]=M):(j=t[16],M=t[17]),(0,Q.useEffect)(j,M);let N,P;t[18]!==a||t[19]!==s?(N=jn(a),P=N===``||s===``?``:_u(s,N),t[18]=a,t[19]=s,t[20]=N,t[21]=P):(N=t[20],P=t[21]);let F=P,I=F===``?s:F,L=!g&&N!==``&&s!==``&&(m.kind===`free`||m.kind===`confirm-git`),R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[22]=R):R=t[22];let z=R,B;t[23]===i?B=t[24]:(B=async function(){try{let e=await i.dialog.openFolder();if(e===null)return;c(e)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[23]=i,t[24]=B);let V=B,H;t[25]!==i||t[26]!==L||t[27]!==d||t[28]!==r||t[29]!==s||t[30]!==N?(H=async function(e){if(e.preventDefault(),L){_(!0),y(null);try{await i.project.createNew({parent:s,name:N,editors:Array.from(d)}),r(!1)}catch(e){y(bu(e)),_(!1)}}},t[25]=i,t[26]=L,t[27]=d,t[28]=r,t[29]=s,t[30]=N,t[31]=H):H=t[31];let U=H,W;t[32]!==g||t[33]!==r?(W=function(e){g||r(e)},t[32]=g,t[33]=r,t[34]=W):W=t[34];let G=W,K;t[35]!==i||t[36]!==r?(K=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[35]=i,t[36]=r,t[37]=K):K=t[37];let q=K,ee;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsxs)(qa,{children:[(0,Z.jsx)(Ra,{children:`Create new project`}),(0,Z.jsx)(Ia,{children:`Make a new folder for a brand-new Open Knowledge project.`})]}),t[38]=ee):ee=t[38];let te;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(oo,{htmlFor:`create-name`,className:`block`,children:`Name`}),t[39]=te):te=t[39];let ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{o(e.target.value),y(null)},t[40]=ne):ne=t[40];let re;t[41]!==g||t[42]!==a?(re=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[te,(0,Z.jsx)(fo,{id:`create-name`,ref:E,value:a,onChange:ne,disabled:g,placeholder:`My Notes`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`create-target-caption`,"data-testid":`create-name`})]}),t[41]=g,t[42]=a,t[43]=re):re=t[43];let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(oo,{htmlFor:`create-location`,className:`block`,children:`Location`}),t[44]=ie):ie=t[44];let ae=g||l,oe;t[45]===V?oe=t[46]:(oe=()=>void V(),t[45]=V,t[46]=oe);let se;t[47]!==ae||t[48]!==oe?(se=(0,Z.jsx)(`div`,{className:`flex items-stretch gap-2`,children:(0,Z.jsx)(X,{id:`create-location`,type:`button`,variant:`outline`,disabled:ae,onClick:oe,"data-testid":`create-browse`,children:`Browse`})}),t[47]=ae,t[48]=oe,t[49]=se):se=t[49];let ce;t[50]===I?ce=t[51]:(ce=I===``?(0,Z.jsx)(`span`,{className:`sr-only`,children:`No target path yet`}):I,t[50]=I,t[51]=ce);let le;t[52]===ce?le=t[53]:(le=(0,Z.jsx)(`p`,{id:`create-target-caption`,className:`text-xs text-muted-foreground`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:ce}),t[52]=ce,t[53]=le);let ue;t[54]!==se||t[55]!==le?(ue=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[ie,se,le]}),t[54]=se,t[55]=le,t[56]=ue):ue=t[56];let de;t[57]!==m||t[58]!==q?(de=(0,Z.jsx)(Eu,{cascade:m,onOpenNested:q}),t[57]=m,t[58]=q,t[59]=de):de=t[59];let fe,pe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Connect AI editors`}),pe=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All editors are checked by default — uncheck the ones you don't use.`}),t[60]=fe,t[61]=pe):(fe=t[60],pe=t[61]);let me;t[62]!==g||t[63]!==d?(me=cn.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(oo,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)($a,{id:t,checked:d.has(e),onCheckedChange:()=>z(e),disabled:g,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:qn[e]})]},e)}),t[62]=g,t[63]=d,t[64]=me):me=t[64];let he;t[65]===me?he=t[66]:(he=(0,Z.jsxs)(`fieldset`,{className:`space-y-2 pb-2`,children:[fe,pe,me]}),t[65]=me,t[66]=he);let ge;t[67]===v?ge=t[68]:(ge=v===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:xu(v)}),t[67]=v,t[68]=ge);let _e;t[69]!==re||t[70]!==ue||t[71]!==de||t[72]!==he||t[73]!==ge?(_e=(0,Z.jsxs)(Wa,{className:`space-y-4`,children:[re,ue,de,he,ge]}),t[69]=re,t[70]=ue,t[71]=de,t[72]=he,t[73]=ge,t[74]=_e):_e=t[74];let ve;t[75]===r?ve=t[76]:(ve=()=>r(!1),t[75]=r,t[76]=ve);let ye;t[77]!==g||t[78]!==ve?(ye=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:ve,disabled:g,"data-testid":`create-cancel`,children:`Cancel`}),t[77]=g,t[78]=ve,t[79]=ye):ye=t[79];let be=!L,xe=g?`Creating`:`Create`,Se;t[80]!==be||t[81]!==xe?(Se=(0,Z.jsx)(X,{type:`submit`,disabled:be,"data-testid":`create-submit`,children:xe}),t[80]=be,t[81]=xe,t[82]=Se):Se=t[82];let Ce;t[83]!==ye||t[84]!==Se?(Ce=(0,Z.jsxs)(Ga,{children:[ye,Se]}),t[83]=ye,t[84]=Se,t[85]=Ce):Ce=t[85];let we;t[86]!==U||t[87]!==_e||t[88]!==Ce?(we=(0,Z.jsxs)(Va,{className:`sm:max-w-lg motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,"data-testid":`create-project-dialog`,children:[ee,(0,Z.jsxs)(`form`,{onSubmit:U,"data-testid":`create-project-form`,className:`flex min-h-0 flex-1 flex-col`,children:[_e,Ce]})]}),t[86]=U,t[87]=_e,t[88]=Ce,t[89]=we):we=t[89];let J;return t[90]!==G||t[91]!==n||t[92]!==we?(J=(0,Z.jsx)(Ja,{open:n,onOpenChange:G,children:we}),t[90]=G,t[91]=n,t[92]=we,t[93]=J):J=t[93],J}function Cu(){}function wu(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Tu(){return new Set(cn)}function Eu(e){let t=(0,$.c)(19),{cascade:n,onOpenNested:r}=e;if(n.kind===`idle`||n.kind===`pending`||n.kind===`free`)return null;if(n.kind===`block-nested`){let e;t[0]===n.rootPath?e=t[1]:(e=vu(n.rootPath),t[0]=n.rootPath,t[1]=e);let i=e,a;t[2]===n.rootPath?a=t[3]:(a=(0,Z.jsxs)(`p`,{className:`mb-2`,children:[`Can't nest projects. An Open Knowledge project already exists at`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all`,children:n.rootPath}),`. Choose a location outside it, or open that project instead.`]}),t[2]=n.rootPath,t[3]=a);let o;t[4]!==n.rootPath||t[5]!==r?(o=()=>r(n.rootPath),t[4]=n.rootPath,t[5]=r,t[6]=o):o=t[6];let s;t[7]!==i||t[8]!==o?(s=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:o,"data-testid":`create-banner-nested-open`,children:[`Open `,i]}),t[7]=i,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(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:[a,s]}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}if(n.kind===`confirm-git`){let e;t[13]===n.gitRoot?e=t[14]:(e=(0,Z.jsx)(`code`,{children:n.gitRoot}),t[13]=n.gitRoot,t[14]=e);let r;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`code`,{children:`.git`}),t[15]=r):r=t[15];let i;return t[16]===e?i=t[17]:(i=(0,Z.jsx)(`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:(0,Z.jsxs)(`p`,{children:[`Open Knowledge will be initialized at `,e,` — the parent of your new folder, because it contains a `,r,` folder (one project per git repo).`]})}),t[16]=e,t[17]=i),i}let i;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-nonempty`,children:(0,Z.jsx)(`p`,{children:`A non-empty folder with this name already exists. Use "Open folder on disk" instead.`})}),t[18]=i):i=t[18],i}function Du(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 Ou(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 ku=(0,Q.lazy)(()=>r(()=>import(`./McpConsentDialogBody-CEvkljQ2.js`),__vite__mapDeps([12,1,6,7,13,14,15,8,16]),import.meta.url));function Au(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Qa.subscribe,Mu,ju))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)(ku,{})}),e[0]=t):t=e[0],t}function ju(){return!1}function Mu(){return Qa.getSnapshot()!==null}var Nu=(e,t,n)=>Cc(e,t,n,`NavigatorApp`);function Pu(e){let t=(0,$.c)(74),{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),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=typeof window<`u`&&window.okDesktop!=null,[y,b]=(0,Q.useState)(`auth`),{channel:x}=bc(),{theme:S}=yr();Ta(n,S??`system`);let C;t[1]===n.project?C=t[2]:(C=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||l(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>Nu(e,t,l),t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>d(!0),t[6]=D):D=t[6];let O=D,k;t[7]===n?k=t[8]:(k=()=>E(async()=>{let e=await n.dialog.openFolder();e&&await Lu(n,e,`pick-existing`)},`Failed to open folder.`),t[7]=n,t[8]=k);let A=k,j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>p(!0),t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=e=>E(async()=>{await Lu(n,e,`recents`)},`Failed to open project.`),t[10]=n,t[11]=N);let P=N,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Ou,{className:`size-12 shrink-0`}),t[12]=F):F=t[12];let I;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=(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)(cu,{})]}),t[13]=I):I=t[13];let L;t[14]===n.appVersion?L=t[15]:(L=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]}),t[14]=n.appVersion,t[15]=L);let R;t[16]===x?R=t[17]:(R=x!==null&&(0,Z.jsx)(Ne,{variant:`gray`,className:`text-2xs font-mono`,children:x===`beta`?`Beta`:`Stable`}),t[16]=x,t[17]=R);let z;t[18]!==L||t[19]!==R?(z=(0,Z.jsx)(`div`,{className:`shrink-0 ${v?`[-webkit-app-region:drag]`:``}`,"data-testid":`nav-chrome-row`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-5xl px-12 pt-12 pb-10`,children:(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[F,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[I,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[L,R]})]})]})})}),t[18]=L,t[19]=R,t[20]=z):z=t[20];let B=`mx-auto flex w-full max-w-5xl flex-1 flex-col overflow-hidden px-12 pb-12 space-y-10 ${!o&&i.length===0?`justify-center`:``}`,V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(Fu,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:O,dataTestId:`nav-clone`,Icon:Du}),t[21]=V):V=t[21];let H;t[22]===A?H=t[23]:(H=(0,Z.jsx)(Fu,{title:`Open folder on disk`,description:`Use a folder you already have.`,onClick:A,dataTestId:`nav-open`,Icon:G}),t[22]=A,t[23]=H);let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Fu,{title:`Create new project`,description:`Make a new folder for a brand-new project.`,onClick:M,dataTestId:`nav-create-new`,Icon:Fi}),t[24]=U):U=t[24];let W;t[25]===H?W=t[26]:(W=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[V,H,U]}),t[25]=H,t[26]=W);let K;t[27]===c?K=t[28]:(K=c===null?null:(0,Z.jsxs)(`div`,{className:`mb-3 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:c}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-red-700 text-xs underline hover:no-underline dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[27]=c,t[28]=K);let q;t[29]!==o||t[30]!==P||t[31]!==i?(q=o?(0,Z.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(Ze,{className:`size-4 animate-spin text-muted-foreground/60`})})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 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 flex-1 subtle-scrollbar overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(Iu,{project:e,onOpen:()=>P(e.path)},e.path))})]}):null,t[29]=o,t[30]=P,t[31]=i,t[32]=q):q=t[32];let ee;t[33]!==B||t[34]!==W||t[35]!==K||t[36]!==q?(ee=(0,Z.jsxs)(`div`,{className:B,children:[W,K,q]}),t[33]=B,t[34]=W,t[35]=K,t[36]=q,t[37]=ee):ee=t[37];let te,ne;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Au,{}),ne=(0,Z.jsx)(pu,{}),t[38]=te,t[39]=ne):(te=t[38],ne=t[39]);let re;t[40]!==n||t[41]!==f?(re=(0,Z.jsx)(Su,{open:f,onOpenChange:p,bridge:n}),t[40]=n,t[41]=f,t[42]=re):re=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{h(e),e||_(!1)},t[43]=ie):ie=t[43];let ae;t[44]===n?ae=t[45]:(ae=Nc(n),t[44]=n,t[45]=ae);let oe=y===`identity`,se;t[46]===g?se=t[47]:(se=()=>{h(!1),g&&(_(!1),d(!0))},t[46]=g,t[47]=se);let ce;t[48]!==m||t[49]!==ae||t[50]!==oe||t[51]!==se?(ce=(0,Z.jsx)(ou,{open:m,onOpenChange:ie,transport:ae,identityPrompt:oe,onSuccess:se}),t[48]=m,t[49]=ae,t[50]=oe,t[51]=se,t[52]=ce):ce=t[52];let le;t[53]===n?le=t[54]:(le=Fc(n),t[53]=n,t[54]=le);let ue;t[55]===n?ue=t[56]:(ue=kc(n),t[55]=n,t[56]=ue);let de;t[57]===n.dialog?de=t[58]:(de=()=>n.dialog.openFolder(),t[57]=n.dialog,t[58]=de);let fe;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>{d(!1),b(`auth`),_(!0),h(!0)},t[59]=fe):fe=t[59];let pe;t[60]===n?pe=t[61]:(pe=e=>{let{dir:t}=e;E(()=>Lu(n,t,`pick-existing`),`Failed to open cloned project.`)},t[60]=n,t[61]=pe);let me;t[62]!==u||t[63]!==le||t[64]!==ue||t[65]!==de||t[66]!==pe?(me=(0,Z.jsx)(du,{open:u,onOpenChange:d,transport:le,authQueryTransport:ue,pickParentFolder:de,onSignIn:fe,onCloneComplete:pe}),t[62]=u,t[63]=le,t[64]=ue,t[65]=de,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==z||t[69]!==ee||t[70]!==re||t[71]!==ce||t[72]!==me?(he=(0,Z.jsxs)(`div`,{className:`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[z,ee,te,ne,re,ce,me]}),t[68]=z,t[69]=ee,t[70]=re,t[71]=ce,t[72]=me,t[73]=he):he=t[73],he}function Fu(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)(`button`,{type:`button`,onClick:i,"data-testid":a,className:`flex flex-col items-start gap-1.5 rounded-lg border border-border bg-card py-3.5 px-4 text-left transition-colors hover:bg-accent`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Iu(e){let t=(0,$.c)(17),{project:n,onOpen:r}=e,i=`flex items-center justify-between ${n.missing?`opacity-50`:``}`,a;t[0]===n.name?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[0]=n.name,t[1]=a);let o;t[2]===n.path?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[2]=n.path,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.missing?c=t[8]:(c=n.missing?(0,Z.jsx)(Ne,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[7]=n.missing,t[8]=c);let l;t[9]!==r||t[10]!==n.missing||t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,disabled:n.missing,className:`flex min-w-0 flex-1 items-center text-left disabled:cursor-not-allowed py-3.5 px-4 hover:bg-accent rounded-lg gap-2 justify-between`,children:[s,c]}),t[9]=r,t[10]=n.missing,t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;return t[14]!==i||t[15]!==l?(u=(0,Z.jsx)(`li`,{className:i,children:l}),t[14]=i,t[15]=l,t[16]=u):u=t[16],u}async function Lu(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var Ru=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=yr(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(sn,{className:`size-4`}),info:(0,Z.jsx)(le,{className:`size-4`}),warning:(0,Z.jsx)(Dn,{className:`size-4`}),error:(0,Z.jsx)(Ks,{className:`size-4`}),loading:(0,Z.jsx)(Ze,{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)(La,{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 zu(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(Bu(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 Bu(e,t){return e.startsWith(`/api/`)?t+e:e}function Vu(e){return`#/${encodeURIComponent(e)}`}function Hu(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(Vu(e.doc))})}var Uu=4e3,Wu=1440*60*1e3;function Gu(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){Xa.success(`Opened existing OK project at ${e.ancestorPath}`,{duration:Uu});return}if(e.kind===`mcp-repaired`){let t=e.editors.map(e=>qn[e]??e).join(`, `);Xa.success(`Repaired ${t} MCP integration. Restart ${t} if already open.`,{duration:Wu});return}if(e.kind===`mcp-repair-failed`){Xa.error(`MCP auto-repair failed — open Settings → AI Tool Integration to fix.`,{duration:Wu});return}let t=mo(e.gitRoot,e.pickedPath)??e.pickedPath;Xa.success(`Initialized OK at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Uu})})}var Ku=!1;function qu(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{Ge(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Ju(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 Yu=0,Xu=0,Zu=0,Qu=0,$u=null,ed=[`linkResolutionDecoration$`],td=new WeakSet,nd=new WeakSet;function rd(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function id(){return!1}function ad(){return!id()}function od(e,t){if(ad())return t;let n=`ok/cold/nodeview-factory-${rd(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Ge(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function sd(e){if(ad())return;let t=e.state.plugins;for(let e of t){if(nd.has(e))continue;let t=e.spec?.key?.key;if(!t||!ed.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){nd.add(e);continue}let i=`ok/cold/decoration-${rd(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Ge(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},nd.add(e)}}function cd(e){if(ad())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=od(e,n);r.__okWrapped=!0,t[e]=r}}function ld(e){return ad()?e:e.map(e=>{let t=e.name??`unknown`,n=rd(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ge(`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;Ge(`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;Ge(`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;Ge(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function ud(){if(!Ku){Ku=!0,qu(hr.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return ad()||($u=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Ju(i.editorState),durationMs:r}}),qu(hr.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!ad()&&!td.has(e)&&t.view&&(sd(t.view),cd(t.view),td.add(e)),{docSize:Ju(t.editorState)}}),qu(hr.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Qu+=1;let i=e;return!ad()&&i.view&&cd(i.view),{docSize:Ju(i.view),seq:Qu,durationMs:r}}),qu(Tn.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Xu+=1,{seq:Xu,docSize:Ju(e.state),durationMs:r})),qu(Tn.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Zu+=1,{seq:Zu,docSize:Ju(e.state),durationMs:r})),qu(x.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Yu+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Yu,topLevelYElements:a,durationMs:r}}),qu(H.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`)&&(Ge(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}),!ad()&&e===`first-paint`&&$u!==null)){let e=$u,n=Math.max(0,t.startTime-e);Ge(`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}),$u=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var dd=`Relaunch`,fd=`Release notes`,pd=`Updates paused`,md=`Download`,hd=`Reset to defaults`,gd=`Relaunch failed — please restart manually`,_d=`Recovery action failed — please try again`;function vd(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function yd(e){return`Version ${e} ready to install`}function bd(e){return`Updated to Version ${e}`}function xd(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var Sd=0,Cd=0,wd=1,Td=2,Ed=3;function Dd(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:yd(r),priority:Td,action:{label:dd,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:vd(gd,e),variant:`error`,priority:wd})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:bd(n),priority:Ed,action:{label:fd,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:pd,priority:Cd,action:{label:md,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function Od(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:vd(_d,e),variant:`error`,priority:Sd})};n({id:i,body:xd(t.currentBuild),priority:Sd,action:{label:hd,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var kd=[],Ad=new Set,jd=!1;function Md(){for(let e of Ad)e()}function Nd(e){let t=kd.findIndex(t=>t.id===e.id);if(t===-1)kd=[...kd,e];else{let n=kd.slice();n[t]=e,kd=n}Md()}function Pd(e){let t=kd.filter(t=>t.id!==e);t.length!==kd.length&&(kd=t,Md())}function Fd(){return kd}function Id(e){return Ad.add(e),()=>{Ad.delete(e)}}function Ld(){if(jd||typeof window>`u`)return;let e=window.okDesktop;e&&(jd=!0,Dd(e,Nd,Pd),e.state.query().then(t=>{t.schemaIncompatibility&&Od(e,t.schemaIncompatibility,Nd,Pd)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Rd=`ok-omnibar-recents-v1`,zd=10;function Bd(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function Vd(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Hd(e,t){return`${e}:${t}`}function Ud(e){let t=Vd(e);if(!t)return[];try{let e=t.getItem(Rd);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Bd).slice(0,zd):[]}catch{return[]}}function Wd(e,t){let n=Vd(t);if(n)try{n.setItem(Rd,JSON.stringify(e.slice(0,zd)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Gd(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,zd)}function Kd(e,t){return e.filter(e=>t.has(Hd(e.kind,e.path)))}var qd=50,Jd=30,Yd=``,Xd=null;function Zd(e){return e.trim().toLowerCase()}function Qd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $d(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function ef(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:pr(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:pr(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 tf(e){return cr({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function nf(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:Un(e.map(tf))}}function rf(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function af(e){let t=rf(e);return Xd&&Yd===t?Xd:(Yd=t,Xd=nf(e),Xd)}function of(e,t,n=qd){return sf(af(e),t,n)}function sf(e,t,n=qd){let r=Zd(t);return r?kn(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 cf(e,t){let n=$d(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(Qd).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 lf(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=pr(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 uf(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??Jd}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Bn(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(lf).filter(e=>!!e)}function df(e,t,n=[]){let r=Zd(t);return r?Zd([e,...n].join(` `)).includes(r):!0}var ff=`tag:`;function pf(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 mf(e,t){return B(e,t)}var hf=F;async function gf(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 _f=`open-knowledge:doc-panel-tab`,vf=null;function yf(){let e=vf;return vf=null,e}function bf(e,t=typeof window>`u`?new EventTarget:window){vf=e,t.dispatchEvent(new CustomEvent(_f,{detail:{tab:e}}))}function xf(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(_f,n),()=>t.removeEventListener(_f,n)}function Sf(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=Y(`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)(Xl,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cf(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=Y(`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)(Ql,{"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)(Zl,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var wf=[`.md`,`.mdx`];function Tf(e){let t=e.toLowerCase();for(let e of wf)if(t.endsWith(e))return e;return null}function Ef(e){let t=Tf(e);return t?e.slice(0,-t.length):e}var Df=`__blank__`,Of={local:0,inherited:1,user:2};function kf(e){return[...e].sort((e,t)=>{let n=Of[e.scope]-Of[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 Af(e){return e.trim()?e.includes(`..`)?`Path cannot contain ".."`:e.startsWith(`/`)?`Path cannot start with "/"`:e.includes(`\\`)?`Path cannot contain backslashes`:e.includes(`\0`)?`Path cannot contain null bytes`:null:`Name cannot be empty`}function jf(e){let t=e.fileName.trim(),n=Tf(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 Mf(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 Nf(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Pf(e){let t=(0,$.c)(115),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{addPage:d}=wr(),f=ra(u?null:a),p=u??f,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`.md`),[b,x]=(0,Q.useState)(Df),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),O=(0,Q.useId)(),k=(0,Q.useId)(),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P,F;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(P=()=>{if(n){C(null),D(null),T(!1),_(``),x(i===`file`&&s?s:Df);let e=i===`file`?o??`untitled`:`index`,t=Tf(e);y(t??`.md`),h(t?Ef(e):e)}},F=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=p.state.status===`ready`?kf(p.state.data.folder.templates_available??[]):[],L;t[6]!==p.state.data||t[7]!==p.state.status||t[8]!==n||t[9]!==b?(L=()=>{n&&b!==Df&&p.state.status===`ready`&&((p.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(Df))},t[6]=p.state.data,t[7]=p.state.status,t[8]=n,t[9]=b,t[10]=L):L=t[10];let R;t[11]!==p.state||t[12]!==n||t[13]!==b?(R=[n,b,p.state],t[11]=p.state,t[12]=n,t[13]=b,t[14]=R):R=t[14],(0,Q.useEffect)(L,R);let z=i===`file`,B=p.state.status===`loading`||p.state.status===`idle`,V=p.state.status===`error`?p.state.message:null,H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){let t=Tf(e);t?(y(t),h(Ef(e))):h(e),C(null)},t[15]=H):H=t[15];let U=H,W;t[16]!==v||t[17]!==m||t[18]!==g||t[19]!==a||t[20]!==i?(W=function(){return jf({kind:i,initialDir:a,fileName:m,fileExtension:v,folderName:g})},t[16]=v,t[17]=m,t[18]=g,t[19]=a,t[20]=i,t[21]=W):W=t[21];let G=W,K;t[22]!==m||t[23]!==g||t[24]!==i?(K=function(){if(i===`folder`){let e=Af(g.trim());if(e)return{message:`Folder name: ${e}`,field:`folder`}}let e=Af(m.trim());return e?{message:e,field:`file`}:null},t[22]=m,t[23]=g,t[24]=i,t[25]=K):K=t[25];let q=K,ee;t[26]!==w||t[27]!==m||t[28]!==g||t[29]!==i?(ee=w||!m.trim()||i===`folder`&&!g.trim(),t[26]=w,t[27]=m,t[28]=g,t[29]=i,t[30]=ee):ee=t[30];let te=ee,ne;t[31]!==d||t[32]!==G||t[33]!==q||t[34]!==i||t[35]!==l||t[36]!==r||t[37]!==b?(ne=async function(){let e=q();if(e){C(e.message),D(e.field);return}T(!0),C(null),D(null);let t=G(),n=i===`file`&&b!==Df?b: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=await Le(e,`Server error (HTTP ${e.status})`);if(!t.ok){T(!1),C(t.title),D(`form`);return}let n=Er.safeParse(t.body);if(T(!1),!n.success){C(`Failed to create ${i}`),D(`form`);return}let o=n.data.docName;r(!1),window.location.hash=`#/${o}`,d(o),Kn([`files`,`backlinks`,`graph`]),l?.(o)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),T(!1),C(`Network error — please try again`),D(`form`)}},t[31]=d,t[32]=G,t[33]=q,t[34]=i,t[35]=l,t[36]=r,t[37]=b,t[38]=ne):ne=t[38];let re=ne,ie=a||`(root)`,ae=i===`file`?`New file`:`New folder`,oe=Ja,se=Va,ce;t[39]===ae?ce=t[40]:(ce=(0,Z.jsx)(Ra,{children:ae}),t[39]=ae,t[40]=ce);let le;t[41]!==c||t[42]!==ie?(le=c??(0,Z.jsxs)(Z.Fragment,{children:[`Create in `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:ie})]}),t[41]=c,t[42]=ie,t[43]=le):le=t[43];let ue;t[44]===le?ue=t[45]:(ue=(0,Z.jsx)(Ia,{children:le}),t[44]=le,t[45]=ue);let de;t[46]!==ce||t[47]!==ue?(de=(0,Z.jsxs)(qa,{children:[ce,ue]}),t[46]=ce,t[47]=ue,t[48]=de):de=t[48];let fe=Wa,pe=z&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{id:j,className:`mb-1.5 text-sm font-medium`,children:`Start from`}),B?(0,Z.jsx)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:`Loading templates`}):(0,Z.jsxs)(Z.Fragment,{children:[V?(0,Z.jsxs)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:[`Could not load templates: `,V,`. You can still create a blank note.`]}):null,(0,Z.jsxs)(Sf,{value:b,onValueChange:x,"aria-labelledby":j,className:`max-h-56 overflow-y-auto rounded-md border border-border bg-card subtle-scrollbar`,children:[(0,Z.jsx)(Rf,{value:Df,title:`Blank note`,description:`Empty starting content`}),I.length===0&&!V?(0,Z.jsx)(`p`,{className:`px-3 pb-2 text-xs text-muted-foreground`,children:`No templates resolve here. Add one in this folder's Templates section, or in Settings → User templates.`}):I.map(Lf)]})]})]}),me;t[49]!==S||t[50]!==E||t[51]!==O||t[52]!==k||t[53]!==g||t[54]!==i?(me=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:k,children:`Folder name`}),(0,Z.jsx)(fo,{ref:N,id:k,value:g,onChange:e=>{_(e.target.value),C(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":S&&(E===`folder`||E===`form`)?O:void 0,"aria-invalid":S&&(E===`folder`||E===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Af(g.trim());if(t){C(`Folder name: ${t}`),D(`folder`);return}M.current?.focus()}}})]}),t[49]=S,t[50]=E,t[51]=O,t[52]=k,t[53]=g,t[54]=i,t[55]=me):me=t[55];let he=i===`folder`?`First file name`:`File name`,ge;t[56]!==A||t[57]!==he?(ge=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:A,children:he}),t[56]=A,t[57]=he,t[58]=ge):ge=t[58];let _e;t[59]===U?_e=t[60]:(_e=e=>U(e.target.value),t[59]=U,t[60]=_e);let ve=i===`file`,ye=S&&(E===`file`||E===`form`)?O:void 0,be=S&&(E===`file`||E===`form`)?!0:void 0,xe;t[61]!==re||t[62]!==te?(xe=e=>{e.key===`Enter`&&!te&&re()},t[61]=re,t[62]=te,t[63]=xe):xe=t[63];let Se;t[64]!==A||t[65]!==m||t[66]!==_e||t[67]!==ve||t[68]!==ye||t[69]!==be||t[70]!==xe?(Se=(0,Z.jsx)(fo,{ref:M,id:A,value:m,onChange:_e,placeholder:`my-note`,autoFocus:ve,"aria-describedby":ye,"aria-invalid":be,onFocus:If,onKeyDown:xe,className:`flex-1`}),t[64]=A,t[65]=m,t[66]=_e,t[67]=ve,t[68]=ye,t[69]=be,t[70]=xe,t[71]=Se):Se=t[71];let Ce;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>{(e===`.md`||e===`.mdx`)&&y(e)},t[72]=Ce):Ce=t[72];let we;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(we=wf.map(Ff),t[73]=we):we=t[73];let J;t[74]===v?J=t[75]:(J=(0,Z.jsx)(ao,{type:`single`,value:v,onValueChange:Ce,variant:`outline`,size:`sm`,"aria-label":`File extension`,className:`shrink-0`,children:we}),t[74]=v,t[75]=J);let Te;t[76]!==Se||t[77]!==J?(Te=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Se,J]}),t[76]=Se,t[77]=J,t[78]=Te):Te=t[78];let Ee;t[79]!==S||t[80]!==O?(Ee=S&&(0,Z.jsx)(`p`,{id:O,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:S}),t[79]=S,t[80]=O,t[81]=Ee):Ee=t[81];let De;t[82]!==ge||t[83]!==Te||t[84]!==Ee?(De=(0,Z.jsxs)(`div`,{children:[ge,Te,Ee]}),t[82]=ge,t[83]=Te,t[84]=Ee,t[85]=De):De=t[85];let Oe;t[86]!==pe||t[87]!==me||t[88]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[pe,me,De]}),t[86]=pe,t[87]=me,t[88]=De,t[89]=Oe):Oe=t[89];let ke;t[90]!==fe||t[91]!==Oe?(ke=(0,Z.jsx)(fe,{children:Oe}),t[90]=fe,t[91]=Oe,t[92]=ke):ke=t[92];let Ae;t[93]===r?Ae=t[94]:(Ae=()=>r(!1),t[93]=r,t[94]=Ae);let je;t[95]!==w||t[96]!==Ae?(je=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:w,children:`Cancel`}),t[95]=w,t[96]=Ae,t[97]=je):je=t[97];let Me=w?`Creating`:`Create`,Ne;t[98]!==re||t[99]!==te||t[100]!==Me?(Ne=(0,Z.jsx)(X,{onClick:re,disabled:te,children:Me}),t[98]=re,t[99]=te,t[100]=Me,t[101]=Ne):Ne=t[101];let Pe;t[102]!==je||t[103]!==Ne?(Pe=(0,Z.jsxs)(Ga,{children:[je,Ne]}),t[102]=je,t[103]=Ne,t[104]=Pe):Pe=t[104];let Fe;t[105]!==se||t[106]!==de||t[107]!==ke||t[108]!==Pe?(Fe=(0,Z.jsxs)(se,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[de,ke,Pe]}),t[105]=se,t[106]=de,t[107]=ke,t[108]=Pe,t[109]=Fe):Fe=t[109];let Ie;return t[110]!==oe||t[111]!==r||t[112]!==n||t[113]!==Fe?(Ie=(0,Z.jsx)(oe,{open:n,onOpenChange:r,children:Fe}),t[110]=oe,t[111]=r,t[112]=n,t[113]=Fe,t[114]=Ie):Ie=t[114],Ie}function Ff(e){return(0,Z.jsx)(ro,{value:e,"aria-label":`Use ${e} extension`,children:e},e)}function If(e){return Nf(e.currentTarget)}function Lf(e){return(0,Z.jsx)(Rf,{value:e.name,title:e.title??e.name,subName:e.title&&e.title!==e.name?e.name:void 0,description:e.description,scope:e.scope,sourceFolder:e.source_folder},`${e.scope}:${e.source_folder}:${e.name}`)}function Rf(e){let t=(0,$.c)(26),{value:n,title:r,subName:i,description:a,scope:o,sourceFolder:s}=e,c=(0,Q.useId)(),l;t[0]!==c||t[1]!==n?(l=(0,Z.jsx)(Cf,{id:c,value:n,className:`mt-1`}),t[0]=c,t[1]=n,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r}),t[3]=r,t[4]=u);let d;t[5]===i?d=t[6]:(d=i?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:i}):null,t[5]=i,t[6]=d);let f;t[7]!==o||t[8]!==s?(f=o===`inherited`&&s?(0,Z.jsx)(Ne,{variant:`gray`,className:`ml-auto shrink-0 text-2xs`,children:s||`root`}):null,t[7]=o,t[8]=s,t[9]=f):f=t[9];let p;t[10]===o?p=t[11]:(p=o===`user`?(0,Z.jsx)(Ne,{variant:`primary`,className:`ml-auto shrink-0 text-2xs`,children:`user`}):null,t[10]=o,t[11]=p);let m;t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,d,f,p]}),t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;t[17]===a?h=t[18]:(h=a?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:a}):null,t[17]=a,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==c||t[23]!==l||t[24]!==g?(_=(0,Z.jsxs)(`label`,{htmlFor:c,className:`flex cursor-pointer items-start gap-3 px-3 py-2 transition-colors hover:bg-muted/50 has-data-[state=checked]:bg-muted/70`,children:[l,g]}),t[22]=c,t[23]=l,t[24]=g,t[25]=_):_=t[25],_}var zf=[{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 Code`,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.`}],Bf=`#settings`;function Vf(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function Hf(e){return e.replace(/^#/,``)===`settings`}function Uf(){return typeof window>`u`?``:window.location.hash}function Wf(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(Kf),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{n(Hf(Uf()))};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=Gf,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function Gf(){typeof window>`u`||Hf(Uf())&&window.history.back()}function Kf(){return Hf(Uf())}function qf(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(Xf),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||typeof window>`u`||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(Yf);if(!e||!t.ok)return;let i=On.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(Jf),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function Jf(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function Yf(){return null}function Xf(){return Zf()}function Zf(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 Qf(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 $f(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=Bn(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 ep(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?Qf(e):$f()}var tp=`ok:skill:cowork:installed`,np=`1`,rp=250,ip=`/api/skill/install-state`;function ap(e){return`${tp}:v${e}`}var op=new Map;async function sp(e={},t={}){let n=t.force?`__force__`:`__default__`,r=op.get(n);if(r)return r;let i=cp(e,t);return op.set(n,i),i.finally(()=>{op.get(n)===i&&op.delete(n)}),i}async function cp(e,t){let n=e.installer===void 0?ep():e.installer,r=lp(e.storage),i=e.fetchSnapshot??dp,a=e.serverTimeoutMs??rp,o=null;if(!t.force){try{o=await fp(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=ap(o?.currentVersion??e.fallbackSkillVersion??up());if(!t.force&&r?.getItem(s)===np)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,np)}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 lp(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function up(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function dp(){let e;try{e=await fetch(ip,{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 fp(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function pp(e){return sp({},e)}function mp(){return sp({},{force:!0})}async function hp(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 gp(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return hp({target:`claude-cowork`,url:An({mode:`cowork`},e)},n);case`claude-code`:return hp({target:`claude-code`,url:An({mode:`code`},e)},n);case`codex`:return hp({target:`codex`,url:Pn(e)},n);case`cursor`:return hp({target:`cursor`,url:Cn(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function _p(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:vp(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:vp(e)}}}function vp(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 yp(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 bp(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function xp(e){return`${e}.md`}function Sp(e){if(!e.docName||!e.workspace)return null;let t=xp(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:bp(n,t,r)}}function Cp(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function wp(e){return _p(e.installUrl).then(()=>void 0)}function Tp(e){return`Opened in ${e}.`}function Ep(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 Dp(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Op(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}}async function kp(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:t.docContext===null?``:tr(t.docContext)},a=await n.dispatchHandoff(i),o=Op(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Tp(s));else{let i=Dp(r),a=Ep(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{kp(e,t,n,r+1)}}})}return a}function Ap(e){return zf.find(t=>t.id===e)?.displayName??e}function jp(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Mp(){return{dispatchHandoff:gp,recordHandoff:yp,toast:{success:e=>{Xa.success(e)},error:(e,t)=>{Xa.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>jp(),getDisplayName:Ap,ensureCoworkSkillInstalled:pp}}function Np(){return{dispatch:(e,t)=>kp(e,t,Mp()),reinstallCoworkSkill:mp}}var Pp=[...new Set(zf.flatMap(e=>e.schemes))];function Fp(e,t){let n=t.now?.()??Date.now(),r={};for(let t of zf){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 Ip(e){return Fp({},e)}async function Lp(e){let t=e.schemes??Pp,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 Rp=Object.fromEntries(Pp.map(e=>[e,{installed:!1}]));async function zp(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 Rp}if(!t.ok)return Rp;let n;try{n=await t.json()}catch{return Rp}if(typeof n!=`object`||!n||Array.isArray(n))return Rp;let r=n,i={};for(let e of Pp)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function Bp(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 Vp(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=Ip({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=Fp(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=!Bp(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 Hp(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function Up(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>Lp({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>zp({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function Wp(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(Gp),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=Vp(Up());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return typeof window<`u`&&window.addEventListener(`focus`,i),()=>{typeof window<`u`&&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 Gp(){return Ip({isElectronHost:Hp(),now:Date.now})}var Kp=3e3,qp=(e,t,n)=>wc(e,t,n,`CommandPalette`);function Jp(e){window.location.assign(er(e))}function Yp(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Jn(t)}function Xp(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?G:ws,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)(Zp,{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)(Zp,{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)(Zp,{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)(L,{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 Zp(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=cf(n,r).map(Qp),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 Qp(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 $p({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function em(e){let t=(0,$.c)(104),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,[o,s]=(0,Q.useState)(``),c=(0,Q.useDeferredValue)(o),l=c.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(`idle`),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[1]=_):_=t[1];let[v,b]=(0,Q.useState)(_),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[2]=x):x=t[2];let[S,C]=(0,Q.useState)(x),[w,T]=(0,Q.useState)(null),E;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[3]=E):E=t[3];let[D,O]=(0,Q.useState)(E),[k,A]=(0,Q.useState)(`idle`),j;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(j=[],t[4]=j):j=t[4];let[M,N]=(0,Q.useState)(j),[P,F]=(0,Q.useState)(`idle`),I=(0,Q.useRef)(!1),R=(0,Q.useRef)(null),z=(0,Q.useRef)(null),{activeDocName:B,activeTarget:V}=We(),{pages:H,pageTitles:U,pageMeta:W,folderPaths:K}=wr(),q=qf(),{states:ee,refresh:ne}=Wp(),{dispatch:re}=Np(),ie=Sp({docName:B,workspace:q}),ae=ef(H,K,U,W),oe=Kd(S,new Set(ae.map(rm))),se=a?.config.projectPath??null,ce=a?v.filter(e=>e.path!==se):[],le;t[5]!==B||t[6]!==V?(le=Yp(V,B),t[5]=B,t[6]=V,t[7]=le):le=t[7];let ue=le,de=l===``?[]:of(ae,l,8),fe,pe;t[8]!==i||t[9]!==r?(fe=()=>{let e=function(e){e.key===`k`&&(Vr()?e.metaKey:e.ctrlKey)&&(e.preventDefault(),i(!r))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},pe=[i,r],t[8]=i,t[9]=r,t[10]=fe,t[11]=pe):(fe=t[10],pe=t[11]),(0,Q.useEffect)(fe,pe);let me,he;t[12]!==a||t[13]!==r||t[14]!==ne?(me=()=>{if(r){if(C(Ud()),ne(),a){let e=!1;return qp(async()=>{let t=await a.project.listRecent();e||b(t)},`Failed to load recent projects.`),()=>{e=!0}}return}s(``),O([]),A(`idle`),I.current=!1,N([]),F(`idle`)},he=[r,a,ne],t[12]=a,t[13]=r,t[14]=ne,t[15]=me,t[16]=he):(me=t[15],he=t[16]),(0,Q.useEffect)(me,he);let ge;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ge=()=>{R.current&&(R.current.scrollTop=0)},t[17]=ge):ge=t[17];let _e;t[18]===o?_e=t[19]:(_e=[o],t[18]=o,t[19]=_e),(0,Q.useEffect)(ge,_e);let ve=pf(c,new Set(D.map(nm))),ye=ve.kind!==`normal`,be,xe;t[20]!==ye||t[21]!==r?(be=()=>{if(!r||!ye||I.current)return;I.current=!0,A(`loading`);let e=!1;return hf().then(t=>{e||(O(t),A(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),O([]),A(`error`))}),()=>{e=!0}},xe=[r,ye],t[20]=ye,t[21]=r,t[22]=be,t[23]=xe):(be=t[22],xe=t[23]),(0,Q.useEffect)(be,xe);let Se=ve.kind===`tag-docs`?ve.tagName:null;(0,Q.useEffect)(()=>{if(!r||Se===null){N([]),F(`idle`);return}F(`loading`),N([]);let e=!1;return gf(Se).then(t=>{e||(N(t),F(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),N([]),F(`error`))}),()=>{e=!0}},[r,Se]),(0,Q.useEffect)(()=>{if(!r||!l||ye){p([]),h(`idle`);return}let e=new AbortController;h(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),p([]),h(`error`)},Kp);return uf(l,{signal:e.signal}).then(e=>{window.clearTimeout(n),p(e),h(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(p([]),h(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,l,ye]);let Ce;t[24]===i?Ce=t[25]:(Ce=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),qp(async()=>{await e()},n)},t[24]=i,t[25]=Ce);let we=Ce,J;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(J=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Gd(Ud(),t);Wd(n),C(n)},t[26]=J):J=t[26];let Te=J,Ee;t[27]===i?Ee=t[28]:(Ee=function(e){i(!1),Te(e),Jp(e.path)},t[27]=i,t[28]=Ee);let De=Ee,Oe=!ye&&l===``&&oe.length>0,ke=$p({searchResults:f,fallbackSearchResults:de,searchStatus:m}),Ae=!ye&&ke.length>0,je=!ye&&l!==``&&m===`loading`&&!Ae,Me;t[29]!==c||t[30]!==ye?(Me=!ye&&df(`New file`,c,[`create file`]),t[29]=c,t[30]=ye,t[31]=Me):Me=t[31];let Ne=Me,Pe;t[32]!==c||t[33]!==ye?(Pe=!ye&&df(`New folder`,c,[`create folder`]),t[32]=c,t[33]=ye,t[34]=Pe):Pe=t[34];let Fe=Pe,Ie;t[35]!==B||t[36]!==c||t[37]!==ye?(Ie=!ye&&B!==null&&df(`Open graph`,c,[`graph panel network`]),t[35]=B,t[36]=c,t[37]=ye,t[38]=Ie):Ie=t[38];let Le=Ie,ze=!ye&&a!==null&&df(`Open folder on disk`,c,[`project`]),Be=!ye&&a!==null&&df(`Switch Project`,c,[`switch project navigator projects`]),Ve=!ye&&df(`Settings`,c,[`preferences config`]),He=!ye&&df(`Install for Claude Chat & Cowork (Desktop App)`,c,[`claude desktop install cowork`]),Ue=!ye&&a!==null&&ce.length>0&&(l===``||ce.some(e=>df(`${e.name} ${e.path}`,c,[`recent project`]))),Ge=!ye&&ie!==null&&(l===``||zf.some(e=>df(`Open in ${e.displayName}`,c,[e.id,`agent handoff`]))),Ke=ve.kind===`tag-list`?mf(D,ve.query):[],qe=ve.kind===`tag-list`&&k!==`loading`&&Ke.length===0,Je=ve.kind===`tag-docs`&&P===`success`&&M.length===0,Ye=ye||Oe||Ae||je||Ne||Fe||Le||ze||Be||Ve||He||Ue||Ge,Xe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=function(e){s(`${ff}${e}`)},t[39]=Xe):Xe=t[39];let Ze=Xe,Qe=ht,$e;t[40]===Symbol.for(`react.memo_cache_sentinel`)?($e={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[40]=$e):$e=t[40];let et;t[41]===o?et=t[42]:(et=(0,Z.jsx)(g,{ref:z,value:o,onValueChange:s,placeholder:`Search files, folders, or commands`}),t[41]=o,t[42]=et);let tt;t[43]===ye?tt=t[44]:(tt=()=>{s(ye?``:ff),z.current?.focus()},t[43]=ye,t[44]=tt);let nt=ye?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,rt;t[45]===nt?rt=t[46]:(rt=Y(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,nt),t[45]=nt,t[46]=rt);let it,at;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,Z.jsx)(_t,{className:`size-3.5`}),at=(0,Z.jsx)(`span`,{children:`By tag`}),t[47]=it,t[48]=at):(it=t[47],at=t[48]);let ot;t[49]!==ye||t[50]!==tt||t[51]!==rt?(ot=(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:tt,"data-testid":`command-palette-filter-tag`,"data-active":ye,"aria-pressed":ye,className:rt,children:[it,at]})}),t[49]=ye,t[50]=tt,t[51]=rt,t[52]=ot):ot=t[52];let st=Re,ct;t[53]!==Ae||t[54]!==je?(ct=je&&!Ae?(0,Z.jsx)(te,{children:`Searching`}):null,t[53]=Ae,t[54]=je,t[55]=ct):ct=t[55];let lt=Ye?null:(0,Z.jsx)(te,{children:m===`error`?`Search failed.`:`No matching commands.`}),ut=ve.kind===`tag-list`?(0,Z.jsxs)(y,{heading:ve.query?`Tags matching "${ve.query}"`:`All tags`,children:[k===`loading`?(0,Z.jsx)(te,{children:`Loading tags`}):null,k===`error`?(0,Z.jsx)(te,{children:`Failed to load tags. Press Escape and re-open to retry.`}):null,qe?(0,Z.jsx)(te,{children:ve.query?`No tags match "${ve.query}".`:"No tags yet — author `#tagname` in any doc to populate the index."}):null,Ke.map(e=>(0,Z.jsxs)(L,{value:`tag ${e.name}`,onSelect:()=>Ze(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(_t,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:[e.count,` `,e.count===1?`doc`:`docs`]})]},`tag:${e.name}`))]}):null,dt;t[56]!==i||t[57]!==ve||t[58]!==Je||t[59]!==M||t[60]!==P?(dt=ve.kind===`tag-docs`?(0,Z.jsxs)(y,{heading:`Docs tagged #${ve.tagName}`,children:[P===`loading`?(0,Z.jsx)(te,{children:`Loading docs`}):null,P===`error`?(0,Z.jsx)(te,{children:`Failed to load docs. Press Escape and re-open to retry.`}):null,Je?(0,Z.jsx)(te,{children:`No docs registered under #${ve.tagName}.`}):null,M.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName;return(0,Z.jsxs)(L,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),Jp(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(ws,{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!==ve.tagName)?(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:[`via`,` `,e.matchingTags.filter(e=>e!==ve.tagName).map(tm).join(`, `)]}):null]})]},`tag-doc:${e.docName}`)})]}):null,t[56]=i,t[57]=ve,t[58]=Je,t[59]=M,t[60]=P,t[61]=dt):dt=t[61];let ft=Oe?(0,Z.jsx)(y,{heading:`Recently opened`,children:oe.map(e=>(0,Z.jsx)(Xp,{entry:e,onSelect:()=>De(e)},Hd(e.kind,e.path)))}):null,pt;t[62]!==B||t[63]!==i||t[64]!==T||t[65]!==Ne||t[66]!==Fe||t[67]!==Le?(pt=Ne||Fe||Le?(0,Z.jsxs)(y,{heading:`Commands`,children:[Ne?(0,Z.jsxs)(L,{value:`new file create file`,onSelect:()=>{i(!1),T(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(mt,{}),(0,Z.jsx)(`span`,{children:`New file`})]}):null,Fe?(0,Z.jsxs)(L,{value:`new folder create folder`,onSelect:()=>{i(!1),T(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(Os,{}),(0,Z.jsx)(`span`,{children:`New folder`})]}):null,Le?(0,Z.jsxs)(L,{value:`open graph graph panel network`,onSelect:()=>{B&&(i(!1),bf(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Gs,{}),(0,Z.jsx)(`span`,{children:`Open graph`})]}):null]}):null,t[62]=B,t[63]=i,t[64]=T,t[65]=Ne,t[66]=Fe,t[67]=Le,t[68]=pt):pt=t[68];let gt=Ge?(0,Z.jsx)(y,{heading:`Open in agent`,children:zf.filter(e=>df(`Open in ${e.displayName}`,c,[e.id,`agent handoff`])).map(e=>{let t=ee[e.id],n=t.installed===!0&&ie!==null,r=t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(L,{value:`open in ${e.displayName} ${e.id} agent`,disabled:!n,onSelect:()=>{!n||!ie||(i(!1),re(e.id,ie))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Open in `,e.displayName]}),r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})}):null,vt=ze||Be||Ve||He||Ue?(0,Z.jsxs)(y,{heading:`Project`,children:[ze&&a?(0,Z.jsxs)(L,{value:`open folder on disk project`,onSelect:()=>we(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)(G,{}),(0,Z.jsx)(`span`,{children:`Open folder on disk`}),(0,Z.jsx)(u,{children:`⌘O`})]}):null,Be&&a?(0,Z.jsxs)(L,{value:`switch-project navigator projects`,onSelect:()=>we(()=>a.navigator.open(),`Failed to open Project Navigator.`),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(Fs,{}),(0,Z.jsx)(`span`,{children:`Switch Project`}),(0,Z.jsx)(u,{children:`⌘⇧N`})]}):null,Ve?(0,Z.jsxs)(L,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=Bf)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(rc,{}),(0,Z.jsx)(`span`,{children:`Settings`}),(0,Z.jsx)(u,{children:`⌘,`})]}):null,He?(0,Z.jsxs)(L,{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)(Oi,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)`})]}):null,Ue&&a?ce.filter(e=>df(`${e.name} ${e.path}`,c,[`recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(L,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>we(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`),"data-testid":`command-palette-recent-${e.path}`,children:[(0,Z.jsx)(ii,{}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,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?` (missing)`:``]})]})]},e.path)):null]}):null,yt=Ae?(0,Z.jsx)(y,{heading:`Search`,children:ke.map(e=>(0,Z.jsx)(Xp,{entry:e,query:l,onSelect:()=>De(e)},Hd(e.kind,e.path)))}):null,bt;t[69]!==st||t[70]!==ct||t[71]!==lt||t[72]!==ut||t[73]!==dt||t[74]!==ft||t[75]!==pt||t[76]!==gt||t[77]!==vt||t[78]!==yt?(bt=(0,Z.jsxs)(st,{ref:R,className:`subtle-scrollbar`,children:[ct,lt,ut,dt,ft,pt,gt,vt,yt]}),t[69]=st,t[70]=ct,t[71]=lt,t[72]=ut,t[73]=dt,t[74]=ft,t[75]=pt,t[76]=gt,t[77]=vt,t[78]=yt,t[79]=bt):bt=t[79];let xt;t[80]!==Qe||t[81]!==i||t[82]!==r||t[83]!==$e||t[84]!==et||t[85]!==ot||t[86]!==bt?(xt=(0,Z.jsxs)(Qe,{open:r,onOpenChange:i,title:`Workspace Command Palette`,description:`Search files, folders, and commands for the current workspace.`,className:`sm:max-w-2xl`,commandProps:$e,children:[et,ot,bt]}),t[80]=Qe,t[81]=i,t[82]=r,t[83]=$e,t[84]=et,t[85]=ot,t[86]=bt,t[87]=xt):xt=t[87];let St=w===`file`,Ct;t[88]===T?Ct=t[89]:(Ct=e=>{e||T(null)},t[88]=T,t[89]=Ct);let wt;t[90]!==ue||t[91]!==St||t[92]!==Ct?(wt=(0,Z.jsx)(Pf,{open:St,onOpenChange:Ct,kind:`file`,initialDir:ue}),t[90]=ue,t[91]=St,t[92]=Ct,t[93]=wt):wt=t[93];let Tt=w===`folder`,Et;t[94]===T?Et=t[95]:(Et=e=>{e||T(null)},t[94]=T,t[95]=Et);let Dt;t[96]!==ue||t[97]!==Tt||t[98]!==Et?(Dt=(0,Z.jsx)(Pf,{open:Tt,onOpenChange:Et,kind:`folder`,initialDir:ue}),t[96]=ue,t[97]=Tt,t[98]=Et,t[99]=Dt):Dt=t[99];let Ot;return t[100]!==xt||t[101]!==wt||t[102]!==Dt?(Ot=(0,Z.jsxs)(Z.Fragment,{children:[xt,wt,Dt]}),t[100]=xt,t[101]=wt,t[102]=Dt,t[103]=Ot):Ot=t[103],Ot}function tm(e){return`#${e}`}function nm(e){return e.name}function rm(e){return Hd(e.kind,e.path)}var im=500;function am(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function om(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 sm(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=We(),[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),im);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=am(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=om(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 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 shadow-md`,children:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function cm(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(Bn(e)??`Server error: ${t.status} ${t.statusText}`)}return(await t.json()).docs??[]}function lm(){let e=(0,$.c)(15),[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`}),cm(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(Ve,e),()=>document.removeEventListener(Ve,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(er(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m=(0,Z.jsx)(qa,{children:(0,Z.jsxs)(Ra,{children:[`Documents tagged `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,p]})]})}),e[4]=p,e[5]=m);let h=r??``,g;e[6]!==o||e[7]!==h?(g=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(um,{fetchState:o,tag:h,onSelectDoc:f})}),e[6]=o,e[7]=h,e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==g?(_=(0,Z.jsxs)(Va,{children:[m,g]}),e[9]=m,e[10]=g,e[11]=_):_=e[11];let v;return e[12]!==t||e[13]!==_?(v=(0,Z.jsx)(Ja,{open:t,onOpenChange:n,children:_}),e[12]=t,e[13]=_,e[14]=v):v=e[14],v}function um(e){let t=(0,$.c)(12),{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:`Loading`}),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;return t[3]===r?e=t[4]:(e=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:[`Only the current document uses `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,r]}),`.`]}),t[3]=r,t[4]=e),e}let a;if(t[5]!==n.docs||t[6]!==i){let e;t[8]===i?e=t[9]:(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(dm)}):null]})},e.docName)},t[8]=i,t[9]=e),a=n.docs.map(e),t[5]=n.docs,t[6]=i,t[7]=a}else a=t[7];let o;return t[10]===a?o=t[11]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[10]=a,t[11]=o),o}function dm(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 fm=`raw-mdx-nav`,pm=`ok-editor-mode-v1`,mm=[`wysiwyg`,`source`],hm=`wysiwyg`;function gm(e){return mm.includes(e)}function _m(e=localStorage){try{let t=e.getItem(pm);if(t===null)return hm;if(gm(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return hm}function vm(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return gm(n)?n:_m(t)}function ym(e,t=localStorage){try{return t.setItem(pm,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function bm(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(vm),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),ym(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 xm(e){let t=(0,$.c)(21),{open:n,onResolved:r}=e,i=Vi(),a;t[0]!==r||t[1]!==i?(a=function(e){if(i===null){Xa.error(`Sync settings not yet loaded — try again in a moment`);return}let t=i(e);if(!t.ok){Xa.error(`Could not ${e?`enable sync`:`save sync preference`}: ${t.error}`);return}r()},t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(qa,{children:(0,Z.jsx)(Ai,{})}),t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(li,{})}),t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=()=>o(!1),t[5]=o,t[6]=l);let u=i===null,d;t[7]!==l||t[8]!==u?(d=(0,Z.jsx)(X,{variant:`ghost`,className:`uppercase font-mono`,onClick:l,disabled:u,children:`Keep disabled`}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;t[10]===o?f=t[11]:(f=()=>o(!0),t[10]=o,t[11]=f);let p=i===null,m;t[12]!==f||t[13]!==p?(m=(0,Z.jsx)(X,{onClick:f,disabled:p,children:`Enable auto-sync`}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,Z.jsxs)(Va,{className:`sm:max-w-lg`,showCloseButton:!1,children:[s,c,(0,Z.jsxs)(Ga,{children:[d,m]})]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==n||t[19]!==h?(g=(0,Z.jsx)(Ja,{open:n,onOpenChange:Sm,children:h}),t[18]=n,t[19]=h,t[20]=g):g=t[20],g}function Sm(){}function Cm(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=da();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)(Dn,{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 wm=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 Tm(e,t,n,r,i,a){if(e==r)return[];let o=Fm(e,t,n,r,i,a),s=Im(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 wm(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new wm(t,t+o,i,i),new wm(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 wm(t,t,i,i+o),new wm(n,n,i+o+c,a)]}if(c==1||l==1)return[new wm(t,n,i,a)];let u=Rm(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Tm(e,t,o,r,i,s).concat(Tm(e,o+c,n,r,s+c,a))}return km(e,t,n,r,i,a)}var Em=1e9,Dm=0,Om=!1;function km(e,t,n,r,i,a){let o=n-t,s=a-i;if(Em<1e9&&Math.min(o,s)>Em*16||Dm>0&&Date.now()>Dm)return Math.min(o,s)>Em*64?[new wm(t,n,i,a)]:zm(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);jm.reset(c),Mm.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:Mm,f=d?null:jm;for(let p=0;p<c;p++){if(p>Em||Dm>0&&!(p&63)&&Date.now()>Dm)return zm(e,t,n,r,i,a);let m=jm.advance(p,o,s,c,d,!1,l)||Mm.advance(p,o,s,c,f,!0,u);if(m)return Nm(e,t,n,t+m[0],r,i,a,i+m[1])}return[new wm(t,n,i,a)]}var Am=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}},jm=new Am,Mm=new Am;function Nm(e,t,n,r,i,a,o,s){let c=!1;return!eh(e,r)&&++r==n&&(c=!0),!eh(i,s)&&++s==o&&(c=!0),c?[new wm(t,n,a,o)]:Tm(e,t,r,i,a,s).concat(Tm(e,r,n,i,s,o))}function Pm(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function Fm(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=Pm(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-+!eh(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Im(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=Pm(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-+!eh(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function Lm(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;;){eh(e,s)||s++;let u=s+o;if(eh(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=Fm(e,u,n,r,i+f+d.length,a),c=Im(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 Rm(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=Rm(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:Lm(e,t,n,r,i,a,Math.floor(o/4),-1)}function zm(e,t,n,r,i,a){Om=!0;let o=n-t,s=a-i,c;if(o<s){let s=Lm(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=Lm(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new wm(t,n,i,a)];let[l,u,d]=c;return Tm(e,t,l,r,i,u).concat(Tm(e,l+d,n,r,u+d,a))}function Bm(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 wm(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Vm(e,t,n){for(;;){Bm(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=Fm(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wm(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Im(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new wm(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 wm(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 wm(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function Hm(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=Ym(t,a.fromA,l),f=Jm(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 wm(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Jm(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new wm(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Ym(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new wm(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Zm(n,a.fromB,a.toB),r,o=t<0?-1:Xm(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=Zm(t,a.fromA,a.toA),r,o=n<0?-1:Xm(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 Bm(e,3),e}var Um;try{Um=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function Wm(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Gm(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!Wm(n):Um?!Qm(n)||t==e.length-1?+!!Um.test(String.fromCharCode(n)):Um.test(e.slice(t,t+2))?2:0:0}function Km(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!Wm(n):Um?!$m(n)||t==1?+!!Um.test(String.fromCharCode(n)):Um.test(e.slice(t-2,t))?2:0:0}var qm=8;function Jm(e,t,n){if(t==e.length||!Km(e,t))return t;for(let r=t,i=t+n,a=0;a<qm;a++){let t=Gm(e,r);if(!t||r+t>i)return r;r+=t}return t}function Ym(e,t,n){if(!t||!Gm(e,t))return t;for(let r=t,i=t-n,a=0;a<qm;a++){let t=Km(e,r);if(!t||r-t<i)return r;r-=t}return t}function Xm(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Zm(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var Qm=e=>e>=55296&&e<=56319,$m=e=>e>=56320&&e<=57343;function eh(e,t){return!t||t==e.length||!Qm(e.charCodeAt(t-1))||!$m(e.charCodeAt(t))}function th(e,t,n){let r=n?.override;return r?r(e,t):(Em=(n?.scanLimit??1e9)>>1,Dm=n?.timeout?Date.now()+n.timeout:0,Om=!1,Vm(e,t,Tm(e,0,e.length,t,0,t.length)))}function nh(){return!Om}function rh(e,t,n){return Hm(th(e,t,n),e,t)}var ih=To.define({combine:e=>e[0]}),ah=Eo.define(),oh=To.define(),sh=bo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(ah)&&(e=n.value);for(let n of t.state.facet(oh))e=n(e,t);return e}});function ch(e){let t=e.field(sh,!1);if(!t)return null;let n=e.facet(ih);return{chunks:t,side:n?n.side:null}}var lh=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 fh(rh(e.toString(),t.toString(),n),e,t,0,0,nh())}static updateA(e,t,n,r,i){return gh(hh(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return gh(hh(e,r,!1,t.length),e,t,n,i)}};function uh(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 dh(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 fh(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=uh(c.fromA+r,c.fromB+i,t,n),[d,f]=dh(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]=uh(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]=dh(a.toA+r,a.toB+i,t,n),s++}o.push(new lh(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var ph=1e3;function mh(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 hh(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>ph&&([l,d]=mh(e,a-ph,n,!0)),o<t.length-ph&&([u,f]=mh(e,o+ph,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 gh(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=rh(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of fh(h,n,r,d,f,nh()))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 _h={scanLimit:500},vh=Do.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Oh(e))}update(e){(e.docChanged||e.viewportChanged||bh(e.startState,e.state)||xh(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Oh(e.view))}},{decorations:e=>e.deco}),yh=_o.low(jo({class:`cm-changeGutter`,markers:e=>e.plugin(vh)?.gutter||No.empty}));function bh(e,t){return e.field(sh,!1)!=t.field(sh,!1)}function xh(e,t){return e.facet(ih)!=t.facet(ih)}var Sh=Co.line({class:`cm-changedLine`}),Ch=Co.mark({class:`cm-changedText`}),wh=Co.mark({tagName:`ins`,class:`cm-insertedLine`}),Th=Co.mark({tagName:`del`,class:`cm-deletedLine`}),Eh=new class extends Ao{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Dh(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,Sh),i.add(o,s,n?Th:wh),a&&a.add(o,o,Eh);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Sh),a&&a.add(u,u,Eh);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,Ch),s<t)c++;else break}u=t}}}function Oh(e){let t=e.state.field(sh),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(ih),o=n==`a`,s=new wo,c=i?new wo: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))&&Dh(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var kh=class extends go{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}},Ah=Eo.define({map:(e,t)=>e.map(t)}),jh=bo.define({create:()=>Co.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Ah))return e.value;return e.map(t.changes)},provide:e=>ko.decorations.from(e)}),Mh=.01;function Nh(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 Ph(e,t,n){let r=new wo,i=new wo,a=e.state.field(jh).iter(),o=t.state.field(jh).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<-Mh?(l-=n,r.add(s,s,Co.widget({widget:new kh(-n),block:!0,side:-1}))):n>Mh&&(u+=n,i.add(c,c,Co.widget({widget:new kh(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<Mh?r.add(e.state.doc.length,e.state.doc.length,Co.widget({widget:new kh(-p),block:!0,side:1})):p>Mh&&i.add(t.state.doc.length,t.state.doc.length,Co.widget({widget:new kh(p),block:!0,side:1}));let m=r.finish(),h=i.finish();Nh(m,e.state.field(jh))||e.dispatch({effects:Ah.of(m)}),Nh(h,t.state.field(jh))||t.dispatch({effects:Ah.of(h)})}var Fh=Eo.define({map:(e,t)=>t.mapPos(e)}),Ih=class extends go{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:Fh.of(n)});let{side:r,sibling:i}=e.state.facet(ih);i&&i().dispatch({effects:Fh.of(Lh(n,e.state.field(sh),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Lh(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 Rh=bo.define({create(e){return Co.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Fh)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ko.decorations.from(e)});function zh({margin:e=3,minSize:t=4}){return Rh.init(n=>Bh(n,e,t))}function Bh(e,t,n){let r=new wo,i=e.facet(ih).side==`a`,a=e.field(sh),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,Co.replace({widget:new Ih(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Vh=ko.styleModule.of(new Mo({".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`}})),Hh=ko.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`}}),Uh=new Oo,Wh=new Oo,Gh=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||_h;let t=[_o.low(vh),Hh,Vh,jh,ko.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Ah)))&&this.measure()})],n=[ih.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(yh);let r=yo.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ko.editorAttributes.of({class:`cm-merge-a`}),Wh.of(n),t]}),i=[ih.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(yh);let a=yo.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ko.editorAttributes.of({class:`cm-merge-b`}),Wh.of(i),t]});this.chunks=lh.build(r.doc,a.doc,this.diffConf);let o=[sh.init(()=>this.chunks),Uh.of(e.collapseUnchanged?zh(e.collapseUnchanged):[])];r=r.update({effects:Eo.appendConfig.of(o)}).state,a=a.update({effects:Eo.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 ko({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ko({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),vo.empty(e[0].startState.doc.length));this.chunks=t==this.a?lh.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):lh.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:ah.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:ah.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(ih),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(Wh.reconfigure([ih.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?yh:[]])),a.push(Wh.reconfigure([ih.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?yh:[]]))}if(r){let t=Uh.reconfigure(e.collapseUnchanged?zh(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(){Ph(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=Kh(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=Kh(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 Kh(e){let t=e.nextSibling;return e.remove(),t}var qh=new class extends Ao{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Jh=_o.low(jo({class:`cm-changeGutter`,markers:e=>e.plugin(vh)?.gutter||No.empty,widgetMarker:(e,t)=>t instanceof $h?qh:null}));function Yh(e){let t=typeof e.original==`string`?So.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||_h;return[_o.low(vh),ig,Hh,ko.editorAttributes.of({class:`cm-merge-b`}),oh.of((e,t)=>{let r=t.effects.find(e=>e.is(Xh));return r&&(e=lh.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=lh.updateB(e,t.state.field(Zh),t.newDoc,t.changes,n)),e}),ih.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?ug:void 0,side:`b`}),Zh.init(()=>t),e.gutter===!1?[]:Jh,e.collapseUnchanged?zh(e.collapseUnchanged):[],sh.init(e=>lh.build(t,e.doc,n))]}var Xh=Eo.define(),Zh=bo.define({create:()=>So.empty,update(e,t){for(let n of t.effects)n.is(Xh)&&(e=n.value.doc);return e}}),Qh=new WeakMap,$h=class extends go{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 eg(e,t,n){let r=Qh.get(t.changes);if(r)return r;let i=Co.widget({block:!0,side:-1,widget:new $h(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(ih),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(),tg(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),ng(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(Zh).sliceString(t.fromA,t.endA),u=a&&e.facet(Po),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 Fc(e){return{start(t){return e.localOp.clone.start(t)}}}var Ic=`ContextMenu`,[Lc,Rc]=Ur(Ic,[Ni]),zc=Ni(),[Bc,Vc]=Lc(Ic),Hc=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:a=!0}=e,[o,s]=Q.useState(!1),c=zc(t),l=Gr(r),u=Q.useCallback(e=>{s(e),l(e)},[l]);return(0,Z.jsx)(Bc,{scope:t,open:o,onOpenChange:u,modal:a,children:(0,Z.jsx)(Ui,{...c,dir:i,open:o,onOpenChange:u,modal:a,children:n})})};Hc.displayName=Ic;var Uc=`ContextMenuTrigger`,Wc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Vc(Uc,n),o=zc(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)(fa,{...o,virtualRef:c}),(0,Z.jsx)(Br.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:zr(e.onContextMenu,e=>{u(),d(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:zr(e.onPointerDown,yl(e=>{u(),l.current=window.setTimeout(()=>d(e),700)})),onPointerMove:r?e.onPointerMove:zr(e.onPointerMove,yl(u)),onPointerCancel:r?e.onPointerCancel:zr(e.onPointerCancel,yl(u)),onPointerUp:r?e.onPointerUp:zr(e.onPointerUp,yl(u))})]})});Wc.displayName=Uc;var Gc=`ContextMenuPortal`,Kc=e=>{let{__scopeContextMenu:t,...n}=e,r=zc(t);return(0,Z.jsx)(ua,{...r,...n})};Kc.displayName=Gc;var qc=`ContextMenuContent`,Jc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Vc(qc,n),a=zc(n),o=Q.useRef(!1);return(0,Z.jsx)(ca,{...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)`}})});Jc.displayName=qc;var Yc=`ContextMenuGroup`,Xc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(xa,{...i,...r,ref:t})});Xc.displayName=Yc;var Zc=`ContextMenuLabel`,Qc=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(ma,{...i,...r,ref:t})});Qc.displayName=Zc;var $c=`ContextMenuItem`,el=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Yi,{...i,...r,ref:t})});el.displayName=$c;var tl=`ContextMenuCheckboxItem`,nl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Ji,{...i,...r,ref:t})});nl.displayName=tl;var rl=`ContextMenuRadioGroup`,il=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(na,{...i,...r,ref:t})});il.displayName=rl;var al=`ContextMenuRadioItem`,ol=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(ea,{...i,...r,ref:t})});ol.displayName=al;var sl=`ContextMenuItemIndicator`,cl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Qi,{...i,...r,ref:t})});cl.displayName=sl;var ll=`ContextMenuSeparator`,ul=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Ca,{...i,...r,ref:t})});ul.displayName=ll;var dl=`ContextMenuArrow`,fl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(va,{...i,...r,ref:t})});fl.displayName=dl;var pl=`ContextMenuSub`,ml=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=zc(t),[s,c]=Kr({prop:i,defaultProp:a??!1,onChange:r,caller:pl});return(0,Z.jsx)(ka,{...o,open:s,onOpenChange:c,children:n})};ml.displayName=pl;var hl=`ContextMenuSubTrigger`,gl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(Da,{...i,...r,ref:t})});gl.displayName=hl;var _l=`ContextMenuSubContent`,vl=Q.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=zc(n);return(0,Z.jsx)(qi,{...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)`}})});vl.displayName=_l;function yl(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var bl=Hc,xl=Wc,Sl=Kc,Cl=Jc,wl=el,Tl=ul,El=`Radio`,[Dl,Ol]=Ur(El),[kl,Al]=Dl(El),jl=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=Jr(t,e=>f(e)),m=Q.useRef(!1),h=d?l||!!d.closest(`form`):!0;return(0,Z.jsxs)(kl,{scope:n,checked:i,disabled:o,children:[(0,Z.jsx)(Br.button,{type:`button`,role:`radio`,"aria-checked":i,"data-state":Il(i),"data-disabled":o?``:void 0,disabled:o,value:s,...u,ref:p,onClick:zr(e.onClick,e=>{i||c?.(),h&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),h&&(0,Z.jsx)(Fl,{control:d,bubbles:!m.current,name:r,value:s,checked:i,required:a,disabled:o,form:l,style:{transform:`translateX(-100%)`}})]})});jl.displayName=El;var Ml=`RadioIndicator`,Nl=Q.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=Al(Ml,n);return(0,Z.jsx)(Hr,{present:r||a.checked,children:(0,Z.jsx)(Br.span,{"data-state":Il(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});Nl.displayName=Ml;var Pl=`RadioBubbleInput`,Fl=Q.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=Q.useRef(null),s=Jr(o,a),c=Pa(n),l=Za(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)(Br.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}})});Fl.displayName=Pl;function Il(e){return e?`checked`:`unchecked`}var Ll=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],Rl=`RadioGroup`,[zl,Bl]=Ur(Rl,[to,Ol]),Vl=to(),Hl=Ol(),[Ul,Wl]=zl(Rl),Gl=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=Vl(n),m=un(l),[h,g]=Kr({prop:a,defaultProp:i??null,onChange:d,caller:Rl});return(0,Z.jsx)(Ul,{scope:n,name:r,required:o,disabled:s,value:h,onValueChange:g,children:(0,Z.jsx)(no,{asChild:!0,...p,orientation:c,dir:m,loop:u,children:(0,Z.jsx)(Br.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":c,"data-disabled":s?``:void 0,dir:m,...f,ref:t})})})});Gl.displayName=Rl;var Kl=`RadioGroupItem`,ql=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...i}=e,a=Wl(Kl,n),o=a.disabled||r,s=Vl(n),c=Hl(n),l=Q.useRef(null),u=Jr(t,l),d=a.value===i.value,f=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{Ll.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)(io,{asChild:!0,...s,focusable:!o,active:d,children:(0,Z.jsx)(jl,{disabled:o,required:a.required,checked:d,...c,...i,name:a.name,ref:u,onCheck:()=>a.onValueChange(i.value),onKeyDown:zr(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:zr(i.onFocus,()=>{f.current&&l.current?.click()})})})});ql.displayName=Kl;var Jl=`RadioGroupIndicator`,Yl=Q.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,Z.jsx)(Nl,{...Hl(n),...r,ref:t})});Yl.displayName=Jl;var Xl=Gl,Zl=ql,Ql=Yl;async function $l(e){try{await navigator.clipboard.writeText(e)}catch{}}var eu=120*1e3;function tu(e){let t=(0,$.c)(26),{onSuccess:n,onCancel:r,transport:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(`https://github.com/login/device`),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(eu),_=(0,Q.useRef)(null),v=(0,Q.useRef)(null),y;t[0]!==n||t[1]!==i?(y=async function(){f(null),m(!0);try{let e=i.start();_.current=e.cancel;let t=e.events[Symbol.asyncIterator](),r=!1,a=await t.next();for(;!a.done;){let e=a.value;if(e.type===`verification`)o(e.user_code),c(e.verification_uri),g(e.expires_in*1e3),$l(e.user_code).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)});else if(e.type===`complete`){r=!0,m(!1),n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){r=!0,f(e.message),m(!1);break}a=await t.next()}r||(f(`Sign-in stream ended without confirmation — please try again`),m(!1))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&f(`Connection error — try again`),m(!1)}},t[0]=n,t[1]=i,t[2]=y):y=t[2];let b=y,x;t[3]===b?x=t[4]:(x=()=>{let e=!1;return queueMicrotask(()=>{e||b()}),()=>{e=!0,_.current?.(),_.current=null,v.current&&clearInterval(v.current)}},t[3]=b,t[4]=x);let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],t[5]=S):S=t[5],(0,Q.useEffect)(x,S);let C,w;t[6]===a?(C=t[7],w=t[8]):(C=()=>{if(!a)return;let e=Date.now();return v.current=setInterval(()=>{let t=eu-(Date.now()-e);t<=0?(g(0),v.current&&clearInterval(v.current),f(`Code expired — please try again`)):g(t)},1e3),()=>{v.current&&clearInterval(v.current)}},w=[a],t[6]=a,t[7]=C,t[8]=w),(0,Q.useEffect)(C,w);let T=Math.floor(h/6e4),E=Math.floor(h%6e4/1e3),D;t[9]===E?D=t[10]:(D=E.toString().padStart(2,`0`),t[9]=E,t[10]=D);let O=`${T}:${D}`,k;t[11]!==l||t[12]!==d||t[13]!==O||t[14]!==a||t[15]!==s?(k=a?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Open`,` `,(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>pi(e,s),onAuxClick:e=>pi(e,s),className:`underline underline-offset-2`,children:s}),` `,`and enter this code:`]}),(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:a}),(0,Z.jsx)(X,{variant:`outline`,size:`sm`,onClick:()=>void $l(a).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}),children:l?`Copied!`:`Copy`})]}),(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`}),`Waiting for authorization`]}),(0,Z.jsxs)(`span`,{children:[`Expires in `,O]})]})]}):(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:d?null:`Starting sign-in flow`}),t[11]=l,t[12]=d,t[13]=O,t[14]=a,t[15]=s,t[16]=k):k=t[16];let A;t[17]===d?A=t[18]:(A=d&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:d}),t[17]=d,t[18]=A);let j;t[19]!==r||t[20]!==p?(j=p&&(0,Z.jsx)(X,{variant:`ghost`,size:`sm`,onClick:r,children:`Cancel`}),t[19]=r,t[20]=p,t[21]=j):j=t[21];let M;return t[22]!==k||t[23]!==A||t[24]!==j?(M=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[k,A,j]}),t[22]=k,t[23]=A,t[24]=j,t[25]=M):M=t[25],M}function nu(e){let t=(0,$.c)(32),{onSuccess:n,onCancel:r}=e,[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(null),d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>()=>{u.current?.abort()},f=[],t[0]=d,t[1]=f):(d=t[0],f=t[1]),(0,Q.useEffect)(d,f);let p;t[2]!==n||t[3]!==i?(p=async function(){if(!i.trim()){l(`Paste a personal access token`);return}u.current?.abort();let e=new AbortController;u.current=e,s(!0),l(null);try{let t=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pat:i.trim()}),signal:e.signal});if(!t.ok){let e=`Invalid token — check that it has repo scope`;try{let n=await t.json(),r=ir.safeParse(n);r.success&&(e=r.data.title)}catch{}l(e),s(!1);return}if(!t.body){l(`Invalid token — check that it has repo scope`),s(!1);return}await Ac(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}),s(!1),`terminal`):`continue`})||l(`No response — try again`)}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&l(`Connection error — try again`)}s(!1)},t[2]=n,t[3]=i,t[4]=p):p=t[4];let m=p,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(`a`,{href:`https://github.com/settings/tokens`,target:`_blank`,rel:`noopener noreferrer`,onClick:iu,onAuxClick:ru,className:`underline underline-offset-2`,children:`github.com/settings/tokens`}),t[5]=h):h=t[5];let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Create a token at`,` `,h,` `,`with `,(0,Z.jsx)(`code`,{className:`text-xs bg-muted px-1 rounded`,children:`repo`}),` scope.`]}),t[6]=g):g=t[6];let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>a(e.target.value),t[7]=_):_=t[7];let v;t[8]===m?v=t[9]:(v=e=>{e.key===`Enter`&&m()},t[8]=m,t[9]=v);let y;t[10]!==o||t[11]!==i||t[12]!==v?(y=(0,Z.jsx)(fo,{type:`password`,"aria-label":`Personal access token`,placeholder:`ghp_…`,value:i,onChange:_,disabled:o,onKeyDown:v}),t[10]=o,t[11]=i,t[12]=v,t[13]=y):y=t[13];let b;t[14]===c?b=t[15]:(b=c&&(0,Z.jsx)(`p`,{className:`text-sm text-destructive`,children:c}),t[14]=c,t[15]=b);let x;t[16]===m?x=t[17]:(x=()=>void m(),t[16]=m,t[17]=x);let S=o?`Validating`:`Add token`,C;t[18]!==o||t[19]!==x||t[20]!==S?(C=(0,Z.jsx)(X,{className:`flex-1`,onClick:x,disabled:o,children:S}),t[18]=o,t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==o||t[23]!==r?(w=(0,Z.jsx)(X,{variant:`ghost`,onClick:r,disabled:o,children:`Cancel`}),t[22]=o,t[23]=r,t[24]=w):w=t[24];let T;t[25]!==C||t[26]!==w?(T=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[C,w]}),t[25]=C,t[26]=w,t[27]=T):T=t[27];let E;return t[28]!==T||t[29]!==y||t[30]!==b?(E=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[g,y,b,T]}),t[28]=T,t[29]=y,t[30]=b,t[31]=E):E=t[31],E}function ru(e){return pi(e,`https://github.com/settings/tokens`)}function iu(e){return pi(e,`https://github.com/settings/tokens`)}function au(e){let t=(0,$.c)(27),{login:n,onSave:r,onSkip:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Before syncing, set your identity for git commits:`}),t[0]=l):l=t[0];let u=`Name (e.g. ${n})`,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[1]=d):d=t[1];let f;t[2]!==a||t[3]!==u?(f=(0,Z.jsx)(fo,{"aria-label":`Name`,placeholder:u,value:a,onChange:d}),t[2]=a,t[3]=u,t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>c(e.target.value),t[5]=p):p=t[5];let m;t[6]===s?m=t[7]:(m=(0,Z.jsx)(fo,{type:`email`,"aria-label":`Email`,placeholder:`Email`,value:s,onChange:p}),t[6]=s,t[7]=m);let h;t[8]!==s||t[9]!==a||t[10]!==r?(h=()=>r(a.trim(),s.trim()),t[8]=s,t[9]=a,t[10]=r,t[11]=h):h=t[11];let g;t[12]!==s||t[13]!==a?(g=!a.trim()||!s.trim(),t[12]=s,t[13]=a,t[14]=g):g=t[14];let _;t[15]!==h||t[16]!==g?(_=(0,Z.jsx)(X,{className:`flex-1`,onClick:h,disabled:g,children:`Save`}),t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]===i?v=t[19]:(v=(0,Z.jsx)(X,{variant:`ghost`,onClick:i,children:`Skip`}),t[18]=i,t[19]=v);let y;t[20]!==v||t[21]!==_?(y=(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[_,v]}),t[20]=v,t[21]=_,t[22]=y):y=t[22];let b;return t[23]!==y||t[24]!==f||t[25]!==m?(b=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,f,m,y]}),t[23]=y,t[24]=f,t[25]=m,t[26]=b):b=t[26],b}function ou(e){let t=(0,$.c)(42),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s}=e,c;t[0]===s?c=t[1]:(c=s??Mc(),t[0]=s,t[1]=c);let l=c,[u,d]=(0,Q.useState)(`device`),[f,p]=(0,Q.useState)(`auth`),[m,h]=(0,Q.useState)(null),g,_;t[2]===n?(g=t[3],_=t[4]):(g=()=>{n&&(d(`device`),p(`auth`),h(null))},_=[n],t[2]=n,t[3]=g,t[4]=_),(0,Q.useEffect)(g,_);let v;t[5]!==a||t[6]!==r||t[7]!==i?(v=function(e){h(e),a&&(!e.name||!e.email)?p(`identity`):(p(`done`),i?.(e),r(!1),Xa.success(`Signed in as @${e.login}`))},t[5]=a,t[6]=r,t[7]=i,t[8]=v):v=t[8];let y=v,b;t[9]!==m||t[10]!==r||t[11]!==i?(b=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(su);let n={...m??{login:``},name:e,email:t};p(`done`),i?.(n),r(!1),Xa.success(`Signed in as @${n.login}`)},t[9]=m,t[10]=r,t[11]=i,t[12]=b):b=t[12];let x=b,S;t[13]!==m||t[14]!==r||t[15]!==i?(S=function(){m&&(p(`done`),i?.(m),r(!1),Xa.success(`Signed in as @${m.login}`))},t[13]=m,t[14]=r,t[15]=i,t[16]=S):S=t[16];let C=S,w;t[17]===r?w=t[18]:(w=function(){r(!1)},t[17]=r,t[18]=w);let T=w,E=o?`Re-authenticate with GitHub`:`Sign in to GitHub`,D;t[19]===E?D=t[20]:(D=(0,Z.jsx)(qa,{children:(0,Z.jsx)(Ra,{children:E})}),t[19]=E,t[20]=D);let O;t[21]!==y||t[22]!==T||t[23]!==l||t[24]!==f||t[25]!==u?(O=f===`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:u===`device`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`device`),children:`GitHub App`}),(0,Z.jsx)(X,{variant:u===`pat`?`secondary`:`ghost`,size:`sm`,onClick:()=>d(`pat`),children:`Token`})]}),u===`device`?(0,Z.jsx)(tu,{onSuccess:y,onCancel:T,transport:l}):(0,Z.jsx)(nu,{onSuccess:y,onCancel:T})]}),t[21]=y,t[22]=T,t[23]=l,t[24]=f,t[25]=u,t[26]=O):O=t[26];let k;t[27]!==m||t[28]!==x||t[29]!==C||t[30]!==f?(k=f===`identity`&&m&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`text-sm font-medium`,children:[`Signed in as @`,m.login]}),(0,Z.jsx)(au,{login:m.login,onSave:x,onSkip:C})]}),t[27]=m,t[28]=x,t[29]=C,t[30]=f,t[31]=k):k=t[31];let A;t[32]!==k||t[33]!==O?(A=(0,Z.jsxs)(Wa,{children:[O,k]}),t[32]=k,t[33]=O,t[34]=A):A=t[34];let j;t[35]!==A||t[36]!==D?(j=(0,Z.jsxs)(Va,{className:`sm:max-w-md`,children:[D,A]}),t[35]=A,t[36]=D,t[37]=j):j=t[37];let M;return t[38]!==r||t[39]!==n||t[40]!==j?(M=(0,Z.jsx)(Ja,{open:n,onOpenChange:r,children:j}),t[38]=r,t[39]=n,t[40]=j,t[41]=M):M=t[41],M}function su(){}function cu(e){let t=(0,$.c)(2),{className:n}=e,{channel:r}=bc();if(r!==`beta`)return null;let i;return t[0]===n?i=t[1]:(i=(0,Z.jsx)(Ne,{variant:`secondary`,"aria-label":`Beta channel`,"data-testid":`beta-badge`,className:n,children:`BETA`}),t[0]=n,t[1]=i),i}function lu(e){switch(e){case`receiving`:return`Receiving objects`;case`resolving`:return`Resolving deltas`;case`checking`:return`Checking out files`;case`init`:return`Initializing project`;case`done`:return`Complete`;default:return`Cloning`}}function uu(e){let t=e.trim();if(/^[\w.-]+\/[\w.-]+$/.test(t))return t.split(`/`)[1];try{return new URL(t.replace(/^git@([^:]+):/,`https://$1/`)).pathname.replace(/\.git$/,``).split(`/`).pop()??`repo`}catch{return t.split(`/`).pop()?.replace(/\.git$/,``)??`repo`}}function du(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,onSignIn:i,onCloneComplete:a,transport:o,authQueryTransport:s,pickParentFolder:c}=e,l;t[0]===o?l=t[1]:(l=o??Pc(),t[0]=o,t[1]=l);let u=l,d;t[2]===s?d=t[3]:(d=s??Oc(),t[2]=s,t[3]=d);let f=d,p=c!==void 0,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),O=(0,Q.useRef)(null),k=(0,Q.useRef)(null),A;t[4]!==n||t[5]!==f?(A=()=>{if(!n)return;let e=!1;return f.status().then(t=>{e||T(t.authenticated)}).catch(()=>{e||T(!1)}),()=>{e=!0}},t[4]=n,t[5]=f,t[6]=A):A=t[6];let j;t[7]===n?j=t[8]:(j=[n],t[7]=n,t[8]=j),(0,Q.useEffect)(A,j);let M;t[9]!==w||t[10]!==n||t[11]!==f?(M=()=>{if(!w||!n)return;let e=!1;return x(!0),f.repos().then(t=>{e||(y(t.ok?t.repos:[]),x(!1))}).catch(()=>{e||(y([]),x(!1))}),()=>{e=!0}},t[9]=w,t[10]=n,t[11]=f,t[12]=M):M=t[12];let N;t[13]!==w||t[14]!==n?(N=[w,n],t[13]=w,t[14]=n,t[15]=N):N=t[15],(0,Q.useEffect)(M,N);let P;t[16]===p?P=t[17]:(P=function(e){if(h(e),p)return;let t=uu(e);t&&_(`~/Documents/${t}`)},t[16]=p,t[17]=P);let F=P,I;t[18]===p?I=t[19]:(I=function(e){if(h(e.clone_url),p)return;let t=e.full_name.split(`/`)[1];_(`~/Documents/${t}`)},t[18]=p,t[19]=I);let L=I,R;t[20]!==g||t[21]!==a||t[22]!==r||t[23]!==c||t[24]!==u||t[25]!==m?(R=async function(){let e=m.trim();if(!e){Xa.error(`Enter a repository URL or owner/repo`);return}let t=g||``;if(c){D(!0);let n=await c();if(!n){D(!1);return}let r=uu(e);t=`${n.replace(/\/$/,``)}/${r}`}else D(!0);let n=Xa.loading(`Starting clone`,{duration:1/0});k.current=n;let i=u.start({url:e,dir:t});O.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`)Xa.loading(`${lu(i.phase)} — ${i.pct}%`,{id:n});else if(i.type===`complete`){Xa.success(`Clone complete — opening project`,{id:n}),r(!1),D(!1),O.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`){Xa.error(`Clone failed: ${i.message}`,{id:n}),D(!1),O.current=null;return}t=await e.next()}Xa.error(`Clone stream ended unexpectedly — check if the clone completed`,{id:n}),D(!1),O.current=null}catch(e){console.error(`[CloneDialog] clone iteration failed:`,e),Xa.error(`Clone failed — connection error`,{id:n}),D(!1),O.current=null}},t[20]=g,t[21]=a,t[22]=r,t[23]=c,t[24]=u,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(){O.current?.(),O.current=null,D(!1),Xa.dismiss(k.current??void 0)},t[27]=B):B=t[27];let V=B,H;t[28]!==E||t[29]!==r||t[30]!==p?(H=function(e){E||(r(e),e||(h(``),p||_(``),C(``)))},t[28]=E,t[29]=r,t[30]=p,t[31]=H):H=t[31];let U=H,W,G,K,q,ee,te,ne,re,ie,ae;if(t[32]!==E||t[33]!==U||t[34]!==L||t[35]!==F||t[36]!==w||t[37]!==b||t[38]!==n||t[39]!==S||t[40]!==v||t[41]!==m){let e=v?.filter(e=>e.full_name.toLowerCase().includes(S.toLowerCase()));K=Ja,ie=n,ae=U,G=Va,ne=`sm:max-w-lg`,t[52]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Z.jsx)(qa,{children:(0,Z.jsx)(Ra,{children:`Clone from GitHub`})}),t[52]=re):re=t[52],W=Wa,q=`flex flex-col gap-4`;let r;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`label`,{htmlFor:`clone-url`,className:`text-sm font-medium`,children:`Repository URL or owner/repo`}),t[53]=r):r=t[53];let i;t[54]===F?i=t[55]:(i=e=>F(e.target.value),t[54]=F,t[55]=i),t[56]!==E||t[57]!==i||t[58]!==m?(ee=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[r,(0,Z.jsx)(fo,{id:`clone-url`,placeholder:`https://github.com/owner/repo or owner/repo`,value:m,onChange:i,disabled:E})]}),t[56]=E,t[57]=i,t[58]=m,t[59]=ee):ee=t[59],te=w&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`repo-filter`,className:`text-sm font-medium`,children:`Your repositories`}),(0,Z.jsx)(fo,{id:`repo-filter`,"aria-label":`Filter repositories`,placeholder:`Filter repositories`,value:S,onChange:e=>C(e.target.value),disabled:E||b&&v===null}),(0,Z.jsx)(`div`,{className:`border rounded-md max-h-40 overflow-y-auto subtle-scrollbar`,"aria-busy":b&&v===null,children:b&&v===null?(0,Z.jsxs)(`output`,{className:`flex flex-col gap-1.5 px-3 py-2`,"aria-label":`Loading repositories`,children:[(0,Z.jsx)(Gi,{className:`h-4 w-2/3`}),(0,Z.jsx)(Gi,{className:`h-4 w-1/2`}),(0,Z.jsx)(Gi,{className:`h-4 w-3/4`}),(0,Z.jsx)(Gi,{className:`h-4 w-2/5`}),(0,Z.jsx)(Gi,{className:`h-4 w-3/5`})]}):e?.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:v?.length===0?`No repositories found.`:`No matches.`}):e?.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`w-full text-left px-3 py-1.5 text-sm hover:bg-muted flex items-center gap-2 truncate disabled:opacity-50`,onClick:()=>L(e),disabled:E,children:[e.private&&(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:`🔒`}),e.full_name]},e.full_name))})]}),t[32]=E,t[33]=U,t[34]=L,t[35]=F,t[36]=w,t[37]=b,t[38]=n,t[39]=S,t[40]=v,t[41]=m,t[42]=W,t[43]=G,t[44]=K,t[45]=q,t[46]=ee,t[47]=te,t[48]=ne,t[49]=re,t[50]=ie,t[51]=ae}else W=t[42],G=t[43],K=t[44],q=t[45],ee=t[46],te=t[47],ne=t[48],re=t[49],ie=t[50],ae=t[51];let oe;t[60]!==E||t[61]!==w||t[62]!==i?(oe=!w&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(`span`,{children:`Browse your repos:`}),(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`h-auto p-0`,onClick:()=>i?.(),disabled:E,children:`Sign in to GitHub`})]}),t[60]=E,t[61]=w,t[62]=i,t[63]=oe):oe=t[63];let se;t[64]!==E||t[65]!==g||t[66]!==p?(se=!p&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:`clone-path`,className:`text-sm font-medium`,children:`Local path`}),(0,Z.jsx)(fo,{id:`clone-path`,placeholder:`~/Documents/repo-name`,value:g,onChange:e=>_(e.target.value),disabled:E})]}),t[64]=E,t[65]=g,t[66]=p,t[67]=se):se=t[67];let ce;t[68]!==q||t[69]!==ee||t[70]!==te||t[71]!==oe||t[72]!==se?(ce=(0,Z.jsxs)(`div`,{className:q,children:[ee,te,oe,se]}),t[68]=q,t[69]=ee,t[70]=te,t[71]=oe,t[72]=se,t[73]=ce):ce=t[73];let le;t[74]!==W||t[75]!==ce?(le=(0,Z.jsx)(W,{children:ce}),t[74]=W,t[75]=ce,t[76]=le):le=t[76];let ue;t[77]!==E||t[78]!==z||t[79]!==U||t[80]!==m||t[81]!==p?(ue=(0,Z.jsx)(Ga,{children:E?(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:V,children:`Cancel`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:()=>U(!1),children:`Cancel`}),(0,Z.jsx)(X,{onClick:()=>void z(),disabled:!m.trim(),"aria-describedby":p?`clone-picker-hint`:void 0,children:`Clone`}),p&&(0,Z.jsx)(`span`,{id:`clone-picker-hint`,className:`sr-only`,children:`Opens a folder picker to choose where to clone the repository.`})]})}),t[77]=E,t[78]=z,t[79]=U,t[80]=m,t[81]=p,t[82]=ue):ue=t[82];let de;t[83]!==G||t[84]!==ne||t[85]!==re||t[86]!==le||t[87]!==ue?(de=(0,Z.jsxs)(G,{className:ne,children:[re,le,ue]}),t[83]=G,t[84]=ne,t[85]=re,t[86]=le,t[87]=ue,t[88]=de):de=t[88];let fe;return t[89]!==K||t[90]!==ie||t[91]!==ae||t[92]!==de?(fe=(0,Z.jsx)(K,{open:ie,onOpenChange:ae,children:de}),t[89]=K,t[90]=ie,t[91]=ae,t[92]=de,t[93]=fe):fe=t[93],fe}var fu=(0,Q.lazy)(()=>r(()=>import(`./ConsentDialogBody-BYenkRKt.js`),__vite__mapDeps([5,1,6,7,8,9,10,11]),import.meta.url));function pu(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(ho.subscribe,hu,mu))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)(fu,{})}),e[0]=t):t=e[0],t}function mu(){return!1}function hu(){return ho.getSnapshot()!==null}var gu=180;function _u(e,t){if(e===``||t===``)return``;let n=e.includes(`\\`)&&!e.includes(`/`)?`\\`:`/`;return`${e.replace(/[/\\]+$/,``)}${n}${t}`}function vu(e){if(e===``)return``;let t=e.split(/[/\\]/).filter(Boolean);return t.length>0?t[t.length-1]??e:e}function yu(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 bu(e){let t=e instanceof Error?e.message:String(e);for(let e of Cr)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 xu(e){switch(e.reason){case`nested-project`:return`A project already exists at this location. Pick a different parent folder.`;case`target-not-empty`:return`A non-empty folder with this name already exists. Use a different name.`;case`invalid-args`:return`Invalid input — please check the name and try again.`;case`mkdir-failed`:return`Could not create the project folder. Try a different name or location.`;case`git-init-failed`:return`Project folder created, but git init failed. Try again.`;case`init-failed`:return`Could not write project files. Try a different location.`;case`discovery-failed`:return`Could not finalize project setup. Try again.`;case`unknown`:return`Could not create project. Try again or pick a different location.`}}function Su(e){let t=(0,$.c)(94),{open:n,onOpenChange:r,bridge:i}=e,[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(Tu),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)(!1),[v,y]=(0,Q.useState)(null),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=new Map,t[1]=b):b=t[1];let x=(0,Q.useRef)(b),S;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=new Set,t[2]=S):S=t[2];let C=(0,Q.useRef)(S),w=(0,Q.useRef)(null),T=(0,Q.useRef)(null),E=(0,Q.useRef)(null),D,O;t[3]!==i||t[4]!==n?(D=()=>{if(!n)return;x.current.clear(),C.current.clear(),y(null),h({kind:`idle`}),_(!1),o(``),f(new Set(cn));let e=!1;u(!0),i.fs.defaultProjectsRoot().then(t=>{e||c(t)}).catch(wu).finally(()=>{e||u(!1)});let t=requestAnimationFrame(()=>{E.current?.focus()});return()=>{e=!0,cancelAnimationFrame(t)}},O=[n,i],t[3]=i,t[4]=n,t[5]=D,t[6]=O):(D=t[5],O=t[6]),(0,Q.useEffect)(D,O);let k,A;t[7]!==i||t[8]!==a||t[9]!==n||t[10]!==s?(k=()=>{if(!n)return;T.current!==null&&clearTimeout(T.current),w.current!==null&&w.current.abort();let e=jn(a);if(s===``||e===``){h({kind:`idle`});return}let t=_u(s,e),r=x.current.get(t);if(r!==void 0){h(yu({parent:s,sanitizedName:e,enclosingProject:r.enclosingProject,enclosingGit:r.enclosingGit,targetState:r.targetState}));return}h({kind:`pending`});let o=new AbortController;return w.current=o,T.current=setTimeout(()=>{Promise.all([i.fs.findEnclosingProjectRoot(s),i.fs.findEnclosingGitRoot(s),i.fs.folderState(t)]).then(n=>{let[r,i,a]=n;o.signal.aborted||(x.current.set(t,{enclosingProject:r,enclosingGit:i,targetState:a}),h(yu({parent:s,sanitizedName:e,enclosingProject:r,enclosingGit:i,targetState:a})))}).catch(e=>{o.signal.aborted||(console.warn(`[CreateProjectDialog] cascade probe failed:`,e),h({kind:`free`}))})},gu),()=>{T.current!==null&&clearTimeout(T.current),o.abort()}},A=[n,a,s,i],t[7]=i,t[8]=a,t[9]=n,t[10]=s,t[11]=k,t[12]=A):(k=t[11],A=t[12]),(0,Q.useEffect)(k,A);let j,M;t[13]!==i||t[14]!==m||t[15]!==n?(j=()=>{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&&(C.current.has(e)||(C.current.add(e),i.project.recordCreateNewBannerShown(e).catch(Cu)))},M=[n,m,i],t[13]=i,t[14]=m,t[15]=n,t[16]=j,t[17]=M):(j=t[16],M=t[17]),(0,Q.useEffect)(j,M);let N,P;t[18]!==a||t[19]!==s?(N=jn(a),P=N===``||s===``?``:_u(s,N),t[18]=a,t[19]=s,t[20]=N,t[21]=P):(N=t[20],P=t[21]);let F=P,I=F===``?s:F,L=!g&&N!==``&&s!==``&&(m.kind===`free`||m.kind===`confirm-git`),R;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[22]=R):R=t[22];let z=R,B;t[23]===i?B=t[24]:(B=async function(){try{let e=await i.dialog.openFolder();if(e===null)return;c(e)}catch(e){console.warn(`[CreateProjectDialog] dialog.openFolder failed:`,e)}},t[23]=i,t[24]=B);let V=B,H;t[25]!==i||t[26]!==L||t[27]!==d||t[28]!==r||t[29]!==s||t[30]!==N?(H=async function(e){if(e.preventDefault(),L){_(!0),y(null);try{await i.project.createNew({parent:s,name:N,editors:Array.from(d)}),r(!1)}catch(e){y(bu(e)),_(!1)}}},t[25]=i,t[26]=L,t[27]=d,t[28]=r,t[29]=s,t[30]=N,t[31]=H):H=t[31];let U=H,W;t[32]!==g||t[33]!==r?(W=function(e){g||r(e)},t[32]=g,t[33]=r,t[34]=W):W=t[34];let G=W,K;t[35]!==i||t[36]!==r?(K=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[35]=i,t[36]=r,t[37]=K):K=t[37];let q=K,ee;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsxs)(qa,{children:[(0,Z.jsx)(Ra,{children:`Create new project`}),(0,Z.jsx)(Ia,{children:`Make a new folder for a brand-new Open Knowledge project.`})]}),t[38]=ee):ee=t[38];let te;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(oo,{htmlFor:`create-name`,className:`block`,children:`Name`}),t[39]=te):te=t[39];let ne;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{o(e.target.value),y(null)},t[40]=ne):ne=t[40];let re;t[41]!==g||t[42]!==a?(re=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[te,(0,Z.jsx)(fo,{id:`create-name`,ref:E,value:a,onChange:ne,disabled:g,placeholder:`My Notes`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`create-target-caption`,"data-testid":`create-name`})]}),t[41]=g,t[42]=a,t[43]=re):re=t[43];let ie;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Z.jsx)(oo,{htmlFor:`create-location`,className:`block`,children:`Location`}),t[44]=ie):ie=t[44];let ae=g||l,oe;t[45]===V?oe=t[46]:(oe=()=>void V(),t[45]=V,t[46]=oe);let se;t[47]!==ae||t[48]!==oe?(se=(0,Z.jsx)(`div`,{className:`flex items-stretch gap-2`,children:(0,Z.jsx)(X,{id:`create-location`,type:`button`,variant:`outline`,disabled:ae,onClick:oe,"data-testid":`create-browse`,children:`Browse`})}),t[47]=ae,t[48]=oe,t[49]=se):se=t[49];let ce;t[50]===I?ce=t[51]:(ce=I===``?(0,Z.jsx)(`span`,{className:`sr-only`,children:`No target path yet`}):I,t[50]=I,t[51]=ce);let le;t[52]===ce?le=t[53]:(le=(0,Z.jsx)(`p`,{id:`create-target-caption`,className:`text-xs text-muted-foreground`,"aria-live":`polite`,"data-testid":`create-target-caption`,children:ce}),t[52]=ce,t[53]=le);let ue;t[54]!==se||t[55]!==le?(ue=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[ie,se,le]}),t[54]=se,t[55]=le,t[56]=ue):ue=t[56];let de;t[57]!==m||t[58]!==q?(de=(0,Z.jsx)(Eu,{cascade:m,onOpenNested:q}),t[57]=m,t[58]=q,t[59]=de):de=t[59];let fe,pe;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Connect AI editors`}),pe=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`All editors are checked by default — uncheck the ones you don't use.`}),t[60]=fe,t[61]=pe):(fe=t[60],pe=t[61]);let me;t[62]!==g||t[63]!==d?(me=cn.map(e=>{let t=`create-editor-${e}`;return(0,Z.jsxs)(oo,{htmlFor:t,className:`text-sm font-normal`,children:[(0,Z.jsx)($a,{id:t,checked:d.has(e),onCheckedChange:()=>z(e),disabled:g,"data-testid":`create-editor-${e}`}),(0,Z.jsx)(`span`,{children:qn[e]})]},e)}),t[62]=g,t[63]=d,t[64]=me):me=t[64];let he;t[65]===me?he=t[66]:(he=(0,Z.jsxs)(`fieldset`,{className:`space-y-2 pb-2`,children:[fe,pe,me]}),t[65]=me,t[66]=he);let ge;t[67]===v?ge=t[68]:(ge=v===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:xu(v)}),t[67]=v,t[68]=ge);let _e;t[69]!==re||t[70]!==ue||t[71]!==de||t[72]!==he||t[73]!==ge?(_e=(0,Z.jsxs)(Wa,{className:`space-y-4`,children:[re,ue,de,he,ge]}),t[69]=re,t[70]=ue,t[71]=de,t[72]=he,t[73]=ge,t[74]=_e):_e=t[74];let ve;t[75]===r?ve=t[76]:(ve=()=>r(!1),t[75]=r,t[76]=ve);let ye;t[77]!==g||t[78]!==ve?(ye=(0,Z.jsx)(X,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:ve,disabled:g,"data-testid":`create-cancel`,children:`Cancel`}),t[77]=g,t[78]=ve,t[79]=ye):ye=t[79];let be=!L,xe=g?`Creating`:`Create`,Se;t[80]!==be||t[81]!==xe?(Se=(0,Z.jsx)(X,{type:`submit`,disabled:be,"data-testid":`create-submit`,children:xe}),t[80]=be,t[81]=xe,t[82]=Se):Se=t[82];let Ce;t[83]!==ye||t[84]!==Se?(Ce=(0,Z.jsxs)(Ga,{children:[ye,Se]}),t[83]=ye,t[84]=Se,t[85]=Ce):Ce=t[85];let we;t[86]!==U||t[87]!==_e||t[88]!==Ce?(we=(0,Z.jsxs)(Va,{className:`sm:max-w-lg motion-reduce:duration-0 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none`,"data-testid":`create-project-dialog`,children:[ee,(0,Z.jsxs)(`form`,{onSubmit:U,"data-testid":`create-project-form`,className:`flex min-h-0 flex-1 flex-col`,children:[_e,Ce]})]}),t[86]=U,t[87]=_e,t[88]=Ce,t[89]=we):we=t[89];let J;return t[90]!==G||t[91]!==n||t[92]!==we?(J=(0,Z.jsx)(Ja,{open:n,onOpenChange:G,children:we}),t[90]=G,t[91]=n,t[92]=we,t[93]=J):J=t[93],J}function Cu(){}function wu(e){console.warn(`[CreateProjectDialog] defaultProjectsRoot probe failed:`,e)}function Tu(){return new Set(cn)}function Eu(e){let t=(0,$.c)(19),{cascade:n,onOpenNested:r}=e;if(n.kind===`idle`||n.kind===`pending`||n.kind===`free`)return null;if(n.kind===`block-nested`){let e;t[0]===n.rootPath?e=t[1]:(e=vu(n.rootPath),t[0]=n.rootPath,t[1]=e);let i=e,a;t[2]===n.rootPath?a=t[3]:(a=(0,Z.jsxs)(`p`,{className:`mb-2`,children:[`Can't nest projects. An Open Knowledge project already exists at`,` `,(0,Z.jsx)(`code`,{className:`font-mono break-all`,children:n.rootPath}),`. Choose a location outside it, or open that project instead.`]}),t[2]=n.rootPath,t[3]=a);let o;t[4]!==n.rootPath||t[5]!==r?(o=()=>r(n.rootPath),t[4]=n.rootPath,t[5]=r,t[6]=o):o=t[6];let s;t[7]!==i||t[8]!==o?(s=(0,Z.jsxs)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:o,"data-testid":`create-banner-nested-open`,children:[`Open `,i]}),t[7]=i,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(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:[a,s]}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}if(n.kind===`confirm-git`){let e;t[13]===n.gitRoot?e=t[14]:(e=(0,Z.jsx)(`code`,{children:n.gitRoot}),t[13]=n.gitRoot,t[14]=e);let r;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`code`,{children:`.git`}),t[15]=r):r=t[15];let i;return t[16]===e?i=t[17]:(i=(0,Z.jsx)(`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:(0,Z.jsxs)(`p`,{children:[`Open Knowledge will be initialized at `,e,` — the parent of your new folder, because it contains a `,r,` folder (one project per git repo).`]})}),t[16]=e,t[17]=i),i}let i;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,"data-testid":`create-banner-nonempty`,children:(0,Z.jsx)(`p`,{children:`A non-empty folder with this name already exists. Use "Open folder on disk" instead.`})}),t[18]=i):i=t[18],i}function Du(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 Ou(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 ku=(0,Q.lazy)(()=>r(()=>import(`./McpConsentDialogBody-CEvkljQ2.js`),__vite__mapDeps([12,1,6,7,13,14,15,8,16]),import.meta.url));function Au(){let e=(0,$.c)(1);if(!(0,Q.useSyncExternalStore)(Qa.subscribe,Mu,ju))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)(ku,{})}),e[0]=t):t=e[0],t}function ju(){return!1}function Mu(){return Qa.getSnapshot()!==null}var Nu=(e,t,n)=>Cc(e,t,n,`NavigatorApp`);function Pu(e){let t=(0,$.c)(74),{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),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=typeof window<`u`&&window.okDesktop!=null,[y,b]=(0,Q.useState)(`auth`),{channel:x}=bc(),{theme:S}=yr();Ta(n,S??`system`);let C;t[1]===n.project?C=t[2]:(C=()=>{let e=!1;return n.project.listRecent().then(t=>{e||a(t)}).catch(t=>{console.error(`[NavigatorApp] listRecent failed:`,t),e||l(t instanceof Error?t.message:`Failed to load recent projects.`)}).finally(()=>{e||s(!1)}),()=>{e=!0}},t[1]=n.project,t[2]=C);let w;t[3]===n?w=t[4]:(w=[n],t[3]=n,t[4]=w),(0,Q.useEffect)(C,w);let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>Nu(e,t,l),t[5]=T):T=t[5];let E=T,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>d(!0),t[6]=D):D=t[6];let O=D,k;t[7]===n?k=t[8]:(k=()=>E(async()=>{let e=await n.dialog.openFolder();e&&await Lu(n,e,`pick-existing`)},`Failed to open folder.`),t[7]=n,t[8]=k);let A=k,j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>p(!0),t[9]=j):j=t[9];let M=j,N;t[10]===n?N=t[11]:(N=e=>E(async()=>{await Lu(n,e,`recents`)},`Failed to open project.`),t[10]=n,t[11]=N);let P=N,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(Ou,{className:`size-12 shrink-0`}),t[12]=F):F=t[12];let I;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=(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)(cu,{})]}),t[13]=I):I=t[13];let L;t[14]===n.appVersion?L=t[15]:(L=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-xs font-mono`,children:[`v`,n.appVersion]}),t[14]=n.appVersion,t[15]=L);let R;t[16]===x?R=t[17]:(R=x!==null&&(0,Z.jsx)(Ne,{variant:`gray`,className:`text-2xs font-mono`,children:x===`beta`?`Beta`:`Stable`}),t[16]=x,t[17]=R);let z;t[18]!==L||t[19]!==R?(z=(0,Z.jsx)(`div`,{className:`shrink-0 ${v?`[-webkit-app-region:drag]`:``}`,"data-testid":`nav-chrome-row`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-5xl px-12 pt-12 pb-10`,children:(0,Z.jsxs)(`header`,{className:`shrink-0 flex-wrap flex items-center gap-2.5`,children:[F,(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[I,(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[L,R]})]})]})})}),t[18]=L,t[19]=R,t[20]=z):z=t[20];let B=`mx-auto flex w-full max-w-5xl flex-1 flex-col overflow-hidden px-12 pb-12 space-y-10 ${!o&&i.length===0?`justify-center`:``}`,V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Z.jsx)(Fu,{title:`Clone from GitHub`,description:`Bring a remote repository onto this machine.`,onClick:O,dataTestId:`nav-clone`,Icon:Du}),t[21]=V):V=t[21];let H;t[22]===A?H=t[23]:(H=(0,Z.jsx)(Fu,{title:`Open folder on disk`,description:`Use a folder you already have.`,onClick:A,dataTestId:`nav-open`,Icon:G}),t[22]=A,t[23]=H);let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Z.jsx)(Fu,{title:`Create new project`,description:`Make a new folder for a brand-new project.`,onClick:M,dataTestId:`nav-create-new`,Icon:Fi}),t[24]=U):U=t[24];let W;t[25]===H?W=t[26]:(W=(0,Z.jsxs)(`section`,{className:`grid shrink-0 sm:grid-cols-3 gap-3`,children:[V,H,U]}),t[25]=H,t[26]=W);let K;t[27]===c?K=t[28]:(K=c===null?null:(0,Z.jsxs)(`div`,{className:`mb-3 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:c}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`text-red-700 text-xs underline hover:no-underline dark:text-red-300`,"data-testid":`nav-error-dismiss`,children:`Dismiss`})]}),t[27]=c,t[28]=K);let q;t[29]!==o||t[30]!==P||t[31]!==i?(q=o?(0,Z.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(Ze,{className:`size-4 animate-spin text-muted-foreground/60`})})}):i.length>0?(0,Z.jsxs)(`section`,{className:`flex min-h-0 flex-1 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 flex-1 subtle-scrollbar overflow-y-auto space-y-0.5 -mx-4`,"data-testid":`nav-recent-list`,children:i.map(e=>(0,Z.jsx)(Iu,{project:e,onOpen:()=>P(e.path)},e.path))})]}):null,t[29]=o,t[30]=P,t[31]=i,t[32]=q):q=t[32];let ee;t[33]!==B||t[34]!==W||t[35]!==K||t[36]!==q?(ee=(0,Z.jsxs)(`div`,{className:B,children:[W,K,q]}),t[33]=B,t[34]=W,t[35]=K,t[36]=q,t[37]=ee):ee=t[37];let te,ne;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Z.jsx)(Au,{}),ne=(0,Z.jsx)(pu,{}),t[38]=te,t[39]=ne):(te=t[38],ne=t[39]);let re;t[40]!==n||t[41]!==f?(re=(0,Z.jsx)(Su,{open:f,onOpenChange:p,bridge:n}),t[40]=n,t[41]=f,t[42]=re):re=t[42];let ie;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ie=e=>{h(e),e||_(!1)},t[43]=ie):ie=t[43];let ae;t[44]===n?ae=t[45]:(ae=Nc(n),t[44]=n,t[45]=ae);let oe=y===`identity`,se;t[46]===g?se=t[47]:(se=()=>{h(!1),g&&(_(!1),d(!0))},t[46]=g,t[47]=se);let ce;t[48]!==m||t[49]!==ae||t[50]!==oe||t[51]!==se?(ce=(0,Z.jsx)(ou,{open:m,onOpenChange:ie,transport:ae,identityPrompt:oe,onSuccess:se}),t[48]=m,t[49]=ae,t[50]=oe,t[51]=se,t[52]=ce):ce=t[52];let le;t[53]===n?le=t[54]:(le=Fc(n),t[53]=n,t[54]=le);let ue;t[55]===n?ue=t[56]:(ue=kc(n),t[55]=n,t[56]=ue);let de;t[57]===n.dialog?de=t[58]:(de=()=>n.dialog.openFolder(),t[57]=n.dialog,t[58]=de);let fe;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(fe=()=>{d(!1),b(`auth`),_(!0),h(!0)},t[59]=fe):fe=t[59];let pe;t[60]===n?pe=t[61]:(pe=e=>{let{dir:t}=e;E(()=>Lu(n,t,`pick-existing`),`Failed to open cloned project.`)},t[60]=n,t[61]=pe);let me;t[62]!==u||t[63]!==le||t[64]!==ue||t[65]!==de||t[66]!==pe?(me=(0,Z.jsx)(du,{open:u,onOpenChange:d,transport:le,authQueryTransport:ue,pickParentFolder:de,onSignIn:fe,onCloneComplete:pe}),t[62]=u,t[63]=le,t[64]=ue,t[65]=de,t[66]=pe,t[67]=me):me=t[67];let he;return t[68]!==z||t[69]!==ee||t[70]!==re||t[71]!==ce||t[72]!==me?(he=(0,Z.jsxs)(`div`,{className:`flex h-screen w-screen flex-col overflow-hidden bg-primary-foreground dark:bg-background text-foreground`,children:[z,ee,te,ne,re,ce,me]}),t[68]=z,t[69]=ee,t[70]=re,t[71]=ce,t[72]=me,t[73]=he):he=t[73],he}function Fu(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)(`button`,{type:`button`,onClick:i,"data-testid":a,className:`flex flex-col items-start gap-1.5 rounded-lg border border-border bg-card py-3.5 px-4 text-left transition-colors hover:bg-accent`,children:[l,u]}),t[9]=a,t[10]=i,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Iu(e){let t=(0,$.c)(17),{project:n,onOpen:r}=e,i=`flex items-center justify-between ${n.missing?`opacity-50`:``}`,a;t[0]===n.name?a=t[1]:(a=(0,Z.jsx)(`span`,{className:`font-medium text-sm text-gray-700 dark:text-foreground`,children:n.name}),t[0]=n.name,t[1]=a);let o;t[2]===n.path?o=t[3]:(o=(0,Z.jsx)(`span`,{className:`truncate w-full text-muted-foreground text-xs`,children:n.path}),t[2]=n.path,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 truncate`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n.missing?c=t[8]:(c=n.missing?(0,Z.jsx)(Ne,{className:`text-2xs rounded-sm`,variant:`warning`,children:`Missing`}):null,t[7]=n.missing,t[8]=c);let l;t[9]!==r||t[10]!==n.missing||t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(`button`,{type:`button`,onClick:r,disabled:n.missing,className:`flex min-w-0 flex-1 items-center text-left disabled:cursor-not-allowed py-3.5 px-4 hover:bg-accent rounded-lg gap-2 justify-between`,children:[s,c]}),t[9]=r,t[10]=n.missing,t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;return t[14]!==i||t[15]!==l?(u=(0,Z.jsx)(`li`,{className:i,children:l}),t[14]=i,t[15]=l,t[16]=u):u=t[16],u}async function Lu(e,t,n){await e.project.open({path:t,target:`new-window`,entryPoint:n})}var Ru=e=>{let t=(0,$.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=yr(),i=r===void 0?`system`:r,a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,Z.jsx)(sn,{className:`size-4`}),info:(0,Z.jsx)(le,{className:`size-4`}),warning:(0,Z.jsx)(Dn,{className:`size-4`}),error:(0,Z.jsx)(Ks,{className:`size-4`}),loading:(0,Z.jsx)(Ze,{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)(La,{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 zu(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(Bu(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 Bu(e,t){return e.startsWith(`/api/`)?t+e:e}function Vu(e){return`#/${encodeURIComponent(e)}`}function Hu(e){let t=e.bridge;if(!t)return;let n=e.setHash??(e=>{window.location.hash=e});return t.onDeepLink(e=>{n(Vu(e.doc))})}var Uu=4e3,Wu=1440*60*1e3;function Gu(e){let t=e.bridge;if(t&&t.onboarding)return t.onboarding.onToast(e=>{if(e.kind===`ancestor-promote`){Xa.success(`Opened existing OK project at ${e.ancestorPath}`,{duration:Uu});return}if(e.kind===`mcp-repaired`){let t=e.editors.map(e=>qn[e]??e).join(`, `);Xa.success(`Repaired ${t} MCP integration. Restart ${t} if already open.`,{duration:Wu});return}if(e.kind===`mcp-repair-failed`){Xa.error(`MCP auto-repair failed — open Settings → AI Tool Integration to fix.`,{duration:Wu});return}let t=mo(e.gitRoot,e.pickedPath)??e.pickedPath;Xa.success(`Initialized OK at ${e.gitRoot} — opened parent of ${t} because it contains a .git folder`,{duration:Uu})})}var Ku=!1;function qu(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{Ge(n,{durationMs:Math.round(e*1e3)/1e3,threw:!o,...i},{startTime:t,duration:e})}catch{}}}}function Ju(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 Yu=0,Xu=0,Zu=0,Qu=0,$u=null,ed=[`linkResolutionDecoration$`],td=new WeakSet,nd=new WeakSet;function rd(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}function id(){return!1}function ad(){return!id()}function od(e,t){if(ad())return t;let n=`ok/cold/nodeview-factory-${rd(e)}`;return function(...r){let i=performance.now();try{return t(...r)}finally{let t=performance.now()-i;Ge(n,{nodeType:e,durationMs:Math.round(t*1e3)/1e3},{startTime:i,duration:t})}}}function sd(e){if(ad())return;let t=e.state.plugins;for(let e of t){if(nd.has(e))continue;let t=e.spec?.key?.key;if(!t||!ed.some(e=>t.startsWith(e)))continue;let n=e.props,r=n.decorations;if(typeof r!=`function`){nd.add(e);continue}let i=`ok/cold/decoration-${rd(t.replace(/\$\d*$/,``))}`;n.decorations=function(...e){let n=performance.now();try{return r.apply(this,e)}finally{let e=performance.now()-n;Ge(i,{pluginKey:t,durationMs:Math.round(e*1e3)/1e3},{startTime:n,duration:e})}},nd.add(e)}}function cd(e){if(ad())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=od(e,n);r.__okWrapped=!0,t[e]=r}}function ld(e){return ad()?e:e.map(e=>{let t=e.name??`unknown`,n=rd(t);return e.extend({onBeforeCreate(){let e=performance.now();try{this.parent?.()}finally{let r=performance.now()-e;Ge(`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;Ge(`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;Ge(`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;Ge(`ok/cold/ext-${n}-on-destroy`,{ext:t,hook:`onDestroy`,durationMs:Math.round(r*1e3)/1e3},{startTime:e,duration:r})}}})})}function ud(){if(!Ku){Ku=!0,qu(hr.prototype,`mount`,`ok/cold/editor-mount`,(e,t,n,r)=>{let i=e;return ad()||($u=performance.now()),{elementDefault:i.options?.element?.nodeName??null,docSize:Ju(i.editorState),durationMs:r}}),qu(hr.prototype,`createView`,`ok/cold/editor-create-view`,e=>{let t=e;return!ad()&&!td.has(e)&&t.view&&(sd(t.view),cd(t.view),td.add(e)),{docSize:Ju(t.editorState)}}),qu(hr.prototype,`createNodeViews`,`ok/cold/create-node-views`,(e,t,n,r)=>{Qu+=1;let i=e;return!ad()&&i.view&&cd(i.view),{docSize:Ju(i.view),seq:Qu,durationMs:r}}),qu(Tn.prototype,`updateState`,`ok/cold/pm-update-state`,(e,t,n,r)=>(Xu+=1,{seq:Xu,docSize:Ju(e.state),durationMs:r})),qu(Tn.prototype,`setProps`,`ok/cold/pm-set-props`,(e,t,n,r)=>(Zu+=1,{seq:Zu,docSize:Ju(e.state),durationMs:r})),qu(x.prototype,`_forceRerender`,`ok/cold/force-rerender`,(e,t,n,r)=>{Yu+=1;let i=e,a=(()=>{try{return i.type?.toArray?i.type.toArray().length:null}catch{return null}})();return{seq:Yu,topLevelYElements:a,durationMs:r}}),qu(H.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`)&&(Ge(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}),!ad()&&e===`first-paint`&&$u!==null)){let e=$u,n=Math.max(0,t.startTime-e);Ge(`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}),$u=null}}}).observe({type:`paint`,buffered:!0})}catch{}globalThis.__okColdMountInstrumented=!0}}var dd=`Relaunch`,fd=`Release notes`,pd=`Updates paused`,md=`Download`,hd=`Reset to defaults`,gd=`Relaunch failed — please restart manually`,_d=`Recovery action failed — please try again`;function vd(e,t){let n=t instanceof Error&&t.message?t.message:``;return n?`${e}: ${n}`:e}function yd(e){return`Version ${e} ready to install`}function bd(e){return`Updated to Version ${e}`}function xd(e){return`Your settings and recent projects were saved by a newer build than this one (v${e}). Reset to defaults to continue.`}var Sd=0,Cd=0,wd=1,Td=2,Ed=3;function Dd(e,t,n=()=>{}){let r=[];return r.push(e.onUpdateDownloaded(({version:r})=>{let i=`update-downloaded-${r}`;t({id:i,body:yd(r),priority:Td,action:{label:dd,onClick:()=>{e.update.relaunchNow().then(()=>{n(i)},e=>{t({id:`relaunch-error-${r}`,body:vd(gd,e),variant:`error`,priority:wd})})}}})})),r.push(e.onWhatsNew(({version:n,releaseUrl:r})=>{t({id:`whats-new-${n}`,body:bd(n),priority:Ed,action:{label:fd,onClick:()=>{e.shell.openExternal(r)}}})})),r.push(e.onUpdateStuckHint(({downloadUrl:n})=>{t({id:`update-stuck-hint`,body:pd,priority:Cd,action:{label:md,onClick:()=>{e.shell.openExternal(n)}}})})),()=>{for(let e of r)e()}}function Od(e,t,n,r=()=>{}){let i=`schema-incompatibility-${t.persistedSchemaVersion}`,a=`schema-incompatibility-error-${t.persistedSchemaVersion}`,o=e=>{r(i),n({id:a,body:vd(_d,e),variant:`error`,priority:Sd})};n({id:i,body:xd(t.currentBuild),priority:Sd,action:{label:hd,onClick:()=>{e.state.resetIncompatible().then(()=>{r(i)},o)}}})}var kd=[],Ad=new Set,jd=!1;function Md(){for(let e of Ad)e()}function Nd(e){let t=kd.findIndex(t=>t.id===e.id);if(t===-1)kd=[...kd,e];else{let n=kd.slice();n[t]=e,kd=n}Md()}function Pd(e){let t=kd.filter(t=>t.id!==e);t.length!==kd.length&&(kd=t,Md())}function Fd(){return kd}function Id(e){return Ad.add(e),()=>{Ad.delete(e)}}function Ld(){if(jd||typeof window>`u`)return;let e=window.okDesktop;e&&(jd=!0,Dd(e,Nd,Pd),e.state.query().then(t=>{t.schemaIncompatibility&&Od(e,t.schemaIncompatibility,Nd,Pd)},e=>{console.warn(`[update-notices-store] bridge.state.query() failed`,e)}))}var Rd=`ok-omnibar-recents-v1`,zd=10;function Bd(e){return typeof e==`object`&&!!e&&(e.kind===`file`||e.kind===`folder`)&&typeof e.path==`string`&&typeof e.lastOpenedAt==`string`}function Vd(e){if(e)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Hd(e,t){return`${e}:${t}`}function Ud(e){let t=Vd(e);if(!t)return[];try{let e=t.getItem(Rd);if(!e)return[];let n=JSON.parse(e);return Array.isArray(n)?n.filter(Bd).slice(0,zd):[]}catch{return[]}}function Wd(e,t){let n=Vd(t);if(n)try{n.setItem(Rd,JSON.stringify(e.slice(0,zd)))}catch(e){console.warn(`[omnibar] Failed to save recent entries:`,e)}}function Gd(e,t){return[t,...e.filter(e=>e.kind!==t.kind||e.path!==t.path)].slice(0,zd)}function Kd(e,t){return e.filter(e=>t.has(Hd(e.kind,e.path)))}var qd=50,Jd=30,Yd=``,Xd=null;function Zd(e){return e.trim().toLowerCase()}function Qd(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $d(e){let t=e.trim();return t?[...new Set(t.split(/\s+/).filter(Boolean))].sort((e,t)=>t.length-e.length):[]}function ef(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:pr(t),...a?{title:a}:{},...e?{modifiedTs:Date.parse(e)}:{}})}for(let e of t)i.push({kind:`folder`,path:e,name:pr(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 tf(e){return cr({kind:e.kind===`file`?`page`:`folder`,path:e.path,title:e.title??e.name,modifiedTs:e.modifiedTs??0})}function nf(e){return{entries:e,byId:new Map(e.map(e=>[`${e.kind===`file`?`page`:`folder`}:${e.path}`,e])),corpus:Un(e.map(tf))}}function rf(e){return e.map(e=>`${e.kind}\u0000${e.path}\u0000${e.title??``}\u0000${e.modifiedTs??0}`).join(``)}function af(e){let t=rf(e);return Xd&&Yd===t?Xd:(Yd=t,Xd=nf(e),Xd)}function of(e,t,n=qd){return sf(af(e),t,n)}function sf(e,t,n=qd){let r=Zd(t);return r?kn(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 cf(e,t){let n=$d(t);if(n.length===0||e.length===0)return[{text:e,match:!1,start:0}];let r=RegExp(`(${n.map(Qd).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 lf(e){if(e.kind!==`page`&&e.kind!==`folder`||typeof e.path!=`string`)return null;let t=pr(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 uf(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??Jd}),signal:t.signal});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(Bn(e)??`Search failed with status ${r.status}`)}return((await r.json()).results??[]).map(lf).filter(e=>!!e)}function df(e,t,n=[]){let r=Zd(t);return r?Zd([e,...n].join(` `)).includes(r):!0}var ff=`tag:`;function pf(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 mf(e,t){return B(e,t)}var hf=F;async function gf(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 _f=`open-knowledge:doc-panel-tab`,vf=null;function yf(){let e=vf;return vf=null,e}function bf(e,t=typeof window>`u`?new EventTarget:window){vf=e,t.dispatchEvent(new CustomEvent(_f,{detail:{tab:e}}))}function xf(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(_f,n),()=>t.removeEventListener(_f,n)}function Sf(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=Y(`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)(Xl,{"data-slot":`radio-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Cf(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=Y(`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)(Ql,{"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)(Zl,{"data-slot":`radio-group-item`,className:i,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var wf=[`.md`,`.mdx`];function Tf(e){let t=e.toLowerCase();for(let e of wf)if(t.endsWith(e))return e;return null}function Ef(e){let t=Tf(e);return t?e.slice(0,-t.length):e}var Df=`__blank__`,Of={local:0,inherited:1,user:2};function kf(e){return[...e].sort((e,t)=>{let n=Of[e.scope]-Of[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 Af(e){return e.trim()?e.includes(`..`)?`Path cannot contain ".."`:e.startsWith(`/`)?`Path cannot start with "/"`:e.includes(`\\`)?`Path cannot contain backslashes`:e.includes(`\0`)?`Path cannot contain null bytes`:null:`Name cannot be empty`}function jf(e){let t=e.fileName.trim(),n=Tf(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 Mf(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 Nf(e){let t=e.value.lastIndexOf(`.`);t>0?e.setSelectionRange(0,t):e.select()}function Pf(e){let t=(0,$.c)(115),{open:n,onOpenChange:r,kind:i,initialDir:a,suggestedName:o,initialTemplate:s,description:c,onCreated:l,folderConfig:u}=e,{addPage:d}=wr(),f=ra(u?null:a),p=u??f,[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`.md`),[b,x]=(0,Q.useState)(Df),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),O=(0,Q.useId)(),k=(0,Q.useId)(),A=(0,Q.useId)(),j=(0,Q.useId)(),M=(0,Q.useRef)(null),N=(0,Q.useRef)(null),P,F;t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==o?(P=()=>{if(n){C(null),D(null),T(!1),_(``),x(i===`file`&&s?s:Df);let e=i===`file`?o??`untitled`:`index`,t=Tf(e);y(t??`.md`),h(t?Ef(e):e)}},F=[n,i,o,s],t[0]=s,t[1]=i,t[2]=n,t[3]=o,t[4]=P,t[5]=F):(P=t[4],F=t[5]),(0,Q.useEffect)(P,F);let I=p.state.status===`ready`?kf(p.state.data.folder.templates_available??[]):[],L;t[6]!==p.state.data||t[7]!==p.state.status||t[8]!==n||t[9]!==b?(L=()=>{n&&b!==Df&&p.state.status===`ready`&&((p.state.data.folder.templates_available??[]).some(e=>e.name===b)||x(Df))},t[6]=p.state.data,t[7]=p.state.status,t[8]=n,t[9]=b,t[10]=L):L=t[10];let R;t[11]!==p.state||t[12]!==n||t[13]!==b?(R=[n,b,p.state],t[11]=p.state,t[12]=n,t[13]=b,t[14]=R):R=t[14],(0,Q.useEffect)(L,R);let z=i===`file`,B=p.state.status===`loading`||p.state.status===`idle`,V=p.state.status===`error`?p.state.message:null,H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){let t=Tf(e);t?(y(t),h(Ef(e))):h(e),C(null)},t[15]=H):H=t[15];let U=H,W;t[16]!==v||t[17]!==m||t[18]!==g||t[19]!==a||t[20]!==i?(W=function(){return jf({kind:i,initialDir:a,fileName:m,fileExtension:v,folderName:g})},t[16]=v,t[17]=m,t[18]=g,t[19]=a,t[20]=i,t[21]=W):W=t[21];let G=W,K;t[22]!==m||t[23]!==g||t[24]!==i?(K=function(){if(i===`folder`){let e=Af(g.trim());if(e)return{message:`Folder name: ${e}`,field:`folder`}}let e=Af(m.trim());return e?{message:e,field:`file`}:null},t[22]=m,t[23]=g,t[24]=i,t[25]=K):K=t[25];let q=K,ee;t[26]!==w||t[27]!==m||t[28]!==g||t[29]!==i?(ee=w||!m.trim()||i===`folder`&&!g.trim(),t[26]=w,t[27]=m,t[28]=g,t[29]=i,t[30]=ee):ee=t[30];let te=ee,ne;t[31]!==d||t[32]!==G||t[33]!==q||t[34]!==i||t[35]!==l||t[36]!==r||t[37]!==b?(ne=async function(){let e=q();if(e){C(e.message),D(e.field);return}T(!0),C(null),D(null);let t=G(),n=i===`file`&&b!==Df?b: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=await Le(e,`Server error (HTTP ${e.status})`);if(!t.ok){T(!1),C(t.title),D(`form`);return}let n=Er.safeParse(t.body);if(T(!1),!n.success){C(`Failed to create ${i}`),D(`form`);return}let o=n.data.docName;r(!1),window.location.hash=`#/${o}`,d(o),Kn([`files`,`backlinks`,`graph`]),l?.(o)}catch(e){console.warn(`[NewItemDialog] create failed:`,e),T(!1),C(`Network error — please try again`),D(`form`)}},t[31]=d,t[32]=G,t[33]=q,t[34]=i,t[35]=l,t[36]=r,t[37]=b,t[38]=ne):ne=t[38];let re=ne,ie=a||`(root)`,ae=i===`file`?`New file`:`New folder`,oe=Ja,se=Va,ce;t[39]===ae?ce=t[40]:(ce=(0,Z.jsx)(Ra,{children:ae}),t[39]=ae,t[40]=ce);let le;t[41]!==c||t[42]!==ie?(le=c??(0,Z.jsxs)(Z.Fragment,{children:[`Create in `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:ie})]}),t[41]=c,t[42]=ie,t[43]=le):le=t[43];let ue;t[44]===le?ue=t[45]:(ue=(0,Z.jsx)(Ia,{children:le}),t[44]=le,t[45]=ue);let de;t[46]!==ce||t[47]!==ue?(de=(0,Z.jsxs)(qa,{children:[ce,ue]}),t[46]=ce,t[47]=ue,t[48]=de):de=t[48];let fe=Wa,pe=z&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{id:j,className:`mb-1.5 text-sm font-medium`,children:`Start from`}),B?(0,Z.jsx)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground`,children:`Loading templates`}):(0,Z.jsxs)(Z.Fragment,{children:[V?(0,Z.jsxs)(`p`,{role:`alert`,className:`mb-1.5 text-xs text-destructive`,children:[`Could not load templates: `,V,`. You can still create a blank note.`]}):null,(0,Z.jsxs)(Sf,{value:b,onValueChange:x,"aria-labelledby":j,className:`max-h-56 overflow-y-auto rounded-md border border-border bg-card subtle-scrollbar`,children:[(0,Z.jsx)(Rf,{value:Df,title:`Blank note`,description:`Empty starting content`}),I.length===0&&!V?(0,Z.jsx)(`p`,{className:`px-3 pb-2 text-xs text-muted-foreground`,children:`No templates resolve here. Add one in this folder's Templates section, or in Settings → User templates.`}):I.map(Lf)]})]})]}),me;t[49]!==S||t[50]!==E||t[51]!==O||t[52]!==k||t[53]!==g||t[54]!==i?(me=i===`folder`&&(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:k,children:`Folder name`}),(0,Z.jsx)(fo,{ref:N,id:k,value:g,onChange:e=>{_(e.target.value),C(null)},placeholder:`folder-name`,autoFocus:!0,"aria-describedby":S&&(E===`folder`||E===`form`)?O:void 0,"aria-invalid":S&&(E===`folder`||E===`form`)?!0:void 0,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Af(g.trim());if(t){C(`Folder name: ${t}`),D(`folder`);return}M.current?.focus()}}})]}),t[49]=S,t[50]=E,t[51]=O,t[52]=k,t[53]=g,t[54]=i,t[55]=me):me=t[55];let he=i===`folder`?`First file name`:`File name`,ge;t[56]!==A||t[57]!==he?(ge=(0,Z.jsx)(`label`,{className:`mb-1.5 block text-sm font-medium`,htmlFor:A,children:he}),t[56]=A,t[57]=he,t[58]=ge):ge=t[58];let _e;t[59]===U?_e=t[60]:(_e=e=>U(e.target.value),t[59]=U,t[60]=_e);let ve=i===`file`,ye=S&&(E===`file`||E===`form`)?O:void 0,be=S&&(E===`file`||E===`form`)?!0:void 0,xe;t[61]!==re||t[62]!==te?(xe=e=>{e.key===`Enter`&&!te&&re()},t[61]=re,t[62]=te,t[63]=xe):xe=t[63];let Se;t[64]!==A||t[65]!==m||t[66]!==_e||t[67]!==ve||t[68]!==ye||t[69]!==be||t[70]!==xe?(Se=(0,Z.jsx)(fo,{ref:M,id:A,value:m,onChange:_e,placeholder:`my-note`,autoFocus:ve,"aria-describedby":ye,"aria-invalid":be,onFocus:If,onKeyDown:xe,className:`flex-1`}),t[64]=A,t[65]=m,t[66]=_e,t[67]=ve,t[68]=ye,t[69]=be,t[70]=xe,t[71]=Se):Se=t[71];let Ce;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=e=>{(e===`.md`||e===`.mdx`)&&y(e)},t[72]=Ce):Ce=t[72];let we;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(we=wf.map(Ff),t[73]=we):we=t[73];let J;t[74]===v?J=t[75]:(J=(0,Z.jsx)(ao,{type:`single`,value:v,onValueChange:Ce,variant:`outline`,size:`sm`,"aria-label":`File extension`,className:`shrink-0`,children:we}),t[74]=v,t[75]=J);let Te;t[76]!==Se||t[77]!==J?(Te=(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[Se,J]}),t[76]=Se,t[77]=J,t[78]=Te):Te=t[78];let Ee;t[79]!==S||t[80]!==O?(Ee=S&&(0,Z.jsx)(`p`,{id:O,role:`alert`,className:`text-xs text-red-600 dark:text-red-400`,children:S}),t[79]=S,t[80]=O,t[81]=Ee):Ee=t[81];let De;t[82]!==ge||t[83]!==Te||t[84]!==Ee?(De=(0,Z.jsxs)(`div`,{children:[ge,Te,Ee]}),t[82]=ge,t[83]=Te,t[84]=Ee,t[85]=De):De=t[85];let Oe;t[86]!==pe||t[87]!==me||t[88]!==De?(Oe=(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[pe,me,De]}),t[86]=pe,t[87]=me,t[88]=De,t[89]=Oe):Oe=t[89];let ke;t[90]!==fe||t[91]!==Oe?(ke=(0,Z.jsx)(fe,{children:Oe}),t[90]=fe,t[91]=Oe,t[92]=ke):ke=t[92];let Ae;t[93]===r?Ae=t[94]:(Ae=()=>r(!1),t[93]=r,t[94]=Ae);let je;t[95]!==w||t[96]!==Ae?(je=(0,Z.jsx)(X,{variant:`outline`,className:`font-mono uppercase`,onClick:Ae,disabled:w,children:`Cancel`}),t[95]=w,t[96]=Ae,t[97]=je):je=t[97];let Me=w?`Creating`:`Create`,Ne;t[98]!==re||t[99]!==te||t[100]!==Me?(Ne=(0,Z.jsx)(X,{onClick:re,disabled:te,children:Me}),t[98]=re,t[99]=te,t[100]=Me,t[101]=Ne):Ne=t[101];let Pe;t[102]!==je||t[103]!==Ne?(Pe=(0,Z.jsxs)(Ga,{children:[je,Ne]}),t[102]=je,t[103]=Ne,t[104]=Pe):Pe=t[104];let Fe;t[105]!==se||t[106]!==de||t[107]!==ke||t[108]!==Pe?(Fe=(0,Z.jsxs)(se,{className:`sm:max-w-md`,"data-ok-layer-spawned":``,children:[de,ke,Pe]}),t[105]=se,t[106]=de,t[107]=ke,t[108]=Pe,t[109]=Fe):Fe=t[109];let Ie;return t[110]!==oe||t[111]!==r||t[112]!==n||t[113]!==Fe?(Ie=(0,Z.jsx)(oe,{open:n,onOpenChange:r,children:Fe}),t[110]=oe,t[111]=r,t[112]=n,t[113]=Fe,t[114]=Ie):Ie=t[114],Ie}function Ff(e){return(0,Z.jsx)(ro,{value:e,"aria-label":`Use ${e} extension`,children:e},e)}function If(e){return Nf(e.currentTarget)}function Lf(e){return(0,Z.jsx)(Rf,{value:e.name,title:e.title??e.name,subName:e.title&&e.title!==e.name?e.name:void 0,description:e.description,scope:e.scope,sourceFolder:e.source_folder},`${e.scope}:${e.source_folder}:${e.name}`)}function Rf(e){let t=(0,$.c)(26),{value:n,title:r,subName:i,description:a,scope:o,sourceFolder:s}=e,c=(0,Q.useId)(),l;t[0]!==c||t[1]!==n?(l=(0,Z.jsx)(Cf,{id:c,value:n,className:`mt-1`}),t[0]=c,t[1]=n,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:r}),t[3]=r,t[4]=u);let d;t[5]===i?d=t[6]:(d=i?(0,Z.jsx)(`code`,{className:`font-mono text-2xs text-muted-foreground shrink-0`,children:i}):null,t[5]=i,t[6]=d);let f;t[7]!==o||t[8]!==s?(f=o===`inherited`&&s?(0,Z.jsx)(Ne,{variant:`gray`,className:`ml-auto shrink-0 text-2xs`,children:s||`root`}):null,t[7]=o,t[8]=s,t[9]=f):f=t[9];let p;t[10]===o?p=t[11]:(p=o===`user`?(0,Z.jsx)(Ne,{variant:`primary`,className:`ml-auto shrink-0 text-2xs`,children:`user`}):null,t[10]=o,t[11]=p);let m;t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(m=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,d,f,p]}),t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;t[17]===a?h=t[18]:(h=a?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs text-muted-foreground`,children:a}):null,t[17]=a,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==c||t[23]!==l||t[24]!==g?(_=(0,Z.jsxs)(`label`,{htmlFor:c,className:`flex cursor-pointer items-start gap-3 px-3 py-2 transition-colors hover:bg-muted/50 has-data-[state=checked]:bg-muted/70`,children:[l,g]}),t[22]=c,t[23]=l,t[24]=g,t[25]=_):_=t[25],_}async function zf(e){let t=await e.json().catch(()=>null),n=ir.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 Bf(){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),e?.includePersonalTemplates&&t.set(`includePersonalTemplates`,`true`);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await zf(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,includePersonalTemplates:t?.includePersonalTemplates})});if(!n.ok)return{ok:!1,error:await zf(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result,personalTemplates:r.personalTemplates}:{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 Vf={"knowledge-base":Is,"software-lifecycle":As,"plain-notes":uc,worldbuilding:_s,"writing-pipeline":Ys,gbrain:Gs};function Hf(e){return Vf[e]??Is}function Uf(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 Bf().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=Y(`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=Y(`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},Gf).map(Wf),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=Y(`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=Y(`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)(Kf,{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 Wf(e){return(0,Z.jsx)(Jf,{},`skeleton-${e}`)}function Gf(e,t){return t}function Kf(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Hf(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=qf({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 qf({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 Jf(){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)(Ze,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var Yf=`knowledge-base`;function Xf(e){let t=(0,$.c)(78),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={kind:`loading`},t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(a??Yf),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(`project-root`),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(a===void 0?`pick`:`configure`),x=(0,Q.useRef)(!0),S;t[1]!==l||t[2]!==d?(S=l?.find(e=>e.id===d),t[1]=l,t[2]=d,t[3]=S):S=t[3];let C=S,w,T;t[4]!==n||t[5]!==l?(w=()=>{if(!n||l!==null)return;let e=!1;return(async()=>{try{let t=await Bf().listPacks();if(e)return;t.ok?u(t.packs):(u([]),c({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;u([]),c({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},T=[n,l],t[4]=n,t[5]=l,t[6]=w,t[7]=T):(w=t[6],T=t[7]),(0,Q.useEffect)(w,T);let E,D;t[8]!==a||t[9]!==n?(E=()=>{n&&(f(a??Yf),m(!0),g(`project-root`),v(``),b(a===void 0?`pick`:`configure`),c({kind:`loading`}),x.current=!0)},D=[n,a],t[8]=a,t[9]=n,t[10]=E,t[11]=D):(E=t[10],D=t[11]),(0,Q.useEffect)(E,D);let O,k;t[12]===C?(O=t[13],k=t[14]):(O=()=>{C&&v(C.defaultSubfolder??``)},k=[C],t[12]=C,t[13]=O,t[14]=k),(0,Q.useEffect)(O,k);let A;t[15]===_?A=t[16]:(A=_.trim(),t[15]=_,t[16]=A);let j=A,M=h===`subfolder`&&j===``,N,P;t[17]!==p||t[18]!==n||t[19]!==l||t[20]!==h||t[21]!==d||t[22]!==y||t[23]!==M||t[24]!==j?(N=()=>{if(!n||y!==`configure`||l===null)return;if(M){c({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=h===`project-root`?void 0:j,t=x.current?0:200;x.current=!1;let r=!1,i=setTimeout(()=>{r||(c(Zf),Bf().plan({rootDir:e,packId:d,includePersonalTemplates:p}).then(e=>{if(!r){if(!e.ok){c({kind:`error`,message:e.error.message});return}c(e.plan.created.length>0||(e.plan.personalTemplates?.willWrite.length??0)>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||c({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},P=[n,y,l,d,p,h,j,M],t[17]=p,t[18]=n,t[19]=l,t[20]=h,t[21]=d,t[22]=y,t[23]=M,t[24]=j,t[25]=N,t[26]=P):(N=t[25],P=t[26]),(0,Q.useEffect)(N,P);let F;t[27]!==p||t[28]!==r||t[29]!==i||t[30]!==s.kind||t[31]!==s.plan||t[32]!==C?.name||t[33]!==d?(F=async function(){if(s.kind!==`plan`)return;let e=s.plan;c({kind:`applying`,plan:e});let t;try{t=await Bf().apply(e,{packId:d,includePersonalTemplates:p})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Xa.error(`Initialize failed: ${r}`),c({kind:`plan`,plan:e});return}if(t.ok){let e=C?.name??`starter pack`,n=t.result.applied,a=t.personalTemplates?.written.length??0,o=n===0&&a>0?`${a} personal template${a===1?``:`s`} written to ~/.ok/templates/`:n===0?`${e} was already set up. Nothing to do.`:a>0?`${e} initialized (${n} ${n===1?`entry`:`entries`}) + ${a} personal template${a===1?``:`s`}`:`${e} initialized (${n} ${n===1?`entry`:`entries`})`;Xa.success(o),i?.(),r(!1)}else Xa.error(`Initialize failed: ${t.error.message}`),c({kind:`plan`,plan:e})},t[27]=p,t[28]=r,t[29]=i,t[30]=s.kind,t[31]=s.plan,t[32]=C?.name,t[33]=d,t[34]=F):F=t[34];let I=F,L=a!==void 0,R=y===`configure`&&C?`Initialize ${C.name}`:`Initialize a starter pack`,z=y===`configure`&&C?C.description:`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.`,B;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){f(e),b(`configure`),x.current=!0},t[35]=B):B=t[35];let V=B,H;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(){b(`pick`),c({kind:`loading`}),x.current=!0},t[36]=H):H=t[36];let U=H,W;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Z.jsx)(ii,{"aria-hidden":`true`,className:`h-4 w-4 text-foreground opacity-70`}),t[37]=W):W=t[37];let G;t[38]===R?G=t[39]:(G=(0,Z.jsxs)(Ra,{className:`flex items-center gap-2`,children:[W,R]}),t[38]=R,t[39]=G);let K;t[40]===z?K=t[41]:(K=(0,Z.jsx)(Ia,{children:z}),t[40]=z,t[41]=K);let q;t[42]!==G||t[43]!==K?(q=(0,Z.jsxs)(qa,{children:[G,K]}),t[42]=G,t[43]=K,t[44]=q):q=t[44];let ee;t[45]!==p||t[46]!==l||t[47]!==s||t[48]!==h||t[49]!==C||t[50]!==y||t[51]!==_?(ee=y===`pick`?(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Uf,{packs:l,onPackSelect:V})}):(0,Z.jsxs)(Wa,{className:`space-y-6`,children:[(0,Z.jsx)(Qf,{checked:p,onCheckedChange:m}),(0,Z.jsx)($f,{choice:h,subfolder:_,placeholder:C?.defaultSubfolder??`subfolder`,onChoiceChange:g,onSubfolderChange:v}),(0,Z.jsx)(ep,{phase:s,selectedPack:C})]}),t[45]=p,t[46]=l,t[47]=s,t[48]=h,t[49]=C,t[50]=y,t[51]=_,t[52]=ee):ee=t[52];let te;t[53]!==L||t[54]!==y?(te=y===`configure`&&!L?(0,Z.jsxs)(X,{className:`mr-auto uppercase font-mono`,variant:`ghost`,onClick:U,children:[(0,Z.jsx)(ti,{"aria-hidden":`true`,className:`h-4 w-4`}),`Back`]}):null,t[53]=L,t[54]=y,t[55]=te):te=t[55];let ne;t[56]===r?ne=t[57]:(ne=()=>r(!1),t[56]=r,t[57]=ne);let re=s.kind===`already-seeded`||s.kind===`error`?`Close`:`Cancel`,ie;t[58]!==ne||t[59]!==re?(ie=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,onClick:ne,children:re}),t[58]=ne,t[59]=re,t[60]=ie):ie=t[60];let ae;t[61]!==I||t[62]!==s.kind||t[63]!==y||t[64]!==M?(ae=y===`configure`&&s.kind===`plan`?(0,Z.jsx)(X,{onClick:I,disabled:M,children:`Initialize`}):y===`configure`&&s.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(Ze,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Setting up`]}):null,t[61]=I,t[62]=s.kind,t[63]=y,t[64]=M,t[65]=ae):ae=t[65];let oe;t[66]!==te||t[67]!==ie||t[68]!==ae?(oe=(0,Z.jsxs)(Ga,{children:[te,ie,ae]}),t[66]=te,t[67]=ie,t[68]=ae,t[69]=oe):oe=t[69];let se;t[70]!==q||t[71]!==ee||t[72]!==oe?(se=(0,Z.jsxs)(Va,{className:`sm:max-w-3xl`,"data-ok-layer-spawned":``,children:[q,ee,oe]}),t[70]=q,t[71]=ee,t[72]=oe,t[73]=se):se=t[73];let ce;return t[74]!==r||t[75]!==n||t[76]!==se?(ce=(0,Z.jsx)(Ja,{open:n,onOpenChange:r,children:se}),t[74]=r,t[75]=n,t[76]=se,t[77]=ce):ce=t[77],ce}function Zf(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function Qf(e){let t=(0,$.c)(7),{checked:n,onCheckedChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(da,{children:`Include personal templates`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(li,{children:[i,(0,Z.jsxs)(Xi,{className:`text-1sm`,children:[`Adds daily journal, reading log, recipes, and more to `,(0,Z.jsx)(`code`,{children:`~/.ok/templates/`}),`. Idempotent. Never overwrites your edits.`]})]}),t[1]=a):a=t[1];let o;t[2]===r?o=t[3]:(o=e=>r(e===!0),t[2]=r,t[3]=o);let s;return t[4]!==n||t[5]!==o?(s=(0,Z.jsx)(ba,{htmlFor:`seed-include-personal-templates`,className:`cursor-pointer`,children:(0,Z.jsxs)(Ai,{orientation:`horizontal`,children:[a,(0,Z.jsx)($a,{id:`seed-include-personal-templates`,checked:n,onCheckedChange:o})]})}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}function $f(e){let t=(0,$.c)(22),{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:`Where should it live?`}),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)(ba,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Ai,{orientation:`horizontal`,children:[(0,Z.jsxs)(li,{children:[(0,Z.jsx)(da,{children:`Project root`}),(0,Z.jsx)(Xi,{className:`text-1sm`,children:`Scaffold the pack's folders directly under this project.`})]}),(0,Z.jsx)(Cf,{value:`project-root`,id:`seed-root-project-root`})]})}),t[3]=l):l=t[3];let u,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(da,{children:`In a subfolder`}),d=(0,Z.jsx)(Xi,{className:`nth-last-2:mt-0 text-1sm`,children:`Created if missing. Reuses the folder if it already exists.`}),t[4]=u,t[5]=d):(u=t[4],d=t[5]);let f;t[6]===o?f=t[7]:(f=e=>o(e.target.value),t[6]=o,t[7]=f);let p;t[8]===a?p=t[9]:(p=()=>a(`subfolder`),t[8]=a,t[9]=p);let m;t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(li,{children:[u,d,(0,Z.jsx)(fo,{value:r,onChange:f,onFocus:p,placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`})]}),t[10]=i,t[11]=r,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Cf,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=h):h=t[15];let g;t[16]===m?g=t[17]:(g=(0,Z.jsx)(ba,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Ai,{orientation:`horizontal`,children:[m,h]})}),t[16]=m,t[17]=g);let _;return t[18]!==n||t[19]!==g||t[20]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(Sf,{className:`sm:flex`,value:n,onValueChange:c,children:[l,g]})]}),t[18]=n,t[19]=g,t[20]=c,t[21]=_):_=t[21],_}function ep(e){let t=(0,$.c)(12),{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)(Ze,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Computing scaffold plan`]}),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;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`This pack is already set up here.`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The folders and templates are in place; there's nothing left to scaffold.`})]}),t[3]=e):e=t[3],e}let i;t[4]!==n.plan||t[5]!==r?(i=(0,Z.jsx)(ip,{plan:n.plan,selectedPack:r}),t[4]=n.plan,t[5]=r,t[6]=i):i=t[6];let a;t[7]===n.plan.warnings?a=t[8]:(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(tp)}):null,t[7]=n.plan.warnings,t[8]=a);let o;return t[9]!==i||t[10]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}function tp(e){return(0,Z.jsx)(`p`,{children:e},e)}function np(e){return e.split(`/`).pop()??e}function rp(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(np(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:np(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function ip(e){let t=(0,$.c)(18),{plan:n,selectedPack:r}=e,i,a,o,s,c;if(t[0]!==n||t[1]!==r){let e=rp(n,r);i=n.personalTemplates?.willWrite.length??0,s=`space-y-3`,t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(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[7]=c):c=t[7],a=`space-y-3 overflow-y-auto subtle-scrollbar max-h-full`,o=e.map(ap),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];let l;t[8]===i?l=t[9]:(l=i>0?(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 rounded-md border border-dashed border-border/60 bg-muted/10 p-3`,children:[(0,Z.jsx)(ws,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`code`,{className:`font-mono text-1sm`,children:[`~/.ok/templates/ (`,i,` `,i===1?`template`:`templates`,`)`]}),(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:`Personal templates: daily journal, reading log, weekly review, recipes, and more.`})]})]}):null,t[8]=i,t[9]=l);let u;t[10]!==a||t[11]!==o||t[12]!==l?(u=(0,Z.jsxs)(`ul`,{className:a,children:[o,l]}),t[10]=a,t[11]=o,t[12]=l,t[13]=u):u=t[13];let d;return t[14]!==s||t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`section`,{className:s,children:[c,u]}),t[14]=s,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function ap(e){return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[e.kind===`folder`?(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`mt-1 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(ws,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsx)(`code`,{className:`font-mono text-1sm`,children:e.name}),e.description?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:e.description}):null]})]},e.name)}var op=[{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 Code`,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.`}],sp=`#settings`;function cp(e){let t=e.target;return t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable?!1:!!((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key===`,`)}function lp(e){return e.replace(/^#/,``)===`settings`}function up(){return typeof window>`u`?``:window.location.hash}function dp(){let e=(0,$.c)(4),[t,n]=(0,Q.useState)(pp),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=()=>{n(lp(up()))};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=fp,o;return e[2]===t?o=e[3]:(o={open:t,close:a},e[2]=t,e[3]=o),o}function fp(){typeof window>`u`||lp(up())&&window.history.back()}function pp(){return lp(up())}function mp(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(_p),r,i;return e[0]===t?(r=e[1],i=e[2]):(r=()=>{if(t!==null||typeof window>`u`||window.okDesktop)return;let e=!0;return fetch(`/api/workspace`).then(async t=>{let r=await t.json().catch(gp);if(!e||!t.ok)return;let i=On.safeParse(r);i.success&&n({contentDir:i.data.contentDir,pathSeparator:i.data.pathSeparator})}).catch(hp),()=>{e=!1}},i=[t],e[0]=t,e[1]=r,e[2]=i),(0,Q.useEffect)(r,i),t}function hp(e){console.warn(`[useWorkspace] /api/workspace fetch failed:`,e)}function gp(){return null}function _p(){return vp()}function vp(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 yp(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 bp(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=Bn(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 xp(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?yp(e):bp()}var Sp=`ok:skill:cowork:installed`,Cp=`1`,wp=250,Tp=`/api/skill/install-state`;function Ep(e){return`${Sp}:v${e}`}var Dp=new Map;async function Op(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Dp.get(n);if(r)return r;let i=kp(e,t);return Dp.set(n,i),i.finally(()=>{Dp.get(n)===i&&Dp.delete(n)}),i}async function kp(e,t){let n=e.installer===void 0?xp():e.installer,r=Ap(e.storage),i=e.fetchSnapshot??Mp,a=e.serverTimeoutMs??wp,o=null;if(!t.force){try{o=await Np(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=Ep(o?.currentVersion??e.fallbackSkillVersion??jp());if(!t.force&&r?.getItem(s)===Cp)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,Cp)}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 Ap(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function jp(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Mp(){let e;try{e=await fetch(Tp,{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 Np(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Pp(e){return Op({},e)}function Fp(){return Op({},{force:!0})}async function Ip(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 Lp(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return Ip({target:`claude-cowork`,url:An({mode:`cowork`},e)},n);case`claude-code`:return Ip({target:`claude-code`,url:An({mode:`code`},e)},n);case`codex`:return Ip({target:`codex`,url:Pn(e)},n);case`cursor`:return Ip({target:`cursor`,url:Cn(e),workspacePath:e.projectDir},n);default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Rp(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:zp(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:zp(e)}}}function zp(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 Bp(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 Vp(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}function Hp(e){return`${e}.md`}function Up(e){if(!e.docName||!e.workspace)return null;let t=Hp(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Vp(n,t,r)}}function Wp(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function Gp(e){return Rp(e.installUrl).then(()=>void 0)}function Kp(e){return`Opened in ${e}.`}function qp(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 Jp(e){return e>=3?null:e===2?`Try one more time`:`Retry`}function Yp(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}}async function Xp(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:t.docContext===null?``:tr(t.docContext)},a=await n.dispatchHandoff(i),o=Yp(e,a,n.isElectronHost()?`electron`:`web`,n.now().toISOString());await n.recordHandoff(o);let s=n.getDisplayName(e);if(a.ok)n.toast.success(Kp(s));else{let i=Jp(r),a=qp(s,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{Xp(e,t,n,r+1)}}})}return a}function Zp(e){return op.find(t=>t.id===e)?.displayName??e}function Qp(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function $p(){return{dispatchHandoff:Lp,recordHandoff:Bp,toast:{success:e=>{Xa.success(e)},error:(e,t)=>{Xa.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>Qp(),getDisplayName:Zp,ensureCoworkSkillInstalled:Pp}}function em(){return{dispatch:(e,t)=>Xp(e,t,$p()),reinstallCoworkSkill:Fp}}var tm=[...new Set(op.flatMap(e=>e.schemes))];function nm(e,t){let n=t.now?.()??Date.now(),r={};for(let t of op){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 rm(e){return nm({},e)}async function im(e){let t=e.schemes??tm,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 am=Object.fromEntries(tm.map(e=>[e,{installed:!1}]));async function om(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 am}if(!t.ok)return am;let n;try{n=await t.json()}catch{return am}if(typeof n!=`object`||!n||Array.isArray(n))return am;let r=n,i={};for(let e of tm)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function sm(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 cm(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=rm({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=nm(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=!sm(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 lm(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function um(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>im({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>om({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function dm(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(fm),r=(0,Q.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=cm(um());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return typeof window<`u`&&window.addEventListener(`focus`,i),()=>{typeof window<`u`&&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 fm(){return rm({isElectronHost:lm(),now:Date.now})}var pm=3e3,mm=(e,t,n)=>wc(e,t,n,`CommandPalette`);function hm(e){window.location.assign(er(e))}function gm(e,t){return e?.kind===`folder`||e?.kind===`folder-index`?e.folderPath:Jn(t)}function _m(e){let t=(0,$.c)(23),{entry:n,query:r,onSelect:i}=e,a=r===void 0?``:r,o=n.kind===`folder`?G:ws,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)(vm,{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)(vm,{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)(vm,{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)(L,{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 vm(e){let t=(0,$.c)(5),{text:n,query:r}=e,i;t[0]!==r||t[1]!==n?(i=cf(n,r).map(ym),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 ym(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 bm({searchResults:e,fallbackSearchResults:t,searchStatus:n}){return e.length>0?e:n===`success`?[]:t}function xm(e){let t=(0,$.c)(113),{bridge:n,open:r,onOpenChange:i}=e,a=n===void 0?null:n,[o,s]=(0,Q.useState)(``),c=(0,Q.useDeferredValue)(o),l=c.trim(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,p]=(0,Q.useState)(d),[m,h]=(0,Q.useState)(`idle`),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[1]=_):_=t[1];let[v,b]=(0,Q.useState)(_),x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=[],t[2]=x):x=t[2];let[S,C]=(0,Q.useState)(x),[w,T]=(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[k,A]=(0,Q.useState)(O),[j,M]=(0,Q.useState)(`idle`),N;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],t[4]=N):N=t[4];let[P,F]=(0,Q.useState)(N),[I,R]=(0,Q.useState)(`idle`),z=(0,Q.useRef)(!1),B=(0,Q.useRef)(null),V=(0,Q.useRef)(null),{activeDocName:H,activeTarget:U}=We(),{pages:W,pageTitles:K,pageMeta:q,folderPaths:ee}=wr(),ne=mp(),{states:re,refresh:ie}=dm(),{dispatch:ae}=em(),oe=Up({docName:H,workspace:ne}),se=ef(W,ee,K,q),ce=Kd(S,new Set(se.map(wm))),le=a?.config.projectPath??null,ue=a?v.filter(e=>e.path!==le):[],de;t[5]!==H||t[6]!==U?(de=gm(U,H),t[5]=H,t[6]=U,t[7]=de):de=t[7];let fe=de,pe=l===``?[]:of(se,l,8),me,he;t[8]!==i||t[9]!==r?(me=()=>{let e=function(e){e.key===`k`&&(Vr()?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]!==a||t[13]!==r||t[14]!==ie?(ge=()=>{if(r){if(C(Ud()),ie(),a){let e=!1;return mm(async()=>{let t=await a.project.listRecent();e||b(t)},`Failed to load recent projects.`),()=>{e=!0}}return}s(``),A([]),M(`idle`),z.current=!1,F([]),R(`idle`)},_e=[r,a,ie],t[12]=a,t[13]=r,t[14]=ie,t[15]=ge,t[16]=_e):(ge=t[15],_e=t[16]),(0,Q.useEffect)(ge,_e);let ve;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>{B.current&&(B.current.scrollTop=0)},t[17]=ve):ve=t[17];let ye;t[18]===o?ye=t[19]:(ye=[o],t[18]=o,t[19]=ye),(0,Q.useEffect)(ve,ye);let be=pf(c,new Set(k.map(Cm))),xe=be.kind!==`normal`,Se,Ce;t[20]!==xe||t[21]!==r?(Se=()=>{if(!r||!xe||z.current)return;z.current=!0,M(`loading`);let e=!1;return hf().then(t=>{e||(A(t),M(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tags failed`,t),A([]),M(`error`))}),()=>{e=!0}},Ce=[r,xe],t[20]=xe,t[21]=r,t[22]=Se,t[23]=Ce):(Se=t[22],Ce=t[23]),(0,Q.useEffect)(Se,Ce);let we=be.kind===`tag-docs`?be.tagName:null;(0,Q.useEffect)(()=>{if(!r||we===null){F([]),R(`idle`);return}R(`loading`),F([]);let e=!1;return gf(we).then(t=>{e||(F(t),R(`success`))}).catch(t=>{e||(console.error(`[command-palette-tag] fetch tag docs failed`,t),F([]),R(`error`))}),()=>{e=!0}},[r,we]),(0,Q.useEffect)(()=>{if(!r||!l||xe){p([]),h(`idle`);return}let e=new AbortController;h(`loading`);let t=!1,n=window.setTimeout(()=>{t=!0,e.abort(),p([]),h(`error`)},pm);return uf(l,{signal:e.signal}).then(e=>{window.clearTimeout(n),p(e),h(`success`)}).catch(e=>{window.clearTimeout(n),!(e instanceof Error&&e.name===`AbortError`&&!t)&&(p([]),h(`error`))}),()=>{window.clearTimeout(n),e.abort()}},[r,l,xe]);let J;t[24]===i?J=t[25]:(J=(e,t)=>{let n=t===void 0?`Command failed.`:t;i(!1),mm(async()=>{await e()},n)},t[24]=i,t[25]=J);let Te=J,Ee;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=function(e){let t={kind:e.kind,path:e.path,lastOpenedAt:new Date().toISOString()},n=Gd(Ud(),t);Wd(n),C(n)},t[26]=Ee):Ee=t[26];let De=Ee,Oe;t[27]===i?Oe=t[28]:(Oe=function(e){i(!1),De(e),hm(e.path)},t[27]=i,t[28]=Oe);let ke=Oe,Ae=!xe&&l===``&&ce.length>0,je=bm({searchResults:f,fallbackSearchResults:pe,searchStatus:m}),Me=!xe&&je.length>0,Ne=!xe&&l!==``&&m===`loading`&&!Me,Pe;t[29]!==c||t[30]!==xe?(Pe=!xe&&df(`New file`,c,[`create file`]),t[29]=c,t[30]=xe,t[31]=Pe):Pe=t[31];let Fe=Pe,Ie;t[32]!==c||t[33]!==xe?(Ie=!xe&&df(`New folder`,c,[`create folder`]),t[32]=c,t[33]=xe,t[34]=Ie):Ie=t[34];let Le=Ie,ze;t[35]!==H||t[36]!==c||t[37]!==xe?(ze=!xe&&H!==null&&df(`Open graph`,c,[`graph panel network`]),t[35]=H,t[36]=c,t[37]=xe,t[38]=ze):ze=t[38];let Be=ze,Ve;t[39]!==c||t[40]!==xe?(Ve=!xe&&df(`Initialize starter pack`,c,[`scaffold`,`seed`,`pack`,`starter`]),t[39]=c,t[40]=xe,t[41]=Ve):Ve=t[41];let He=Ve,Ue=!xe&&a!==null&&df(`Open folder on disk`,c,[`project`]),Ge=!xe&&a!==null&&df(`Switch Project`,c,[`switch project navigator projects`]),Ke=!xe&&df(`Settings`,c,[`preferences config`]),qe=!xe&&df(`Install for Claude Chat & Cowork (Desktop App)`,c,[`claude desktop install cowork`]),Je=!xe&&a!==null&&ue.length>0&&(l===``||ue.some(e=>df(`${e.name} ${e.path}`,c,[`recent project`]))),Ye=!xe&&oe!==null&&(l===``||op.some(e=>df(`Open in ${e.displayName}`,c,[e.id,`agent handoff`]))),Xe=be.kind===`tag-list`?mf(k,be.query):[],Ze=be.kind===`tag-list`&&j!==`loading`&&Xe.length===0,Qe=be.kind===`tag-docs`&&I===`success`&&P.length===0,$e=xe||Ae||Me||Ne||Fe||Le||Be||He||Ue||Ge||Ke||qe||Je||Ye,et;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(et=function(e){s(`${ff}${e}`)},t[42]=et):et=t[42];let tt=et,nt=ht,rt;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(rt={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[43]=rt):rt=t[43];let it;t[44]===o?it=t[45]:(it=(0,Z.jsx)(g,{ref:V,value:o,onValueChange:s,placeholder:`Search files, folders, or commands`}),t[44]=o,t[45]=it);let at;t[46]===xe?at=t[47]:(at=()=>{s(xe?``:ff),V.current?.focus()},t[46]=xe,t[47]=at);let ot=xe?`border-primary/30 bg-primary/10 text-primary`:`border-border bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground`,st;t[48]===ot?st=t[49]:(st=Y(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors`,ot),t[48]=ot,t[49]=st);let ct,lt;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ct=(0,Z.jsx)(_t,{className:`size-3.5`}),lt=(0,Z.jsx)(`span`,{children:`By tag`}),t[50]=ct,t[51]=lt):(ct=t[50],lt=t[51]);let ut;t[52]!==xe||t[53]!==at||t[54]!==st?(ut=(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:at,"data-testid":`command-palette-filter-tag`,"data-active":xe,"aria-pressed":xe,className:st,children:[ct,lt]})}),t[52]=xe,t[53]=at,t[54]=st,t[55]=ut):ut=t[55];let dt=Re,ft;t[56]!==Me||t[57]!==Ne?(ft=Ne&&!Me?(0,Z.jsx)(te,{children:`Searching`}):null,t[56]=Me,t[57]=Ne,t[58]=ft):ft=t[58];let pt=$e?null:(0,Z.jsx)(te,{children:m===`error`?`Search failed.`:`No matching commands.`}),gt=be.kind===`tag-list`?(0,Z.jsxs)(y,{heading:be.query?`Tags matching "${be.query}"`:`All tags`,children:[j===`loading`?(0,Z.jsx)(te,{children:`Loading tags`}):null,j===`error`?(0,Z.jsx)(te,{children:`Failed to load tags. Press Escape and re-open to retry.`}):null,Ze?(0,Z.jsx)(te,{children:be.query?`No tags match "${be.query}".`:"No tags yet — author `#tagname` in any doc to populate the index."}):null,Xe.map(e=>(0,Z.jsxs)(L,{value:`tag ${e.name}`,onSelect:()=>tt(e.name),"data-testid":`command-palette-tag-${e.name}`,children:[(0,Z.jsx)(_t,{}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.name}),(0,Z.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground tabular-nums`,children:[e.count,` `,e.count===1?`doc`:`docs`]})]},`tag:${e.name}`))]}):null,vt;t[59]!==i||t[60]!==be||t[61]!==Qe||t[62]!==P||t[63]!==I?(vt=be.kind===`tag-docs`?(0,Z.jsxs)(y,{heading:`Docs tagged #${be.tagName}`,children:[I===`loading`?(0,Z.jsx)(te,{children:`Loading docs`}):null,I===`error`?(0,Z.jsx)(te,{children:`Failed to load docs. Press Escape and re-open to retry.`}):null,Qe?(0,Z.jsx)(te,{children:`No docs registered under #${be.tagName}.`}):null,P.map(e=>{let t=e.title||e.docName.split(`/`).pop()||e.docName;return(0,Z.jsxs)(L,{value:`tag-doc ${e.docName}`,onSelect:()=>{i(!1),hm(e.docName)},"data-testid":`command-palette-tag-doc-${e.docName}`,className:`items-start`,children:[(0,Z.jsx)(ws,{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!==be.tagName)?(0,Z.jsxs)(`span`,{className:`truncate text-muted-foreground text-[11px]`,children:[`via`,` `,e.matchingTags.filter(e=>e!==be.tagName).map(Sm).join(`, `)]}):null]})]},`tag-doc:${e.docName}`)})]}):null,t[59]=i,t[60]=be,t[61]=Qe,t[62]=P,t[63]=I,t[64]=vt):vt=t[64];let yt=Ae?(0,Z.jsx)(y,{heading:`Recently opened`,children:ce.map(e=>(0,Z.jsx)(_m,{entry:e,onSelect:()=>ke(e)},Hd(e.kind,e.path)))}):null,bt;t[65]!==H||t[66]!==i||t[67]!==T||t[68]!==D||t[69]!==Fe||t[70]!==Le||t[71]!==Be||t[72]!==He?(bt=Fe||Le||Be||He?(0,Z.jsxs)(y,{heading:`Commands`,children:[Fe?(0,Z.jsxs)(L,{value:`new file create file`,onSelect:()=>{i(!1),T(`file`)},"data-testid":`command-palette-new-file`,children:[(0,Z.jsx)(mt,{}),(0,Z.jsx)(`span`,{children:`New file`})]}):null,Le?(0,Z.jsxs)(L,{value:`new folder create folder`,onSelect:()=>{i(!1),T(`folder`)},"data-testid":`command-palette-new-folder`,children:[(0,Z.jsx)(Os,{}),(0,Z.jsx)(`span`,{children:`New folder`})]}):null,Be?(0,Z.jsxs)(L,{value:`open graph graph panel network`,onSelect:()=>{H&&(i(!1),bf(`graph`))},"data-testid":`command-palette-open-graph`,children:[(0,Z.jsx)(Gs,{}),(0,Z.jsx)(`span`,{children:`Open graph`})]}):null,He?(0,Z.jsxs)(L,{value:`initialize starter pack scaffold seed`,onSelect:()=>{i(!1),D(!0)},"data-testid":`command-palette-initialize-starter-pack`,children:[(0,Z.jsx)(ii,{}),(0,Z.jsx)(`span`,{children:`Initialize starter pack`})]}):null]}):null,t[65]=H,t[66]=i,t[67]=T,t[68]=D,t[69]=Fe,t[70]=Le,t[71]=Be,t[72]=He,t[73]=bt):bt=t[73];let xt=Ye?(0,Z.jsx)(y,{heading:`Open in agent`,children:op.filter(e=>df(`Open in ${e.displayName}`,c,[e.id,`agent handoff`])).map(e=>{let t=re[e.id],n=t.installed===!0&&oe!==null,r=t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null,a=r?`Open in ${e.displayName}, ${r}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(L,{value:`open in ${e.displayName} ${e.id} agent`,disabled:!n,onSelect:()=>{!n||!oe||(i(!1),ae(e.id,oe))},"data-testid":`command-palette-open-in-${e.id}`,"aria-label":a,children:[(0,Z.jsxs)(`span`,{className:`flex-1`,children:[`Open in `,e.displayName]}),r?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-auto text-muted-foreground text-xs`,children:r}):null]},e.id)})}):null,St=Ue||Ge||Ke||qe||Je?(0,Z.jsxs)(y,{heading:`Project`,children:[Ue&&a?(0,Z.jsxs)(L,{value:`open folder on disk project`,onSelect:()=>Te(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)(G,{}),(0,Z.jsx)(`span`,{children:`Open folder on disk`}),(0,Z.jsx)(u,{children:`⌘O`})]}):null,Ge&&a?(0,Z.jsxs)(L,{value:`switch-project navigator projects`,onSelect:()=>Te(()=>a.navigator.open(),`Failed to open Project Navigator.`),"data-testid":`command-palette-switch-project`,children:[(0,Z.jsx)(Fs,{}),(0,Z.jsx)(`span`,{children:`Switch Project`}),(0,Z.jsx)(u,{children:`⌘⇧N`})]}):null,Ke?(0,Z.jsxs)(L,{value:`settings preferences config`,onSelect:()=>{i(!1),window.location.hash!==`#settings`&&(window.location.hash=sp)},"data-testid":`command-palette-settings`,children:[(0,Z.jsx)(rc,{}),(0,Z.jsx)(`span`,{children:`Settings`}),(0,Z.jsx)(u,{children:`⌘,`})]}):null,qe?(0,Z.jsxs)(L,{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)(Oi,{}),(0,Z.jsx)(`span`,{children:`Install for Claude Chat & Cowork (Desktop App)`})]}):null,Je&&a?ue.filter(e=>df(`${e.name} ${e.path}`,c,[`recent project`])).slice(0,10).map(e=>(0,Z.jsxs)(L,{value:`${e.name} ${e.path} recent project`,disabled:e.missing,onSelect:()=>Te(()=>a.project.open({path:e.path,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`),"data-testid":`command-palette-recent-${e.path}`,children:[(0,Z.jsx)(ii,{}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,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?` (missing)`:``]})]})]},e.path)):null]}):null,Ct=Me?(0,Z.jsx)(y,{heading:`Search`,children:je.map(e=>(0,Z.jsx)(_m,{entry:e,query:l,onSelect:()=>ke(e)},Hd(e.kind,e.path)))}):null,wt;t[74]!==dt||t[75]!==ft||t[76]!==pt||t[77]!==gt||t[78]!==vt||t[79]!==yt||t[80]!==bt||t[81]!==xt||t[82]!==St||t[83]!==Ct?(wt=(0,Z.jsxs)(dt,{ref:B,className:`subtle-scrollbar`,children:[ft,pt,gt,vt,yt,bt,xt,St,Ct]}),t[74]=dt,t[75]=ft,t[76]=pt,t[77]=gt,t[78]=vt,t[79]=yt,t[80]=bt,t[81]=xt,t[82]=St,t[83]=Ct,t[84]=wt):wt=t[84];let Tt;t[85]!==nt||t[86]!==i||t[87]!==r||t[88]!==rt||t[89]!==it||t[90]!==ut||t[91]!==wt?(Tt=(0,Z.jsxs)(nt,{open:r,onOpenChange:i,title:`Workspace Command Palette`,description:`Search files, folders, and commands for the current workspace.`,className:`sm:max-w-2xl`,commandProps:rt,children:[it,ut,wt]}),t[85]=nt,t[86]=i,t[87]=r,t[88]=rt,t[89]=it,t[90]=ut,t[91]=wt,t[92]=Tt):Tt=t[92];let Et=w===`file`,Dt;t[93]===T?Dt=t[94]:(Dt=e=>{e||T(null)},t[93]=T,t[94]=Dt);let Ot;t[95]!==fe||t[96]!==Et||t[97]!==Dt?(Ot=(0,Z.jsx)(Pf,{open:Et,onOpenChange:Dt,kind:`file`,initialDir:fe}),t[95]=fe,t[96]=Et,t[97]=Dt,t[98]=Ot):Ot=t[98];let kt=w===`folder`,At;t[99]===T?At=t[100]:(At=e=>{e||T(null)},t[99]=T,t[100]=At);let jt;t[101]!==fe||t[102]!==kt||t[103]!==At?(jt=(0,Z.jsx)(Pf,{open:kt,onOpenChange:At,kind:`folder`,initialDir:fe}),t[101]=fe,t[102]=kt,t[103]=At,t[104]=jt):jt=t[104];let Mt;t[105]!==E||t[106]!==D?(Mt=(0,Z.jsx)(Xf,{open:E,onOpenChange:D}),t[105]=E,t[106]=D,t[107]=Mt):Mt=t[107];let Nt;return t[108]!==Tt||t[109]!==Ot||t[110]!==jt||t[111]!==Mt?(Nt=(0,Z.jsxs)(Z.Fragment,{children:[Tt,Ot,jt,Mt]}),t[108]=Tt,t[109]=Ot,t[110]=jt,t[111]=Mt,t[112]=Nt):Nt=t[112],Nt}function Sm(e){return`#${e}`}function Cm(e){return e.name}function wm(e){return Hd(e.kind,e.path)}var Tm=500;function Em(e,t,n){return t?`terminal`:e===null&&n?`retrying`:`hidden`}function Dm(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 Om(){let e=(0,$.c)(16),{collabUrl:t,collabTerminal:n,collabLastError:r,retryCollab:i}=We(),[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),Tm);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=Em(t,n,a);if(l===`hidden`)return null;if(l===`terminal`){let t;e[4]===r?t=e[5]:(t=Dm(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 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 shadow-md`,children:`Connecting — waiting for collab server`}),e[15]=u):u=e[15],u}async function km(e){let t=await fetch(`/api/tags/${encodeURIComponent(e)}`);if(!t.ok){let e=await t.json().catch(()=>null);throw Error(Bn(e)??`Server error: ${t.status} ${t.statusText}`)}return(await t.json()).docs??[]}function Am(){let e=(0,$.c)(15),[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`}),km(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(Ve,e),()=>document.removeEventListener(Ve,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(er(e))},e[3]=d):d=e[3];let f=d,p=r??``,m;e[4]===p?m=e[5]:(m=(0,Z.jsx)(qa,{children:(0,Z.jsxs)(Ra,{children:[`Documents tagged `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,p]})]})}),e[4]=p,e[5]=m);let h=r??``,g;e[6]!==o||e[7]!==h?(g=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(jm,{fetchState:o,tag:h,onSelectDoc:f})}),e[6]=o,e[7]=h,e[8]=g):g=e[8];let _;e[9]!==m||e[10]!==g?(_=(0,Z.jsxs)(Va,{children:[m,g]}),e[9]=m,e[10]=g,e[11]=_):_=e[11];let v;return e[12]!==t||e[13]!==_?(v=(0,Z.jsx)(Ja,{open:t,onOpenChange:n,children:_}),e[12]=t,e[13]=_,e[14]=v):v=e[14],v}function jm(e){let t=(0,$.c)(12),{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:`Loading`}),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;return t[3]===r?e=t[4]:(e=(0,Z.jsxs)(`p`,{className:`text-muted-foreground text-sm`,"data-testid":`tag-dialog-empty`,children:[`Only the current document uses `,(0,Z.jsxs)(`span`,{className:`font-mono`,children:[`#`,r]}),`.`]}),t[3]=r,t[4]=e),e}let a;if(t[5]!==n.docs||t[6]!==i){let e;t[8]===i?e=t[9]:(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(Mm)}):null]})},e.docName)},t[8]=i,t[9]=e),a=n.docs.map(e),t[5]=n.docs,t[6]=i,t[7]=a}else a=t[7];let o;return t[10]===a?o=t[11]:(o=(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,"data-testid":`tag-dialog-list`,children:a}),t[10]=a,t[11]=o),o}function Mm(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 Nm=`raw-mdx-nav`,Pm=`ok-editor-mode-v1`,Fm=[`wysiwyg`,`source`],Im=`wysiwyg`;function Lm(e){return Fm.includes(e)}function Rm(e=localStorage){try{let t=e.getItem(Pm);if(t===null)return Im;if(Lm(t))return t;console.warn(`[editor-mode] invalid persisted value, falling back to default`,{raw:t})}catch{}return Im}function zm(e=window,t=localStorage){let n=e.__OK_EDITOR_MODE__;return Lm(n)?n:Rm(t)}function Bm(e,t=localStorage){try{return t.setItem(Pm,e),!0}catch(e){return console.warn(`[editor-mode] persist failed`,e),!1}}function Vm(){let e=(0,$.c)(3),[t,n]=(0,Q.useState)(zm),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=function(e){n(e),Bm(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 Hm(e){let t=(0,$.c)(21),{open:n,onResolved:r}=e,i=yi(),a;t[0]!==r||t[1]!==i?(a=function(e){if(i===null){Xa.error(`Sync settings not yet loaded — try again in a moment`);return}let t=i(e);if(!t.ok){Xa.error(`Could not ${e?`enable sync`:`save sync preference`}: ${t.error}`);return}r()},t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(qa,{children:(0,Z.jsx)(Ci,{})}),t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(ha,{})}),t[4]=c):c=t[4];let l;t[5]===o?l=t[6]:(l=()=>o(!1),t[5]=o,t[6]=l);let u=i===null,d;t[7]!==l||t[8]!==u?(d=(0,Z.jsx)(X,{variant:`ghost`,className:`uppercase font-mono`,onClick:l,disabled:u,children:`Keep disabled`}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;t[10]===o?f=t[11]:(f=()=>o(!0),t[10]=o,t[11]=f);let p=i===null,m;t[12]!==f||t[13]!==p?(m=(0,Z.jsx)(X,{onClick:f,disabled:p,children:`Enable auto-sync`}),t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,Z.jsxs)(Va,{className:`sm:max-w-lg`,showCloseButton:!1,children:[s,c,(0,Z.jsxs)(Ga,{children:[d,m]})]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==n||t[19]!==h?(g=(0,Z.jsx)(Ja,{open:n,onOpenChange:Um,children:h}),t[18]=n,t[19]=h,t[20]=g):g=t[20],g}function Um(){}function Wm(e){let t=(0,$.c)(9),{onOpenResolver:n}=e,r=zi();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)(Dn,{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 Gm=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 Km(e,t,n,r,i,a){if(e==r)return[];let o=nh(e,t,n,r,i,a),s=rh(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 Gm(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new Gm(t,t+o,i,i),new Gm(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 Gm(t,t,i,i+o),new Gm(n,n,i+o+c,a)]}if(c==1||l==1)return[new Gm(t,n,i,a)];let u=ah(e,t,n,r,i,a);if(u){let[o,s,c]=u;return Km(e,t,o,r,i,s).concat(Km(e,o+c,n,r,s+c,a))}return Xm(e,t,n,r,i,a)}var qm=1e9,Jm=0,Ym=!1;function Xm(e,t,n,r,i,a){let o=n-t,s=a-i;if(qm<1e9&&Math.min(o,s)>qm*16||Jm>0&&Date.now()>Jm)return Math.min(o,s)>qm*64?[new Gm(t,n,i,a)]:oh(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);Qm.reset(c),$m.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:$m,f=d?null:Qm;for(let p=0;p<c;p++){if(p>qm||Jm>0&&!(p&63)&&Date.now()>Jm)return oh(e,t,n,r,i,a);let m=Qm.advance(p,o,s,c,d,!1,l)||$m.advance(p,o,s,c,f,!0,u);if(m)return eh(e,t,n,t+m[0],r,i,a,i+m[1])}return[new Gm(t,n,i,a)]}var Zm=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}},Qm=new Zm,$m=new Zm;function eh(e,t,n,r,i,a,o,s){let c=!1;return!xh(e,r)&&++r==n&&(c=!0),!xh(i,s)&&++s==o&&(c=!0),c?[new Gm(t,n,a,o)]:Km(e,t,r,i,a,s).concat(Km(e,r,n,i,s,o))}function th(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function nh(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=th(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-+!xh(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function rh(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=th(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-+!xh(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function ih(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;;){xh(e,s)||s++;let u=s+o;if(xh(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=nh(e,u,n,r,i+f+d.length,a),c=rh(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 ah(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=ah(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:ih(e,t,n,r,i,a,Math.floor(o/4),-1)}function oh(e,t,n,r,i,a){Ym=!0;let o=n-t,s=a-i,c;if(o<s){let s=ih(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=ih(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new Gm(t,n,i,a)];let[l,u,d]=c;return Km(e,t,l,r,i,u).concat(Km(e,l+d,n,r,u+d,a))}function sh(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 Gm(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function ch(e,t,n){for(;;){sh(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=nh(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Gm(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=rh(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new Gm(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 Gm(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 Gm(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function lh(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=gh(t,a.fromA,l),f=hh(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 Gm(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=hh(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new Gm(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=gh(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new Gm(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=vh(n,a.fromB,a.toB),r,o=t<0?-1:_h(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=vh(t,a.fromA,a.toA),r,o=n<0?-1:_h(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 sh(e,3),e}var uh;try{uh=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function dh(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function fh(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!dh(n):uh?!yh(n)||t==e.length-1?+!!uh.test(String.fromCharCode(n)):uh.test(e.slice(t,t+2))?2:0:0}function ph(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!dh(n):uh?!bh(n)||t==1?+!!uh.test(String.fromCharCode(n)):uh.test(e.slice(t-2,t))?2:0:0}var mh=8;function hh(e,t,n){if(t==e.length||!ph(e,t))return t;for(let r=t,i=t+n,a=0;a<mh;a++){let t=fh(e,r);if(!t||r+t>i)return r;r+=t}return t}function gh(e,t,n){if(!t||!fh(e,t))return t;for(let r=t,i=t-n,a=0;a<mh;a++){let t=ph(e,r);if(!t||r-t<i)return r;r-=t}return t}function _h(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function vh(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var yh=e=>e>=55296&&e<=56319,bh=e=>e>=56320&&e<=57343;function xh(e,t){return!t||t==e.length||!yh(e.charCodeAt(t-1))||!bh(e.charCodeAt(t))}function Sh(e,t,n){let r=n?.override;return r?r(e,t):(qm=(n?.scanLimit??1e9)>>1,Jm=n?.timeout?Date.now()+n.timeout:0,Ym=!1,ch(e,t,Km(e,0,e.length,t,0,t.length)))}function Ch(){return!Ym}function wh(e,t,n){return lh(Sh(e,t,n),e,t)}var Th=To.define({combine:e=>e[0]}),Eh=Eo.define(),Dh=To.define(),Oh=bo.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Eh)&&(e=n.value);for(let n of t.state.facet(Dh))e=n(e,t);return e}});function kh(e){let t=e.field(Oh,!1);if(!t)return null;let n=e.facet(Th);return{chunks:t,side:n?n.side:null}}var Ah=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 Nh(wh(e.toString(),t.toString(),n),e,t,0,0,Ch())}static updateA(e,t,n,r,i){return Lh(Ih(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return Lh(Ih(e,r,!1,t.length),e,t,n,i)}};function jh(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 Mh(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 Nh(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=jh(c.fromA+r,c.fromB+i,t,n),[d,f]=Mh(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]=jh(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]=Mh(a.toA+r,a.toB+i,t,n),s++}o.push(new Ah(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var Ph=1e3;function Fh(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 Ih(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>Ph&&([l,d]=Fh(e,a-Ph,n,!0)),o<t.length-Ph&&([u,f]=Fh(e,o+Ph,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 Lh(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=wh(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Nh(h,n,r,d,f,Ch()))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 Rh={scanLimit:500},zh=Do.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=Yh(e))}update(e){(e.docChanged||e.viewportChanged||Vh(e.startState,e.state)||Hh(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=Yh(e.view))}},{decorations:e=>e.deco}),Bh=_o.low(jo({class:`cm-changeGutter`,markers:e=>e.plugin(zh)?.gutter||No.empty}));function Vh(e,t){return e.field(Oh,!1)!=t.field(Oh,!1)}function Hh(e,t){return e.facet(Th)!=t.facet(Th)}var Uh=Co.line({class:`cm-changedLine`}),Wh=Co.mark({class:`cm-changedText`}),Gh=Co.mark({tagName:`ins`,class:`cm-insertedLine`}),Kh=Co.mark({tagName:`del`,class:`cm-deletedLine`}),qh=new class extends Ao{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function Jh(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,Uh),i.add(o,s,n?Kh:Gh),a&&a.add(o,o,qh);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,Uh),a&&a.add(u,u,qh);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,Wh),s<t)c++;else break}u=t}}}function Yh(e){let t=e.state.field(Oh),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Th),o=n==`a`,s=new wo,c=i?new wo: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))&&Jh(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var Xh=class extends go{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}},Zh=Eo.define({map:(e,t)=>e.map(t)}),Qh=bo.define({create:()=>Co.none,update:(e,t)=>{for(let e of t.effects)if(e.is(Zh))return e.value;return e.map(t.changes)},provide:e=>ko.decorations.from(e)}),$h=.01;function eg(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 tg(e,t,n){let r=new wo,i=new wo,a=e.state.field(Qh).iter(),o=t.state.field(Qh).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<-$h?(l-=n,r.add(s,s,Co.widget({widget:new Xh(-n),block:!0,side:-1}))):n>$h&&(u+=n,i.add(c,c,Co.widget({widget:new Xh(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<$h?r.add(e.state.doc.length,e.state.doc.length,Co.widget({widget:new Xh(-p),block:!0,side:1})):p>$h&&i.add(t.state.doc.length,t.state.doc.length,Co.widget({widget:new Xh(p),block:!0,side:1}));let m=r.finish(),h=i.finish();eg(m,e.state.field(Qh))||e.dispatch({effects:Zh.of(m)}),eg(h,t.state.field(Qh))||t.dispatch({effects:Zh.of(h)})}var ng=Eo.define({map:(e,t)=>t.mapPos(e)}),rg=class extends go{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:ng.of(n)});let{side:r,sibling:i}=e.state.facet(Th);i&&i().dispatch({effects:ng.of(ig(n,e.state.field(Oh),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function ig(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 ag=bo.define({create(e){return Co.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(ng)&&(e=e.update({filter:e=>e!=n.value}));return e},provide:e=>ko.decorations.from(e)});function og({margin:e=3,minSize:t=4}){return ag.init(n=>sg(n,e,t))}function sg(e,t,n){let r=new wo,i=e.facet(Th).side==`a`,a=e.field(Oh),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,Co.replace({widget:new rg(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var cg=ko.styleModule.of(new Mo({".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`}})),lg=ko.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`}}),ug=new Oo,dg=new Oo,fg=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||Rh;let t=[_o.low(zh),lg,cg,Qh,ko.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(Zh)))&&this.measure()})],n=[Th.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Bh);let r=yo.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],ko.editorAttributes.of({class:`cm-merge-a`}),dg.of(n),t]}),i=[Th.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Bh);let a=yo.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],ko.editorAttributes.of({class:`cm-merge-b`}),dg.of(i),t]});this.chunks=Ah.build(r.doc,a.doc,this.diffConf);let o=[Oh.init(()=>this.chunks),ug.of(e.collapseUnchanged?og(e.collapseUnchanged):[])];r=r.update({effects:Eo.appendConfig.of(o)}).state,a=a.update({effects:Eo.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 ko({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new ko({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),vo.empty(e[0].startState.doc.length));this.chunks=t==this.a?Ah.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Ah.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Eh.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Eh.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(Th),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(dg.reconfigure([Th.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?Bh:[]])),a.push(dg.reconfigure([Th.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?Bh:[]]))}if(r){let t=ug.reconfigure(e.collapseUnchanged?og(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(){tg(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=pg(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=pg(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 pg(e){let t=e.nextSibling;return e.remove(),t}var mg=new class extends Ao{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},hg=_o.low(jo({class:`cm-changeGutter`,markers:e=>e.plugin(zh)?.gutter||No.empty,widgetMarker:(e,t)=>t instanceof bg?mg:null}));function gg(e){let t=typeof e.original==`string`?So.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||Rh;return[_o.low(zh),Tg,lg,ko.editorAttributes.of({class:`cm-merge-b`}),Dh.of((e,t)=>{let r=t.effects.find(e=>e.is(_g));return r&&(e=Ah.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Ah.updateB(e,t.state.field(vg),t.newDoc,t.changes,n)),e}),Th.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?jg:void 0,side:`b`}),vg.init(()=>t),e.gutter===!1?[]:hg,e.collapseUnchanged?og(e.collapseUnchanged):[],Oh.init(e=>Ah.build(t,e.doc,n))]}var _g=Eo.define(),vg=bo.define({create:()=>So.empty,update(e,t){for(let n of t.effects)n.is(_g)&&(e=n.value.doc);return e}}),yg=new WeakMap,bg=class extends go{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 xg(e,t,n){let r=yg.get(t.changes);if(r)return r;let i=Co.widget({block:!0,side:-1,widget:new bg(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Th),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(),Sg(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Cg(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(vg).sliceString(t.fromA,t.endA),u=a&&e.facet(Po),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
- `,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;xo(t,{style:t=>Fo(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 Qh.set(t.changes,i),i}function tg(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(sh).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(Zh);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=vo.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Xh.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function ng(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(sh).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Zh).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 rg(e){let t=new wo;for(let n of e.field(sh)){let r=e.facet(ih).overrideChunk&&og(e,n);t.add(n.fromB,n.fromB,eg(e,n,!!r))}return t.finish()}var ig=bo.define({create:e=>rg(e),update(e,t){return t.state.field(sh,!1)==t.startState.field(sh,!1)?e:rg(t.state)},provide:e=>ko.decorations.from(e)}),ag=new WeakMap;function og(e,t){let n=ag.get(t);if(n!==void 0)return n;n=null;let r=e.field(Zh),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(Co.widget({widget:new sg(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Ch.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return ag.set(t,n),n}var sg=class extends go{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}},cg=new class extends Ao{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},lg=Co.line({class:`cm-inlineChangedLine`});function ug(e,t,n,r){let i=og(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,cg),n.add(o.from,o.from,lg);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 dg=W({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),fg=gt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function pg(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}=yr(),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 g,v;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?dg:fg,t=[ko.editable.of(!1),yo.readOnly.of(!0)],o=[Ro,_(),...t,e,ko.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new ko({doc:r,extensions:[Ro,_(),ko.editable.of(!1),e,ko.lineWrapping,Yh({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ko.updateListener.of(e=>{let t=ch(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=ch(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new Gh({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 ko({doc:r,extensions:[...o,Yh({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]=g,t[9]=v):(g=t[8],v=t[9]),(0,Q.useEffect)(g,v);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){let e=l.current;!e||!(e instanceof ko)||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 mg(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)(Ua,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function hg(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)(Ka,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function gg(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=Y(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(za,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _g(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)(gg,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=Y(`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`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Z.jsx)(Ha,{"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)(Fa,{}),(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)(hg,{children:[l,(0,Z.jsxs)(Ya,{"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 vg(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=Y(`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 yg(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=Y(`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)(Ba,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function bg(){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 xg(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 Sg(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 Cg=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function wg(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 xg(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)(qa,{className:`shrink-0`,children:(0,Z.jsxs)(Ra,{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)(Va,{className:Cg,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(Ja,{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)(Ra,{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)(qa,{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)(pg,{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)(Va,{className:`${Cg} 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)(Ja,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function Tg(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(){bg().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(Eg));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=()=>_r(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&&(Xa.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 Sg(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):Xa.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?Xa.info(`Merge aborted — sync paused`):Xa.error(`Failed to abort merge`)}catch{Xa.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)(yg,{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)(vg,{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)(_g,{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)(mg,{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)(wg,{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 Eg(e){return e.file}var Dg=5;async function Og(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=ir.safeParse(n);throw e.success?Error(e.data.title):new Ce(`Failed to parse backlinks error response (HTTP ${t.status})`,{status:t.status})}let r=fn.safeParse(n);if(!r.success)throw new Ce(`Backlinks response did not match expected shape.`,{status:t.status});return r.data.backlinks}async function kg(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=ir.safeParse(n);throw e.success?Error(e.data.title):new Ce(`Failed to parse forward-links error response (HTTP ${t.status})`,{status:t.status})}let r=Zn.safeParse(n);if(!r.success)throw new Ce(`Forward-links response did not match expected shape.`,{status:t.status});return r.data.forwardLinks}function Ag(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function jg(e){window.location.hash=er(e)}function Mg(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)(Ie,{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)(Gt,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Wt,{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)(R,{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 Ng(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=Dg)return null;let a=n-Dg,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Ie,{className:`size-3`}):(0,Z.jsx)(l,{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 Pg(e){let t=(0,$.c)(38),{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,hoverAction:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=Y(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=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:Y(`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]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(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]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":h.tooltip,disabled:h.disabled,className:`relative z-10 shrink-0 cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground group-hover:opacity-100`,onClick:h.onClick,children:h.icon})}),(0,Z.jsx)(co,{side:`top`,children:h.tooltip})]}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(so,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(co,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(uo,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function Fg(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=wr(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>Og(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}=Nt(l),m;t[11]===u?m=t[12]:(m=u===void 0?[]:u,t[11]=u,t[12]=m);let h=m,[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(n);v!==n&&(y(n),_(!1));let b;t[13]!==h||t[14]!==g?(b=g?h:h.slice(0,Dg),t[13]=h,t[14]=g,t[15]=b):b=t[15];let x=b,S;t[16]!==h.length||t[17]!==d?(S=(0,Z.jsx)(Mg,{title:`Backlinks`,count:h.length,isLoading:d}),t[16]=h.length,t[17]=d,t[18]=S):S=t[18];let C;t[19]!==h.length||t[20]!==f||t[21]!==g||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==x?(C=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(jt,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):h.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Rt,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map((e,t)=>{let n=Na(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(Pg,{icon:(0,Z.jsx)(p,{className:`size-3.5`}),title:e.title,path:Ag(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:er(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(Ng,{total:h.length,expanded:g,onToggle:()=>_(Ig)})]}),t[19]=h.length,t[20]=f,t[21]=g,t[22]=r,t[23]=d,t[24]=i,t[25]=x,t[26]=C):C=t[26];let w;t[27]!==d||t[28]!==C?(w=(0,Z.jsx)(N,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:C})}),t[27]=d,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==w||t[31]!==S?(T=(0,Z.jsxs)(A,{defaultOpen:!0,children:[S,w]}),t[30]=w,t[31]=S,t[32]=T):T=t[32],T}function Ig(e){return!e}function Lg(e){let t=(0,$.c)(42),{docName:n}=e,{addPage:r,folderPaths:i,pages:a,pagesBySlug:o,loading:s}=wr(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>kg(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 f;t[7]!==c||t[8]!==l||t[9]!==u?(f={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=f):f=t[10];let{data:m,isLoading:h,error:g}=Nt(f),_;t[11]===m?_=t[12]:(_=m===void 0?[]:m,t[11]=m,t[12]=_);let v=_,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1),b(null));let T;t[13]!==x||t[14]!==v?(T=x?v:v.slice(0,Dg),t[13]=x,t[14]=v,t[15]=T):T=t[15];let E=T,D;t[16]!==r||t[17]!==y?(D=async function(e,t){if(!y){b(t);try{await U(e,{addPage:r,onCreated:jg}),b(null)}catch(e){let t=e;Xa.error(t instanceof Error?t.message:`Failed to create page`),b(null)}}},t[16]=r,t[17]=y,t[18]=D):D=t[18];let O=D,k;t[19]!==y||t[20]!==i||t[21]!==O||t[22]!==a||t[23]!==o||t[24]!==s?(k=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(Pg,{icon:(0,Z.jsx)(Ma,{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=d(e.docName,{pages:a,folderPaths:i,pagesBySlug:o}),n=!s&&t.kind===`create`,r=!s&&t.kind===`navigate`&&t.displayState===`folder`,c=Ag(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,f=er(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)(Pg,{icon:(0,Z.jsx)(Dn,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:y===u?`Creating page`:`Missing page — click to create`,ariaLabel:y===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:y!==null,onClick:()=>void O(n,u)},u)}if(r&&t.kind===`navigate`){let n=xt(t);return(0,Z.jsx)(Pg,{icon:(0,Z.jsx)(ks,{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:f,hoverAction:{icon:(0,Z.jsx)(Fi,{className:`size-3.5`}),tooltip:y===u?`Creating index note`:`Create index note`,disabled:y!==null||n===null,onClick:()=>{n&&O(n,u)}}},u)}return(0,Z.jsx)(Pg,{icon:(0,Z.jsx)(p,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:f},u)},t[19]=y,t[20]=i,t[21]=O,t[22]=a,t[23]=o,t[24]=s,t[25]=k):k=t[25];let j=k,M;t[26]!==h||t[27]!==v.length?(M=(0,Z.jsx)(Mg,{title:`Outgoing`,count:v.length,isLoading:h}),t[26]=h,t[27]=v.length,t[28]=M):M=t[28];let P;t[29]!==g||t[30]!==x||t[31]!==h||t[32]!==v.length||t[33]!==j||t[34]!==E?(P=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(jt,{children:g instanceof Error?g.message:`Failed to load outgoing links`})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Rt,{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:E.map(j)}),(0,Z.jsx)(Ng,{total:v.length,expanded:x,onToggle:()=>S(Rg)})]}),t[29]=g,t[30]=x,t[31]=h,t[32]=v.length,t[33]=j,t[34]=E,t[35]=P):P=t[35];let F;t[36]!==h||t[37]!==P?(F=(0,Z.jsx)(N,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:P})}),t[36]=h,t[37]=P,t[38]=F):F=t[38];let I;return t[39]!==M||t[40]!==F?(I=(0,Z.jsxs)(A,{defaultOpen:!0,children:[M,F]}),t[39]=M,t[40]=F,t[41]=I):I=t[41],I}function Rg(e){return!e}function zg(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)(Lg,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(Bi,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(Fg,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(Ht,{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)(Kt,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var Bg=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 Bg{};function Vg(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 Hg(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 Ug(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 Wg(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 Gg(e,t){return Ug(e,t,``)}function Kg(e,t){return Wg(e,t,``)}function qg(e,t){return t.slice(0,Jg(e,t))}function Jg(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 Yg(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 Xg(e,t){if(t)return Qg(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Zg(e,t){if(t)return Qg(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function Qg(e,t){if(!t)return[Zg(e),Xg(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Yg(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var $g=`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}`,e_=RegExp(`[${$g}]+|\\s+|[^${$g}]`,`ug`);new class extends Bg{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=Yg(e,r)}else n=e.match(e_)||[];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)&&t_(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&t_(n,i,r,null,t.intlSegmenter),e}};function t_(e,t,n,r,i){if(t&&n){let[a,o]=Qg(t.value,i),[s,c]=Qg(n.value,i);if(e){let r=Vg(a,s);e.value=Wg(e.value,s,r),t.value=Gg(t.value,r),n.value=Gg(n.value,r)}if(r){let e=Hg(o,c);r.value=Ug(r.value,c,e),t.value=Kg(t.value,e),n.value=Kg(n.value,e)}}else if(n){if(e){let e=Zg(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Zg(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Zg(r.value,i),[a,o]=Qg(t.value,i),s=Vg(n,a);t.value=Gg(t.value,s);let c=Hg(Gg(n,s),o);t.value=Kg(t.value,c),r.value=Ug(r.value,n,c),e.value=Wg(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Zg(r.value,i),n=qg(Xg(t.value,i),e);t.value=Kg(t.value,n)}else if(e){let n=qg(Xg(e.value,i),Zg(t.value,i));t.value=Gg(t.value,n)}}new class extends Bg{tokenize(e){let t=RegExp(`(\\r?\\n)|[${$g}]+|[^\\S\\n\\r]+|[^${$g}]`,`ug`);return e.match(t)||[]}};var n_=new class extends Bg{constructor(){super(...arguments),this.tokenize=i_}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
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;xo(t,{style:t=>Fo(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 yg.set(t.changes,i),i}function Sg(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Oh).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(vg);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=vo.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:_g.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Cg(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Oh).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(vg).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 wg(e){let t=new wo;for(let n of e.field(Oh)){let r=e.facet(Th).overrideChunk&&Dg(e,n);t.add(n.fromB,n.fromB,xg(e,n,!!r))}return t.finish()}var Tg=bo.define({create:e=>wg(e),update(e,t){return t.state.field(Oh,!1)==t.startState.field(Oh,!1)?e:wg(t.state)},provide:e=>ko.decorations.from(e)}),Eg=new WeakMap;function Dg(e,t){let n=Eg.get(t);if(n!==void 0)return n;n=null;let r=e.field(vg),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(Co.widget({widget:new Og(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(Wh.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Eg.set(t,n),n}var Og=class extends go{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}},kg=new class extends Ao{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Ag=Co.line({class:`cm-inlineChangedLine`});function jg(e,t,n,r){let i=Dg(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,kg),n.add(o.from,o.from,Ag);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 Mg=W({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}}),Ng=gt({settings:{background:`var(--background)`,gutterBackground:`var(--muted)`}});function Pg(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}=yr(),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 g,v;t[3]!==a||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==u?(g=()=>{if(!c.current)return;let e=u===`dark`?Mg:Ng,t=[ko.editable.of(!1),yo.readOnly.of(!0)],o=[Ro,_(),...t,e,ko.lineWrapping];if(l.current&&=(l.current.destroy(),null),a){let t=new ko({doc:r,extensions:[Ro,_(),ko.editable.of(!1),e,ko.lineWrapping,gg({original:n,highlightChanges:!0,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),ko.updateListener.of(e=>{let t=kh(e.state);m(t?t.chunks.length:0)})],parent:c.current});l.current=t;let i=kh(t.state);m(i?i.chunks.length:0)}else i===`split`?l.current=new fg({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 ko({doc:r,extensions:[...o,gg({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]=g,t[9]=v):(g=t[8],v=t[9]),(0,Q.useEffect)(g,v);let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=function(){let e=l.current;!e||!(e instanceof ko)||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 Fg(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)(Ua,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Ig(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)(Ka,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function Lg(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=Y(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(za,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Rg(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)(Lg,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=Y(`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`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Z.jsx)(Ha,{"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)(Fa,{}),(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)(Ig,{children:[l,(0,Z.jsxs)(Ya,{"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 zg(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=Y(`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 Bg(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=Y(`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)(Ba,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}async function Vg(){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 Hg(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 Ug(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 Wg=`w-[98vw] !max-w-[98vw] h-[96vh] flex flex-col gap-0 sm:!max-w-[98vw]`;function Gg(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 Hg(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)(qa,{className:`shrink-0`,children:(0,Z.jsxs)(Ra,{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)(Va,{className:Wg,children:[r,a]}),t[8]=r,t[9]=o);let s;return t[10]!==e||t[11]!==o?(s=(0,Z.jsx)(Ja,{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)(Ra,{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)(qa,{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)(Pg,{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)(Va,{className:`${Wg} 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)(Ja,{open:!0,onOpenChange:l,children:m}),t[28]=l,t[29]=m,t[30]=h):h=t[30],h}function Kg(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(){Vg().then(e=>{let{conflicts:t,error:n}=e;c(n??null),o(t),d(e=>{let n=new Set(t.map(qg));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=()=>_r(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&&(Xa.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 Ug(e,t,n);m(t=>{let n=new Set(t);return n.delete(e),n}),r?d(t=>new Set([...t,e])):Xa.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?Xa.info(`Merge aborted — sync paused`):Xa.error(`Failed to abort merge`)}catch{Xa.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)(Bg,{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)(zg,{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)(Rg,{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)(Fg,{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)(Gg,{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 qg(e){return e.file}var Jg=5;async function Yg(e){let t=await fetch(`/api/backlinks?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=ir.safeParse(n);throw e.success?Error(e.data.title):new Ce(`Failed to parse backlinks error response (HTTP ${t.status})`,{status:t.status})}let r=fn.safeParse(n);if(!r.success)throw new Ce(`Backlinks response did not match expected shape.`,{status:t.status});return r.data.backlinks}async function Xg(e){let t=await fetch(`/api/forward-links?docName=${encodeURIComponent(e)}`),n=await t.json().catch(()=>null);if(!t.ok){let e=ir.safeParse(n);throw e.success?Error(e.data.title):new Ce(`Failed to parse forward-links error response (HTTP ${t.status})`,{status:t.status})}let r=Zn.safeParse(n);if(!r.success)throw new Ce(`Forward-links response did not match expected shape.`,{status:t.status});return r.data.forwardLinks}function Zg(e){let t=e.split(`/`);return t.length<=2?e:`…/${t.slice(-2).join(`/`)}`}function Qg(e){window.location.hash=er(e)}function $g(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)(Ie,{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)(Gt,{children:n})]}),t[1]=n,t[2]=o);let s;t[3]!==r||t[4]!==i?(s=!i&&(0,Z.jsx)(Wt,{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)(R,{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 e_(e){let t=(0,$.c)(7),{total:n,expanded:r,onToggle:i}=e;if(n<=Jg)return null;let a=n-Jg,o;t[0]===r?o=t[1]:(o=r?(0,Z.jsx)(Ie,{className:`size-3`}):(0,Z.jsx)(l,{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 t_(e){let t=(0,$.c)(38),{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,hoverAction:h}=e,g=o!==void 0&&o!==a,_=r??`text-muted-foreground`,v;t[0]===_?v=t[1]:(v=Y(`mt-0.5 shrink-0`,_),t[0]=_,t[1]=v);let y;t[2]!==n||t[3]!==v?(y=(0,Z.jsx)(`span`,{className:v,children:n}),t[2]=n,t[3]=v,t[4]=y):y=t[4];let b=y,x;t[5]!==u||t[6]!==p||t[7]!==f||t[8]!==d||t[9]!==m||t[10]!==a||t[11]!==l?(x=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:Y(`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]=x):x=t[12];let S=x,C;t[13]===b?C=t[14]:(C=(0,Z.jsx)(`div`,{className:`mt-px flex items-center`,children:b}),t[13]=b,t[14]=C);let w;t[15]!==s||t[16]!==o||t[17]!==g?(w=g?(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]=g,t[18]=w):w=t[18];let T;t[19]===c?T=t[20]:(T=c?(0,Z.jsx)(`p`,{className:`line-clamp-2 text-muted-foreground`,children:c}):null,t[19]=c,t[20]=T);let E;t[21]!==S||t[22]!==w||t[23]!==T?(E=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5 text-1sm`,children:[S,w,T]}),t[21]=S,t[22]=w,t[23]=T,t[24]=E):E=t[24];let D;t[25]===h?D=t[26]:(D=h?(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":h.tooltip,disabled:h.disabled,className:`relative z-10 shrink-0 cursor-pointer rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground group-hover:opacity-100`,onClick:h.onClick,children:h.icon})}),(0,Z.jsx)(co,{side:`top`,children:h.tooltip})]}):null,t[25]=h,t[26]=D);let O;t[27]!==C||t[28]!==E||t[29]!==D?(O=(0,Z.jsxs)(`div`,{className:`group relative flex items-start gap-2.5 rounded-md px-3 py-2.5 transition-colors hover:bg-muted/80`,children:[C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=O):O=t[30];let k=O;if(i){let e;t[31]===k?e=t[32]:(e=(0,Z.jsx)(so,{asChild:!0,children:k}),t[31]=k,t[32]=e);let n;t[33]===i?n=t[34]:(n=(0,Z.jsx)(co,{side:`top`,children:i}),t[33]=i,t[34]=n);let r;return t[35]!==e||t[36]!==n?(r=(0,Z.jsxs)(uo,{children:[e,n]}),t[35]=e,t[36]=n,t[37]=r):r=t[37],r}return k}function n_(e){let t=(0,$.c)(33),{docName:n}=e,{folderPaths:r,pages:i,loading:a}=wr(),o,s;t[0]===n?(o=t[1],s=t[2]):(o=[`backlinks`,n],s=()=>Yg(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}=Nt(l),m;t[11]===u?m=t[12]:(m=u===void 0?[]:u,t[11]=u,t[12]=m);let h=m,[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(n);v!==n&&(y(n),_(!1));let b;t[13]!==h||t[14]!==g?(b=g?h:h.slice(0,Jg),t[13]=h,t[14]=g,t[15]=b):b=t[15];let x=b,S;t[16]!==h.length||t[17]!==d?(S=(0,Z.jsx)($g,{title:`Backlinks`,count:h.length,isLoading:d}),t[16]=h.length,t[17]=d,t[18]=S):S=t[18];let C;t[19]!==h.length||t[20]!==f||t[21]!==g||t[22]!==r||t[23]!==d||t[24]!==i||t[25]!==x?(C=f?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(jt,{children:f instanceof Error?f.message:`Failed to load backlinks`})}):h.length===0&&!d?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Rt,{children:`No pages link here yet.`})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-1`,children:x.map((e,t)=>{let n=Na(e.source,{pages:i,folderPaths:r});return(0,Z.jsx)(t_,{icon:(0,Z.jsx)(p,{className:`size-3.5`}),title:e.title,path:Zg(e.source),titleHover:e.source,anchor:e.anchor,snippet:e.snippet,href:er(n.hashDocName,e.anchor)},`${e.source}-${t}`)})}),(0,Z.jsx)(e_,{total:h.length,expanded:g,onToggle:()=>_(r_)})]}),t[19]=h.length,t[20]=f,t[21]=g,t[22]=r,t[23]=d,t[24]=i,t[25]=x,t[26]=C):C=t[26];let w;t[27]!==d||t[28]!==C?(w=(0,Z.jsx)(N,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":d,children:C})}),t[27]=d,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==w||t[31]!==S?(T=(0,Z.jsxs)(A,{defaultOpen:!0,children:[S,w]}),t[30]=w,t[31]=S,t[32]=T):T=t[32],T}function r_(e){return!e}function i_(e){let t=(0,$.c)(42),{docName:n}=e,{addPage:r,folderPaths:i,pages:a,pagesBySlug:o,loading:s}=wr(),c,l;t[0]===n?(c=t[1],l=t[2]):(c=[`forward-links`,n],l=()=>Xg(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 f;t[7]!==c||t[8]!==l||t[9]!==u?(f={queryKey:c,queryFn:l,enabled:u},t[7]=c,t[8]=l,t[9]=u,t[10]=f):f=t[10];let{data:m,isLoading:h,error:g}=Nt(f),_;t[11]===m?_=t[12]:(_=m===void 0?[]:m,t[11]=m,t[12]=_);let v=_,[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(n);C!==n&&(w(n),S(!1),b(null));let T;t[13]!==x||t[14]!==v?(T=x?v:v.slice(0,Jg),t[13]=x,t[14]=v,t[15]=T):T=t[15];let E=T,D;t[16]!==r||t[17]!==y?(D=async function(e,t){if(!y){b(t);try{await U(e,{addPage:r,onCreated:Qg}),b(null)}catch(e){let t=e;Xa.error(t instanceof Error?t.message:`Failed to create page`),b(null)}}},t[16]=r,t[17]=y,t[18]=D):D=t[18];let O=D,k;t[19]!==y||t[20]!==i||t[21]!==O||t[22]!==a||t[23]!==o||t[24]!==s?(k=function(e){if(e.kind===`external`){let t=e.title===e.url;return(0,Z.jsx)(t_,{icon:(0,Z.jsx)(Ma,{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=d(e.docName,{pages:a,folderPaths:i,pagesBySlug:o}),n=!s&&t.kind===`create`,r=!s&&t.kind===`navigate`&&t.displayState===`folder`,c=Zg(e.docName),l=e.title===e.docName?c:e.title,u=`doc:${e.docName}:${e.anchor??``}`,f=er(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)(t_,{icon:(0,Z.jsx)(Dn,{className:`size-3.5`}),iconColorClass:`text-amber-600 dark:text-amber-400`,rowTooltip:y===u?`Creating page`:`Missing page — click to create`,ariaLabel:y===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:y!==null,onClick:()=>void O(n,u)},u)}if(r&&t.kind===`navigate`){let n=xt(t);return(0,Z.jsx)(t_,{icon:(0,Z.jsx)(ks,{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:f,hoverAction:{icon:(0,Z.jsx)(Fi,{className:`size-3.5`}),tooltip:y===u?`Creating index note`:`Create index note`,disabled:y!==null||n===null,onClick:()=>{n&&O(n,u)}}},u)}return(0,Z.jsx)(t_,{icon:(0,Z.jsx)(p,{className:`size-3.5`}),title:l,path:c,titleHover:e.docName,anchor:e.anchor,snippet:e.snippet,href:f},u)},t[19]=y,t[20]=i,t[21]=O,t[22]=a,t[23]=o,t[24]=s,t[25]=k):k=t[25];let j=k,M;t[26]!==h||t[27]!==v.length?(M=(0,Z.jsx)($g,{title:`Outgoing`,count:v.length,isLoading:h}),t[26]=h,t[27]=v.length,t[28]=M):M=t[28];let P;t[29]!==g||t[30]!==x||t[31]!==h||t[32]!==v.length||t[33]!==j||t[34]!==E?(P=g?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(jt,{children:g instanceof Error?g.message:`Failed to load outgoing links`})}):v.length===0&&!h?(0,Z.jsx)(`div`,{className:`px-3`,children:(0,Z.jsx)(Rt,{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:E.map(j)}),(0,Z.jsx)(e_,{total:v.length,expanded:x,onToggle:()=>S(a_)})]}),t[29]=g,t[30]=x,t[31]=h,t[32]=v.length,t[33]=j,t[34]=E,t[35]=P):P=t[35];let F;t[36]!==h||t[37]!==P?(F=(0,Z.jsx)(N,{children:(0,Z.jsx)(`div`,{className:`px-2 pb-3`,"aria-busy":h,children:P})}),t[36]=h,t[37]=P,t[38]=F):F=t[38];let I;return t[39]!==M||t[40]!==F?(I=(0,Z.jsxs)(A,{defaultOpen:!0,children:[M,F]}),t[39]=M,t[40]=F,t[41]=I):I=t[41],I}function a_(e){return!e}function o_(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)(i_,{docName:n}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(_a,{}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,Z.jsx)(n_,{docName:n}),t[3]=n,t[4]=s);let c;t[5]!==a||t[6]!==s?(c=(0,Z.jsxs)(Ht,{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)(Kt,{className:i,children:c}),t[8]=i,t[9]=c,t[10]=l):l=t[10],l}var s_=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 s_{};function c_(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 l_(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 u_(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 d_(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 f_(e,t){return u_(e,t,``)}function p_(e,t){return d_(e,t,``)}function m_(e,t){return t.slice(0,h_(e,t))}function h_(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 g_(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 __(e,t){if(t)return y_(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function v_(e,t){if(t)return y_(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function y_(e,t){if(!t)return[v_(e),__(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=g_(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var b_=`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}`,x_=RegExp(`[${b_}]+|\\s+|[^${b_}]`,`ug`);new class extends s_{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=g_(e,r)}else n=e.match(x_)||[];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)&&S_(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&S_(n,i,r,null,t.intlSegmenter),e}};function S_(e,t,n,r,i){if(t&&n){let[a,o]=y_(t.value,i),[s,c]=y_(n.value,i);if(e){let r=c_(a,s);e.value=d_(e.value,s,r),t.value=f_(t.value,r),n.value=f_(n.value,r)}if(r){let e=l_(o,c);r.value=u_(r.value,c,e),t.value=p_(t.value,e),n.value=p_(n.value,e)}}else if(n){if(e){let e=v_(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=v_(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=v_(r.value,i),[a,o]=y_(t.value,i),s=c_(n,a);t.value=f_(t.value,s);let c=l_(f_(n,s),o);t.value=p_(t.value,c),r.value=u_(r.value,n,c),e.value=d_(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=v_(r.value,i),n=m_(__(t.value,i),e);t.value=p_(t.value,n)}else if(e){let n=m_(__(e.value,i),v_(t.value,i));t.value=f_(t.value,n)}}new class extends s_{tokenize(e){let t=RegExp(`(\\r?\\n)|[${b_}]+|[^\\S\\n\\r]+|[^${b_}]`,`ug`);return e.match(t)||[]}};var C_=new class extends s_{constructor(){super(...arguments),this.tokenize=T_}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
16
16
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
17
17
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
18
18
  `)&&(e=e.slice(0,-1)),t.endsWith(`
19
- `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function r_(e,t,n){return n_.diff(e,t,n)}function i_(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
20
- `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function a_(e){return e==`.`||e==`!`||e==`?`}new class extends Bg{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(a_(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends Bg{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends Bg{constructor(){super(...arguments),this.tokenize=i_}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(o_(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function o_(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=o_(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=o_(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends Bg{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var s_={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function c_(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;r_(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(r_(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||f_(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s)if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
21
- `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function l_(e,t){if(t||=s_,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>l_(e,t)).join(`
19
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function w_(e,t,n){return C_.diff(e,t,n)}function T_(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
20
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function E_(e){return e==`.`||e==`!`||e==`?`}new class extends s_{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(E_(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends s_{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends s_{constructor(){super(...arguments),this.tokenize=T_}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(D_(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function D_(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=D_(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=D_(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends s_{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};var O_={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function k_(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;w_(n,r,Object.assign(Object.assign({},s),{callback:t=>{e(l(t))}}))}else return l(w_(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||N_(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s)if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
21
+ `)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function A_(e,t){if(t||=O_,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders)throw Error(`Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)`);return e.map(e=>A_(e,t)).join(`
22
22
  `)}let n=[];t.includeIndex&&e.oldFileName==e.newFileName&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`),t.includeFileHeaders&&(n.push(`--- `+e.oldFileName+(e.oldHeader===void 0?``:` `+e.oldHeader)),n.push(`+++ `+e.newFileName+(e.newHeader===void 0?``:` `+e.newHeader)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t];r.oldLines===0&&--r.oldStart,r.newLines===0&&--r.newStart,n.push(`@@ -`+r.oldStart+`,`+r.oldLines+` +`+r.newStart+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
23
23
  `)+`
24
- `}function u_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;c_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?l_(e,o.headerOptions):void 0)}}))}else{let s=c_(e,t,n,r,i,a,o);return s?l_(s,o?.headerOptions):void 0}}function d_(e,t,n,r,i,a){return u_(e,e,t,n,r,i,a)}function f_(e){let t=e.endsWith(`
24
+ `}function j_(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;k_(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?A_(e,o.headerOptions):void 0)}}))}else{let s=k_(e,t,n,r,i,a,o);return s?A_(s,o?.headerOptions):void 0}}function M_(e,t,n,r,i,a){return j_(e,e,t,n,r,i,a)}function N_(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 p_(e,t){return`${e}\u0000${t}`}function m_(e,t,n){let r=Sn(e).body,i=Sn(t).body;return r===i?``:d_(n,r,i,``,``,{context:3})}function h_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=We(),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=p_(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=m_(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 g_=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityPanelDiffView-EaCFURAu.js`),__vite__mapDeps([17,1,7,18]),import.meta.url)).ActivityPanelDiffView}));function __(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 v_(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function y_(e){return e.slice(0,7)}function b_(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 x_(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)(Zr,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ri,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Yr,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ei,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ci,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(oi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ii,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function S_(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)(As,{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=en(i),t[1]=i,t[2]=a);let o=a,s=r?En[o]??$t[o]:$t[o],c;t[3]!==s||t[4]!==i?(c=s??Sr(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)(x_,{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)(Ms,{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)(es,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(yc,{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)(ii,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(es,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(yc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function C_(e){let t=(0,$.c)(20),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:u,onRestoreSuccess:d}=e,[f,p]=(0,Q.useState)(r);if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>p(w_),t[0]=m):m=t[0];let h;t[1]===f?h=t[2]:(h=f?(0,Z.jsx)(Ie,{className:`size-3`}):(0,Z.jsx)(l,{className:`size-3`}),t[1]=f,t[2]=h);let g=f?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,_;t[3]!==f||t[4]!==h||t[5]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":f,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[3]=f,t[4]=h,t[5]=g,t[6]=_):_=t[6];let v;t[7]!==o||t[8]!==a||t[9]!==s||t[10]!==n||t[11]!==f||t[12]!==c||t[13]!==i||t[14]!==d||t[15]!==u?(v=f&&n.map(e=>(0,Z.jsx)(R_,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:u,onRestoreSuccess:d},e.sha)),t[7]=o,t[8]=a,t[9]=s,t[10]=n,t[11]=f,t[12]=c,t[13]=i,t[14]=d,t[15]=u,t[16]=v):v=t[16];let y;return t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function w_(e){return!e}function T_(e){return e.checkpoint?e.checkpoint.kind:`save`}function E_(e){let t=T_(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${D_(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function D_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function O_(e){return e.type===`checkpoint`?T_(e)===`save`?`version`:`auto-save`:`wip`}var k_={version:`Restore this version`,"auto-save":`Restore this auto-save`,wip:`Restore to this point`},A_={version:`Restore this version?`,"auto-save":`Restore this auto-save?`,wip:`Restore to this point?`};function j_(e){return k_[O_(e)]}function M_(e){return A_[O_(e)]}function N_(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function P_(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 u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(I_),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==a||t[15]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(F_)},children:[r?(0,Z.jsx)(Ie,{className:`size-3`}):(0,Z.jsx)(l,{className:`size-3`}),r?`Hide`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=p):p=t[16];let m;return t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function F_(e){return!e}function I_(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 L_(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=h_(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)(Ze,{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)(Ze,{className:`size-3 animate-spin`}),`Loading diff renderer`]}),children:(0,Z.jsx)(g_,{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 R_(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=__(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=b_(n),t[2]=n,t[3]=m);let h=m,g=n.contributors.flatMap(z_),_;t[4]===n?_=t[5]:(_=N_(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}),Xa.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=ir.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}),Xa.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=T_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Dn,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Ss,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(bs,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(S_,{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:E_(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=j_(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 K;t[40]===x?K=t[41]:(K=x?(0,Z.jsx)(Ze,{className:`size-3 animate-spin`}):(0,Z.jsx)(Qr,{className:`size-3`}),t[40]=x,t[41]=K);let q;t[42]!==x||t[43]!==W||t[44]!==G||t[45]!==K?(q=(0,Z.jsx)(so,{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:K})}),t[42]=x,t[43]=W,t[44]=G,t[45]=K,t[46]=q):q=t[46];let ee;t[47]===n?ee=t[48]:(ee=j_(n),t[47]=n,t[48]=ee);let te;t[49]===ee?te=t[50]:(te=(0,Z.jsx)(co,{side:`top`,children:ee}),t[49]=ee,t[50]=te);let ne;t[51]!==q||t[52]!==te?(ne=(0,Z.jsxs)(uo,{children:[q,te]}),t[51]=q,t[52]=te,t[53]=ne):ne=t[53];let re;t[54]!==V||t[55]!==H||t[56]!==ne?(re=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[V,H,U,ne]}),t[54]=V,t[55]=H,t[56]=ne,t[57]=re):re=t[57];let ie;t[58]===v?ie=t[59]:(ie=v.length>0&&(0,Z.jsx)(P_,{summaries:v}),t[58]=v,t[59]=ie);let ae=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}),oe;t[60]!==re||t[61]!==ie||t[62]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[re,ie,ae]}),t[60]=re,t[61]=ie,t[62]=ae,t[63]=oe):oe=t[63];let se;t[64]!==c||t[65]!==O||t[66]!==F||t[67]!==R||t[68]!==z||t[69]!==B||t[70]!==oe?(se=(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,oe]}),t[64]=c,t[65]=O,t[66]=F,t[67]=R,t[68]=z,t[69]=B,t[70]=oe,t[71]=se):se=t[71];let ce;t[72]!==o||t[73]!==a||t[74]!==w||t[75]!==s||t[76]!==n.sha||t[77]!==c?(ce=c&&(0,Z.jsx)(L_,{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]=ce):ce=t[78];let le;t[79]!==se||t[80]!==ce?(le=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[se,ce]}),t[79]=se,t[80]=ce,t[81]=le):le=t[81];let ue;t[82]!==A||t[83]!==b?(ue=e=>{e?b(!0):A()},t[82]=A,t[83]=b,t[84]=ue):ue=t[84];let de;t[85]===n?de=t[86]:(de=M_(n),t[85]=n,t[86]=de);let fe;t[87]===de?fe=t[88]:(fe=(0,Z.jsx)(Ra,{children:de}),t[87]=de,t[88]=fe);let pe;t[89]===n.timestamp?pe=t[90]:(pe=v_(n.timestamp),t[89]=n.timestamp,t[90]=pe);let me;t[91]===n.sha?me=t[92]:(me=y_(n.sha),t[91]=n.sha,t[92]=me);let he;t[93]!==p||t[94]!==pe||t[95]!==me?(he=(0,Z.jsxs)(`span`,{className:`font-medium text-foreground`,children:[p,` (`,pe,`, `,me,`)`]}),t[93]=p,t[94]=pe,t[95]=me,t[96]=he):he=t[96];let ge;t[97]===h?ge=t[98]:(ge=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[97]=h,t[98]=ge);let _e;t[99]!==he||t[100]!==ge?(_e=(0,Z.jsxs)(Ia,{children:[`This will replace the current document content with the version from`,` `,he,` `,`by `,ge,`. Your current content is already saved in the timeline — you can restore it anytime.`]}),t[99]=he,t[100]=ge,t[101]=_e):_e=t[101];let ve;t[102]!==fe||t[103]!==_e?(ve=(0,Z.jsxs)(qa,{children:[fe,_e]}),t[102]=fe,t[103]=_e,t[104]=ve):ve=t[104];let ye;t[105]===A?ye=t[106]:(ye=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:A,children:`Cancel`}),t[105]=A,t[106]=ye);let be;t[107]===M?be=t[108]:(be=()=>M(),t[107]=M,t[108]=be);let xe;t[109]===x?xe=t[110]:(xe=x?(0,Z.jsx)(Ze,{className:`mr-2 size-4 animate-spin`}):null,t[109]=x,t[110]=xe);let Se;t[111]!==x||t[112]!==be||t[113]!==xe?(Se=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:x,onClick:be,children:[xe,`Restore`]}),t[111]=x,t[112]=be,t[113]=xe,t[114]=Se):Se=t[114];let Ce;t[115]!==ye||t[116]!==Se?(Ce=(0,Z.jsxs)(Ga,{children:[ye,Se]}),t[115]=ye,t[116]=Se,t[117]=Ce):Ce=t[117];let we;t[118]!==ve||t[119]!==Ce?(we=(0,Z.jsxs)(Va,{children:[ve,Ce]}),t[118]=ve,t[119]=Ce,t[120]=we):we=t[120];let J;t[121]!==y||t[122]!==ue||t[123]!==we?(J=(0,Z.jsx)(Ja,{open:y,onOpenChange:ue,children:we}),t[121]=y,t[122]=ue,t[123]=we,t[124]=J):J=t[124];let Te;return t[125]!==le||t[126]!==J?(Te=(0,Z.jsxs)(Z.Fragment,{children:[le,J]}),t[125]=le,t[126]=J,t[127]=Te):Te=t[127],Te}function z_(e){return e.docs}function B_(e){let t=(0,$.c)(63),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{resolvedTheme:a}=yr(),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)(W_),[g,_]=(0,Q.useState)(U_),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(H_),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)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsxs)(ao,{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)(ro,{value:`unified`,"aria-label":`Unified diff`,className:`size-6 px-0`,children:(0,Z.jsx)(tc,{className:`size-3.5`})}),(0,Z.jsx)(ro,{value:`split`,"aria-label":`Split diff`,className:`size-6 px-0`,children:(0,Z.jsx)(hs,{className:`size-3.5`})})]})}),(0,Z.jsx)(co,{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`,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(V_)}),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)(R_,{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)(R_,{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)(C_,{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 V_(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Gi,{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)(Gi,{className:`h-3 w-28`}),(0,Z.jsx)(Gi,{className:`h-3 w-40`})]})]},e)}function H_(e){return e.type===`checkpoint`}function U_(){return new Set}function W_(){return new $r(32)}var G_=[{id:`outline`,label:`Outline`,icon:Hs},{id:`links`,label:`Links`,icon:Rs},{id:`graph`,label:`Graph`,icon:Gs},{id:`timeline`,label:`Timeline`,icon:ds}];function K_(){return r(()=>import(`./GraphPanel-DwQX9Gl9.js`),__vite__mapDeps([19,1,20,3,6,7,15,21,22,23,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var q_=(0,Q.lazy)(async()=>({default:(await K_()).GraphPanel})),J_=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityModeContent-BMLTkwc9.js`),__vite__mapDeps([34,1,2,35,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,23,42]),import.meta.url)).ActivityModeContent}));function Y_(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 border-b border-border/60 p-2`,children:(0,Z.jsx)(ao,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:G_.map(X_)})}):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)(Io,{docName:n,isSourceMode:r}),i===`links`&&(0,Z.jsx)(zg,{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)(q_,{activeDocName:n})}),i===`timeline`&&(0,Z.jsx)(B_,{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`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Loading agent activity`}),children:(0,Z.jsx)(J_,{})})}),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 X_(e){let{id:t,label:n,icon:r}=e;return(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(ro,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Z.jsx)(so,{children:(0,Z.jsx)(r,{})})}),(0,Z.jsx)(co,{side:`bottom`,children:n})]},t)}function Z_(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function Q_(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function $_(e){return e/100*window.innerHeight}function ev(e){return e/100*window.innerWidth}function tv(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 nv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=tv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=Q_(t,i);break;case`em`:r=Z_(t,i);break;case`vh`:r=$_(i);break;case`vw`:r=ev(i);break}return r}function rv(e){return parseFloat(e.toFixed(3))}function iv({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 av(e){let{panels:t}=e,n=iv({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=rv(nv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=rv(nv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=rv(nv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=rv(nv({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 ov(e,t=`Assertion error`){if(!e)throw Error(t)}function sv(e,t){return Array.from(t).sort(e===`horizontal`?cv:lv)}function cv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function lv(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function uv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function dv(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 fv({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}=dv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return ov(i,`No rect found`),i}var pv;function mv(){return pv===void 0&&(pv=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),pv}function hv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=sv(n,Array.from(t.children).filter(uv).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,fv({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=mv()?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:iv({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 gv=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)}}},_v=new Map,vv=new gv;function yv(e){_v=new Map(_v),_v.delete(e)}function bv(e,t){for(let[t]of _v)if(t.id===e)return t}function xv(e,t){for(let[t,n]of _v)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Sv(){return _v}function Cv(e,t){return vv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function wv(e,t){let n=_v.get(e);_v=new Map(_v),_v.set(e,t),vv.emit(`groupChange`,{group:e,prev:n,next:t})}function Tv(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=dv(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 Ev(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Dv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Nv(e),b:Nv(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();ov(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:Mv(jv(n.a)),b:Mv(jv(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 Ov=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function kv(e){let t=getComputedStyle(Pv(e)??e).display;return t===`flex`||t===`inline-flex`}function Av(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||kv(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`||Ov.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function jv(e){let t=e.length;for(;t--;){let n=e[t];if(ov(n,`Missing node`),Av(n))return n}return null}function Mv(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Nv(e){let t=[];for(;e;)t.push(e),e=Pv(e);return t}function Pv(e){let{parentNode:t}=e;return Ev(t)?t.host:t}function Fv(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Iv({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!uv(n)||n.contains(e)||e.contains(n))return!0;if(Dv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Fv(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Lv(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=hv(r),a=Tv(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Iv({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Rv(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 zv(e,t,n=0){return Math.abs(rv(e)-rv(t))<=n}function Bv(e,t){return zv(e,t)?0:e>t?1:-1}function Vv({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(Bv(r,c)<0)if(a){let e=(i+c)/2;r=Bv(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=rv(r),r}function Hv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(zv(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;ov(u!=null,`Invalid first pivot index`),ov(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];ov(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(ov(n!=null,`Previous layout not found for panel index ${t}`),zv(n,i)){let t=o-n;Bv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];ov(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(ov(n!=null,`Previous layout not found for panel index ${t}`),zv(n,o)){let t=n-i;Bv(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];ov(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&Bv(i,c)<0)if(e>0){let t=c-o,n=t/2;Bv(i+e,c)<0&&(e=Bv(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;Bv(i-e,c)<0&&(e=Bv(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];ov(e!=null,`Previous layout not found for panel index ${r}`);let a=Vv({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];ov(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=Vv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!zv(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(Rv(c,l))return i;{let t=e<0?d:u,r=s[t];ov(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=Vv({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!zv(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];ov(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=Vv({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(zv(i,s)||(t-=s-i,l[r]=s),zv(t,0))break;e>0?r--:r++}}}if(!zv(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 Uv(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||Bv(e[n],t[n])!==0)return!1;return!0}function Wv({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(!zv(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];ov(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];ov(i!=null,`No layout data found for index ${e}`);let o=r[e];ov(o!=null,`No layout data found for index ${e}`);let s=Vv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!zv(a,0))for(let e=0;e<t.length;e++){let n=r[e];ov(n!=null,`No layout data found for index ${e}`);let i=n+a,o=Vv({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,zv(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Gv({groupId:e,panelId:t}){let n=()=>{let t=Sv();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=Wv({layout:Hv({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});Uv(l,p)||wv(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&&zv(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=iv({group:t});o(rv(nv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Kv(e){e.defaultPrevented||Lv(e,Sv()).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=Gv({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function qv(e){let t=Sv();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 Jv({groupId:e}){let t=()=>{let t=Sv();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=Wv({layout:e,panelConstraints:r});return n?o:(Uv(o,c)||wv(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function Yv(e,t){let n=qv(e),r=xv(n.id,!0),i=n.separators.find(t=>t.element===e);ov(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);ov(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=Jv({groupId:n.id}).getLayout(),c=Wv({layout:Hv({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});Uv(s,c)||wv(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Xv(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=qv(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&Yv(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&Yv(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&Yv(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&Yv(t,-5);break;case`End`:e.preventDefault(),Yv(t,100);break;case`Enter`:{e.preventDefault();let n=qv(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=xv(n.id,!0),o=n.separators.find(e=>e.element===t);ov(o,`Matching separator not found`);let s=a.get(o);ov(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(ov(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];Yv(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=qv(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);ov(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(),Yv(t,-100);break}}var Zv={cursorFlags:0,state:`inactive`},Qv=new gv;function $v(){return Zv}function ey(e){return Qv.addListener(`change`,e)}function ty(e){let t=Zv,n={...Zv};n.cursorFlags=e,Zv=n,Qv.emit(`change`,{prev:t,next:n})}function ny(e){let t=Zv;Zv=e,Qv.emit(`change`,{prev:t,next:e})}function ry(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Sv(),n=Lv(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)}),ny({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var iy=e=>e,ay=()=>{},oy=1,sy=2,cy=4,ly=8,uy=3,dy=12,fy;function py(){return fy===void 0&&(fy=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(fy=!0)),fy}function my({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&&py()){let t=(e&oy)!==0,n=(e&sy)!==0,r=(e&cy)!==0,i=(e&ly)!==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 py()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var hy=new WeakMap;function gy(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=hy.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=$v();switch(r.state){case`active`:case`hover`:{let e=my({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}hy.set(e,{prevStyle:t,styleSheet:n})}function _y({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=Hv({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(Uv(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?oy:sy;break;case`vertical`:s|=d<0?cy:ly;break}}else wv(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&uy:c|=s&uy,t.movementY===0?c|=o&dy:c|=s&dy,ty(c),gy(e)}function vy(e){let t=Sv(),n=$v();switch(n.state){case`active`:_y({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function yy(e){if(e.defaultPrevented)return;let t=$v(),n=Sv();switch(t.state){case`active`:if(e.buttons===0){ny({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=xv(e.group.id,!0);wv(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)}_y({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Lv(e,n);r.length===0?t.state!==`inactive`&&ny({cursorFlags:0,state:`inactive`}):ny({cursorFlags:0,hitRegions:r,state:`hover`}),gy(e.currentTarget);break}}}function by(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch($v().state){case`hover`:ny({cursorFlags:0,state:`inactive`})}}function xy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=$v();switch(t.state){case`active`:ny({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(gy(e.currentTarget),t.hitRegions.forEach(e=>{let t=xv(e.group.id,!0);wv(e.group,t)}),e.preventDefault())}}function Sy(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=rv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=rv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Cy(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=iv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:rv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function wy(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 Ty({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=rv(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]=rv((r[e]??0)/a*l);else{let e=rv(l/c.length);for(let t of c)u[t]=e}return u}function Ey(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 Dy=new Map;function Oy(e){let t=!0;ov(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=iv({group:e});if(t===0)return;let n=xv(e.id);if(!n)return;let r=av(e),i=n.defaultLayoutDeferred?Sy(r):n.layout,a=Wv({layout:Ty({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&Uv(n.layout,a)&&wy(n.derivedPanelConstraints,r)&&n.groupSize===t)return;wv(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Cy(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{ov(!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=iv({group:e}),s=av(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(Ey(e.panels,l)||(l=void 0));let u=Wv({layout:e.mutableState.layouts[c]??l??Sy(s),panelConstraints:s}),d=e.element.ownerDocument;Dy.set(d,(Dy.get(d)??0)+1);let f=new Map;return hv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),wv(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{ov(!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`,Xv)}),Dy.get(d)===1&&(d.addEventListener(`dblclick`,Kv,!0),d.addEventListener(`pointerdown`,ry,!0),d.addEventListener(`pointerleave`,vy),d.addEventListener(`pointermove`,yy),d.addEventListener(`pointerout`,by),d.addEventListener(`pointerup`,xy,!0)),function(){t=!1,Dy.set(d,Math.max(0,(Dy.get(d)??0)-1)),yv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,Xv)}),Dy.get(d)||(d.removeEventListener(`dblclick`,Kv,!0),d.removeEventListener(`pointerdown`,ry,!0),d.removeEventListener(`pointerleave`,vy),d.removeEventListener(`pointermove`,yy),d.removeEventListener(`pointerout`,by),d.removeEventListener(`pointerup`,xy,!0)),a.disconnect()}}function ky(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Ay(e){let t=(0,Q.useId)();return`${e??t}`}var jy=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function My(e){let t=(0,Q.useRef)(e);return jy(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function Ny(...e){return My(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Py(e){let t=(0,Q.useRef)({...e});return jy(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Fy=(0,Q.createContext)(null);function Iy(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:iy});(0,Q.useImperativeHandle)(t,()=>n.current,[]),jy(()=>{Object.assign(n.current,Jv({groupId:e}))})}function Ly({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=My(e=>{Uv(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=My(e=>{Uv(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Ay(s),v=(0,Q.useRef)(null),[y,b]=ky(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=Ny(v,a);Iy(_,o);let C=My((e,t)=>{let r=$v(),i=bv(e),a=xv(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=Py({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=sv(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=sv(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=bv(_),i=xv(_);r&&i&&wv(r,{...i,derivedPanelConstraints:av(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 jy(()=>{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=Oy(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=xv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Cv(_,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=zv(t.collapsedSize,i[t.panelId]),a=zv(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=$v().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)(Fy.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})})}Ly.displayName=`Group`;function Ry(){let e=(0,Q.useContext)(Fy);return ov(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function zy(e,t){let{id:n}=Ry(),r=(0,Q.useRef)({collapse:ay,expand:ay,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ay});(0,Q.useImperativeHandle)(t,()=>r.current,[]),jy(()=>{Object.assign(r.current,Gv({groupId:n,panelId:e}))})}function By({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=Ay(c),_=Py({disabled:a}),v=(0,Q.useRef)(null),y=Ny(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Ry(),T=d!==null,E=My((e,t,n)=>{d?.(e,c,n)});jy(()=>{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]),zy(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Cv(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:{...Vy,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})})}By.displayName=`Panel`;var Vy={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Hy(){return(0,Q.useRef)(null)}function Uy({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=Wv({layout:Hv({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=Wv({layout:Hv({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Wy({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Ay(a),l=Py({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=Ny(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=Ry(),x=v===`horizontal`?`vertical`:`horizontal`;jy(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=ey(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Cv(_,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(Uy({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})}Wy.displayName=`Separator`;function Gy(e){return`/api/asset?path=${encodeURIComponent(e)}`}function Ky(e){let t=(0,$.c)(14),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=Gy(n),t[0]=n,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=n.split(`/`).pop()??n,t[2]=n,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=s.includes(`.`)?s.split(`.`).pop()?.toUpperCase()??`FILE`:`FILE`,t[4]=s,t[5]=c);let l=c,u;t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==a?(u=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:r===`image`?(0,Z.jsx)(`img`,{src:a,alt:s,className:`max-h-full max-w-full object-contain`,draggable:!1}):r===`video`?(0,Z.jsx)(`video`,{src:a,controls:!0,className:`max-h-full max-w-full`}):(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:l}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:s}),(0,Z.jsx)(`a`,{href:a,className:`rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:`Open file`})]})}),t[6]=l,t[7]=s,t[8]=r,t[9]=a,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":s,children:u}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function qy(){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)(Gi,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Gi,{className:`h-4 w-full`}),(0,Z.jsx)(Gi,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}var Jy={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function Yy(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}=yr(),s=Jy[r],c=s?(o===`dark`?En[s]:void 0)??$t[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=Y(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)(Zr,{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)(Xr,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(ri,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function Xy(e){let{installState:t}=e;return t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null}function Zy(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 Qy(e){return Mn(e)}function $y(e){return`Opened ${e} in your browser.`}var eb=`claude.ai`;async function tb(e,t=_p){(await t(Mn(e))).ok?Xa.success($y(eb)):Xa.error(`Couldn't open ${eb} in your browser.`)}function nb(e){return e.onInstallSkillRequest!==void 0&&e.target.id===`claude-cowork`}function rb(e){let t=(0,$.c)(80),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o,onInstallSkillRequest:s}=e,c=e.openExternal??_p,l=e.onWebFallbackSuccess??ab,u=e.onWebFallbackError??ib,d;t[0]!==r||t[1]!==i||t[2]!==n?(d=Zy({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=d):d=t[3];let f=d,p;t[4]!==r||t[5]!==i||t[6]!==n?(p=Xy({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=p):p=t[7];let m=p,h;t[8]!==c||t[9]!==f.tooltip?(h=()=>{f.tooltip&&c(f.tooltip.installAction.url)},t[8]=c,t[9]=f.tooltip,t[10]=h):h=t[10];let g=h,_;t[11]!==u||t[12]!==l||t[13]!==c||t[14]!==a||t[15]!==n?(_=()=>{(async()=>{let e=await c(Qy(a));e.ok?l(n):u(n,e.detail??e.reason)})()},t[11]=u,t[12]=l,t[13]=c,t[14]=a,t[15]=n,t[16]=_):_=t[16];let v=_;if(f.enabled){let e;t[17]!==s||t[18]!==n?(e=nb({target:n,onInstallSkillRequest:s}),t[17]=s,t[18]=n,t[19]=e):e=t[19];let r=e,i=r&&s?s:o,a=`open-in-agent-item-${n.id}`,c=r?`Install Open Knowledge skill in ${n.displayName}`:`Open in ${n.displayName}`,l;t[20]===n.id?l=t[21]:(l=(0,Z.jsx)(Yy,{id:n.id,"aria-hidden":`true`}),t[20]=n.id,t[21]=l);let u=r?`flex-1 whitespace-nowrap`:void 0,d;t[22]!==u||t[23]!==n.displayName?(d=(0,Z.jsx)(`span`,{className:u,children:n.displayName}),t[22]=u,t[23]=n.displayName,t[24]=d):d=t[24];let f;t[25]===r?f=t[26]:(f=r?(0,Z.jsx)(Ne,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):null,t[25]=r,t[26]=f);let p;return t[27]!==d||t[28]!==f||t[29]!==i||t[30]!==a||t[31]!==c||t[32]!==l?(p=(0,Z.jsxs)(di,{onSelect:i,"data-testid":a,"aria-label":c,children:[l,d,f]}),t[27]=d,t[28]=f,t[29]=i,t[30]=a,t[31]=c,t[32]=l,t[33]=p):p=t[33],p}if(!f.tooltip){let e=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[34]===n.id?i=t[35]:(i=(0,Z.jsx)(Yy,{id:n.id,"aria-hidden":`true`}),t[34]=n.id,t[35]=i);let a;t[36]===n.displayName?a=t[37]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[36]=n.displayName,t[37]=a);let o;t[38]===m?o=t[39]:(o=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[38]=m,t[39]=o);let s;return t[40]!==e||t[41]!==r||t[42]!==i||t[43]!==a||t[44]!==o?(s=(0,Z.jsxs)(di,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[40]=e,t[41]=r,t[42]=i,t[43]=a,t[44]=o,t[45]=s):s=t[45],s}let y=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,b=`open-in-agent-item-${n.id}`,x;t[46]===n.id?x=t[47]:(x=(0,Z.jsx)(Yy,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[46]=n.id,t[47]=x);let S;t[48]===n.displayName?S=t[49]:(S=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[48]=n.displayName,t[49]=S);let C;t[50]===m?C=t[51]:(C=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[50]=m,t[51]=C);let w;t[52]!==y||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==C?(w=(0,Z.jsxs)(ha,{"data-testid":b,"data-row-disabled":``,"aria-label":y,children:[x,S,C]}),t[52]=y,t[53]=b,t[54]=x,t[55]=S,t[56]=C,t[57]=w):w=t[57];let T=`open-in-agent-submenu-${n.id}`,E=`open-in-agent-message-${n.id}`,D;t[58]!==f.tooltip.message||t[59]!==E?(D=(0,Z.jsx)(Li,{className:`font-normal text-muted-foreground text-xs`,"data-testid":E,children:f.tooltip.message}),t[58]=f.tooltip.message,t[59]=E,t[60]=D):D=t[60];let O;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Ri,{}),t[61]=O):O=t[61];let k=`open-in-agent-install-${n.id}`,A;t[62]===f.tooltip.installAction.label?A=t[63]:(A=(0,Z.jsx)(`span`,{children:f.tooltip.installAction.label}),t[62]=f.tooltip.installAction.label,t[63]=A);let j;t[64]!==g||t[65]!==k||t[66]!==A?(j=(0,Z.jsx)(di,{onSelect:g,"data-testid":k,children:A}),t[64]=g,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==v||t[69]!==f.tooltip.webFallback||t[70]!==n.id?(M=f.tooltip.webFallback?(0,Z.jsxs)(di,{onSelect:v,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${f.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:f.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[68]=v,t[69]=f.tooltip.webFallback,t[70]=n.id,t[71]=M):M=t[71];let N;t[72]!==D||t[73]!==j||t[74]!==M||t[75]!==T?(N=(0,Z.jsxs)(Ci,{className:`min-w-[260px]`,"data-testid":T,children:[D,O,j,M]}),t[72]=D,t[73]=j,t[74]=M,t[75]=T,t[76]=N):N=t[76];let P;return t[77]!==N||t[78]!==w?(P=(0,Z.jsxs)(yi,{children:[w,N]}),t[77]=N,t[78]=w,t[79]=P):P=t[79],P}function ib(){}function ab(){}function ob(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=Wp(),{dispatch:a}=Np(),o=qf(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Cp({workspace:o});t[7]===n?s=t[8]:(s=Y(`grid w-full max-w-5xl gap-4 sm:grid-cols-2`,n),t[7]=n,t[8]=s),c=zf.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(sb,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{wp(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 sb(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)(Yy,{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)(Ma,{"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 cb=1700,lb=3;function ub(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??lb;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var db={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:250,durationMin:620,durationMax:1400}},fb=[`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 pb(e,t={}){let n=t.rng??Math.random,r=t.colors??fb,i=db[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 mb=1.8,hb=90,gb=16,_b=380,vb=.025,yb=.1,bb=.18,xb=400,Sb=9.2736,Cb=18.1799,wb=14.5244,Tb={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function Eb(e,t){let{halfWidth:n,apexLift:r}=Tb[t];return`M${e-n} ${wb+.3} Q${e} ${wb-r}, ${e+n} ${wb+.3}`}function Db(e){let t=1.5,n=.3;return`M${e-t} ${wb-n} Q${e} ${wb+1.4}, ${e+t} ${wb-n}`}var Ob=15,kb=15;function Ab(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 jb(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=ub(g,t);_(n),y(Fb),S(pb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},cb)},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(Pb),S(pb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},cb))},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/_b)),C=Math.max(-1,Math.min(1,b/_b)),w=S*gb,T=-C*gb,E=0,D=0;if(x>=1){let e=Math.min(x/hb,1)*mb;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)*yb,i+=(w-i)*yb,u.style.transform=`perspective(${xb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*bb,o+=(D-o)*bb;let k=i*vb,A=-r*vb,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=Y(`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=Y(`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=Y(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:Sb,cy:wb,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,ee;t[26]===q?ee=t[27]:(ee=Y(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=ee);let te;t[28]===ee?te=t[29]:(te=(0,Z.jsx)(`ellipse`,{cx:Cb,cy:wb,rx:1.2722,ry:1.9083,className:ee}),t[28]=ee,t[29]=te);let ne;t[30]===I?ne=t[31]:(ne=Eb(Sb,I),t[30]=I,t[31]=ne);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Y(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==ne||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=ne,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=Eb(Cb,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Y(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Db(Sb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Db(Cb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==K||t[47]!==te||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[K,te,ae,le,ue]}),t[46]=K,t[47]=te,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=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]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map(Mb)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(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:Nb,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function Mb(e){return(0,Z.jsx)(`circle`,{cx:Ob+e.originDx,cy:kb+e.originDy,r:e.size,className:`ok-blob-firework`,style:Ab(e)},e.id)}function Nb(e){return e.preventDefault()}function Pb(e){return e+1}function Fb(e){return e+1}function Ib(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(jb,{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 Lb(e){let t=(0,$.c)(5),{className:n}=e,r=Vr()?`⌘`:`Ctrl`,i;t[0]===n?i=t[1]:(i=Y(`select-none font-mono text-2xs uppercase tracking-wider text-muted-foreground`,n),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Rb,{mod:r,letter:`K`}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,Z.jsxs)(`p`,{className:i,children:[a,` Search`]}),t[3]=i,t[4]=o),o}function Rb(e){let t=(0,$.c)(4),{mod:n,letter:r}=e,i=n.length>1?` `:``,a;return t[0]!==r||t[1]!==n||t[2]!==i?(a=(0,Z.jsxs)(`kbd`,{className:`font-mono not-italic`,children:[n,i,r]}),t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3],a}function zb(e){let t=(0,$.c)(8),{className:n}=e,r=qf(),i=typeof window<`u`?window.okDesktop?.config.projectName:void 0,a=null;if(i)a=i;else if(r){let e;t[0]!==r.contentDir||t[1]!==r.pathSeparator?(e=Bb(r.contentDir,r.pathSeparator),t[0]=r.contentDir,t[1]=r.pathSeparator,t[2]=e):e=t[2],a=e}if(!a)return null;let o;t[3]===n?o=t[4]:(o=Y(`select-none font-mono text-2xs uppercase tracking-wider text-muted-foreground`,n),t[3]=n,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(`p`,{className:o,children:a}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Bb(e,t){let n=e.endsWith(t)?e.slice(0,-1):e,r=n.lastIndexOf(t);return r>=0?n.slice(r+1):n}async function Vb(e){let t=await e.json().catch(()=>null),n=ir.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 Hb(){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),e?.includePersonalTemplates&&t.set(`includePersonalTemplates`,`true`);let n=t.toString(),r=await fetch(`/api/seed/plan${n?`?${n}`:``}`);if(!r.ok)return{ok:!1,error:await Vb(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,includePersonalTemplates:t?.includePersonalTemplates})});if(!n.ok)return{ok:!1,error:await Vb(n)};let r=await n.json().catch(()=>null);return r?.result?{ok:!0,result:r.result,personalTemplates:r.personalTemplates}:{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 Ub={"knowledge-base":Is,"software-lifecycle":As,"plain-notes":uc,worldbuilding:_s,"writing-pipeline":Ys,gbrain:Gs};function Wb(e){return Ub[e]??Is}function Gb(e){let t=(0,$.c)(27),{onPackSelect:n,className:r}=e,[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c,l;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return(async()=>{try{let t=await Hb().listPacks();if(e)return;t.ok?a(t.packs):s(t.error.message)}catch(t){let n=t;if(e)return;s(n instanceof Error?n.message:String(n))}})(),()=>{e=!0}},l=[],t[0]=c,t[1]=l):(c=t[0],l=t[1]),(0,Q.useEffect)(c,l),o!==null){let e;t[2]===r?e=t[3]:(e=Y(`rounded-md bg-destructive/10 p-4 text-sm text-destructive`,r),t[2]=r,t[3]=e);let n;return t[4]!==o||t[5]!==e?(n=(0,Z.jsxs)(`div`,{role:`alert`,className:e,children:[`Couldn't load starter packs: `,o]}),t[4]=o,t[5]=e,t[6]=n):n=t[6],n}if(i===null){let e;t[7]===r?e=t[8]:(e=Y(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[7]=r,t[8]=e);let n;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(n=Array.from({length:6},qb).map(Kb),t[9]=n):n=t[9];let i;return t[10]!==e||t[11]!==n?(i=(0,Z.jsx)(`div`,{role:`status`,className:e,"aria-busy":`true`,"aria-label":`Loading starter packs`,children:n}),t[10]=e,t[11]=n,t[12]=i):i=t[12],i}if(i.length===0){let e;t[13]===r?e=t[14]:(e=Y(`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[13]=r,t[14]=e);let n;return t[15]===e?n=t[16]:(n=(0,Z.jsx)(`div`,{role:`status`,className:e,children:`No starter packs available.`}),t[15]=e,t[16]=n),n}let u;t[17]===r?u=t[18]:(u=Y(`grid w-full max-w-5xl gap-4 sm:grid-cols-2 lg:grid-cols-3`,r),t[17]=r,t[18]=u);let d;if(t[19]!==n||t[20]!==i){let e;t[22]===n?e=t[23]:(e=e=>(0,Z.jsx)(Jb,{pack:e,onSelect:()=>n(e.id)},e.id),t[22]=n,t[23]=e),d=i.map(e),t[19]=n,t[20]=i,t[21]=d}else d=t[21];let f;return t[24]!==u||t[25]!==d?(f=(0,Z.jsx)(`div`,{className:u,children:d}),t[24]=u,t[25]=d,t[26]=f):f=t[26],f}function Kb(e){return(0,Z.jsx)(Xb,{},`skeleton-${e}`)}function qb(e,t){return t}function Jb(e){let t=(0,$.c)(23),{pack:n,onSelect:r}=e,i;t[0]===n.id?i=t[1]:(i=Wb(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=Yb({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 Yb({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 Xb(){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)(Ze,{className:`size-5 animate-spin text-muted-foreground opacity-0`})}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-[200px] flex-col items-start gap-4 rounded-xl border border-border/60 bg-card p-6`,children:[t,(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-4 w-1/2 animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-full animate-pulse rounded bg-muted`}),(0,Z.jsx)(`div`,{className:`h-3 w-4/5 animate-pulse rounded bg-muted`})]}),(0,Z.jsx)(`div`,{className:`mt-auto h-3 w-20 animate-pulse rounded bg-muted`})]}),e[1]=n):n=e[1],n}var Zb=`knowledge-base`;function Qb(e){let t=(0,$.c)(80),{open:n,onOpenChange:r,onSeedApplied:i,initialPackId:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={kind:`loading`},t[0]=o):o=t[0];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(null),[d,f]=(0,Q.useState)(a??Zb),[p,m]=(0,Q.useState)(!0),[h,g]=(0,Q.useState)(`project-root`),[_,v]=(0,Q.useState)(``),y=(0,Q.useRef)(!0),b;t[1]!==l||t[2]!==d?(b=l?.find(e=>e.id===d),t[1]=l,t[2]=d,t[3]=b):b=t[3];let x=b,S,C;t[4]!==n||t[5]!==l?(S=()=>{if(!n||l!==null)return;let e=!1;return(async()=>{try{let t=await Hb().listPacks();if(e)return;t.ok?u(t.packs):(u([]),c({kind:`error`,message:t.error.message}))}catch(t){let n=t;if(e)return;u([]),c({kind:`error`,message:n instanceof Error?n.message:String(n)})}})(),()=>{e=!0}},C=[n,l],t[4]=n,t[5]=l,t[6]=S,t[7]=C):(S=t[6],C=t[7]),(0,Q.useEffect)(S,C);let w,T;t[8]!==a||t[9]!==n?(w=()=>{n&&(f(a??Zb),m(!0),g(`project-root`),v(``),y.current=!0)},T=[n,a],t[8]=a,t[9]=n,t[10]=w,t[11]=T):(w=t[10],T=t[11]),(0,Q.useEffect)(w,T);let E,D;t[12]===x?(E=t[13],D=t[14]):(E=()=>{x&&v(x.defaultSubfolder??``)},D=[x],t[12]=x,t[13]=E,t[14]=D),(0,Q.useEffect)(E,D);let O;t[15]===_?O=t[16]:(O=_.trim(),t[15]=_,t[16]=O);let k=O,A=h===`subfolder`&&k===``,j,M;t[17]!==p||t[18]!==n||t[19]!==l||t[20]!==h||t[21]!==d||t[22]!==A||t[23]!==k?(j=()=>{if(!n||l===null)return;if(A){c({kind:`error`,message:`Enter a folder name (e.g. brain).`});return}let e=h===`project-root`?void 0:k,t=y.current?0:200;y.current=!1;let r=!1,i=setTimeout(()=>{r||(c($b),Hb().plan({rootDir:e,packId:d,includePersonalTemplates:p}).then(e=>{if(!r){if(!e.ok){c({kind:`error`,message:e.error.message});return}c(e.plan.created.length>0||(e.plan.personalTemplates?.willWrite.length??0)>0?{kind:`plan`,plan:e.plan}:{kind:`already-seeded`,plan:e.plan})}}).catch(e=>{r||c({kind:`error`,message:e instanceof Error?e.message:String(e)})}))},t);return()=>{r=!0,clearTimeout(i)}},M=[n,l,d,p,h,k,A],t[17]=p,t[18]=n,t[19]=l,t[20]=h,t[21]=d,t[22]=A,t[23]=k,t[24]=j,t[25]=M):(j=t[24],M=t[25]),(0,Q.useEffect)(j,M);let N;t[26]!==p||t[27]!==r||t[28]!==i||t[29]!==s.kind||t[30]!==s.plan||t[31]!==x?.name||t[32]!==d?(N=async function(){if(s.kind!==`plan`)return;let e=s.plan;c({kind:`applying`,plan:e});let t;try{t=await Hb().apply(e,{packId:d,includePersonalTemplates:p})}catch(t){let n=t,r=n instanceof Error?n.message:String(n);Xa.error(`Initialize failed: ${r}`),c({kind:`plan`,plan:e});return}if(t.ok){let e=x?.name??`starter pack`,n=t.result.applied,a=t.personalTemplates?.written.length??0,o=n===0&&a>0?`${a} personal template${a===1?``:`s`} written to ~/.ok/templates/`:n===0?`${e} was already set up. Nothing to do.`:a>0?`${e} initialized (${n} ${n===1?`entry`:`entries`}) + ${a} personal template${a===1?``:`s`}`:`${e} initialized (${n} ${n===1?`entry`:`entries`})`;Xa.success(o),i?.(),r(!1)}else Xa.error(`Initialize failed: ${t.error.message}`),c({kind:`plan`,plan:e})},t[26]=p,t[27]=r,t[28]=i,t[29]=s.kind,t[30]=s.plan,t[31]=x?.name,t[32]=d,t[33]=N):N=t[33];let P=N,F=a!==void 0,I=F&&x?`Initialize ${x.name}`:`Initialize a starter pack`,L=F&&x?x.description:`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.`,R;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(ii,{"aria-hidden":`true`,className:`h-4 w-4 text-foreground opacity-70`}),t[34]=R):R=t[34];let z;t[35]===I?z=t[36]:(z=(0,Z.jsxs)(Ra,{className:`flex items-center gap-2`,children:[R,I]}),t[35]=I,t[36]=z);let B;t[37]===L?B=t[38]:(B=(0,Z.jsx)(Ia,{children:L}),t[37]=L,t[38]=B);let V;t[39]!==z||t[40]!==B?(V=(0,Z.jsxs)(qa,{children:[z,B]}),t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;t[42]!==F||t[43]!==l||t[44]!==d?(H=F?null:(0,Z.jsx)(ex,{packs:l,selectedPackId:d,onSelect:f}),t[42]=F,t[43]=l,t[44]=d,t[45]=H):H=t[45];let U;t[46]===p?U=t[47]:(U=(0,Z.jsx)(nx,{checked:p,onCheckedChange:m}),t[46]=p,t[47]=U);let W=x?.defaultSubfolder??`subfolder`,G;t[48]!==h||t[49]!==_||t[50]!==W?(G=(0,Z.jsx)(rx,{choice:h,subfolder:_,placeholder:W,onChoiceChange:g,onSubfolderChange:v}),t[48]=h,t[49]=_,t[50]=W,t[51]=G):G=t[51];let K;t[52]!==s||t[53]!==x?(K=(0,Z.jsx)(ix,{phase:s,selectedPack:x}),t[52]=s,t[53]=x,t[54]=K):K=t[54];let q;t[55]!==H||t[56]!==U||t[57]!==G||t[58]!==K?(q=(0,Z.jsxs)(Wa,{className:`space-y-6`,children:[H,U,G,K]}),t[55]=H,t[56]=U,t[57]=G,t[58]=K,t[59]=q):q=t[59];let ee;t[60]===r?ee=t[61]:(ee=()=>r(!1),t[60]=r,t[61]=ee);let te=s.kind===`already-seeded`||s.kind===`error`?`Close`:`Cancel`,ne;t[62]!==ee||t[63]!==te?(ne=(0,Z.jsx)(X,{className:`uppercase font-mono`,variant:`ghost`,onClick:ee,children:te}),t[62]=ee,t[63]=te,t[64]=ne):ne=t[64];let re;t[65]!==P||t[66]!==s.kind||t[67]!==A?(re=s.kind===`plan`?(0,Z.jsx)(X,{onClick:P,disabled:A,children:`Initialize`}):s.kind===`applying`?(0,Z.jsxs)(X,{disabled:!0,children:[(0,Z.jsx)(Ze,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Setting up`]}):null,t[65]=P,t[66]=s.kind,t[67]=A,t[68]=re):re=t[68];let ie;t[69]!==ne||t[70]!==re?(ie=(0,Z.jsxs)(Ga,{children:[ne,re]}),t[69]=ne,t[70]=re,t[71]=ie):ie=t[71];let ae;t[72]!==V||t[73]!==q||t[74]!==ie?(ae=(0,Z.jsxs)(Va,{className:`sm:max-w-2xl`,"data-ok-layer-spawned":``,children:[V,q,ie]}),t[72]=V,t[73]=q,t[74]=ie,t[75]=ae):ae=t[75];let oe;return t[76]!==r||t[77]!==n||t[78]!==ae?(oe=(0,Z.jsx)(Ja,{open:n,onOpenChange:r,children:ae}),t[76]=r,t[77]=n,t[78]=ae,t[79]=oe):oe=t[79],oe}function $b(e){return e.kind===`plan`||e.kind===`already-seeded`?e:{kind:`loading`}}function ex(e){let t=(0,$.c)(5),{packs:n,selectedPackId:r,onSelect:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Pick a starter pack`}),t[0]=a):a=t[0];let o;return t[1]!==i||t[2]!==n||t[3]!==r?(o=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[a,n===null?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-sm text-muted-foreground`,children:[(0,Z.jsx)(Ze,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Loading packs`]}):(0,Z.jsx)(Sf,{className:`grid gap-2 sm:grid-cols-3`,value:r,onValueChange:e=>i(e),children:n.map(tx)})]}),t[1]=i,t[2]=n,t[3]=r,t[4]=o):o=t[4],o}function tx(e){return(0,Z.jsx)(xi,{htmlFor:`pack-${e.id}`,children:(0,Z.jsxs)(Ei,{orientation:`horizontal`,className:`h-full`,children:[(0,Z.jsxs)(ki,{children:[(0,Z.jsx)(wi,{className:`text-sm`,children:e.name}),(0,Z.jsx)(vi,{className:`text-xs`,children:e.description})]}),(0,Z.jsx)(Cf,{value:e.id,id:`pack-${e.id}`})]})},e.id)}function nx(e){let t=(0,$.c)(7),{checked:n,onCheckedChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(wi,{children:`Include personal templates`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(ki,{children:[i,(0,Z.jsxs)(vi,{className:`text-1sm`,children:[`Adds daily journal, reading log, recipes, and more to `,(0,Z.jsx)(`code`,{children:`~/.ok/templates/`}),`. Idempotent. Never overwrites your edits.`]})]}),t[1]=a):a=t[1];let o;t[2]===r?o=t[3]:(o=e=>r(e===!0),t[2]=r,t[3]=o);let s;return t[4]!==n||t[5]!==o?(s=(0,Z.jsx)(xi,{htmlFor:`seed-include-personal-templates`,className:`cursor-pointer`,children:(0,Z.jsxs)(Ei,{orientation:`horizontal`,children:[a,(0,Z.jsx)($a,{id:`seed-include-personal-templates`,checked:n,onCheckedChange:o})]})}),t[4]=n,t[5]=o,t[6]=s):s=t[6],s}function rx(e){let t=(0,$.c)(22),{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:`Where should it live?`}),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)(xi,{htmlFor:`seed-root-project-root`,children:(0,Z.jsxs)(Ei,{orientation:`horizontal`,children:[(0,Z.jsxs)(ki,{children:[(0,Z.jsx)(wi,{children:`Project root`}),(0,Z.jsx)(vi,{className:`text-1sm`,children:`Scaffold the pack's folders directly under this project.`})]}),(0,Z.jsx)(Cf,{value:`project-root`,id:`seed-root-project-root`})]})}),t[3]=l):l=t[3];let u,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(wi,{children:`In a subfolder`}),d=(0,Z.jsx)(vi,{className:`nth-last-2:mt-0 text-1sm`,children:`Created if missing. Reuses the folder if it already exists.`}),t[4]=u,t[5]=d):(u=t[4],d=t[5]);let f;t[6]===o?f=t[7]:(f=e=>o(e.target.value),t[6]=o,t[7]=f);let p;t[8]===a?p=t[9]:(p=()=>a(`subfolder`),t[8]=a,t[9]=p);let m;t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==p?(m=(0,Z.jsxs)(ki,{children:[u,d,(0,Z.jsx)(fo,{value:r,onChange:f,onFocus:p,placeholder:i,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`mt-1.5 font-mono text-xs bg-background`})]}),t[10]=i,t[11]=r,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(Cf,{value:`subfolder`,id:`seed-root-subfolder`}),t[15]=h):h=t[15];let g;t[16]===m?g=t[17]:(g=(0,Z.jsx)(xi,{htmlFor:`seed-root-subfolder`,children:(0,Z.jsxs)(Ei,{orientation:`horizontal`,children:[m,h]})}),t[16]=m,t[17]=g);let _;return t[18]!==n||t[19]!==g||t[20]!==c?(_=(0,Z.jsxs)(`div`,{className:`space-y-2 py-1`,children:[s,(0,Z.jsxs)(Sf,{className:`sm:flex`,value:n,onValueChange:c,children:[l,g]})]}),t[18]=n,t[19]=g,t[20]=c,t[21]=_):_=t[21],_}function ix(e){let t=(0,$.c)(12),{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)(Ze,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin`}),`Computing scaffold plan`]}),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;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`py-2 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`This pack is already set up here.`}),(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`The folders and templates are in place; there's nothing left to scaffold.`})]}),t[3]=e):e=t[3],e}let i;t[4]!==n.plan||t[5]!==r?(i=(0,Z.jsx)(cx,{plan:n.plan,selectedPack:r}),t[4]=n.plan,t[5]=r,t[6]=i):i=t[6];let a;t[7]===n.plan.warnings?a=t[8]:(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(ax)}):null,t[7]=n.plan.warnings,t[8]=a);let o;return t[9]!==i||t[10]!==a?(o=(0,Z.jsxs)(`div`,{className:`space-y-6 py-1 text-sm`,children:[i,a]}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}function ax(e){return(0,Z.jsx)(`p`,{children:e},e)}function ox(e){return e.split(`/`).pop()??e}function sx(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(ox(e.path))??``})),i=e.created.filter(e=>e.kind===`file`).map(e=>({kind:`file`,name:e.path,description:ox(e.path)===`log.md`?`Append-only timeline`:``}));return[...r,...i]}function cx(e){let t=(0,$.c)(18),{plan:n,selectedPack:r}=e,i,a,o,s,c;if(t[0]!==n||t[1]!==r){let e=sx(n,r);i=n.personalTemplates?.willWrite.length??0,s=`space-y-3`,t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(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[7]=c):c=t[7],a=`space-y-3 overflow-y-auto subtle-scrollbar max-h-full`,o=e.map(lx),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];let l;t[8]===i?l=t[9]:(l=i>0?(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 rounded-md border border-dashed border-border/60 bg-muted/10 p-3`,children:[(0,Z.jsx)(ws,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsxs)(`code`,{className:`font-mono text-1sm`,children:[`~/.ok/templates/ (`,i,` `,i===1?`template`:`templates`,`)`]}),(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:`Personal templates: daily journal, reading log, weekly review, recipes, and more.`})]})]}):null,t[8]=i,t[9]=l);let u;t[10]!==a||t[11]!==o||t[12]!==l?(u=(0,Z.jsxs)(`ul`,{className:a,children:[o,l]}),t[10]=a,t[11]=o,t[12]=l,t[13]=u):u=t[13];let d;return t[14]!==s||t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`section`,{className:s,children:[c,u]}),t[14]=s,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function lx(e){return(0,Z.jsxs)(`li`,{className:`flex items-start gap-3 rounded-md border border-border/60 bg-muted/20 p-3`,children:[e.kind===`folder`?(0,Z.jsx)(ks,{"aria-hidden":`true`,className:`mt-1 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}):(0,Z.jsx)(ws,{"aria-hidden":`true`,className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground`,strokeWidth:1.5}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,Z.jsx)(`code`,{className:`font-mono text-1sm`,children:e.name}),e.description?(0,Z.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:e.description}):null]})]},e.name)}var ux=`open-knowledge:create-top-level-file`;function dx(){window.dispatchEvent(new CustomEvent(ux))}function fx(e){let t=()=>e();return window.addEventListener(ux,t),()=>window.removeEventListener(ux,t)}function px(){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(_x);if(e)return;let r=t.ok?Gn.safeParse(n):null;r?.success?(o(vx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=_r(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(gx),250),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(hx);if(!e.ok)return;let n=Gn.safeParse(t);n.success&&o(vx(n.data.documents))}).catch(mx)},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)(yx,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(bx,{celebrateSignal:s}):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)(Qb,{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 mx(){}function hx(){return null}function gx(e){return e+1}function _x(){return null}function vx(e){return e.filter(e=>e.kind===`document`||e.kind===`folder`).length}function yx(e){let t=(0,$.c)(10),{celebrateSignal:n,onPackSelect:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(Ib,{title:`Let's set up your project.`,subtitle:`Pick a starter pack to scaffold folders, templates, and AI-readable rules.`,celebrateSignal:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(Gb,{onPackSelect:r}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:dx,children:[`or start from scratch `,(0,Z.jsx)(oa,{"aria-hidden":`true`,className:`size-3`})]}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[a,o]}),t[5]=a,t[6]=s);let c;return t[7]!==i||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[i,s]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function bx(e){let t=(0,$.c)(6),{celebrateSignal:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(Ib,{title:`Open in your favorite AI editor.`,subtitle:`Select a file from the sidebar, or pick where to edit alongside your agent.`,celebrateSignal:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(ob,{}),t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6`,children:[i,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[(0,Z.jsx)(zb,{}),(0,Z.jsx)(Lb,{})]})]}),t[3]=a):a=t[3];let o;return t[4]===r?o=t[5]:(o=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[r,a]}),t[4]=r,t[5]=o),o}var xx=365.2425,Sx=6048e5,Cx=864e5,wx=6e4,Tx=36e5,Ex=1e3,Dx=3600*24;Dx*7,Dx*xx/12*3;var Ox=Symbol.for(`constructDateFrom`);function kx(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Ox in e?e[Ox](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ax(e,t){return kx(t||e,e)}function jx(e,t,n){let r=Ax(e,n?.in);return isNaN(t)?kx(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Mx(e,t,n){let r=Ax(e,n?.in);if(isNaN(t))return kx(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=kx(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var Nx={};function Px(){return Nx}function Fx(e,t){let n=Px(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ax(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Ix(e,t){return Fx(e,{...t,weekStartsOn:1})}function Lx(e,t){let n=Ax(e,t?.in),r=n.getFullYear(),i=kx(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Ix(i),o=kx(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Ix(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Rx(e){let t=Ax(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function zx(e,...t){let n=kx.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Bx(e,t){let n=Ax(e,t?.in);return n.setHours(0,0,0,0),n}function Vx(e,t,n){let[r,i]=zx(n?.in,e,t),a=Bx(r),o=Bx(i),s=+a-Rx(a),c=+o-Rx(o);return Math.round((s-c)/Cx)}function Hx(e,t){let n=Lx(e,t),r=kx(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ix(r)}function Ux(e,t,n){return jx(e,t*7,n)}function Wx(e,t,n){return Mx(e,t*12,n)}function Gx(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=kx.bind(null,e));let t=Ax(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),kx(r,n||NaN)}function Kx(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=kx.bind(null,e));let t=Ax(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),kx(r,n||NaN)}function qx(e,t,n){let[r,i]=zx(n?.in,e,t);return+Bx(r)==+Bx(i)}function Jx(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Yx(e){return!(!Jx(e)&&typeof e!=`number`||isNaN(+Ax(e)))}function Xx(e,t,n){let[r,i]=zx(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Zx(e,t){let n=Ax(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Qx(e,t){let[n,r]=zx(e,t.start,t.end);return{start:n,end:r}}function $x(e,t){let{start:n,end:r}=Qx(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(kx(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function eS(e,t){let n=Ax(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function tS(e,t){let n=Ax(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function nS(e,t){let n=Ax(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function rS(e,t){let{start:n,end:r}=Qx(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(kx(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function iS(e,t){let n=Px(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ax(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function aS(e,t){return iS(e,{...t,weekStartsOn:1})}var oS={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},sS=(e,t,n)=>{let r,i=oS[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function cS(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var lS={date:cS({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:cS({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:cS({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},uS={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},dS=(e,t,n,r)=>uS[e];function fS(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var pS={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:fS({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:fS({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:fS({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:fS({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:fS({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function mS(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?gS(s,e=>e.test(o)):hS(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function hS(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function gS(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function _S(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var vS={code:`en-US`,formatDistance:sS,formatLong:lS,formatRelative:dS,localize:pS,match:{ordinalNumber:_S({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:mS({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:mS({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:mS({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:mS({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:mS({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function yS(e,t){let n=Ax(e,t?.in);return Vx(n,nS(n))+1}function bS(e,t){let n=Ax(e,t?.in),r=Ix(n)-+Hx(n);return Math.round(r/Sx)+1}function xS(e,t){let n=Ax(e,t?.in),r=n.getFullYear(),i=Px(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=kx(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Fx(o,t),c=kx(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Fx(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function SS(e,t){let n=Px(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=xS(e,t),a=kx(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Fx(a,t)}function CS(e,t){let n=Ax(e,t?.in),r=Fx(n,t)-+SS(n,t);return Math.round(r/Sx)+1}function wS(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var TS={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return wS(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):wS(n+1,2)},d(e,t){return wS(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return wS(e.getHours()%12||12,t.length)},H(e,t){return wS(e.getHours(),t.length)},m(e,t){return wS(e.getMinutes(),t.length)},s(e,t){return wS(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return wS(Math.trunc(r*10**(n-3)),t.length)}},ES={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},DS={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return TS.y(e,t)},Y:function(e,t,n,r){let i=xS(e,r),a=i>0?i:1-i;return t===`YY`?wS(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):wS(a,t.length)},R:function(e,t){return wS(Lx(e),t.length)},u:function(e,t){return wS(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return wS(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return wS(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return TS.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return wS(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=CS(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):wS(i,t.length)},I:function(e,t,n){let r=bS(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):wS(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):TS.d(e,t)},D:function(e,t,n){let r=yS(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):wS(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return wS(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return wS(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return wS(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?ES.noon:r===0?ES.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?ES.evening:r>=12?ES.afternoon:r>=4?ES.morning:ES.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return TS.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):TS.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):wS(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):wS(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):TS.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):TS.s(e,t)},S:function(e,t){return TS.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return kS(r);case`XXXX`:case`XX`:return AS(r);default:return AS(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return kS(r);case`xxxx`:case`xx`:return AS(r);default:return AS(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+OS(r,`:`);default:return`GMT`+AS(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+OS(r,`:`);default:return`GMT`+AS(r,`:`)}},t:function(e,t,n){return wS(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return wS(+e,t.length)}};function OS(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+wS(a,2)}function kS(e,t){return e%60==0?(e>0?`-`:`+`)+wS(Math.abs(e)/60,2):AS(e,t)}function AS(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=wS(Math.trunc(r/60),2),a=wS(r%60,2);return n+i+t+a}var jS=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},MS=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},NS={p:MS,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return jS(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,jS(r,t)).replace(`{{time}}`,MS(i,t))}},PS=/^D+$/,FS=/^Y+$/,IS=[`D`,`DD`,`YY`,`YYYY`];function LS(e){return PS.test(e)}function RS(e){return FS.test(e)}function zS(e,t,n){let r=BS(e,t,n);if(console.warn(r),IS.includes(e))throw RangeError(r)}function BS(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var VS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,HS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,US=/^'([^]*?)'?$/,WS=/''/g,GS=/[a-zA-Z]/;function KS(e,t,n){let r=Px(),i=n?.locale??r.locale??vS,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Ax(e,n?.in);if(!Yx(s))throw RangeError(`Invalid time value`);let c=t.match(HS).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=NS[t];return n(e,i.formatLong)}return e}).join(``).match(VS).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:qS(e)};if(DS[t])return{isToken:!0,value:e};if(t.match(GS))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&RS(a)||!n?.useAdditionalDayOfYearTokens&&LS(a))&&zS(a,t,String(e));let o=DS[a[0]];return o(s,a,i.localize,l)}).join(``)}function qS(e){let t=e.match(US);return t?t[1].replace(WS,`'`):e}function JS(e,t){let n=Ax(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=kx(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function YS(){return Object.assign({},Px())}function XS(e,t){let n=Ax(e,t?.in).getDay();return n===0?7:n}function ZS(e,t){return Ax(e,t?.in).getMonth()}function QS(e,t){return Ax(e,t?.in).getFullYear()}function $S(e,t){return+Ax(e)>+Ax(t)}function eC(e,t){return+Ax(e)<+Ax(t)}function tC(e,t){let n=nC(t)?new t(0):kx(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function nC(e){return typeof e==`function`&&e.prototype?.constructor===e}var rC=10,iC=class{subPriority=0;validate(e,t){return!0}},aC=class extends iC{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}},oC=class extends iC{priority=rC;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>kx(t,e))}set(e,t){return t.timestampIsSet?e:kx(e,tC(e,this.context))}},sC=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new aC(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},cC=class extends sC{priority=140;parse(e,t,n){switch(t){case`G`:case`GG`:case`GGG`:return n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`});case`GGGGG`:return n.era(e,{width:`narrow`});default:return n.era(e,{width:`wide`})||n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`R`,`u`,`t`,`T`]},lC={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},uC={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function dC(e,t){return e&&{value:t(e.value),rest:e.rest}}function fC(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function pC(e,t){let n=t.match(e);if(!n)return null;if(n[0]===`Z`)return{value:0,rest:t.slice(1)};let r=n[1]===`+`?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*Tx+a*wx+o*Ex),rest:t.slice(n[0].length)}}function mC(e){return fC(lC.anyDigitsSigned,e)}function hC(e,t){switch(e){case 1:return fC(lC.singleDigit,t);case 2:return fC(lC.twoDigits,t);case 3:return fC(lC.threeDigits,t);case 4:return fC(lC.fourDigits,t);default:return fC(RegExp(`^\\d{1,`+e+`}`),t)}}function gC(e,t){switch(e){case 1:return fC(lC.singleDigitSigned,t);case 2:return fC(lC.twoDigitsSigned,t);case 3:return fC(lC.threeDigitsSigned,t);case 4:return fC(lC.fourDigitsSigned,t);default:return fC(RegExp(`^-?\\d{1,`+e+`}`),t)}}function _C(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function vC(e,t){let n=t>0,r=n?t:1-t,i;if(r<=50)i=e||100;else{let t=r+50,n=Math.trunc(t/100)*100,a=e>=t%100;i=e+n-(a?100:0)}return n?i:1-i}function yC(e){return e%400==0||e%4==0&&e%100!=0}var bC=class extends sC{priority=130;incompatibleTokens=[`Y`,`R`,`u`,`w`,`I`,`i`,`e`,`c`,`t`,`T`];parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`yy`});switch(t){case`y`:return dC(hC(4,e),r);case`yo`:return dC(n.ordinalNumber(e,{unit:`year`}),r);default:return dC(hC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){let r=e.getFullYear();if(n.isTwoDigitYear){let t=vC(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let i=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},xC=class extends sC{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return dC(hC(4,e),r);case`Yo`:return dC(n.ordinalNumber(e,{unit:`year`}),r);default:return dC(hC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=xS(e,r);if(n.isTwoDigitYear){let t=vC(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Fx(e,r)}let a=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Fx(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},SC=class extends sC{priority=130;parse(e,t){return gC(t===`R`?4:t.length,e)}set(e,t,n){let r=kx(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ix(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},CC=class extends sC{priority=130;parse(e,t){return gC(t===`u`?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`G`,`y`,`Y`,`R`,`w`,`I`,`i`,`e`,`c`,`t`,`T`]},wC=class extends sC{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return hC(t.length,e);case`Qo`:return n.ordinalNumber(e,{unit:`quarter`});case`QQQ`:return n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`});case`QQQQQ`:return n.quarter(e,{width:`narrow`,context:`formatting`});default:return n.quarter(e,{width:`wide`,context:`formatting`})||n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},TC=class extends sC{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return hC(t.length,e);case`qo`:return n.ordinalNumber(e,{unit:`quarter`});case`qqq`:return n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`});case`qqqqq`:return n.quarter(e,{width:`narrow`,context:`standalone`});default:return n.quarter(e,{width:`wide`,context:`standalone`})||n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`Q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},EC=class extends sC{incompatibleTokens=[`Y`,`R`,`q`,`Q`,`L`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`];priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`M`:return dC(fC(lC.month,e),r);case`MM`:return dC(hC(2,e),r);case`Mo`:return dC(n.ordinalNumber(e,{unit:`month`}),r);case`MMM`:return n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`});case`MMMMM`:return n.month(e,{width:`narrow`,context:`formatting`});default:return n.month(e,{width:`wide`,context:`formatting`})||n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}},DC=class extends sC{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return dC(fC(lC.month,e),r);case`LL`:return dC(hC(2,e),r);case`Lo`:return dC(n.ordinalNumber(e,{unit:`month`}),r);case`LLL`:return n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`});case`LLLLL`:return n.month(e,{width:`narrow`,context:`standalone`});default:return n.month(e,{width:`wide`,context:`standalone`})||n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]};function OC(e,t,n){let r=Ax(e,n?.in),i=CS(r,n)-t;return r.setDate(r.getDate()-i*7),Ax(r,n?.in)}var kC=class extends sC{priority=100;parse(e,t,n){switch(t){case`w`:return fC(lC.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return hC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return Fx(OC(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function AC(e,t,n){let r=Ax(e,n?.in),i=bS(r,n)-t;return r.setDate(r.getDate()-i*7),r}var jC=class extends sC{priority=100;parse(e,t,n){switch(t){case`I`:return fC(lC.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return hC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return Ix(AC(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},MC=[31,28,31,30,31,30,31,31,30,31,30,31],NC=[31,29,31,30,31,30,31,31,30,31,30,31],PC=class extends sC{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return fC(lC.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return hC(t.length,e)}}validate(e,t){let n=yC(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=NC[r]:t>=1&&t<=MC[r]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]},FC=class extends sC{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return fC(lC.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return hC(t.length,e)}}validate(e,t){return yC(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`L`,`w`,`I`,`d`,`E`,`i`,`e`,`c`,`t`,`T`]};function IC(e,t,n){let r=Px(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=Ax(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return jx(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var LC=class extends sC{priority=90;parse(e,t,n){switch(t){case`E`:case`EE`:case`EEE`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`EEEEE`:return n.day(e,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=IC(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},RC=class extends sC{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`e`:case`ee`:return dC(hC(t.length,e),i);case`eo`:return dC(n.ordinalNumber(e,{unit:`day`}),i);case`eee`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`eeeee`:return n.day(e,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=IC(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`c`,`t`,`T`]},zC=class extends sC{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`c`:case`cc`:return dC(hC(t.length,e),i);case`co`:return dC(n.ordinalNumber(e,{unit:`day`}),i);case`ccc`:return n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});case`ccccc`:return n.day(e,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});default:return n.day(e,{width:`wide`,context:`standalone`})||n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=IC(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`e`,`t`,`T`]};function BC(e,t,n){let r=Ax(e,n?.in);return jx(r,t-XS(r,n),n)}var VC=class extends sC{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return hC(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return dC(n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiii`:return dC(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return dC(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return dC(n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=BC(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`E`,`e`,`c`,`t`,`T`]},HC=class extends sC{priority=80;parse(e,t,n){switch(t){case`a`:case`aa`:case`aaa`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`aaaaa`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(_C(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},UC=class extends sC{priority=80;parse(e,t,n){switch(t){case`b`:case`bb`:case`bbb`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`bbbbb`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(_C(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},WC=class extends sC{priority=80;parse(e,t,n){switch(t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`BBBBB`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(_C(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},GC=class extends sC{priority=70;parse(e,t,n){switch(t){case`h`:return fC(lC.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return hC(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){let r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`H`,`K`,`k`,`t`,`T`]},KC=class extends sC{priority=70;parse(e,t,n){switch(t){case`H`:return fC(lC.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return hC(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`K`,`k`,`t`,`T`]},qC=class extends sC{priority=70;parse(e,t,n){switch(t){case`K`:return fC(lC.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return hC(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`h`,`H`,`k`,`t`,`T`]},JC=class extends sC{priority=70;parse(e,t,n){switch(t){case`k`:return fC(lC.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return hC(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){let r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`H`,`K`,`t`,`T`]},YC=class extends sC{priority=60;parse(e,t,n){switch(t){case`m`:return fC(lC.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return hC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=[`t`,`T`]},XC=class extends sC{priority=50;parse(e,t,n){switch(t){case`s`:return fC(lC.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return hC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},ZC=class extends sC{priority=30;parse(e,t){return dC(hC(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},QC=class extends sC{priority=10;parse(e,t){switch(t){case`X`:return pC(uC.basicOptionalMinutes,e);case`XX`:return pC(uC.basic,e);case`XXXX`:return pC(uC.basicOptionalSeconds,e);case`XXXXX`:return pC(uC.extendedOptionalSeconds,e);default:return pC(uC.extended,e)}}set(e,t,n){return t.timestampIsSet?e:kx(e,e.getTime()-Rx(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},$C=class extends sC{priority=10;parse(e,t){switch(t){case`x`:return pC(uC.basicOptionalMinutes,e);case`xx`:return pC(uC.basic,e);case`xxxx`:return pC(uC.basicOptionalSeconds,e);case`xxxxx`:return pC(uC.extendedOptionalSeconds,e);default:return pC(uC.extended,e)}}set(e,t,n){return t.timestampIsSet?e:kx(e,e.getTime()-Rx(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},ew=class extends sC{priority=40;parse(e){return mC(e)}set(e,t,n){return[kx(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},tw=class extends sC{priority=20;parse(e){return mC(e)}set(e,t,n){return[kx(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},nw={G:new cC,y:new bC,Y:new xC,R:new SC,u:new CC,Q:new wC,q:new TC,M:new EC,L:new DC,w:new kC,I:new jC,d:new PC,D:new FC,E:new LC,e:new RC,c:new zC,i:new VC,a:new HC,b:new UC,B:new WC,h:new GC,H:new KC,K:new qC,k:new JC,m:new YC,s:new XC,S:new ZC,X:new QC,x:new $C,t:new ew,T:new tw},rw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,iw=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,aw=/^'([^]*?)'?$/,ow=/''/g,sw=/\S/,cw=/[a-zA-Z]/;function lw(e,t,n,r){let i=()=>kx(r?.in||n,NaN),a=YS(),o=r?.locale??a.locale??vS,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():Ax(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new oC(r?.in,n)],d=t.match(iw).map(e=>{let t=e[0];if(t in NS){let n=NS[t];return n(e,o.formatLong)}return e}).join(``).match(rw),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&RS(n)&&zS(n,t,e),!r?.useAdditionalDayOfYearTokens&&LS(n)&&zS(n,t,e);let a=n[0],s=nw[a];if(s){let{incompatibleTokens:t}=s;if(Array.isArray(t)){let e=f.find(e=>t.includes(e.token)||e.token===a);if(e)throw RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if(s.incompatibleTokens===`*`&&f.length>0)throw RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);f.push({token:a,fullToken:n});let r=s.run(e,n,o.match,l);if(!r)return i();u.push(r.setter),e=r.rest}else{if(a.match(cw))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=uw(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&sw.test(e))return i();let p=u.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>u.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]),m=Ax(n,r?.in);if(isNaN(+m))return i();let h={};for(let e of p){if(!e.validate(m,l))return i();let t=e.set(m,h,l);Array.isArray(t)?(m=t[0],Object.assign(h,t[1])):m=t}return m}function uw(e){return e.match(aw)[1].replace(ow,`'`)}function dw(e,t,n){let[r,i]=zx(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function fw(e,t,n){let[r,i]=zx(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function pw(e,t){let n=()=>kx(t?.in,NaN),r=t?.additionalDigits??2,i=vw(e),a;if(i.date){let e=yw(i.date,r);a=bw(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=Sw(i.time),isNaN(s)))return n();if(i.timezone){if(c=ww(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=Ax(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return Ax(o+s+c,t?.in)}var mw={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},hw=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,gw=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,_w=/^([+-])(\d{2})(?::?(\d{2}))?$/;function vw(e){let t={},n=e.split(mw.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],mw.timeZoneDelimiter.test(t.date)&&(t.date=e.split(mw.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=mw.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function yw(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function bw(e,t){if(t===null)return new Date(NaN);let n=e.match(hw);if(!n)return new Date(NaN);let r=!!n[4],i=xw(n[1]),a=xw(n[2])-1,o=xw(n[3]),s=xw(n[4]),c=xw(n[5])-1;if(r)return Aw(t,s,c)?Tw(t,s,c):new Date(NaN);{let e=new Date(0);return!Ow(t,a,o)||!kw(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function xw(e){return e?parseInt(e):1}function Sw(e){let t=e.match(gw);if(!t)return NaN;let n=Cw(t[1]),r=Cw(t[2]),i=Cw(t[3]);return jw(n,r,i)?n*Tx+r*wx+i*1e3:NaN}function Cw(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function ww(e){if(e===`Z`)return 0;let t=e.match(_w);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Mw(r,i)?n*(r*Tx+i*wx):NaN}function Tw(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var Ew=[31,null,31,30,31,30,31,31,30,31,30,31];function Dw(e){return e%400==0||e%4==0&&e%100!=0}function Ow(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Ew[t]||(Dw(e)?29:28))}function kw(e,t){return t>=1&&t<=(Dw(e)?366:365)}function Aw(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function jw(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Mw(e,t){return t>=0&&t<=59}function Nw(e,t,n){let r=Ax(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=kx(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=JS(o);return r.setMonth(t,Math.min(a,s)),r}function Pw(e,t,n){let r=Ax(e,n?.in);return isNaN(+r)?kx(n?.in||e,NaN):(r.setFullYear(t),r)}function Fw(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var Iw={},Lw={};function Rw(e,t){try{let n=(Iw[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in Lw?Lw[n]:Bw(n,n.split(`:`))}catch{if(e in Lw)return Lw[e];let t=e?.match(zw);return t?Bw(e,t.slice(1)):NaN}}var zw=/([+-]\d\d):?(\d\d)?/;function Bw(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return Lw[e]=n*60+r>0?n*60+r+i:n*60-r-i}var Vw=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Rw(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),Gw(this,NaN),Uw(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-Rw(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Uw(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},Hw=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Hw.test(e))return;let t=e.replace(Hw,`$1UTC`);Vw.prototype[t]&&(e.startsWith(`get`)?Vw.prototype[e]=function(){return this.internal[t]()}:(Vw.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Ww(this),+this},Vw.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Uw(this),+this}))});function Uw(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Rw(e.timeZone,e)*60))}function Ww(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Gw(e)}function Gw(e){let t=Rw(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(Rw(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=Rw(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=Rw(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var Kw=class e extends Vw{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${Fw(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},qw=5,Jw=4;function Yw(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,qw*7-1);return t.getMonth(e)===t.getMonth(a)?qw:Jw}function Xw(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function Zw(e,t){let n=Xw(e,t),r=Yw(e,t);return t.addDays(n,r*7-1)}var Qw={...vS,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>KS(e,t,{locale:vS,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>KS(e,n,{locale:vS,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>KS(e,t,{locale:vS,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>KS(e,n,{locale:vS,...t}),r(e,`cccc`)}}},$w=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Kw.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new Kw(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):jx(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):Mx(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):Ux(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Wx(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):Vx(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Xx(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):$x(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):rS(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):Zw(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):aS(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Zx(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):iS(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):tS(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):KS(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):bS(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):ZS(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):QS(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):CS(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):$S(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):eC(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):Jx(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):qx(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):dw(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):fw(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Gx(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Kx(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):Nw(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):Pw(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Xw(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):Bx(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Ix(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):eS(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):Fx(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):nS(e),this.options={locale:Qw,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};$w.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var eT=new $w,tT=class{constructor(e,t,n=eT){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},nT=class{constructor(e,t){this.date=e,this.weeks=t}},rT=class{constructor(e,t){this.days=t,this.weekNumber=e}};function iT(e){return Q.createElement(`button`,{...e})}function aT(e){return Q.createElement(`span`,{...e})}function oT(e){let{size:t=24,orientation:n=`left`,className:r}=e;return Q.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&Q.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&Q.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&Q.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&Q.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function sT(e){let{day:t,modifiers:n,...r}=e;return Q.createElement(`td`,{...r})}function cT(e){let{day:t,modifiers:n,...r}=e,i=Q.useRef(null);return Q.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),Q.createElement(`button`,{ref:i,...r})}var lT;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(lT||={});var uT;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(uT||={});var dT;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(dT||={});var fT;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(fT||={});function pT(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[lT.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return Q.createElement(`span`,{"data-disabled":a.disabled,className:i[lT.DropdownRoot]},Q.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>Q.createElement(r.Option,{key:e,value:e,disabled:n},t))),Q.createElement(`span`,{className:i[lT.CaptionLabel],"aria-hidden":!0},s?.label,Q.createElement(r.Chevron,{orientation:`down`,size:18,className:i[lT.Chevron]})))}function mT(e){return Q.createElement(`div`,{...e})}function hT(e){return Q.createElement(`div`,{...e})}function gT(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r},e.children)}function _T(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r})}function vT(e){return Q.createElement(`table`,{...e})}function yT(e){return Q.createElement(`div`,{...e})}var bT=(0,Q.createContext)(void 0);function xT(){let e=(0,Q.useContext)(bT);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function ST(e){let{components:t}=xT();return Q.createElement(t.Dropdown,{...e})}function CT(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=xT(),u=(0,Q.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,Q.useCallback)(e=>{r&&t?.(e)},[r,t]);return Q.createElement(`nav`,{...a},Q.createElement(o.PreviousMonthButton,{type:`button`,className:s[lT.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},Q.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[lT.Chevron],orientation:`left`})),Q.createElement(o.NextMonthButton,{type:`button`,className:s[lT.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},Q.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[lT.Chevron]})))}function wT(e){let{components:t}=xT();return Q.createElement(t.Button,{...e})}function TT(e){return Q.createElement(`option`,{...e})}function ET(e){let{components:t}=xT();return Q.createElement(t.Button,{...e})}function DT(e){let{rootRef:t,...n}=e;return Q.createElement(`div`,{...n,ref:t})}function OT(e){return Q.createElement(`select`,{...e})}function kT(e){let{week:t,...n}=e;return Q.createElement(`tr`,{...n})}function AT(e){return Q.createElement(`th`,{...e})}function jT(e){return Q.createElement(`thead`,{"aria-hidden":!0},Q.createElement(`tr`,{...e}))}function MT(e){let{week:t,...n}=e;return Q.createElement(`th`,{...n})}function NT(e){return Q.createElement(`th`,{...e})}function PT(e){return Q.createElement(`tbody`,{...e})}function FT(e){let{components:t}=xT();return Q.createElement(t.Dropdown,{...e})}var IT=t({Button:()=>iT,CaptionLabel:()=>aT,Chevron:()=>oT,Day:()=>sT,DayButton:()=>cT,Dropdown:()=>pT,DropdownNav:()=>mT,Footer:()=>hT,Month:()=>gT,MonthCaption:()=>_T,MonthGrid:()=>vT,Months:()=>yT,MonthsDropdown:()=>ST,Nav:()=>CT,NextMonthButton:()=>wT,Option:()=>TT,PreviousMonthButton:()=>ET,Root:()=>DT,Select:()=>OT,Week:()=>kT,WeekNumber:()=>MT,WeekNumberHeader:()=>NT,Weekday:()=>AT,Weekdays:()=>jT,Weeks:()=>PT,YearsDropdown:()=>FT});function LT(e,t,n=!1,r=eT){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function RT(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function zT(e){return!!(e&&typeof e==`object`&&`from`in e)}function BT(e){return!!(e&&typeof e==`object`&&`after`in e)}function VT(e){return!!(e&&typeof e==`object`&&`before`in e)}function HT(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function UT(e,t){return Array.isArray(e)&&e.every(t.isDate)}function WT(e,t,n=eT){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(UT(t,n))return t.some(t=>i(e,t));if(zT(t))return LT(t,e,!1,n);if(HT(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(RT(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return BT(t)?a(e,t.after)>0:VT(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function GT(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[uT.focused]:[],[uT.outside]:[],[uT.disabled]:[],[uT.hidden]:[],[uT.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&WT(e,a,i)),S=!!(o&&WT(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&WT(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[uT.focused]:!1,[uT.disabled]:!1,[uT.hidden]:!1,[uT.outside]:!1,[uT.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function KT(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[uT[r]]?e.push(t[uT[r]]):t[dT[r]]&&e.push(t[dT[r]]),e),[t[lT.Day]])}function qT(e){return{...IT,...e}}function JT(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function YT(){let e={};for(let t in lT)e[lT[t]]=`rdp-${lT[t]}`;for(let t in uT)e[uT[t]]=`rdp-${uT[t]}`;for(let t in dT)e[dT[t]]=`rdp-${dT[t]}`;for(let t in fT)e[fT[t]]=`rdp-${fT[t]}`;return e}function XT(e,t,n){return(n??new $w(t)).formatMonthYear(e)}var ZT=XT;function QT(e,t,n){return(n??new $w(t)).format(e,`d`)}function $T(e,t=eT){return t.format(e,`LLLL`)}function eE(e,t,n){return(n??new $w(t)).format(e,`cccccc`)}function tE(e,t=eT){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function nE(){return``}function rE(e,t=eT){return t.format(e,`yyyy`)}var iE=rE,aE=t({formatCaption:()=>XT,formatDay:()=>QT,formatMonthCaption:()=>ZT,formatMonthDropdown:()=>$T,formatWeekNumber:()=>tE,formatWeekNumberHeader:()=>nE,formatWeekdayName:()=>eE,formatYearCaption:()=>iE,formatYearDropdown:()=>rE});function oE(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...aE,...e}}function sE(e,t,n,r){let i=(r??new $w(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var cE=sE;function lE(e,t,n){return(n??new $w(t)).formatMonthYear(e)}var uE=lE;function dE(e,t,n,r){let i=(r??new $w(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function fE(e){return`Choose the Month`}function pE(){return``}var mE=`Go to the Next Month`;function hE(e,t){return mE}function gE(e){return`Go to the Previous Month`}function _E(e,t,n){return(n??new $w(t)).format(e,`cccc`)}function vE(e,t){return`Week ${e}`}function yE(e){return`Week Number`}function bE(e){return`Choose the Year`}var xE=t({labelCaption:()=>uE,labelDay:()=>cE,labelDayButton:()=>sE,labelGrid:()=>lE,labelGridcell:()=>dE,labelMonthDropdown:()=>fE,labelNav:()=>pE,labelNext:()=>hE,labelPrevious:()=>gE,labelWeekNumber:()=>vE,labelWeekNumberHeader:()=>yE,labelWeekday:()=>_E,labelYearDropdown:()=>bE}),SE=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function CE(e,t){let n=t.locale?.labels??{};return{...xE,...e??{},labelDayButton:SE(sE,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:SE(fE,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:SE(hE,e?.labelNext,n.labelNext),labelPrevious:SE(gE,e?.labelPrevious,n.labelPrevious),labelWeekNumber:SE(vE,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:SE(bE,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:SE(lE,e?.labelGrid,n.labelGrid),labelGridcell:SE(dE,e?.labelGridcell,n.labelGridcell),labelNav:SE(pE,e?.labelNav,n.labelNav),labelWeekNumberHeader:SE(yE,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:SE(_E,e?.labelWeekday,n.labelWeekday)}}function wE(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function TE(e,t={},n={}){let r={...t?.[lT.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function EE(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function DE(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function OE(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new Kw(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(Kw.tz(e)),newDate:(t,n,r)=>new Kw(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new Kw(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new Kw(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new Kw(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new Kw(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>CS(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>bS(o(e)),differenceInCalendarDays:(e,t)=>Vx(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Xx(o(e),o(t))}}var kE=e=>e instanceof HTMLElement?e:null,AE=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],jE=e=>kE(e.querySelector(`[data-animated-month]`)),ME=e=>kE(e.querySelector(`[data-animated-caption]`)),NE=e=>kE(e.querySelector(`[data-animated-weeks]`)),PE=e=>kE(e.querySelector(`[data-animated-nav]`)),FE=e=>kE(e.querySelector(`[data-animated-weekdays]`));function IE(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,Q.useRef)(null),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1);(0,Q.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[fT.caption_after_enter]:n[fT.caption_before_enter],p=d?n[fT.weeks_after_enter]:n[fT.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(AE(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=jE(e);t&&e.contains(t)&&e.removeChild(t);let n=ME(e);n&&n.classList.remove(f);let r=NE(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?AE(m):[],_=AE(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=PE(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=ME(i);s&&s.classList.add(f);let l=NE(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=FE(o);m&&(m.style.opacity=`0`);let h=ME(o);h&&(h.classList.add(d?n[fT.caption_before_exit]:n[fT.caption_after_exit]),h.addEventListener(`animationend`,u));let _=NE(o);_&&_.classList.add(d?n[fT.weeks_before_exit]:n[fT.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function LE(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function RE(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function zE(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function BE(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function VE(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new nT(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new tT(t,m,r);return a?a.days.push(o):e.push(new rT(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function HE(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function UE(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function WE(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function GE(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function KE(e,t){let[n,r]=(0,Q.useState)(e);return[t===void 0?n:t,r]}function qE(e,t){let[n,r]=HE(e,t),{startOfMonth:i,endOfMonth:a}=t,o=BE(e,n,r,t),[s,c]=KE(o,e.month?o:void 0);(0,Q.useEffect)(()=>{c(BE(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,Q.useMemo)(()=>{let i=zE(s,r,{numberOfMonths:e.numberOfMonths},t),o=VE(i,LE(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:GE(o),days:RE(o),previousMonth:WE(s,n,e,t),nextMonth:UE(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var JE;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(JE||={});function YE(e){return!e[uT.disabled]&&!e[uT.hidden]&&!e[uT.outside]}function XE(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);YE(e)&&(e[uT.focused]&&a<JE.FocusedModifier?(i=o,a=JE.FocusedModifier):r?.isEqualTo(o)&&a<JE.LastFocused?(i=o,a=JE.LastFocused):n(o.date)&&a<JE.Selected?(i=o,a=JE.Selected):e[uT.today]&&a<JE.Today&&(i=o,a=JE.Today))}return i||=e.find(e=>YE(t(e))),i}function ZE(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function QE(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=ZE(e,t,n.date,r,i,a,o),l=!!(a.disabled&&WT(c,a.disabled,o)),u=!!(a.hidden&&WT(c,a.hidden,o)),d=new tT(c,c,o);return!l&&!u?d:QE(e,t,d,r,i,a,o,s+1)}function $E(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,Q.useState)(),c=XE(t.days,n,r||(()=>!1),o),[l,u]=(0,Q.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=QE(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function eD(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=KE(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function tD(e,t,n=0,r=0,i=!1,a=eT){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function nD(e,t,n=eT){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function rD(e,t,n=eT){return LT(e,t.from,!1,n)||LT(e,t.to,!1,n)||LT(t,e.from,!1,n)||LT(t,e.to,!1,n)}function iD(e,t,n=eT){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?LT(e,t,!1,n):UT(t,n)?t.some(t=>LT(e,t,!1,n)):zT(t)?t.from&&t.to?rD(e,{from:t.from,to:t.to},n):!1:HT(t)?nD(e,t.dayOfWeek,n):RT(t)?n.isAfter(t.before,t.after)?rD(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):WT(e.from,t,n)||WT(e.to,t,n):BT(t)||VT(t)?WT(e.from,t,n)||WT(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function aD(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=KE(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:tD(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&iD({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&LT(u,e,!1,t)}}function oD(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=KE(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function sD(e,t){let n=oD(e,t),r=eD(e,t),i=aD(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function cD(e,t){return e instanceof Kw&&e.timeZone===t?e:new Kw(e,t)}function lD(e,t,n){if(!n)return cD(e,t);let r=cD(e,t),i=new Kw(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function uD(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?lD(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?lD(e,t,n):e):zT(e)?{...e,from:e.from?cD(e.from,t):e.from,to:e.to?cD(e.to,t):e.to}:RT(e)?{before:lD(e.before,t,n),after:lD(e.after,t,n)}:BT(e)?{after:lD(e.after,t,n)}:VT(e)?{before:lD(e.before,t,n)}:e}function dD(e,t,n){return e&&(Array.isArray(e)?e.map(e=>uD(e,t,n)):uD(e,t,n))}function fD(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=cD(t.today,n),t.month&&=cD(t.month,n),t.defaultMonth&&=cD(t.defaultMonth,n),t.startMonth&&=cD(t.startMonth,n),t.endMonth&&=cD(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=cD(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>cD(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?cD(t.selected.from,n):t.selected.from,to:t.selected.to?cD(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=dD(t.disabled,n)),t.hidden!==void 0&&(t.hidden=dD(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=dD(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,Q.useMemo)(()=>{let e={...Qw,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?OE(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new $w({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:qT(t.components),formatters:oE(t.formatters),labels:CE(t.labels,a.options),locale:e,classNames:{...YT(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:v,onNextClick:y,onPrevClick:b,showWeekNumber:x,styles:S}=t,{formatCaption:C,formatDay:w,formatMonthDropdown:T,formatWeekNumber:E,formatWeekNumberHeader:D,formatWeekdayName:O,formatYearDropdown:k}=i,A=qE(t,o),{days:j,months:M,navStart:N,navEnd:P,previousMonth:F,nextMonth:I,goToMonth:L}=A,R=GT(j,t,N,P,o),{isSelected:z,select:B,selected:V}=sD(t,o)??{},{blur:H,focused:U,isFocusTarget:W,moveFocus:G,setFocused:K}=$E(t,A,R,z??(()=>!1),o),{labelDayButton:q,labelGridcell:ee,labelGrid:te,labelMonthDropdown:ne,labelNav:re,labelPrevious:ie,labelNext:ae,labelWeekday:oe,labelWeekNumber:se,labelWeekNumberHeader:ce,labelYearDropdown:le}=a,ue=(0,Q.useMemo)(()=>EE(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),de=u!==void 0||m!==void 0,fe=(0,Q.useCallback)(()=>{F&&(L(F),b?.(F))},[F,L,b]),pe=(0,Q.useCallback)(()=>{I&&(L(I),y?.(I))},[L,I,y]),me=(0,Q.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),K(e),!t.disabled&&(B?.(e.date,t,n),m?.(e.date,t,n))},[B,m,K]),he=(0,Q.useCallback)((e,t)=>n=>{K(e),h?.(e.date,t,n)},[h,K]),ge=(0,Q.useCallback)((e,t)=>n=>{H(),p?.(e.date,t,n)},[H,p]),_e=(0,Q.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];G(e,t)}g?.(e.date,n,r)},[G,g,t.dir]),ve=(0,Q.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),ye=(0,Q.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),be=(0,Q.useCallback)(e=>t=>{let n=Number(t.target.value);L(o.setMonth(o.startOfMonth(e),n))},[o,L]),xe=(0,Q.useCallback)(e=>t=>{let n=Number(t.target.value);L(o.setYear(o.startOfMonth(e),n))},[o,L]),{className:Se,style:Ce}=(0,Q.useMemo)(()=>({className:[c[lT.Root],t.className].filter(Boolean).join(` `),style:{...S?.[lT.Root],...t.style}}),[c,t.className,t.style,S]),we=JT(t),J=(0,Q.useRef)(null);IE(J,!!t.animate,{classNames:c,months:M,focused:U,dateLib:o});let Te={dayPickerProps:t,selected:V,select:B,isSelected:z,months:M,nextMonth:I,previousMonth:F,goToMonth:L,getModifiers:R,components:r,classNames:c,styles:S,labels:a,formatters:i};return Q.createElement(bT.Provider,{value:Te},Q.createElement(r.Root,{rootRef:t.animate?J:void 0,className:Se,style:Ce,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...we},Q.createElement(r.Months,{className:c[lT.Months],style:S?.[lT.Months]},!t.hideNavigation&&!d&&Q.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[lT.Nav],style:S?.[lT.Nav],"aria-label":re(),onPreviousClick:fe,onNextClick:pe,previousMonth:F,nextMonth:I}),M.map((e,n)=>Q.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[lT.Month],style:S?.[lT.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&Q.createElement(r.PreviousMonthButton,{type:`button`,className:c[lT.PreviousMonthButton],tabIndex:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":ie(F),onClick:fe,"data-animated-button":t.animate?`true`:void 0},Q.createElement(r.Chevron,{disabled:F?void 0:!0,className:c[lT.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),Q.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[lT.MonthCaption],style:S?.[lT.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?Q.createElement(r.DropdownNav,{className:c[lT.Dropdowns],style:S?.[lT.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?Q.createElement(r.MonthsDropdown,{key:`month`,className:c[lT.MonthsDropdown],"aria-label":ne(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:be(e.date),options:wE(e.date,N,P,i,o),style:S?.[lT.Dropdown],value:o.getMonth(e.date)}):Q.createElement(`span`,{key:`month`},T(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?Q.createElement(r.YearsDropdown,{key:`year`,className:c[lT.YearsDropdown],"aria-label":le(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:xe(e.date),options:DE(N,P,i,o,!!t.reverseYears),style:S?.[lT.Dropdown],value:o.getYear(e.date)}):Q.createElement(`span`,{key:`year`},k(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),Q.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},C(e.date,o.options,o))):Q.createElement(r.CaptionLabel,{className:c[lT.CaptionLabel],role:`status`,"aria-live":`polite`},C(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&Q.createElement(r.NextMonthButton,{type:`button`,className:c[lT.NextMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":ae(I),onClick:pe,"data-animated-button":t.animate?`true`:void 0},Q.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[lT.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&Q.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[lT.Nav],style:S?.[lT.Nav],"aria-label":re(),onPreviousClick:fe,onNextClick:pe,previousMonth:F,nextMonth:I}),Q.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":te(e.date,o.options,o)||void 0,className:c[lT.MonthGrid],style:S?.[lT.MonthGrid]},!t.hideWeekdays&&Q.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[lT.Weekdays],style:S?.[lT.Weekdays]},x&&Q.createElement(r.WeekNumberHeader,{"aria-label":ce(o.options),className:c[lT.WeekNumberHeader],style:S?.[lT.WeekNumberHeader],scope:`col`},D()),ue.map(e=>Q.createElement(r.Weekday,{"aria-label":oe(e,o.options,o),className:c[lT.Weekday],key:String(e),style:S?.[lT.Weekday],scope:`col`},O(e,o.options,o)))),Q.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[lT.Weeks],style:S?.[lT.Weeks]},e.weeks.map(e=>Q.createElement(r.Week,{className:c[lT.Week],key:e.weekNumber,style:S?.[lT.Week],week:e},x&&Q.createElement(r.WeekNumber,{week:e,style:S?.[lT.WeekNumber],"aria-label":se(e.weekNumber,{locale:s}),className:c[lT.WeekNumber],scope:`row`,role:`rowheader`},E(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=R(e);if(i[uT.focused]=!i.hidden&&!!U?.isEqualTo(e),i[dT.selected]=z?.(n)||i.selected,zT(V)){let{from:e,to:t}=V;i[dT.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[dT.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[dT.range_middle]=LT(V,n,!0,o)}let a=TE(i,S,t.modifiersStyles),s=KT(i,c,t.modifiersClassNames),l=!de&&!i.hidden?ee(n,i,o.options,o):void 0;return Q.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&de?Q.createElement(r.DayButton,{className:c[lT.DayButton],style:S?.[lT.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:W(e)?0:-1,"aria-label":q(n,i,o.options,o),onClick:me(e,i),onBlur:ge(e,i),onFocus:he(e,i),onKeyDown:_e(e,i),onMouseEnter:ve(e,i),onMouseLeave:ye(e,i)},w(n,o.options,o)):!i.hidden&&w(e.date,o.options,o))})))))))),t.footer&&Q.createElement(r.Footer,{className:c[lT.Footer],style:S?.[lT.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function pD(e){let t=(0,$.c)(97),n,r,i,a,o,s,c,l,u;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],u=t[9]):({className:n,classNames:r,showOutsideDays:c,captionLayout:l,buttonVariant:u,locale:o,formatters:a,components:i,...s}=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,t[9]=u);let d=c===void 0?!0:c,f=l===void 0?`label`:l,p=u===void 0?`ghost`:u,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W;if(t[10]!==p||t[11]!==f||t[12]!==n||t[13]!==a||t[14]!==o||t[15]!==s.showWeekNumber||t[16]!==d){let e=YT();m=fD,P=d,t[48]===n?F=t[49]:(F=Y(`group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent`,`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,n),t[48]=n,t[49]=F),I=f,L=o;let r;t[50]===o?.code?r=t[51]:(r=e=>e.toLocaleString(o?.code,{month:`short`}),t[50]=o?.code,t[51]=r),t[52]!==a||t[53]!==r?(R={formatMonthDropdown:r,...a},t[52]=a,t[53]=r,t[54]=R):R=t[54],z=Y(`w-fit`,e.root),B=Y(`relative flex flex-col gap-4 md:flex-row`,e.months),V=Y(`flex w-full flex-col gap-4`,e.month),H=Y(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,e.nav),U=Y(Wr({variant:p}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,e.button_previous),W=Y(Wr({variant:p}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,e.button_next),h=Y(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,e.month_caption),g=Y(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,e.dropdowns),_=Y(`relative rounded-(--cell-radius)`,e.dropdown_root),v=Y(`absolute inset-0 bg-popover opacity-0`,e.dropdown),y=Y(`font-medium select-none`,f===`label`?`text-sm`:`flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,e.caption_label),b=`w-full border-collapse`,x=Y(`flex`,e.weekdays),S=Y(`flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none`,e.weekday),C=Y(`mt-2 flex w-full`,e.week),w=Y(`w-(--cell-size) select-none`,e.week_number_header),T=Y(`text-[0.8rem] text-muted-foreground select-none`,e.week_number),E=Y(`group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)`,s.showWeekNumber?`[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)`:`[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)`,e.day),D=Y(`relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted`,e.range_start),O=Y(`rounded-none`,e.range_middle),k=Y(`relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted`,e.range_end),A=Y(`rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none`,e.today),j=Y(`text-muted-foreground aria-selected:text-muted-foreground`,e.outside),M=Y(`text-muted-foreground opacity-50`,e.disabled),N=Y(`invisible`,e.hidden),t[10]=p,t[11]=f,t[12]=n,t[13]=a,t[14]=o,t[15]=s.showWeekNumber,t[16]=d,t[17]=m,t[18]=h,t[19]=g,t[20]=_,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S,t[26]=C,t[27]=w,t[28]=T,t[29]=E,t[30]=D,t[31]=O,t[32]=k,t[33]=A,t[34]=j,t[35]=M,t[36]=N,t[37]=P,t[38]=F,t[39]=I,t[40]=L,t[41]=R,t[42]=z,t[43]=B,t[44]=V,t[45]=H,t[46]=U,t[47]=W}else m=t[17],h=t[18],g=t[19],_=t[20],v=t[21],y=t[22],b=t[23],x=t[24],S=t[25],C=t[26],w=t[27],T=t[28],E=t[29],D=t[30],O=t[31],k=t[32],A=t[33],j=t[34],M=t[35],N=t[36],P=t[37],F=t[38],I=t[39],L=t[40],R=t[41],z=t[42],B=t[43],V=t[44],H=t[45],U=t[46],W=t[47];let G;t[55]!==r||t[56]!==h||t[57]!==g||t[58]!==_||t[59]!==v||t[60]!==y||t[61]!==b||t[62]!==x||t[63]!==S||t[64]!==C||t[65]!==w||t[66]!==T||t[67]!==E||t[68]!==D||t[69]!==O||t[70]!==k||t[71]!==A||t[72]!==j||t[73]!==M||t[74]!==N||t[75]!==z||t[76]!==B||t[77]!==V||t[78]!==H||t[79]!==U||t[80]!==W?(G={root:z,months:B,month:V,nav:H,button_previous:U,button_next:W,month_caption:h,dropdowns:g,dropdown_root:_,dropdown:v,caption_label:y,table:b,weekdays:x,weekday:S,week:C,week_number_header:w,week_number:T,day:E,range_start:D,range_middle:O,range_end:k,today:A,outside:j,disabled:M,hidden:N,...r},t[55]=r,t[56]=h,t[57]=g,t[58]=_,t[59]=v,t[60]=y,t[61]=b,t[62]=x,t[63]=S,t[64]=C,t[65]=w,t[66]=T,t[67]=E,t[68]=D,t[69]=O,t[70]=k,t[71]=A,t[72]=j,t[73]=M,t[74]=N,t[75]=z,t[76]=B,t[77]=V,t[78]=H,t[79]=U,t[80]=W,t[81]=G):G=t[81];let K;t[82]===o?K=t[83]:(K=e=>{let{...t}=e;return(0,Z.jsx)(_D,{locale:o,...t})},t[82]=o,t[83]=K);let q;t[84]!==i||t[85]!==K?(q={Root:gD,Chevron:hD,DayButton:K,WeekNumber:mD,...i},t[84]=i,t[85]=K,t[86]=q):q=t[86];let ee;return t[87]!==m||t[88]!==s||t[89]!==P||t[90]!==F||t[91]!==I||t[92]!==L||t[93]!==R||t[94]!==G||t[95]!==q?(ee=(0,Z.jsx)(m,{showOutsideDays:P,className:F,captionLayout:I,locale:L,formatters:R,classNames:G,components:q,...s}),t[87]=m,t[88]=s,t[89]=P,t[90]=F,t[91]=I,t[92]=L,t[93]=R,t[94]=G,t[95]=q,t[96]=ee):ee=t[96],ee}function mD(e){let{children:t,...n}=e;return(0,Z.jsx)(`td`,{...n,children:(0,Z.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:t})})}function hD(e){let{className:t,orientation:n,...r}=e;return n===`left`?(0,Z.jsx)(ls,{className:Y(`size-4`,t),...r}):n===`right`?(0,Z.jsx)(l,{className:Y(`size-4`,t),...r}):(0,Z.jsx)(Ie,{className:Y(`size-4`,t),...r})}function gD(e){let{className:t,rootRef:n,...r}=e;return(0,Z.jsx)(`div`,{"data-slot":`calendar`,ref:n,className:Y(t),...r})}function _D(e){let t=(0,$.c)(21),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,day:r,modifiers:a,locale:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=YT(),c=Q.useRef(null),l,u;t[6]===a.focused?(l=t[7],u=t[8]):(l=()=>{a.focused&&c.current?.focus()},u=[a.focused],t[6]=a.focused,t[7]=l,t[8]=u),Q.useEffect(l,u);let d=X,f;t[9]!==r.date||t[10]!==i?.code?(f=r.date.toLocaleDateString(i?.code),t[9]=r.date,t[10]=i?.code,t[11]=f):f=t[11];let p=a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,m=a.range_start,h=a.range_end,g=a.range_middle,_=Y(`relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70`,s.day,n),v;return t[12]!==d||t[13]!==a.range_end||t[14]!==a.range_middle||t[15]!==a.range_start||t[16]!==o||t[17]!==_||t[18]!==f||t[19]!==p?(v=(0,Z.jsx)(d,{ref:c,variant:`ghost`,size:`icon`,"data-day":f,"data-selected-single":p,"data-range-start":m,"data-range-end":h,"data-range-middle":g,className:_,...o}),t[12]=d,t[13]=a.range_end,t[14]=a.range_middle,t[15]=a.range_start,t[16]=o,t[17]=_,t[18]=f,t[19]=p,t[20]=v):v=t[20],v}function vD(e){let t=(0,$.c)(16),{keyName:n,value:r,onCommit:i}=e,[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(!1),l,u;t[0]===r?(l=t[1],u=t[2]):(l=()=>{s.current||o(r)},u=[r],t[0]=r,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d=`${n} value`,f,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>o(e.target.value),p=()=>{s.current=!0},t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m,h;t[5]!==a||t[6]!==i||t[7]!==r?(m=()=>{if(s.current=!1,c.current){c.current=!1;return}a!==r&&i(a)},h=e=>{e.key===`Enter`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey?(e.preventDefault(),a!==r&&i(a),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c.current=!0,o(r),e.currentTarget.blur())},t[5]=a,t[6]=i,t[7]=r,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g;return t[10]!==a||t[11]!==n||t[12]!==d||t[13]!==m||t[14]!==h?(g=(0,Z.jsx)(`textarea`,{"data-testid":`text-widget`,"data-key":n,rows:1,value:a,placeholder:`Empty`,"aria-label":d,onChange:f,onFocus:p,onBlur:m,onKeyDown:h,className:`block w-full min-h-7 resize-none field-sizing-content border-transparent bg-transparent px-2 py-1 text-sm leading-tight shadow-none placeholder:text-muted-foreground/60 focus-visible:border-transparent focus-visible:bg-muted focus-visible:outline-none focus-visible:ring-0 rounded-sm dark:bg-transparent dark:focus-visible:bg-muted`}),t[10]=a,t[11]=n,t[12]=d,t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function yD(e){let t=(0,$.c)(17),{keyName:n,value:r,onCommit:i}=e,[a,o]=(0,Q.useState)(String(r)),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(!1),l,u;t[0]===r?(l=t[1],u=t[2]):(l=()=>{s.current||o(String(r))},u=[r],t[0]=r,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d=`${n} value`,f,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>o(e.target.value),p=()=>{s.current=!0},t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m;t[5]!==a||t[6]!==i||t[7]!==r?(m=()=>{if(s.current=!1,c.current){c.current=!1,o(String(r));return}let e=Number.parseFloat(a),t=Number.isFinite(e)?e:0;t===r?o(String(r)):i(t)},t[5]=a,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h;t[9]===r?h=t[10]:(h=e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c.current=!0,o(String(r)),e.currentTarget.blur())},t[9]=r,t[10]=h);let g;return t[11]!==a||t[12]!==n||t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Z.jsx)(fo,{"data-testid":`number-widget`,"data-key":n,type:`number`,value:a,"aria-label":d,onChange:f,onFocus:p,onBlur:m,onKeyDown:h,className:`h-7 border-transparent bg-transparent dark:bg-transparent px-2 text-sm shadow-none focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm dark:focus-visible:bg-muted`}),t[11]=a,t[12]=n,t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function bD(e){let t=(0,$.c)(7),{keyName:n,value:r,onCommit:i}=e,a;t[0]===i?a=t[1]:(a=e=>i(e===!0),t[0]=i,t[1]=a);let o=`${n} value`,s;return t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`flex h-7 items-center px-2`,children:(0,Z.jsx)($a,{"data-testid":`boolean-widget`,"data-key":n,checked:r,onCheckedChange:a,"aria-label":o,className:`size-5 rounded-full`})}),t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s}function xD(e){let t=(0,$.c)(42),{keyName:n,value:r,onCommit:i}=e,a,o,s;t[0]===r?(a=t[1],o=t[2],s=t[3]):(a=CD(r),o=Q.useState,s=wD(a),t[0]=r,t[1]=a,t[2]=o,t[3]=s);let[c,l]=o(s),[u,d]=(0,Q.useState)(a),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=(0,Q.useRef)(!1),g,_;t[4]===r?(g=t[5],_=t[6]):(g=()=>{if(!m.current){let e=CD(r);l(wD(e)),d(e)}},_=[r],t[4]=r,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v;t[7]!==a||t[8]!==c||t[9]!==i||t[10]!==r?(v=function(){let e=ED(c);if(e){let t=KS(e,`yyyy-MM-dd`);t!==r&&i(t),l(wD(e)),d(e)}else l(wD(a)),d(a)},t[7]=a,t[8]=c,t[9]=i,t[10]=r,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==r?(b=function(e){if(!e)return;let t=KS(e,`yyyy-MM-dd`);t!==r&&i(t),l(wD(e)),d(e),p(!1)},t[12]=i,t[13]=r,t[14]=b):b=t[14];let x=b,S=`${n} value`,C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{l(e.target.value);let t=ED(e.target.value);t&&d(t)},w=()=>{m.current=!0},t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;t[17]===y?T=t[18]:(T=()=>{if(m.current=!1,h.current){h.current=!1;return}y()},t[17]=y,t[18]=T);let D;t[19]!==y||t[20]!==a?(D=e=>{e.key===`Enter`?(e.preventDefault(),y(),e.currentTarget.blur()):e.key===`Escape`?(e.preventDefault(),h.current=!0,l(wD(a)),e.currentTarget.blur()):e.key===`ArrowDown`&&(e.preventDefault(),p(!0))},t[19]=y,t[20]=a,t[21]=D):D=t[21];let O;t[22]!==c||t[23]!==T||t[24]!==D||t[25]!==S?(O=(0,Z.jsx)(fo,{type:`text`,value:c,placeholder:`Empty`,"aria-label":S,onChange:C,onFocus:w,onBlur:T,onKeyDown:D,className:`h-7 border-transparent bg-transparent dark:bg-transparent pr-7 pl-2 text-sm shadow-none placeholder:text-muted-foreground/60 focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm dark:focus-visible:bg-muted`}),t[22]=c,t[23]=T,t[24]=D,t[25]=S,t[26]=O):O=t[26];let k=`Open date picker for ${n}`,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(ss,{className:`size-3.5`}),t[27]=A):A=t[27];let j;t[28]===k?j=t[29]:(j=(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":k,className:`absolute right-0 size-6 p-0 text-muted-foreground hover:bg-muted hover:text-foreground`,children:A})}),t[28]=k,t[29]=j);let M;t[30]!==a||t[31]!==x||t[32]!==u?(M=(0,Z.jsx)(ae,{className:`w-auto overflow-hidden p-0`,align:`end`,children:(0,Z.jsx)(pD,{mode:`single`,selected:a,month:u,onMonthChange:d,onSelect:x,captionLayout:`dropdown`})}),t[30]=a,t[31]=x,t[32]=u,t[33]=M):M=t[33];let N;t[34]!==f||t[35]!==j||t[36]!==M?(N=(0,Z.jsxs)(E,{open:f,onOpenChange:p,children:[j,M]}),t[34]=f,t[35]=j,t[36]=M,t[37]=N):N=t[37];let P;return t[38]!==n||t[39]!==O||t[40]!==N?(P=(0,Z.jsxs)(`div`,{"data-testid":`date-widget`,"data-key":n,className:`relative flex h-7 items-center`,children:[O,N]}),t[38]=n,t[39]=O,t[40]=N,t[41]=P):P=t[41],P}var SD=`MMM d, yyyy`;function CD(e){if(!e)return;let t=pw(e);return Number.isNaN(t.getTime())?void 0:t}function wD(e){return e?KS(e,SD):``}var TD=[`MMM d, yyyy`,`MMMM d, yyyy`,`yyyy-MM-dd`,`M/d/yyyy`,`MM/dd/yyyy`];function ED(e){let t=e.trim();if(!t)return;let n=new Date;for(let e of TD){let r=lw(t,e,n);if(!Number.isNaN(r.getTime()))return r}}function DD(e){let t=(0,$.c)(32),{keyName:n,value:r,onCommit:i}=e,[a,o]=(0,Q.useState)(``),s;t[0]!==i||t[1]!==r?(s=function(e){let t=e.trim();t&&(i([...r,t]),o(``))},t[0]=i,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]!==i||t[4]!==r?(l=function(e){let t=r.slice();t.splice(e,1),i(t)},t[3]=i,t[4]=r,t[5]=l):l=t[5];let u=l,d=n===`tags`,f;if(t[6]!==d||t[7]!==u||t[8]!==r){let e;t[10]!==d||t[11]!==u?(e=(e,t)=>{let n=d&&$n.test(e);return(0,Z.jsxs)(`span`,{"data-testid":`list-chip`,"data-index":t,className:Y(`inline-flex items-center text-1sm gap-0.5 rounded-full py-0.5 pl-2 pr-1.5 transition-colors`,n?`bg-primary/10 font-medium text-primary has-[button[data-tag]:hover]:bg-primary/20 has-[button[data-tag]:active]:bg-primary/25`:`bg-muted `),children:[n?(0,Z.jsxs)(`button`,{type:`button`,"data-tag":e,"aria-label":`Open documents tagged #${e}`,onClick:()=>ke(e),className:`cursor-pointer rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[`#`,e]}):(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>u(t),className:Y(`inline-flex items-center justify-center rounded-sm p-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,n?`text-primary opacity-70 hover:text-primary hover:opacity-100`:`text-muted-foreground hover:text-foreground`),children:(0,Z.jsx)(Fa,{className:`size-3`,"aria-hidden":`true`})})]},`${t}-${e}`)},t[10]=d,t[11]=u,t[12]=e):e=t[12],f=r.map(e),t[6]=d,t[7]=u,t[8]=r,t[9]=f}else f=t[9];let p=r.length===0?`Empty`:``,m=`${n} value`,h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>o(e.target.value),t[13]=h):h=t[13];let g;t[14]!==c||t[15]!==a||t[16]!==u||t[17]!==r.length?(g=e=>{e.key===`Enter`?(e.preventDefault(),c(a)):e.key===`Backspace`&&a===``&&r.length>0?(e.preventDefault(),u(r.length-1)):e.key===`Escape`&&(e.preventDefault(),o(``),e.currentTarget.blur())},t[14]=c,t[15]=a,t[16]=u,t[17]=r.length,t[18]=g):g=t[18];let _;t[19]!==c||t[20]!==a?(_=()=>{a&&c(a)},t[19]=c,t[20]=a,t[21]=_):_=t[21];let v;t[22]!==a||t[23]!==p||t[24]!==m||t[25]!==g||t[26]!==_?(v=(0,Z.jsx)(`input`,{"data-testid":`list-chip-input`,type:`text`,value:a,placeholder:p,"aria-label":m,onChange:h,onKeyDown:g,onBlur:_,className:`min-w-16 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60`}),t[22]=a,t[23]=p,t[24]=m,t[25]=g,t[26]=_,t[27]=v):v=t[27];let y;return t[28]!==n||t[29]!==f||t[30]!==v?(y=(0,Z.jsxs)(`div`,{"data-testid":`list-widget`,"data-key":n,className:`flex min-h-7 w-full min-w-0 flex-wrap items-center gap-1 rounded-md px-2 py-1 focus-within:bg-background`,children:[f,v]}),t[28]=n,t[29]=f,t[30]=v,t[31]=y):y=t[31],y}var OD={text:hc,number:_t,boolean:oc,date:ss,list:He},kD={text:`Text`,number:`Number`,boolean:`Checkbox`,date:`Date`,list:`List`};function AD(e){let t=(0,$.c)(27),{keyName:n,type:r,onChangeType:i,disabled:a}=e,o=a===void 0?!1:a,s=OD[r];if(o){let e=`${n} type: ${kD[r]} (inherited from folder defaults; not editable here)`,i;t[0]===s?i=t[1]:(i=(0,Z.jsx)(s,{className:`size-3.5`}),t[0]=s,t[1]=i);let a;t[2]!==n||t[3]!==e||t[4]!==i||t[5]!==r?(a=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`inline-flex`,children:(0,Z.jsx)(`button`,{type:`button`,disabled:!0,"data-testid":`type-icon-button`,"data-key":n,"data-type":r,"aria-label":e,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground disabled:cursor-default`,children:i})})}),t[2]=n,t[3]=e,t[4]=i,t[5]=r,t[6]=a):a=t[6];let o;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(co,{children:`Inherited — set a value to override.`}),t[7]=o):o=t[7];let c;return t[8]===a?c=t[9]:(c=(0,Z.jsxs)(uo,{children:[a,o]}),t[8]=a,t[9]=c),c}let c=`${n} type: ${kD[r]}. Click to change.`,l;t[10]===s?l=t[11]:(l=(0,Z.jsx)(s,{className:`size-3.5`}),t[10]=s,t[11]=l);let u;t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==r?(u=(0,Z.jsx)(Si,{"data-testid":`type-icon-button`,"data-key":n,"data-type":r,"aria-label":c,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l}),t[12]=n,t[13]=c,t[14]=l,t[15]=r,t[16]=u):u=t[16];let d;t[17]===i?d=t[18]:(d=e=>i(e),t[17]=i,t[18]=d);let f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=Object.keys(OD),t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=f.map(jD),t[20]=p):p=t[20];let m;t[21]!==d||t[22]!==r?(m=(0,Z.jsx)(Aa,{align:`start`,"data-testid":`type-picker-menu`,children:(0,Z.jsx)(bi,{value:r,onValueChange:d,children:p})}),t[21]=d,t[22]=r,t[23]=m):m=t[23];let h;return t[24]!==u||t[25]!==m?(h=(0,Z.jsxs)(ji,{children:[u,m]}),t[24]=u,t[25]=m,t[26]=h):h=t[26],h}function jD(e){let t=OD[e];return(0,Z.jsxs)(Ii,{value:e,"data-testid":`type-picker-item`,"data-type":e,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),(0,Z.jsx)(`span`,{children:kD[e]})]},e)}function MD(e,t){switch(t){case`text`:return Array.isArray(e)?e.join(`, `):String(e);case`number`:{if(typeof e==`number`)return e;let t=Array.isArray(e)?e[0]:String(e),n=Number.parseFloat(t??``);return Number.isFinite(n)?n:0}case`boolean`:return typeof e==`boolean`?e:typeof e==`number`?e!==0:((Array.isArray(e)?e[0]:String(e))??``).toLowerCase()===`true`;case`date`:return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e)?e:new Date().toISOString().slice(0,10);case`list`:{if(Array.isArray(e))return e;let t=String(e);return t?[t]:[]}}}function ND(e,t){return Array.isArray(e)?`list`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:t===`list`?`text`:t}function PD(e){let t=(0,$.c)(21),{keyName:n,value:r,declared:i,error:a,resetCounter:o,sortableId:s,rename:c,isDuplicate:l,badge:u,isInherited:d,onCommit:f,onChangeType:p,onRemove:m}=e,h=o===void 0?0:o,g=l===void 0?!1:l,_=d===void 0?!1:d,v;t[0]!==u||t[1]!==i||t[2]!==a||t[3]!==g||t[4]!==_||t[5]!==n||t[6]!==p||t[7]!==f||t[8]!==m||t[9]!==c||t[10]!==h||t[11]!==r?(v=e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-1`,children:[e,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1${_?` opacity-60`:``}`,"data-testid":`property-row-identity`,children:[(0,Z.jsx)(AD,{keyName:n,type:i,onChangeType:p,disabled:_}),(0,Z.jsx)(`div`,{className:`w-32 shrink-0`,children:c?.state?(0,Z.jsx)(LD,{keyName:n,draft:c.state.draft,error:c.state.error,onChangeDraft:c.onChangeDraft,onCommit:c.onCommit,onCancel:c.onCancel}):(0,Z.jsx)(RD,{keyName:n,onBegin:c?.onBegin,disabled:!c,isInherited:_})})]}),g?(0,Z.jsx)(`span`,{"data-testid":`property-duplicate-marker`,"data-key":n,title:`Duplicate name "${n}"`,className:`flex size-4 items-center justify-center text-amber-600`,children:(0,Z.jsx)(Dn,{className:`size-3.5`})}):null,(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:_&&i===`list`?(0,Z.jsx)(HD,{keyName:n,value:Array.isArray(r)?r:[]}):(0,Z.jsx)(BD,{keyName:n,value:r,widgetType:i,onCommit:f},`widget-${h}`)}),u?(0,Z.jsx)(`div`,{className:`shrink-0 min-h-7 flex items-center`,children:u}):null,m?(0,Z.jsx)(X,{type:`button`,"data-testid":`property-remove-button`,"data-key":n,"aria-label":`Remove ${n}`,onClick:m,variant:`ghost`,size:`icon-sm`,className:`flex shrink-0 items-center justify-center rounded text-muted-foreground/0 hover:bg-muted hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:text-muted-foreground`,children:(0,Z.jsx)(fe,{className:`size-3.5`})}):null]}),a?(0,Z.jsx)(`div`,{role:`alert`,"data-testid":`property-error`,"data-key":n,className:`pl-9 text-[10px] text-destructive`,children:a}):null]}),t[0]=u,t[1]=i,t[2]=a,t[3]=g,t[4]=_,t[5]=n,t[6]=p,t[7]=f,t[8]=m,t[9]=c,t[10]=h,t[11]=r,t[12]=v):v=t[12];let y;return t[13]!==i||t[14]!==a||t[15]!==g||t[16]!==_||t[17]!==n||t[18]!==s||t[19]!==v?(y=(0,Z.jsx)(FD,{sortableId:s,keyName:n,declared:i,error:a,isDuplicate:g,isInherited:_,children:v}),t[13]=i,t[14]=a,t[15]=g,t[16]=_,t[17]=n,t[18]=s,t[19]=v,t[20]=y):y=t[20],y}function FD(e){let t=(0,$.c)(19),{sortableId:n,keyName:r,declared:i,error:a,isDuplicate:o,isInherited:s,children:c}=e;if(n){let e;return t[0]!==c||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==r||t[5]!==n?(e=(0,Z.jsx)(ID,{sortableId:n,keyName:r,declared:i,error:a,isDuplicate:o,children:c}),t[0]=c,t[1]=i,t[2]=a,t[3]=o,t[4]=r,t[5]=n,t[6]=e):e=t[6],e}let l;t[7]===s?l=t[8]:(l=s?(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}):null,t[7]=s,t[8]=l);let u=l,d=a??void 0,f=o||void 0,p=s||void 0,m;t[9]!==c||t[10]!==u?(m=c(u),t[9]=c,t[10]=u,t[11]=m):m=t[11];let h;return t[12]!==i||t[13]!==r||t[14]!==d||t[15]!==f||t[16]!==p||t[17]!==m?(h=(0,Z.jsx)(`div`,{className:`group py-0.5`,"data-testid":`property-row`,"data-key":r,"data-widget-type":i,"data-error":d,"data-duplicate":f,"data-inherited":p,children:m}),t[12]=i,t[13]=r,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h):h=t[18],h}function ID(e){let t=(0,$.c)(27),{sortableId:n,keyName:r,declared:i,error:a,isDuplicate:o,children:s}=e,c;t[0]===n?c=t[1]:(c={id:n},t[0]=n,t[1]=c);let{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:p,isDragging:m}=wa(c),h;t[2]===f?h=t[3]:(h=Ti.Transform.toString(f),t[2]=f,t[3]=h);let g=m?.5:void 0,_=m?1:void 0,v;t[4]!==h||t[5]!==g||t[6]!==_||t[7]!==p?(v={transform:h,transition:p,opacity:g,zIndex:_},t[4]=h,t[5]=g,t[6]=_,t[7]=p,t[8]=v):v=t[8];let y=v,b=`Drag ${r} to reorder`,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(_i,{className:`size-3.5`}),t[9]=x):x=t[9];let S;t[10]!==l||t[11]!==r||t[12]!==u||t[13]!==b?(S=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`property-drag-handle`,"data-key":r,"aria-label":b,...l,...u,className:`h-7 w-4 shrink-0 cursor-grab touch-none px-0 text-muted-foreground/0 hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing group-hover:text-muted-foreground/60`,children:x}),t[10]=l,t[11]=r,t[12]=u,t[13]=b,t[14]=S):S=t[14];let C=S,w=a??void 0,T=o||void 0,E=m||void 0,D;t[15]!==s||t[16]!==C?(D=s(C),t[15]=s,t[16]=C,t[17]=D):D=t[17];let O;return t[18]!==i||t[19]!==r||t[20]!==d||t[21]!==y||t[22]!==T||t[23]!==E||t[24]!==D||t[25]!==w?(O=(0,Z.jsx)(`div`,{ref:d,style:y,className:`group py-0.5`,"data-testid":`property-row`,"data-key":r,"data-widget-type":i,"data-error":w,"data-duplicate":T,"data-dragging":E,children:D}),t[18]=i,t[19]=r,t[20]=d,t[21]=y,t[22]=T,t[23]=E,t[24]=D,t[25]=w,t[26]=O):O=t[26],O}function LD(e){let t=(0,$.c)(20),{keyName:n,draft:r,error:i,onChangeDraft:a,onCommit:o,onCancel:s}=e,c=i?`property-rename-error-${n}`:void 0,l=`Rename ${n}`,u=i?!0:void 0,d;t[0]===a?d=t[1]:(d=e=>a(e.target.value),t[0]=a,t[1]=d);let f;t[2]!==s||t[3]!==o?(f=e=>{e.key===`Enter`?(e.preventDefault(),o()):e.key===`Escape`&&(e.preventDefault(),s())},t[2]=s,t[3]=o,t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c||t[7]!==n||t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Z.jsx)(fo,{"data-testid":`property-name-rename-input`,"data-key":n,type:`text`,value:r,autoFocus:!0,"aria-label":l,"aria-invalid":u,"aria-describedby":c,onChange:d,onBlur:o,onKeyDown:f,className:`h-7 border-transparent bg-transparent dark:bg-transparent px-2 text-sm shadow-none focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm dark:focus-visible:bg-muted`}),t[5]=r,t[6]=c,t[7]=n,t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]!==i||t[15]!==c?(m=i?(0,Z.jsx)(`div`,{id:c,"data-testid":`property-name-rename-error`,className:`text-[10px] text-destructive`,children:i}):null,t[14]=i,t[15]=c,t[16]=m):m=t[16];let h;return t[17]!==p||t[18]!==m?(h=(0,Z.jsxs)(`div`,{children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19],h}function RD(e){let t=(0,$.c)(9),{keyName:n,onBegin:r,disabled:i,isInherited:a}=e,o;t[0]!==i||t[1]!==n||t[2]!==r?(o=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"data-testid":`property-name-button`,"data-key":n,onClick:r,disabled:i,className:`block h-7 w-full truncate px-2 py-0.5 text-left text-sm rounded-sm font-normal text-muted-foreground hover:bg-transparent hover:text-foreground disabled:opacity-100 disabled:cursor-default`,children:n}),t[0]=i,t[1]=n,t[2]=r,t[3]=o):o=t[3];let s=o;if(!a)return s;let c;t[4]===s?c=t[5]:(c=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`block w-full`,children:s})}),t[4]=s,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(co,{children:`Inherited — set a value to override.`}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,Z.jsxs)(uo,{children:[c,l]}),t[7]=c,t[8]=u),u}function zD(e){let t=(0,$.c)(35),{draft:n,onChangeName:r,onChangeType:i,onChangeValue:a,onCommit:o,onCancel:s}=e,c=n.error?`add-property-error-id`:void 0,l;t[0]!==n.type||t[1]!==i?(l=(0,Z.jsx)(AD,{keyName:`__add__`,type:n.type,onChangeType:i}),t[0]=n.type,t[1]=i,t[2]=l):l=t[2];let u=n.error?!0:void 0,d;t[3]===r?d=t[4]:(d=e=>r(e.target.value),t[3]=r,t[4]=d);let f;t[5]!==s||t[6]!==o?(f=e=>{e.key===`Enter`?(e.preventDefault(),o()):e.key===`Escape`&&(e.preventDefault(),s())},t[5]=s,t[6]=o,t[7]=f):f=t[7];let p;t[8]!==n.name||t[9]!==c||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Z.jsx)(fo,{"data-testid":`add-property-name-input`,type:`text`,value:n.name,autoFocus:!0,placeholder:`Property name`,"aria-label":`New property name`,"aria-invalid":u,"aria-describedby":c,onChange:d,onKeyDown:f,className:`h-7 w-32 border-transparent bg-transparent px-2 text-sm shadow-none placeholder:text-muted-foreground/60 focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm`}),t[8]=n.name,t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]!==n.type||t[15]!==n.value||t[16]!==a?(m=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(BD,{keyName:`__add__`,value:n.value,widgetType:n.type,onCommit:a})}),t[14]=n.type,t[15]=n.value,t[16]=a,t[17]=m):m=t[17];let h;t[18]===o?h=t[19]:(h=(0,Z.jsx)(X,{type:`button`,"data-testid":`add-property-commit`,onClick:o,size:`sm`,className:`rounded bg-primary text-xs text-primary-foreground hover:bg-primary/90`,children:`Add`}),t[18]=o,t[19]=h);let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Fa,{className:`size-3.5`}),t[20]=g):g=t[20];let _;t[21]===s?_=t[22]:(_=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`add-property-cancel`,onClick:s,"aria-label":`Cancel`,className:`rounded px-1 py-0.5 text-xs text-muted-foreground hover:text-foreground`,children:g}),t[21]=s,t[22]=_);let v;t[23]!==l||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-start gap-1`,children:[l,p,m,h,_]}),t[23]=l,t[24]=p,t[25]=m,t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.error||t[30]!==c?(y=n.error?(0,Z.jsx)(`div`,{id:c,role:`alert`,"data-testid":`add-property-error`,className:`mt-0.5 pl-7 text-[10px] text-destructive`,children:n.error}):null,t[29]=n.error,t[30]=c,t[31]=y):y=t[31];let b;return t[32]!==v||t[33]!==y?(b=(0,Z.jsxs)(`div`,{className:`mt-1 rounded border border-dashed bg-background/40 p-1`,"data-testid":`add-property-row`,children:[v,y]}),t[32]=v,t[33]=y,t[34]=b):b=t[34],b}function BD(e){let t=(0,$.c)(24),{keyName:n,value:r,widgetType:i,onCommit:a}=e;if(i===`list`){let e;t[0]===r?e=t[1]:(e=Array.isArray(r)?r:[],t[0]=r,t[1]=e);let i=e,o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,Z.jsx)(DD,{keyName:n,value:i,onCommit:a}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}if(i===`boolean`){let e=typeof r==`boolean`?r:!1,i;return t[6]!==e||t[7]!==n||t[8]!==a?(i=(0,Z.jsx)(bD,{keyName:n,value:e,onCommit:a}),t[6]=e,t[7]=n,t[8]=a,t[9]=i):i=t[9],i}if(i===`number`){let e=typeof r==`number`?r:0,i;return t[10]!==n||t[11]!==e||t[12]!==a?(i=(0,Z.jsx)(yD,{keyName:n,value:e,onCommit:a}),t[10]=n,t[11]=e,t[12]=a,t[13]=i):i=t[13],i}if(i===`date`){let e=typeof r==`string`?r:``,i;return t[14]!==n||t[15]!==a||t[16]!==e?(i=(0,Z.jsx)(xD,{keyName:n,value:e,onCommit:a}),t[14]=n,t[15]=a,t[16]=e,t[17]=i):i=t[17],i}let o;t[18]===r?o=t[19]:(o=typeof r==`string`?r:Array.isArray(r)?r.join(`, `):String(r),t[18]=r,t[19]=o);let s=o,c;return t[20]!==n||t[21]!==a||t[22]!==s?(c=(0,Z.jsx)(vD,{keyName:n,value:s,onCommit:a}),t[20]=n,t[21]=a,t[22]=s,t[23]=c):c=t[23],c}function VD(e){let t=(0,$.c)(2),{source:n}=e,r=`Inherited from ${n===``?`.ok/frontmatter.yml`:`${n}/.ok/frontmatter.yml`}`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(Ne,{variant:`gray`,"data-testid":`property-inherited-badge`,title:r,className:`text-2xs`,children:`inherited`}),t[0]=r,t[1]=i),i}function HD(e){let t=(0,$.c)(5),{keyName:n,value:r}=e,i;t[0]===r?i=t[1]:(i=r.length===0?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground/60`,children:`Empty`}):r.map(UD),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`list-widget-readonly`,"data-key":n,className:`flex min-h-7 w-full min-w-0 flex-wrap items-center gap-1 rounded-md px-2`,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function UD(e,t){return(0,Z.jsx)(`span`,{"data-testid":`list-chip-readonly`,"data-index":t,className:`inline-flex items-center text-1sm rounded-full bg-muted py-0.5 px-2`,children:String(e)},`${t}-${String(e)}`)}var WD={text:``,number:0,boolean:!1,date:``,list:[]};function GD(e){let t=(0,$.c)(74),{folderPath:n,state:r,onChange:i}=e,[a,o]=(0,Q.useState)(!1),[s,c]=(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)(qD,{}),(0,Z.jsx)(Gi,{className:`h-7 w-full`}),(0,Z.jsx)(Gi,{className:`h-7 w-full`}),(0,Z.jsx)(Gi,{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]:(_=Oa(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,j,M;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 Ea(n,{[e]:t});if(!r.ok){Xa.error(`Save failed: ${r.error}`);return}i()},f=async function(e){let t=await Ea(n,{[e]:null});if(!t.ok){Xa.error(`Remove failed: ${t.error}`);return}i()},m=function(e,t){let n=p[e];r(e,MD(n,t))},_;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){c({name:``,type:`text`,value:``,error:null}),o(!1)},t[31]=_):_=t[31],x=_;let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){c(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):WD[e];return{...t,type:e,value:n,error:null}})},t[32]=P):P=t[32],C=P;let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){c(t=>t&&{...t,value:e})},t[33]=F):F=t[33],w=F;let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){c(t=>t&&{...t,name:e,error:null})},t[34]=I):I=t[34],S=I;let L;t[35]!==s||t[36]!==n||t[37]!==p||t[38]!==i?(L=async function(){if(!s)return;let e=s.name.trim();if(!e){c({...s,error:`Name is required`});return}if(Object.hasOwn(p,e)){c({...s,error:`Key "${e}" already resolves here`});return}let t=await Ea(n,{[e]:s.value});if(!t.ok){c({...s,error:t.error});return}c(null),i()},t[35]=s,t[36]=n,t[37]=p,t[38]=i,t[39]=L):L=t[39],T=L;let z=function(e){d({key:e,draft:e,error:null})},B=function(e){d(t=>t&&{...t,draft:e,error:null})},V=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 Ea(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},H=function(){d(null)};M=`rounded-lg border bg-card`,b=A,O=!a,t[40]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>o(!e),t[40]=k):k=t[40];let U=`size-3 transition-transform ${a?``:`rotate-90`}`,W;t[41]===U?W=t[42]:(W=(0,Z.jsx)(l,{className:U,"aria-hidden":!0}),t[41]=U,t[42]=W);let G;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`span`,{children:`Folder defaults`}),t[43]=G):G=t[43];let K;t[44]===W?K=t[45]:(K=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,G]}),t[44]=W,t[45]=K);let q;t[46]===v?q=t[47]:(q=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:KD,children:v}),t[46]=v,t[47]=q),t[48]!==K||t[49]!==q?(j=(0,Z.jsxs)(R,{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:[K,q]}),t[48]=K,t[49]=q,t[50]=j):j=t[50],y=N,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)(PD,{keyName:e,value:t,declared:ND(t,on(t)),rename:n?{state:u?.key===e?u:null,onBegin:()=>z(e),onChangeDraft:B,onCommit:V,onCancel:H}:void 0,badge:n?null:(0,Z.jsx)(VD,{source:g[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>m(e,t),onRemove:n?()=>void f(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]=j,t[30]=M}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],j=t[29],M=t[30];let P;t[51]!==s||t[52]!==x||t[53]!==S||t[54]!==C||t[55]!==w||t[56]!==T?(P=s?(0,Z.jsx)(zD,{draft:s,onChangeName:S,onChangeType:C,onChangeValue:w,onCommit:()=>void T(),onCancel:()=>c(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)(Fi,{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]=P):P=t[57];let F;t[58]!==P||t[59]!==E||t[60]!==D?(F=(0,Z.jsxs)(`div`,{className:E,children:[D,P]}),t[58]=P,t[59]=E,t[60]=D,t[61]=F):F=t[61];let I;t[62]!==y||t[63]!==F?(I=(0,Z.jsx)(y,{children:F}),t[62]=y,t[63]=F,t[64]=I):I=t[64];let L;t[65]!==b||t[66]!==I||t[67]!==O||t[68]!==k||t[69]!==j?(L=(0,Z.jsxs)(b,{open:O,onOpenChange:k,children:[j,I]}),t[65]=b,t[66]=I,t[67]=O,t[68]=k,t[69]=j,t[70]=L):L=t[70];let z;return t[71]!==L||t[72]!==M?(z=(0,Z.jsx)(`section`,{className:M,children:L}),t[71]=L,t[72]=M,t[73]=z):z=t[73],z}function KD(e){return e.stopPropagation()}function qD(){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)(Ds,{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 JD(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function YD(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=JD(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function XD(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function ZD(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:YD(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:XD(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:YD(e,t.pageTitles),children:a}}function QD(e){let t=(0,$.c)(63),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g;t[0]===i?g=t[1]:(g=async function(e){p(!0);let t=e.scope===`user`?`user`:`project`,n=await Ki(e.scope===`user`?``:e.source_folder,e.name,t);if(p(!1),!n.ok){Xa.error(`Delete failed: ${n.error}`);return}Xa.success(`Template "${e.name}" deleted`),l(null),i()},t[0]=i,t[1]=g);let _=g;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)(Gi,{className:`h-12 w-full`}),(0,Z.jsx)(Gi,{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 v;t[5]===r.data.folder.templates_available?v=t[6]:(v=r.data.folder.templates_available??[],t[5]=r.data.folder.templates_available,t[6]=v);let y,b,x,S,C,w;if(t[7]!==c||t[8]!==f||t[9]!==o||t[10]!==n||t[11]!==_||t[12]!==i||t[13]!==v){let e=v.filter(eO),r;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:`Templates available`}),t[20]=r):r=t[20];let a=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r,(0,Z.jsx)(Ne,{className:`text-xs`,variant:`secondary`,children:e.length})]}),u;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>h(!0),children:[(0,Z.jsx)(Fi,{className:`size-3.5`,"aria-hidden":!0}),`New template`]}),t[21]=u):u=t[21];let p;t[22]===a?p=t[23]:(p=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[a,u]}),t[22]=a,t[23]=p);let m=e.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:e.map(e=>(0,Z.jsx)(tO,{template:e,onCreate:()=>d(e.name),onEdit:()=>s(e),onDelete:()=>l(e)},e.path))}),g;t[24]===m?g=t[25]:(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:m}),t[24]=m,t[25]=g),t[26]!==p||t[27]!==g?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[p,g]}),t[26]=p,t[27]=g,t[28]=S):S=t[28];let T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||s(null)},t[29]=T):T=t[29];let E=o?.scope===`user`?`user`:`project`;t[30]!==o||t[31]!==n||t[32]!==i||t[33]!==E?(C=(0,Z.jsx)($i,{folderPath:n,template:o,onOpenChange:T,onSaved:i,target:E}),t[30]=o,t[31]=n,t[32]=i,t[33]=E,t[34]=C):C=t[34];let D=!!c,O;t[35]===f?O=t[36]:(O=e=>{!e&&!f&&l(null)},t[35]=f,t[36]=O);let k;t[37]!==c||t[38]!==f||t[39]!==_?(k=c&&(0,Z.jsx)(Sa,{itemName:`template "${c.name}"`,isSubmitting:f,onDelete:()=>_(c),customDescription:`This permanently removes ${c.path}. Agents that reference this template by name will fail until it's recreated or shadowed by an ancestor.${c.scope===`inherited`?`
27
+ `);return t?n.pop():n.push(n.pop().slice(0,-1)),n}function P_(e,t){return`${e}\u0000${t}`}function F_(e,t,n){let r=Sn(e).body,i=Sn(t).body;return r===i?``:M_(n,r,i,``,``,{context:3})}function I_(e,t,n){let r=(0,$.c)(8),{activeProvider:i}=We(),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=P_(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=F_(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 L_=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityPanelDiffView-EaCFURAu.js`),__vite__mapDeps([17,1,7,18]),import.meta.url)).ActivityPanelDiffView}));function R_(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 z_(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function B_(e){return e.slice(0,7)}function V_(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 H_(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)(Zr,{...r}),t[3]=r,t[4]=e),e}if(n===`cursor`){let e;return t[5]===r?e=t[6]:(e=(0,Z.jsx)(ri,{...r}),t[5]=r,t[6]=e),e}if(n===`windsurf`){let e;return t[7]===r?e=t[8]:(e=(0,Z.jsx)(Yr,{...r}),t[7]=r,t[8]=e),e}if(n===`openai`){let e;return t[9]===r?e=t[10]:(e=(0,Z.jsx)(ei,{...r}),t[9]=r,t[10]=e),e}if(n===`cline`){let e;return t[11]===r?e=t[12]:(e=(0,Z.jsx)(ci,{...r}),t[11]=r,t[12]=e),e}if(n===`github`){let e;return t[13]===r?e=t[14]:(e=(0,Z.jsx)(oi,{...r}),t[13]=r,t[14]=e),e}let i=r,a;return t[15]===i?a=t[16]:(a=(0,Z.jsx)(ii,{strokeWidth:1.5,...i}),t[15]=i,t[16]=a),a}function U_(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)(As,{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=en(i),t[1]=i,t[2]=a);let o=a,s=r?En[o]??$t[o]:$t[o],c;t[3]!==s||t[4]!==i?(c=s??Sr(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)(H_,{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)(Ms,{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)(es,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[12]=e):e=t[12],e}let u;return t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(yc,{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)(ii,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[14]=e):e=t[14],e}if(n.author===`openknowledge-server`||n.author===`server`){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(es,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[15]=e):e=t[15],e}let i;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(yc,{className:`size-3.5 shrink-0 text-muted-foreground`}),t[16]=i):i=t[16],i}function W_(e){let t=(0,$.c)(20),{entries:n,defaultExpanded:r,isDark:i,diffLayout:a,cache:o,docName:s,expandedShas:c,onToggleExpanded:u,onRestoreSuccess:d}=e,[f,p]=(0,Q.useState)(r);if(n.length===0)return null;let m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>p(G_),t[0]=m):m=t[0];let h;t[1]===f?h=t[2]:(h=f?(0,Z.jsx)(Ie,{className:`size-3`}):(0,Z.jsx)(l,{className:`size-3`}),t[1]=f,t[2]=h);let g=f?`Hide ${n.length} auto-save${n.length>1?`s`:``}`:`Show ${n.length} auto-save${n.length>1?`s`:``}`,_;t[3]!==f||t[4]!==h||t[5]!==g?(_=(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":f,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-colors text-left`,onClick:m,children:[h,g]}),t[3]=f,t[4]=h,t[5]=g,t[6]=_):_=t[6];let v;t[7]!==o||t[8]!==a||t[9]!==s||t[10]!==n||t[11]!==f||t[12]!==c||t[13]!==i||t[14]!==d||t[15]!==u?(v=f&&n.map(e=>(0,Z.jsx)(av,{entry:e,isDark:i,diffLayout:a,cache:o,docName:s,expanded:c.has(e.sha),onToggleExpanded:u,onRestoreSuccess:d},e.sha)),t[7]=o,t[8]=a,t[9]=s,t[10]=n,t[11]=f,t[12]=c,t[13]=i,t[14]=d,t[15]=u,t[16]=v):v=t[16];let y;return t[17]!==_||t[18]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19],y}function G_(e){return!e}function K_(e){return e.checkpoint?e.checkpoint.kind:`save`}function q_(e){let t=K_(e);if(t===`save`)return`Save Version`;let n=e.checkpoint?.size??null,r=n!=null&&n>0?` (${J_(n)})`:``;return t===`bridge-merge-loss`?`Auto-saved before a concurrent edit${r}`:`Recovered from an external change${r}`}function J_(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/102.4)/10} KB`:`${Math.round(e/104857.6)/10} MB`}function Y_(e){return e.type===`checkpoint`?K_(e)===`save`?`version`:`auto-save`:`wip`}var X_={version:`Restore this version`,"auto-save":`Restore this auto-save`,wip:`Restore to this point`},Z_={version:`Restore this version?`,"auto-save":`Restore this auto-save?`,wip:`Restore to this point?`};function Q_(e){return X_[Y_(e)]}function $_(e){return Z_[Y_(e)]}function ev(e){let t=[];for(let n of e.contributors)if(n.summaries)for(let e of n.summaries)t.push(e);return t}function tv(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 u;t[4]===o?u=t[5]:(u=(0,Z.jsxs)(`li`,{className:`text-xs text-foreground/90`,children:[c,o]}),t[4]=o,t[5]=u);let d;t[6]!==r||t[7]!==s?(d=r&&s.map(rv),t[6]=r,t[7]=s,t[8]=d):d=t[8];let f;t[9]!==a||t[10]!==u||t[11]!==d?(f=(0,Z.jsxs)(`ul`,{id:a,className:`list-none`,children:[u,d]}),t[9]=a,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==a||t[15]!==s.length?(p=s.length>0&&(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":a,className:`inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer`,onClick:e=>{e.stopPropagation(),i(nv)},children:[r?(0,Z.jsx)(Ie,{className:`size-3`}):(0,Z.jsx)(l,{className:`size-3`}),r?`Hide`:`Show ${s.length} more`]}),t[13]=r,t[14]=a,t[15]=s.length,t[16]=p):p=t[16];let m;return t[17]!==f||t[18]!==p?(m=(0,Z.jsxs)(`div`,{className:`mt-0.5`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function nv(e){return!e}function rv(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 iv(e){let t=(0,$.c)(13),{sha:n,docName:r,cache:i,diffLayout:a,panelId:o}=e,s=I_(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)(Ze,{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)(Ze,{className:`size-3 animate-spin`}),`Loading diff renderer`]}),children:(0,Z.jsx)(L_,{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 av(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=R_(n.timestamp),t[0]=n.timestamp,t[1]=f);let p=f,m;t[2]===n?m=t[3]:(m=V_(n),t[2]=n,t[3]=m);let h=m,g=n.contributors.flatMap(ov),_;t[4]===n?_=t[5]:(_=ev(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}),Xa.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=ir.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}),Xa.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=K_(n);return e===`bridge-merge-loss`?(0,Z.jsx)(Dn,{className:`size-3.5 shrink-0 text-amber-600 dark:text-amber-400`,"aria-hidden":`true`}):e===`external-change-rescue`?(0,Z.jsx)(Ss,{className:`size-3.5 shrink-0 text-sky-600 dark:text-sky-400`,"aria-hidden":`true`}):(0,Z.jsx)(bs,{className:`size-3.5 shrink-0 text-muted-foreground`})})():(0,Z.jsx)(U_,{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:q_(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=Q_(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 K;t[40]===x?K=t[41]:(K=x?(0,Z.jsx)(Ze,{className:`size-3 animate-spin`}):(0,Z.jsx)(Qr,{className:`size-3`}),t[40]=x,t[41]=K);let q;t[42]!==x||t[43]!==W||t[44]!==G||t[45]!==K?(q=(0,Z.jsx)(so,{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:K})}),t[42]=x,t[43]=W,t[44]=G,t[45]=K,t[46]=q):q=t[46];let ee;t[47]===n?ee=t[48]:(ee=Q_(n),t[47]=n,t[48]=ee);let te;t[49]===ee?te=t[50]:(te=(0,Z.jsx)(co,{side:`top`,children:ee}),t[49]=ee,t[50]=te);let ne;t[51]!==q||t[52]!==te?(ne=(0,Z.jsxs)(uo,{children:[q,te]}),t[51]=q,t[52]=te,t[53]=ne):ne=t[53];let re;t[54]!==V||t[55]!==H||t[56]!==ne?(re=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[V,H,U,ne]}),t[54]=V,t[55]=H,t[56]=ne,t[57]=re):re=t[57];let ie;t[58]===v?ie=t[59]:(ie=v.length>0&&(0,Z.jsx)(tv,{summaries:v}),t[58]=v,t[59]=ie);let ae=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}),oe;t[60]!==re||t[61]!==ie||t[62]!==ae?(oe=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[re,ie,ae]}),t[60]=re,t[61]=ie,t[62]=ae,t[63]=oe):oe=t[63];let se;t[64]!==c||t[65]!==O||t[66]!==F||t[67]!==R||t[68]!==z||t[69]!==B||t[70]!==oe?(se=(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,oe]}),t[64]=c,t[65]=O,t[66]=F,t[67]=R,t[68]=z,t[69]=B,t[70]=oe,t[71]=se):se=t[71];let ce;t[72]!==o||t[73]!==a||t[74]!==w||t[75]!==s||t[76]!==n.sha||t[77]!==c?(ce=c&&(0,Z.jsx)(iv,{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]=ce):ce=t[78];let le;t[79]!==se||t[80]!==ce?(le=(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg`,children:[se,ce]}),t[79]=se,t[80]=ce,t[81]=le):le=t[81];let ue;t[82]!==A||t[83]!==b?(ue=e=>{e?b(!0):A()},t[82]=A,t[83]=b,t[84]=ue):ue=t[84];let de;t[85]===n?de=t[86]:(de=$_(n),t[85]=n,t[86]=de);let fe;t[87]===de?fe=t[88]:(fe=(0,Z.jsx)(Ra,{children:de}),t[87]=de,t[88]=fe);let pe;t[89]===n.timestamp?pe=t[90]:(pe=z_(n.timestamp),t[89]=n.timestamp,t[90]=pe);let me;t[91]===n.sha?me=t[92]:(me=B_(n.sha),t[91]=n.sha,t[92]=me);let he;t[93]!==p||t[94]!==pe||t[95]!==me?(he=(0,Z.jsxs)(`span`,{className:`font-medium text-foreground`,children:[p,` (`,pe,`, `,me,`)`]}),t[93]=p,t[94]=pe,t[95]=me,t[96]=he):he=t[96];let ge;t[97]===h?ge=t[98]:(ge=(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:h}),t[97]=h,t[98]=ge);let _e;t[99]!==he||t[100]!==ge?(_e=(0,Z.jsxs)(Ia,{children:[`This will replace the current document content with the version from`,` `,he,` `,`by `,ge,`. Your current content is already saved in the timeline — you can restore it anytime.`]}),t[99]=he,t[100]=ge,t[101]=_e):_e=t[101];let ve;t[102]!==fe||t[103]!==_e?(ve=(0,Z.jsxs)(qa,{children:[fe,_e]}),t[102]=fe,t[103]=_e,t[104]=ve):ve=t[104];let ye;t[105]===A?ye=t[106]:(ye=(0,Z.jsx)(X,{variant:`outline`,"data-testid":`timeline-entry-restore-cancel`,onClick:A,children:`Cancel`}),t[105]=A,t[106]=ye);let be;t[107]===M?be=t[108]:(be=()=>M(),t[107]=M,t[108]=be);let xe;t[109]===x?xe=t[110]:(xe=x?(0,Z.jsx)(Ze,{className:`mr-2 size-4 animate-spin`}):null,t[109]=x,t[110]=xe);let Se;t[111]!==x||t[112]!==be||t[113]!==xe?(Se=(0,Z.jsxs)(X,{variant:`destructive`,"data-testid":`timeline-entry-restore-confirm`,disabled:x,onClick:be,children:[xe,`Restore`]}),t[111]=x,t[112]=be,t[113]=xe,t[114]=Se):Se=t[114];let Ce;t[115]!==ye||t[116]!==Se?(Ce=(0,Z.jsxs)(Ga,{children:[ye,Se]}),t[115]=ye,t[116]=Se,t[117]=Ce):Ce=t[117];let we;t[118]!==ve||t[119]!==Ce?(we=(0,Z.jsxs)(Va,{children:[ve,Ce]}),t[118]=ve,t[119]=Ce,t[120]=we):we=t[120];let J;t[121]!==y||t[122]!==ue||t[123]!==we?(J=(0,Z.jsx)(Ja,{open:y,onOpenChange:ue,children:we}),t[121]=y,t[122]=ue,t[123]=we,t[124]=J):J=t[124];let Te;return t[125]!==le||t[126]!==J?(Te=(0,Z.jsxs)(Z.Fragment,{children:[le,J]}),t[125]=le,t[126]=J,t[127]=Te):Te=t[127],Te}function ov(e){return e.docs}function sv(e){let t=(0,$.c)(63),{docName:n,diffLayout:r,onDiffLayoutChange:i}=e,{resolvedTheme:a}=yr(),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)(dv),[g,_]=(0,Q.useState)(uv),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(lv),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)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsxs)(ao,{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)(ro,{value:`unified`,"aria-label":`Unified diff`,className:`size-6 px-0`,children:(0,Z.jsx)(tc,{className:`size-3.5`})}),(0,Z.jsx)(ro,{value:`split`,"aria-label":`Split diff`,className:`size-6 px-0`,children:(0,Z.jsx)(hs,{className:`size-3.5`})})]})}),(0,Z.jsx)(co,{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`,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(cv)}),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)(av,{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)(av,{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)(W_,{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 cv(e){return(0,Z.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-lg px-3 py-2.5`,children:[(0,Z.jsx)(Gi,{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)(Gi,{className:`h-3 w-28`}),(0,Z.jsx)(Gi,{className:`h-3 w-40`})]})]},e)}function lv(e){return e.type===`checkpoint`}function uv(){return new Set}function dv(){return new $r(32)}var fv=[{id:`outline`,label:`Outline`,icon:Hs},{id:`links`,label:`Links`,icon:Rs},{id:`graph`,label:`Graph`,icon:Gs},{id:`timeline`,label:`Timeline`,icon:ds}];function pv(){return r(()=>import(`./GraphPanel-DwQX9Gl9.js`),__vite__mapDeps([19,1,20,3,6,7,15,21,22,23,24,25,26,27,28,29,30,31,32,33]),import.meta.url)}var mv=(0,Q.lazy)(async()=>({default:(await pv()).GraphPanel})),hv=(0,Q.lazy)(async()=>({default:(await r(()=>import(`./ActivityModeContent-BMLTkwc9.js`),__vite__mapDeps([34,1,2,35,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,23,42]),import.meta.url)).ActivityModeContent}));function gv(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 border-b border-border/60 p-2`,children:(0,Z.jsx)(ao,{type:`single`,variant:`outline`,value:i,onValueChange:e=>{e&&a(e)},"aria-label":`Document panels`,children:fv.map(_v)})}):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)(Io,{docName:n,isSourceMode:r}),i===`links`&&(0,Z.jsx)(o_,{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)(mv,{activeDocName:n})}),i===`timeline`&&(0,Z.jsx)(sv,{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`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:`Loading agent activity`}),children:(0,Z.jsx)(hv,{})})}),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 _v(e){let{id:t,label:n,icon:r}=e;return(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(ro,{value:t,role:`tab`,id:`tab-${t}`,"aria-controls":`panel-${t}`,"aria-label":n,asChild:!0,children:(0,Z.jsx)(so,{children:(0,Z.jsx)(r,{})})}),(0,Z.jsx)(co,{side:`bottom`,children:n})]},t)}function vv(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function yv(e,t){let n=getComputedStyle(e.ownerDocument.body);return t*parseFloat(n.fontSize)}function bv(e){return e/100*window.innerHeight}function xv(e){return e/100*window.innerWidth}function Sv(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 Cv({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=Sv(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=yv(t,i);break;case`em`:r=vv(t,i);break;case`vh`:r=bv(i);break;case`vw`:r=xv(i);break}return r}function wv(e){return parseFloat(e.toFixed(3))}function Tv({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 Ev(e){let{panels:t}=e,n=Tv({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=wv(Cv({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=wv(Cv({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=wv(Cv({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=wv(Cv({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 Dv(e,t=`Assertion error`){if(!e)throw Error(t)}function Ov(e,t){return Array.from(t).sort(e===`horizontal`?kv:Av)}function kv(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Av(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function jv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Mv(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 Nv({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}=Mv(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return Dv(i,`No rect found`),i}var Pv;function Fv(){return Pv===void 0&&(Pv=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Pv}function Iv(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Ov(n,Array.from(t.children).filter(jv).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,Nv({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=Fv()?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:Tv({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 Lv=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)}}},Rv=new Map,zv=new Lv;function Bv(e){Rv=new Map(Rv),Rv.delete(e)}function Vv(e,t){for(let[t]of Rv)if(t.id===e)return t}function Hv(e,t){for(let[t,n]of Rv)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Uv(){return Rv}function Wv(e,t){return zv.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function Gv(e,t){let n=Rv.get(e);Rv=new Map(Rv),Rv.set(e,t),zv.emit(`groupChange`,{group:e,prev:n,next:t})}function Kv(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Mv(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 qv(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Jv(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:ey(e),b:ey(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();Dv(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:$v(Qv(n.a)),b:$v(Qv(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 Yv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Xv(e){let t=getComputedStyle(ty(e)??e).display;return t===`flex`||t===`inline-flex`}function Zv(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||Xv(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`||Yv.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Qv(e){let t=e.length;for(;t--;){let n=e[t];if(Dv(n,`Missing node`),Zv(n))return n}return null}function $v(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ey(e){let t=[];for(;e;)t.push(e),e=ty(e);return t}function ty(e){let{parentNode:t}=e;return qv(t)?t.host:t}function ny(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 ry({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!jv(n)||n.contains(e)||e.contains(n))return!0;if(Jv(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ny(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function iy(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Iv(r),a=Kv(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&ry({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function ay(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 oy(e,t,n=0){return Math.abs(wv(e)-wv(t))<=n}function sy(e,t){return oy(e,t)?0:e>t?1:-1}function cy({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(sy(r,c)<0)if(a){let e=(i+c)/2;r=sy(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=wv(r),r}function ly({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(oy(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;Dv(u!=null,`Invalid first pivot index`),Dv(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];Dv(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(Dv(n!=null,`Previous layout not found for panel index ${t}`),oy(n,i)){let t=o-n;sy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];Dv(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(Dv(n!=null,`Previous layout not found for panel index ${t}`),oy(n,o)){let t=n-i;sy(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];Dv(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&sy(i,c)<0)if(e>0){let t=c-o,n=t/2;sy(i+e,c)<0&&(e=sy(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;sy(i-e,c)<0&&(e=sy(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];Dv(e!=null,`Previous layout not found for panel index ${r}`);let a=cy({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];Dv(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=cy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!oy(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(ay(c,l))return i;{let t=e<0?d:u,r=s[t];Dv(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=cy({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!oy(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];Dv(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=cy({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(oy(i,s)||(t-=s-i,l[r]=s),oy(t,0))break;e>0?r--:r++}}}if(!oy(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 uy(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||sy(e[n],t[n])!==0)return!1;return!0}function dy({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(!oy(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];Dv(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];Dv(i!=null,`No layout data found for index ${e}`);let o=r[e];Dv(o!=null,`No layout data found for index ${e}`);let s=cy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!oy(a,0))for(let e=0;e<t.length;e++){let n=r[e];Dv(n!=null,`No layout data found for index ${e}`);let i=n+a,o=cy({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,oy(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function fy({groupId:e,panelId:t}){let n=()=>{let t=Uv();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=dy({layout:ly({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});uy(l,p)||Gv(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&&oy(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=Tv({group:t});o(wv(Cv({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function py(e){e.defaultPrevented||iy(e,Uv()).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=fy({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function my(e){let t=Uv();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 hy({groupId:e}){let t=()=>{let t=Uv();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=dy({layout:e,panelConstraints:r});return n?o:(uy(o,c)||Gv(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function gy(e,t){let n=my(e),r=Hv(n.id,!0),i=n.separators.find(t=>t.element===e);Dv(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);Dv(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=hy({groupId:n.id}).getLayout(),c=dy({layout:ly({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});uy(s,c)||Gv(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function _y(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=my(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&gy(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&gy(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&gy(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&gy(t,-5);break;case`End`:e.preventDefault(),gy(t,100);break;case`Enter`:{e.preventDefault();let n=my(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Hv(n.id,!0),o=n.separators.find(e=>e.element===t);Dv(o,`Matching separator not found`);let s=a.get(o);Dv(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(Dv(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];gy(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=my(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);Dv(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(),gy(t,-100);break}}var vy={cursorFlags:0,state:`inactive`},yy=new Lv;function by(){return vy}function xy(e){return yy.addListener(`change`,e)}function Sy(e){let t=vy,n={...vy};n.cursorFlags=e,vy=n,yy.emit(`change`,{prev:t,next:n})}function Cy(e){let t=vy;vy=e,yy.emit(`change`,{prev:t,next:e})}function wy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=Uv(),n=iy(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)}),Cy({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var Ty=e=>e,Ey=()=>{},Dy=1,Oy=2,ky=4,Ay=8,jy=3,My=12,Ny;function Py(){return Ny===void 0&&(Ny=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(Ny=!0)),Ny}function Fy({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&&Py()){let t=(e&Dy)!==0,n=(e&Oy)!==0,r=(e&ky)!==0,i=(e&Ay)!==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 Py()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var Iy=new WeakMap;function Ly(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Iy.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));let r=by();switch(r.state){case`active`:case`hover`:{let e=Fy({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}Iy.set(e,{prevStyle:t,styleSheet:n})}function Ry({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=ly({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(uy(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?Dy:Oy;break;case`vertical`:s|=d<0?ky:Ay;break}}else Gv(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&jy:c|=s&jy,t.movementY===0?c|=o&My:c|=s&My,Sy(c),Ly(e)}function zy(e){let t=Uv(),n=by();switch(n.state){case`active`:Ry({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function By(e){if(e.defaultPrevented)return;let t=by(),n=Uv();switch(t.state){case`active`:if(e.buttons===0){Cy({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=Hv(e.group.id,!0);Gv(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)}Ry({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=iy(e,n);r.length===0?t.state!==`inactive`&&Cy({cursorFlags:0,state:`inactive`}):Cy({cursorFlags:0,hitRegions:r,state:`hover`}),Ly(e.currentTarget);break}}}function Vy(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(by().state){case`hover`:Cy({cursorFlags:0,state:`inactive`})}}function Hy(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=by();switch(t.state){case`active`:Cy({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(Ly(e.currentTarget),t.hitRegions.forEach(e=>{let t=Hv(e.group.id,!0);Gv(e.group,t)}),e.preventDefault())}}function Uy(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=wv(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=wv((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Wy(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=Tv({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:wv(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function Gy(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 Ky({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=wv(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]=wv((r[e]??0)/a*l);else{let e=wv(l/c.length);for(let t of c)u[t]=e}return u}function qy(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 Jy=new Map;function Yy(e){let t=!0;Dv(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=Tv({group:e});if(t===0)return;let n=Hv(e.id);if(!n)return;let r=Ev(e),i=n.defaultLayoutDeferred?Uy(r):n.layout,a=dy({layout:Ky({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&uy(n.layout,a)&&Gy(n.derivedPanelConstraints,r)&&n.groupSize===t)return;Gv(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Wy(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{Dv(!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=Tv({group:e}),s=Ev(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(qy(e.panels,l)||(l=void 0));let u=dy({layout:e.mutableState.layouts[c]??l??Uy(s),panelConstraints:s}),d=e.element.ownerDocument;Jy.set(d,(Jy.get(d)??0)+1);let f=new Map;return Iv(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),Gv(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{Dv(!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`,_y)}),Jy.get(d)===1&&(d.addEventListener(`dblclick`,py,!0),d.addEventListener(`pointerdown`,wy,!0),d.addEventListener(`pointerleave`,zy),d.addEventListener(`pointermove`,By),d.addEventListener(`pointerout`,Vy),d.addEventListener(`pointerup`,Hy,!0)),function(){t=!1,Jy.set(d,Math.max(0,(Jy.get(d)??0)-1)),Bv(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,_y)}),Jy.get(d)||(d.removeEventListener(`dblclick`,py,!0),d.removeEventListener(`pointerdown`,wy,!0),d.removeEventListener(`pointerleave`,zy),d.removeEventListener(`pointermove`,By),d.removeEventListener(`pointerout`,Vy),d.removeEventListener(`pointerup`,Hy,!0)),a.disconnect()}}function Xy(){let[e,t]=(0,Q.useState)({});return[e,(0,Q.useCallback)(()=>t({}),[])]}function Zy(e){let t=(0,Q.useId)();return`${e??t}`}var Qy=typeof window<`u`?Q.useLayoutEffect:Q.useEffect;function $y(e){let t=(0,Q.useRef)(e);return Qy(()=>{t.current=e},[e]),(0,Q.useCallback)((...e)=>t.current?.(...e),[t])}function eb(...e){return $y(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function tb(e){let t=(0,Q.useRef)({...e});return Qy(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var nb=(0,Q.createContext)(null);function rb(e,t){let n=(0,Q.useRef)({getLayout:()=>({}),setLayout:Ty});(0,Q.useImperativeHandle)(t,()=>n.current,[]),Qy(()=>{Object.assign(n.current,hy({groupId:e}))})}function ib({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=$y(e=>{uy(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=$y(e=>{uy(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Zy(s),v=(0,Q.useRef)(null),[y,b]=Xy(),x=(0,Q.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=eb(v,a);rb(_,o);let C=$y((e,t)=>{let r=by(),i=Vv(e),a=Hv(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=tb({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=Ov(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Ov(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=Vv(_),i=Hv(_);r&&i&&Gv(r,{...i,derivedPanelConstraints:Ev(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 Qy(()=>{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=Yy(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=Hv(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=Wv(_,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=oy(t.collapsedSize,i[t.panelId]),a=oy(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=by().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)(nb.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})})}ib.displayName=`Group`;function ab(){let e=(0,Q.useContext)(nb);return Dv(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function ob(e,t){let{id:n}=ab(),r=(0,Q.useRef)({collapse:Ey,expand:Ey,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ey});(0,Q.useImperativeHandle)(t,()=>r.current,[]),Qy(()=>{Object.assign(r.current,fy({groupId:n,panelId:e}))})}function sb({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=Zy(c),_=tb({disabled:a}),v=(0,Q.useRef)(null),y=eb(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=ab(),T=d!==null,E=$y((e,t,n)=>{d?.(e,c,n)});Qy(()=>{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]),ob(g,f);let D=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},O=(0,Q.useSyncExternalStore)(e=>Wv(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:{...cb,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})})}sb.displayName=`Panel`;var cb={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function lb(){return(0,Q.useRef)(null)}function ub({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=dy({layout:ly({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=dy({layout:ly({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function db({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Zy(a),l=tb({disabled:n,disableDoubleClick:r}),[u,d]=(0,Q.useState)({}),[f,p]=(0,Q.useState)(`inactive`),m=(0,Q.useRef)(null),h=eb(m,i),{disableCursor:g,id:_,orientation:v,registerSeparator:y,updateSeparatorProps:b}=ab(),x=v===`horizontal`?`vertical`:`horizontal`;Qy(()=>{let e=m.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=y(t),r=xy(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=Wv(_,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(ub({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})}db.displayName=`Separator`;function fb(e){return`/api/asset?path=${encodeURIComponent(e)}`}function pb(e){let t=(0,$.c)(14),{assetPath:n,mediaKind:r}=e,i;t[0]===n?i=t[1]:(i=fb(n),t[0]=n,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=n.split(`/`).pop()??n,t[2]=n,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=s.includes(`.`)?s.split(`.`).pop()?.toUpperCase()??`FILE`:`FILE`,t[4]=s,t[5]=c);let l=c,u;t[6]!==l||t[7]!==s||t[8]!==r||t[9]!==a?(u=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-auto p-4`,children:r===`image`?(0,Z.jsx)(`img`,{src:a,alt:s,className:`max-h-full max-w-full object-contain`,draggable:!1}):r===`video`?(0,Z.jsx)(`video`,{src:a,controls:!0,className:`max-h-full max-w-full`}):(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:l}),(0,Z.jsx)(`div`,{className:`max-w-full break-words font-medium text-sm`,children:s}),(0,Z.jsx)(`a`,{href:a,className:`rounded-md border px-3 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground`,children:`Open file`})]})}),t[6]=l,t[7]=s,t[8]=r,t[9]=a,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,Z.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":s,children:u}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function mb(){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)(Gi,{className:`h-9 w-2/5 mt-6 mb-5`}),(0,Z.jsx)(Gi,{className:`h-4 w-full`}),(0,Z.jsx)(Gi,{className:`h-4 w-3/4`})]})}),e[0]=t):t=e[0],t}var hb={"claude-cowork":`claude`,"claude-code":`claude`,codex:`openai`,cursor:`cursor`};function gb(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}=yr(),s=hb[r],c=s?(o===`dark`?En[s]:void 0)??$t[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=Y(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)(Zr,{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)(Xr,{style:u,className:p,...i}),t[15]=p,t[16]=u,t[17]=i,t[18]=e):e=t[18],e}if(r===`cursor`){let e;return t[19]!==p||t[20]!==u||t[21]!==i?(e=(0,Z.jsx)(ri,{style:u,className:p,...i}),t[19]=p,t[20]=u,t[21]=i,t[22]=e):e=t[22],e}return null}function _b(e){let{installState:t}=e;return t.installed===null?`Detecting`:t.installed===!1?`Not installed`:null}function vb(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 yb(e){return Mn(e)}function bb(e){return`Opened ${e} in your browser.`}var xb=`claude.ai`;async function Sb(e,t=Rp){(await t(Mn(e))).ok?Xa.success(bb(xb)):Xa.error(`Couldn't open ${xb} in your browser.`)}function Cb(e){return e.onInstallSkillRequest!==void 0&&e.target.id===`claude-cowork`}function wb(e){let t=(0,$.c)(80),{target:n,installState:r,isElectronHost:i,prompt:a,onSelect:o,onInstallSkillRequest:s}=e,c=e.openExternal??Rp,l=e.onWebFallbackSuccess??Eb,u=e.onWebFallbackError??Tb,d;t[0]!==r||t[1]!==i||t[2]!==n?(d=vb({target:n,installState:r,isElectronHost:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=d):d=t[3];let f=d,p;t[4]!==r||t[5]!==i||t[6]!==n?(p=_b({target:n,installState:r,isElectronHost:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=p):p=t[7];let m=p,h;t[8]!==c||t[9]!==f.tooltip?(h=()=>{f.tooltip&&c(f.tooltip.installAction.url)},t[8]=c,t[9]=f.tooltip,t[10]=h):h=t[10];let g=h,_;t[11]!==u||t[12]!==l||t[13]!==c||t[14]!==a||t[15]!==n?(_=()=>{(async()=>{let e=await c(yb(a));e.ok?l(n):u(n,e.detail??e.reason)})()},t[11]=u,t[12]=l,t[13]=c,t[14]=a,t[15]=n,t[16]=_):_=t[16];let v=_;if(f.enabled){let e;t[17]!==s||t[18]!==n?(e=Cb({target:n,onInstallSkillRequest:s}),t[17]=s,t[18]=n,t[19]=e):e=t[19];let r=e,i=r&&s?s:o,a=`open-in-agent-item-${n.id}`,c=r?`Install Open Knowledge skill in ${n.displayName}`:`Open in ${n.displayName}`,l;t[20]===n.id?l=t[21]:(l=(0,Z.jsx)(gb,{id:n.id,"aria-hidden":`true`}),t[20]=n.id,t[21]=l);let u=r?`flex-1 whitespace-nowrap`:void 0,d;t[22]!==u||t[23]!==n.displayName?(d=(0,Z.jsx)(`span`,{className:u,children:n.displayName}),t[22]=u,t[23]=n.displayName,t[24]=d):d=t[24];let f;t[25]===r?f=t[26]:(f=r?(0,Z.jsx)(Ne,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):null,t[25]=r,t[26]=f);let p;return t[27]!==d||t[28]!==f||t[29]!==i||t[30]!==a||t[31]!==c||t[32]!==l?(p=(0,Z.jsxs)(vi,{onSelect:i,"data-testid":a,"aria-label":c,children:[l,d,f]}),t[27]=d,t[28]=f,t[29]=i,t[30]=a,t[31]=c,t[32]=l,t[33]=p):p=t[33],p}if(!f.tooltip){let e=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,r=`open-in-agent-item-${n.id}`,i;t[34]===n.id?i=t[35]:(i=(0,Z.jsx)(gb,{id:n.id,"aria-hidden":`true`}),t[34]=n.id,t[35]=i);let a;t[36]===n.displayName?a=t[37]:(a=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[36]=n.displayName,t[37]=a);let o;t[38]===m?o=t[39]:(o=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[38]=m,t[39]=o);let s;return t[40]!==e||t[41]!==r||t[42]!==i||t[43]!==a||t[44]!==o?(s=(0,Z.jsxs)(vi,{disabled:!0,"data-testid":r,"aria-label":e,children:[i,a,o]}),t[40]=e,t[41]=r,t[42]=i,t[43]=a,t[44]=o,t[45]=s):s=t[45],s}let y=m?`Open in ${n.displayName}, ${m}`:`Open in ${n.displayName}`,b=`open-in-agent-item-${n.id}`,x;t[46]===n.id?x=t[47]:(x=(0,Z.jsx)(gb,{id:n.id,"aria-hidden":`true`,className:`mr-2`}),t[46]=n.id,t[47]=x);let S;t[48]===n.displayName?S=t[49]:(S=(0,Z.jsx)(`span`,{className:`flex-1`,children:n.displayName}),t[48]=n.displayName,t[49]=S);let C;t[50]===m?C=t[51]:(C=m?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:m}):null,t[50]=m,t[51]=C);let w;t[52]!==y||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==C?(w=(0,Z.jsxs)(bi,{"data-testid":b,"data-row-disabled":``,"aria-label":y,children:[x,S,C]}),t[52]=y,t[53]=b,t[54]=x,t[55]=S,t[56]=C,t[57]=w):w=t[57];let T=`open-in-agent-submenu-${n.id}`,E=`open-in-agent-message-${n.id}`,D;t[58]!==f.tooltip.message||t[59]!==E?(D=(0,Z.jsx)(xi,{className:`font-normal text-muted-foreground text-xs`,"data-testid":E,children:f.tooltip.message}),t[58]=f.tooltip.message,t[59]=E,t[60]=D):D=t[60];let O;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Aa,{}),t[61]=O):O=t[61];let k=`open-in-agent-install-${n.id}`,A;t[62]===f.tooltip.installAction.label?A=t[63]:(A=(0,Z.jsx)(`span`,{children:f.tooltip.installAction.label}),t[62]=f.tooltip.installAction.label,t[63]=A);let j;t[64]!==g||t[65]!==k||t[66]!==A?(j=(0,Z.jsx)(vi,{onSelect:g,"data-testid":k,children:A}),t[64]=g,t[65]=k,t[66]=A,t[67]=j):j=t[67];let M;t[68]!==v||t[69]!==f.tooltip.webFallback||t[70]!==n.id?(M=f.tooltip.webFallback?(0,Z.jsxs)(vi,{onSelect:v,"data-testid":`open-in-agent-web-fallback-${n.id}`,"aria-label":`${f.tooltip.webFallback.label}, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(`span`,{className:`flex-1`,children:f.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[68]=v,t[69]=f.tooltip.webFallback,t[70]=n.id,t[71]=M):M=t[71];let N;t[72]!==D||t[73]!==j||t[74]!==M||t[75]!==T?(N=(0,Z.jsxs)(Li,{className:`min-w-[260px]`,"data-testid":T,children:[D,O,j,M]}),t[72]=D,t[73]=j,t[74]=M,t[75]=T,t[76]=N):N=t[76];let P;return t[77]!==N||t[78]!==w?(P=(0,Z.jsxs)(di,{children:[w,N]}),t[77]=N,t[78]=w,t[79]=P):P=t[79],P}function Tb(){}function Eb(){}function Db(e){let t=(0,$.c)(12),{className:n}=e,{states:r,refresh:i}=dm(),{dispatch:a}=em(),o=mp(),s,c;if(t[0]!==n||t[1]!==a||t[2]!==i||t[3]!==r||t[4]!==o){let e=Wp({workspace:o});t[7]===n?s=t[8]:(s=Y(`grid w-full max-w-5xl gap-4 sm:grid-cols-2`,n),t[7]=n,t[8]=s),c=op.map(t=>{let n=r[t.id]?.installed,o=n===!0?`installed`:n===!1?`missing`:`pending`;return(0,Z.jsx)(Ob,{target:t,status:o,onOpen:o===`installed`&&e!==null?()=>{a(t.id,e)}:void 0,onInstall:()=>{Gp(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 Ob(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)(gb,{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)(Ma,{"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 kb=1700,Ab=3;function jb(e,t,n){let r=n?.windowMs??600,i=n?.maxLevel??Ab;if(e===0||t>=r)return 1;let a=e+1;return a>i?i:a}var Mb={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:250,durationMin:620,durationMax:1400}},Nb=[`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 Pb(e,t={}){let n=t.rng??Math.random,r=t.colors??Nb,i=Mb[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 Fb=1.8,Ib=90,Lb=16,Rb=380,zb=.025,Bb=.1,Vb=.18,Hb=400,Ub=9.2736,Wb=18.1799,Gb=14.5244,Kb={1:{halfWidth:1.5,apexLift:2.2},2:{halfWidth:1.4,apexLift:2.6},3:{halfWidth:1.25,apexLift:3}};function qb(e,t){let{halfWidth:n,apexLift:r}=Kb[t];return`M${e-n} ${Gb+.3} Q${e} ${Gb-r}, ${e+n} ${Gb+.3}`}function Jb(e){let t=1.5,n=.3;return`M${e-t} ${Gb-n} Q${e} ${Gb+1.4}, ${e+t} ${Gb-n}`}var Yb=15,Xb=15;function Zb(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 Qb(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=jb(g,t);_(n),y(nx),S(Pb(n)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},kb)},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(tx),S(Pb(3)),clearTimeout(w.current),w.current=setTimeout(()=>{_(0),S([])},kb))},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/Rb)),C=Math.max(-1,Math.min(1,b/Rb)),w=S*Lb,T=-C*Lb,E=0,D=0;if(x>=1){let e=Math.min(x/Ib,1)*Fb;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)*Bb,i+=(w-i)*Bb,u.style.transform=`perspective(${Hb}px) rotateX(${r.toFixed(3)}deg) rotateY(${i.toFixed(3)}deg)`,a+=(E-a)*Vb,o+=(D-o)*Vb;let k=i*zb,A=-r*zb,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=Y(`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=Y(`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=Y(`ok-blob-eye`,W),t[22]=W,t[23]=G);let K;t[24]===G?K=t[25]:(K=(0,Z.jsx)(`ellipse`,{cx:Ub,cy:Gb,rx:1.2722,ry:1.9083,className:G}),t[24]=G,t[25]=K);let q=(F||T)&&`ok-blob-eye-hidden`,ee;t[26]===q?ee=t[27]:(ee=Y(`ok-blob-eye ok-blob-eye-right`,q),t[26]=q,t[27]=ee);let te;t[28]===ee?te=t[29]:(te=(0,Z.jsx)(`ellipse`,{cx:Wb,cy:Gb,rx:1.2722,ry:1.9083,className:ee}),t[28]=ee,t[29]=te);let ne;t[30]===I?ne=t[31]:(ne=qb(Ub,I),t[30]=I,t[31]=ne);let re=(!F||T)&&`ok-blob-eye-hidden`,ie;t[32]===re?ie=t[33]:(ie=Y(`ok-blob-happy-eye`,re),t[32]=re,t[33]=ie);let ae;t[34]!==ne||t[35]!==ie?(ae=(0,Z.jsx)(`path`,{d:ne,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ie}),t[34]=ne,t[35]=ie,t[36]=ae):ae=t[36];let oe;t[37]===I?oe=t[38]:(oe=qb(Wb,I),t[37]=I,t[38]=oe);let se=(!F||T)&&`ok-blob-eye-hidden`,ce;t[39]===se?ce=t[40]:(ce=Y(`ok-blob-happy-eye`,se),t[39]=se,t[40]=ce);let le;t[41]!==oe||t[42]!==ce?(le=(0,Z.jsx)(`path`,{d:oe,strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:ce}),t[41]=oe,t[42]=ce,t[43]=le):le=t[43];let ue;t[44]===T?ue=t[45]:(ue=T?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`path`,{d:Jb(Ub),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`}),(0,Z.jsx)(`path`,{d:Jb(Wb),strokeWidth:`1.2`,strokeLinecap:`round`,fill:`none`,className:`ok-blob-sleeping-eye`})]}):null,t[44]=T,t[45]=ue);let de;t[46]!==K||t[47]!==te||t[48]!==ae||t[49]!==le||t[50]!==ue?(de=(0,Z.jsxs)(`g`,{ref:p,children:[K,te,ae,le,ue]}),t[46]=K,t[47]=te,t[48]=ae,t[49]=le,t[50]=ue,t[51]=de):de=t[51];let fe;t[52]!==B||t[53]!==H||t[54]!==de?(fe=(0,Z.jsxs)(`g`,{className:H,children:[U,de]},B),t[52]=B,t[53]=H,t[54]=de,t[55]=fe):fe=t[55];let pe;t[56]===T?pe=t[57]:(pe=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]=pe);let me;t[58]!==v||t[59]!==x?(me=x.length>0&&(0,Z.jsx)(`g`,{children:x.map($b)},`firework-${v}`),t[58]=v,t[59]=x,t[60]=me):me=t[60];let he;t[61]!==D||t[62]!==s||t[63]!==z||t[64]!==fe||t[65]!==pe||t[66]!==me?(he=(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:ex,children:[fe,pe,me]}),t[61]=D,t[62]=s,t[63]=z,t[64]=fe,t[65]=pe,t[66]=me,t[67]=he):he=t[67];let ge;return t[68]!==R||t[69]!==he?(ge=(0,Z.jsx)(`span`,{ref:d,className:R,children:he}),t[68]=R,t[69]=he,t[70]=ge):ge=t[70],ge}function $b(e){return(0,Z.jsx)(`circle`,{cx:Yb+e.originDx,cy:Xb+e.originDy,r:e.size,className:`ok-blob-firework`,style:Zb(e)},e.id)}function ex(e){return e.preventDefault()}function tx(e){return e+1}function nx(e){return e+1}function rx(e){let t=(0,$.c)(12),{title:n,subtitle:r,celebrateSignal:i}=e,a;t[0]===i?a=t[1]:(a=(0,Z.jsx)(Qb,{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 ix(e){let t=(0,$.c)(5),{className:n}=e,r=Vr()?`⌘`:`Ctrl`,i;t[0]===n?i=t[1]:(i=Y(`select-none font-mono text-2xs uppercase tracking-wider text-muted-foreground`,n),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(ax,{mod:r,letter:`K`}),t[2]=a):a=t[2];let o;return t[3]===i?o=t[4]:(o=(0,Z.jsxs)(`p`,{className:i,children:[a,` Search`]}),t[3]=i,t[4]=o),o}function ax(e){let t=(0,$.c)(4),{mod:n,letter:r}=e,i=n.length>1?` `:``,a;return t[0]!==r||t[1]!==n||t[2]!==i?(a=(0,Z.jsxs)(`kbd`,{className:`font-mono not-italic`,children:[n,i,r]}),t[0]=r,t[1]=n,t[2]=i,t[3]=a):a=t[3],a}function ox(e){let t=(0,$.c)(8),{className:n}=e,r=mp(),i=typeof window<`u`?window.okDesktop?.config.projectName:void 0,a=null;if(i)a=i;else if(r){let e;t[0]!==r.contentDir||t[1]!==r.pathSeparator?(e=sx(r.contentDir,r.pathSeparator),t[0]=r.contentDir,t[1]=r.pathSeparator,t[2]=e):e=t[2],a=e}if(!a)return null;let o;t[3]===n?o=t[4]:(o=Y(`select-none font-mono text-2xs uppercase tracking-wider text-muted-foreground`,n),t[3]=n,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,Z.jsx)(`p`,{className:o,children:a}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function sx(e,t){let n=e.endsWith(t)?e.slice(0,-1):e,r=n.lastIndexOf(t);return r>=0?n.slice(r+1):n}var cx=`open-knowledge:create-top-level-file`;function lx(){window.dispatchEvent(new CustomEvent(cx))}function ux(e){let t=()=>e();return window.addEventListener(cx,t),()=>window.removeEventListener(cx,t)}function dx(){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(hx);if(e)return;let r=t.ok?Gn.safeParse(n):null;r?.success?(o(gx(r.data.documents)),l.current=!0):l.current||=(o(1),!0)}catch{!e&&!l.current&&(o(1),l.current=!0)}};t();let n=_r(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(mx),250),fetch(`/api/documents`).then(async e=>{let t=await e.json().catch(px);if(!e.ok)return;let n=Gn.safeParse(t);n.success&&o(gx(n.data.documents))}).catch(fx)},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)(_x,{celebrateSignal:s,onPackSelect:e=>{i(e),n(!0)}}):(0,Z.jsx)(vx,{celebrateSignal:s}):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)(Xf,{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 fx(){}function px(){return null}function mx(e){return e+1}function hx(){return null}function gx(e){return e.filter(e=>e.kind===`document`||e.kind===`folder`).length}function _x(e){let t=(0,$.c)(10),{celebrateSignal:n,onPackSelect:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(rx,{title:`Let's set up your project.`,subtitle:`Pick a starter pack to scaffold folders, templates, and AI-readable rules.`,celebrateSignal:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(Uf,{onPackSelect:r}),t[2]=r,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsxs)(X,{variant:`link`,className:`text-muted-foreground font-normal justify-end`,size:`sm`,onClick:lx,children:[`or start from scratch `,(0,Z.jsx)(oa,{"aria-hidden":`true`,className:`size-3`})]}),t[4]=o):o=t[4];let s;t[5]===a?s=t[6]:(s=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-3`,children:[a,o]}),t[5]=a,t[6]=s);let c;return t[7]!==i||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[i,s]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function vx(e){let t=(0,$.c)(6),{celebrateSignal:n}=e,r;t[0]===n?r=t[1]:(r=(0,Z.jsx)(rx,{title:`Open in your favorite AI editor.`,subtitle:`Select a file from the sidebar, or pick where to edit alongside your agent.`,celebrateSignal:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Db,{}),t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6`,children:[i,(0,Z.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-4`,children:[(0,Z.jsx)(ox,{}),(0,Z.jsx)(ix,{})]})]}),t[3]=a):a=t[3];let o;return t[4]===r?o=t[5]:(o=(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-10 py-12 max-w-5xl my-auto`,children:[r,a]}),t[4]=r,t[5]=o),o}var yx=365.2425,bx=6048e5,xx=864e5,Sx=6e4,Cx=36e5,wx=1e3,Tx=3600*24;Tx*7,Tx*yx/12*3;var Ex=Symbol.for(`constructDateFrom`);function Dx(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Ex in e?e[Ex](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ox(e,t){return Dx(t||e,e)}function kx(e,t,n){let r=Ox(e,n?.in);return isNaN(t)?Dx(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}function Ax(e,t,n){let r=Ox(e,n?.in);if(isNaN(t))return Dx(n?.in||e,NaN);if(!t)return r;let i=r.getDate(),a=Dx(n?.in||e,r.getTime());return a.setMonth(r.getMonth()+t+1,0),i>=a.getDate()?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}var jx={};function Mx(){return jx}function Nx(e,t){let n=Mx(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ox(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Px(e,t){return Nx(e,{...t,weekStartsOn:1})}function Fx(e,t){let n=Ox(e,t?.in),r=n.getFullYear(),i=Dx(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Px(i),o=Dx(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Px(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Ix(e){let t=Ox(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Lx(e,...t){let n=Dx.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Rx(e,t){let n=Ox(e,t?.in);return n.setHours(0,0,0,0),n}function zx(e,t,n){let[r,i]=Lx(n?.in,e,t),a=Rx(r),o=Rx(i),s=+a-Ix(a),c=+o-Ix(o);return Math.round((s-c)/xx)}function Bx(e,t){let n=Fx(e,t),r=Dx(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Px(r)}function Vx(e,t,n){return kx(e,t*7,n)}function Hx(e,t,n){return Ax(e,t*12,n)}function Ux(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Dx.bind(null,e));let t=Ox(e,r);(!n||n<t||isNaN(+t))&&(n=t)}),Dx(r,n||NaN)}function Wx(e,t){let n,r=t?.in;return e.forEach(e=>{!r&&typeof e==`object`&&(r=Dx.bind(null,e));let t=Ox(e,r);(!n||n>t||isNaN(+t))&&(n=t)}),Dx(r,n||NaN)}function Gx(e,t,n){let[r,i]=Lx(n?.in,e,t);return+Rx(r)==+Rx(i)}function Kx(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function qx(e){return!(!Kx(e)&&typeof e!=`number`||isNaN(+Ox(e)))}function Jx(e,t,n){let[r,i]=Lx(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Yx(e,t){let n=Ox(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Xx(e,t){let[n,r]=Lx(e,t.start,t.end);return{start:n,end:r}}function Zx(e,t){let{start:n,end:r}=Xx(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setDate(1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(Dx(n,o)),o.setMonth(o.getMonth()+s);return i?c.reverse():c}function Qx(e,t){let n=Ox(e,t?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function $x(e,t){let n=Ox(e,t?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function eS(e,t){let n=Ox(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function tS(e,t){let{start:n,end:r}=Xx(t?.in,e),i=+n>+r,a=i?+n:+r,o=i?r:n;o.setHours(0,0,0,0),o.setMonth(0,1);let s=t?.step??1;if(!s)return[];s<0&&(s=-s,i=!i);let c=[];for(;+o<=a;)c.push(Dx(n,o)),o.setFullYear(o.getFullYear()+s);return i?c.reverse():c}function nS(e,t){let n=Mx(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ox(e,t?.in),a=i.getDay(),o=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+o),i.setHours(23,59,59,999),i}function rS(e,t){return nS(e,{...t,weekStartsOn:1})}var iS={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},aS=(e,t,n)=>{let r,i=iS[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function oS(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var sS={date:oS({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:oS({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:oS({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},cS={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},lS=(e,t,n,r)=>cS[e];function uS(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var dS={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:uS({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:uS({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:uS({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:uS({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:uS({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function fS(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?mS(s,e=>e.test(o)):pS(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function pS(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function mS(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function hS(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var gS={code:`en-US`,formatDistance:aS,formatLong:sS,formatRelative:lS,localize:dS,match:{ordinalNumber:hS({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:fS({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:fS({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:fS({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:fS({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:fS({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function _S(e,t){let n=Ox(e,t?.in);return zx(n,eS(n))+1}function vS(e,t){let n=Ox(e,t?.in),r=Px(n)-+Bx(n);return Math.round(r/bx)+1}function yS(e,t){let n=Ox(e,t?.in),r=n.getFullYear(),i=Mx(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Dx(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Nx(o,t),c=Dx(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Nx(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function bS(e,t){let n=Mx(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=yS(e,t),a=Dx(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Nx(a,t)}function xS(e,t){let n=Ox(e,t?.in),r=Nx(n,t)-+bS(n,t);return Math.round(r/bx)+1}function SS(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var CS={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return SS(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):SS(n+1,2)},d(e,t){return SS(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return SS(e.getHours()%12||12,t.length)},H(e,t){return SS(e.getHours(),t.length)},m(e,t){return SS(e.getMinutes(),t.length)},s(e,t){return SS(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return SS(Math.trunc(r*10**(n-3)),t.length)}},wS={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},TS={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return CS.y(e,t)},Y:function(e,t,n,r){let i=yS(e,r),a=i>0?i:1-i;return t===`YY`?SS(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):SS(a,t.length)},R:function(e,t){return SS(Fx(e),t.length)},u:function(e,t){return SS(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return SS(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return SS(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return CS.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return SS(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=xS(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):SS(i,t.length)},I:function(e,t,n){let r=vS(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):SS(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):CS.d(e,t)},D:function(e,t,n){let r=_S(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):SS(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return SS(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return SS(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return SS(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?wS.noon:r===0?wS.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?wS.evening:r>=12?wS.afternoon:r>=4?wS.morning:wS.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return CS.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):CS.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):SS(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):SS(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):CS.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):CS.s(e,t)},S:function(e,t){return CS.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return DS(r);case`XXXX`:case`XX`:return OS(r);default:return OS(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return DS(r);case`xxxx`:case`xx`:return OS(r);default:return OS(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+ES(r,`:`);default:return`GMT`+OS(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+ES(r,`:`);default:return`GMT`+OS(r,`:`)}},t:function(e,t,n){return SS(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return SS(+e,t.length)}};function ES(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+SS(a,2)}function DS(e,t){return e%60==0?(e>0?`-`:`+`)+SS(Math.abs(e)/60,2):OS(e,t)}function OS(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=SS(Math.trunc(r/60),2),a=SS(r%60,2);return n+i+t+a}var kS=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},AS=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},jS={p:AS,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return kS(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,kS(r,t)).replace(`{{time}}`,AS(i,t))}},MS=/^D+$/,NS=/^Y+$/,PS=[`D`,`DD`,`YY`,`YYYY`];function FS(e){return MS.test(e)}function IS(e){return NS.test(e)}function LS(e,t,n){let r=RS(e,t,n);if(console.warn(r),PS.includes(e))throw RangeError(r)}function RS(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var zS=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,BS=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,VS=/^'([^]*?)'?$/,HS=/''/g,US=/[a-zA-Z]/;function WS(e,t,n){let r=Mx(),i=n?.locale??r.locale??gS,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Ox(e,n?.in);if(!qx(s))throw RangeError(`Invalid time value`);let c=t.match(BS).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=jS[t];return n(e,i.formatLong)}return e}).join(``).match(zS).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:GS(e)};if(TS[t])return{isToken:!0,value:e};if(t.match(US))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&IS(a)||!n?.useAdditionalDayOfYearTokens&&FS(a))&&LS(a,t,String(e));let o=TS[a[0]];return o(s,a,i.localize,l)}).join(``)}function GS(e){let t=e.match(VS);return t?t[1].replace(HS,`'`):e}function KS(e,t){let n=Ox(e,t?.in),r=n.getFullYear(),i=n.getMonth(),a=Dx(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function qS(){return Object.assign({},Mx())}function JS(e,t){let n=Ox(e,t?.in).getDay();return n===0?7:n}function YS(e,t){return Ox(e,t?.in).getMonth()}function XS(e,t){return Ox(e,t?.in).getFullYear()}function ZS(e,t){return+Ox(e)>+Ox(t)}function QS(e,t){return+Ox(e)<+Ox(t)}function $S(e,t){let n=eC(t)?new t(0):Dx(t,0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}function eC(e){return typeof e==`function`&&e.prototype?.constructor===e}var tC=10,nC=class{subPriority=0;validate(e,t){return!0}},rC=class extends nC{constructor(e,t,n,r,i){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=r,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}},iC=class extends nC{priority=tC;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>Dx(t,e))}set(e,t){return t.timestampIsSet?e:Dx(e,$S(e,this.context))}},aC=class{run(e,t,n,r){let i=this.parse(e,t,n,r);return i?{setter:new rC(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,n){return!0}},oC=class extends aC{priority=140;parse(e,t,n){switch(t){case`G`:case`GG`:case`GGG`:return n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`});case`GGGGG`:return n.era(e,{width:`narrow`});default:return n.era(e,{width:`wide`})||n.era(e,{width:`abbreviated`})||n.era(e,{width:`narrow`})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`R`,`u`,`t`,`T`]},sC={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},cC={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function lC(e,t){return e&&{value:t(e.value),rest:e.rest}}function uC(e,t){let n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function dC(e,t){let n=t.match(e);if(!n)return null;if(n[0]===`Z`)return{value:0,rest:t.slice(1)};let r=n[1]===`+`?1:-1,i=n[2]?parseInt(n[2],10):0,a=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(i*Cx+a*Sx+o*wx),rest:t.slice(n[0].length)}}function fC(e){return uC(sC.anyDigitsSigned,e)}function pC(e,t){switch(e){case 1:return uC(sC.singleDigit,t);case 2:return uC(sC.twoDigits,t);case 3:return uC(sC.threeDigits,t);case 4:return uC(sC.fourDigits,t);default:return uC(RegExp(`^\\d{1,`+e+`}`),t)}}function mC(e,t){switch(e){case 1:return uC(sC.singleDigitSigned,t);case 2:return uC(sC.twoDigitsSigned,t);case 3:return uC(sC.threeDigitsSigned,t);case 4:return uC(sC.fourDigitsSigned,t);default:return uC(RegExp(`^-?\\d{1,`+e+`}`),t)}}function hC(e){switch(e){case`morning`:return 4;case`evening`:return 17;case`pm`:case`noon`:case`afternoon`:return 12;default:return 0}}function gC(e,t){let n=t>0,r=n?t:1-t,i;if(r<=50)i=e||100;else{let t=r+50,n=Math.trunc(t/100)*100,a=e>=t%100;i=e+n-(a?100:0)}return n?i:1-i}function _C(e){return e%400==0||e%4==0&&e%100!=0}var vC=class extends aC{priority=130;incompatibleTokens=[`Y`,`R`,`u`,`w`,`I`,`i`,`e`,`c`,`t`,`T`];parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`yy`});switch(t){case`y`:return lC(pC(4,e),r);case`yo`:return lC(n.ordinalNumber(e,{unit:`year`}),r);default:return lC(pC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){let r=e.getFullYear();if(n.isTwoDigitYear){let t=gC(n.year,r);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}let i=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},yC=class extends aC{priority=130;parse(e,t,n){let r=e=>({year:e,isTwoDigitYear:t===`YY`});switch(t){case`Y`:return lC(pC(4,e),r);case`Yo`:return lC(n.ordinalNumber(e,{unit:`year`}),r);default:return lC(pC(t.length,e),r)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,r){let i=yS(e,r);if(n.isTwoDigitYear){let t=gC(n.year,i);return e.setFullYear(t,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Nx(e,r)}let a=!(`era`in t)||t.era===1?n.year:1-n.year;return e.setFullYear(a,0,r.firstWeekContainsDate),e.setHours(0,0,0,0),Nx(e,r)}incompatibleTokens=[`y`,`R`,`u`,`Q`,`q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]},bC=class extends aC{priority=130;parse(e,t){return mC(t===`R`?4:t.length,e)}set(e,t,n){let r=Dx(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Px(r)}incompatibleTokens=[`G`,`y`,`Y`,`u`,`Q`,`q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},xC=class extends aC{priority=130;parse(e,t){return mC(t===`u`?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`G`,`y`,`Y`,`R`,`w`,`I`,`i`,`e`,`c`,`t`,`T`]},SC=class extends aC{priority=120;parse(e,t,n){switch(t){case`Q`:case`QQ`:return pC(t.length,e);case`Qo`:return n.ordinalNumber(e,{unit:`quarter`});case`QQQ`:return n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`});case`QQQQQ`:return n.quarter(e,{width:`narrow`,context:`formatting`});default:return n.quarter(e,{width:`wide`,context:`formatting`})||n.quarter(e,{width:`abbreviated`,context:`formatting`})||n.quarter(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},CC=class extends aC{priority=120;parse(e,t,n){switch(t){case`q`:case`qq`:return pC(t.length,e);case`qo`:return n.ordinalNumber(e,{unit:`quarter`});case`qqq`:return n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`});case`qqqqq`:return n.quarter(e,{width:`narrow`,context:`standalone`});default:return n.quarter(e,{width:`wide`,context:`standalone`})||n.quarter(e,{width:`abbreviated`,context:`standalone`})||n.quarter(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`Q`,`M`,`L`,`w`,`I`,`d`,`D`,`i`,`e`,`c`,`t`,`T`]},wC=class extends aC{incompatibleTokens=[`Y`,`R`,`q`,`Q`,`L`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`];priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`M`:return lC(uC(sC.month,e),r);case`MM`:return lC(pC(2,e),r);case`Mo`:return lC(n.ordinalNumber(e,{unit:`month`}),r);case`MMM`:return n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`});case`MMMMM`:return n.month(e,{width:`narrow`,context:`formatting`});default:return n.month(e,{width:`wide`,context:`formatting`})||n.month(e,{width:`abbreviated`,context:`formatting`})||n.month(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}},TC=class extends aC{priority=110;parse(e,t,n){let r=e=>e-1;switch(t){case`L`:return lC(uC(sC.month,e),r);case`LL`:return lC(pC(2,e),r);case`Lo`:return lC(n.ordinalNumber(e,{unit:`month`}),r);case`LLL`:return n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`});case`LLLLL`:return n.month(e,{width:`narrow`,context:`standalone`});default:return n.month(e,{width:`wide`,context:`standalone`})||n.month(e,{width:`abbreviated`,context:`standalone`})||n.month(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]};function EC(e,t,n){let r=Ox(e,n?.in),i=xS(r,n)-t;return r.setDate(r.getDate()-i*7),Ox(r,n?.in)}var DC=class extends aC{priority=100;parse(e,t,n){switch(t){case`w`:return uC(sC.week,e);case`wo`:return n.ordinalNumber(e,{unit:`week`});default:return pC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,r){return Nx(EC(e,n,r),r)}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`i`,`t`,`T`]};function OC(e,t,n){let r=Ox(e,n?.in),i=vS(r,n)-t;return r.setDate(r.getDate()-i*7),r}var kC=class extends aC{priority=100;parse(e,t,n){switch(t){case`I`:return uC(sC.week,e);case`Io`:return n.ordinalNumber(e,{unit:`week`});default:return pC(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return Px(OC(e,n))}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`e`,`c`,`t`,`T`]},AC=[31,28,31,30,31,30,31,31,30,31,30,31],jC=[31,29,31,30,31,30,31,31,30,31,30,31],MC=class extends aC{priority=90;subPriority=1;parse(e,t,n){switch(t){case`d`:return uC(sC.date,e);case`do`:return n.ordinalNumber(e,{unit:`date`});default:return pC(t.length,e)}}validate(e,t){let n=_C(e.getFullYear()),r=e.getMonth();return n?t>=1&&t<=jC[r]:t>=1&&t<=AC[r]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`w`,`I`,`D`,`i`,`e`,`c`,`t`,`T`]},NC=class extends aC{priority=90;subpriority=1;parse(e,t,n){switch(t){case`D`:case`DD`:return uC(sC.dayOfYear,e);case`Do`:return n.ordinalNumber(e,{unit:`date`});default:return pC(t.length,e)}}validate(e,t){return _C(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`Y`,`R`,`q`,`Q`,`M`,`L`,`w`,`I`,`d`,`E`,`i`,`e`,`c`,`t`,`T`]};function PC(e,t,n){let r=Mx(),i=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=Ox(e,n?.in),o=a.getDay(),s=(t%7+7)%7,c=7-i;return kx(a,t<0||t>6?t-(o+c)%7:(s+c)%7-(o+c)%7,n)}var FC=class extends aC{priority=90;parse(e,t,n){switch(t){case`E`:case`EE`:case`EEE`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`EEEEE`:return n.day(e,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=PC(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`D`,`i`,`e`,`c`,`t`,`T`]},IC=class extends aC{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`e`:case`ee`:return lC(pC(t.length,e),i);case`eo`:return lC(n.ordinalNumber(e,{unit:`day`}),i);case`eee`:return n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});case`eeeee`:return n.day(e,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`});default:return n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=PC(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`c`,`t`,`T`]},LC=class extends aC{priority=90;parse(e,t,n,r){let i=e=>{let t=Math.floor((e-1)/7)*7;return(e+r.weekStartsOn+6)%7+t};switch(t){case`c`:case`cc`:return lC(pC(t.length,e),i);case`co`:return lC(n.ordinalNumber(e,{unit:`day`}),i);case`ccc`:return n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});case`ccccc`:return n.day(e,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`});default:return n.day(e,{width:`wide`,context:`standalone`})||n.day(e,{width:`abbreviated`,context:`standalone`})||n.day(e,{width:`short`,context:`standalone`})||n.day(e,{width:`narrow`,context:`standalone`})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,r){return e=PC(e,n,r),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`R`,`u`,`q`,`Q`,`M`,`L`,`I`,`d`,`D`,`E`,`i`,`e`,`t`,`T`]};function RC(e,t,n){let r=Ox(e,n?.in);return kx(r,t-JS(r,n),n)}var zC=class extends aC{priority=90;parse(e,t,n){let r=e=>e===0?7:e;switch(t){case`i`:case`ii`:return pC(t.length,e);case`io`:return n.ordinalNumber(e,{unit:`day`});case`iii`:return lC(n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiii`:return lC(n.day(e,{width:`narrow`,context:`formatting`}),r);case`iiiiii`:return lC(n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r);default:return lC(n.day(e,{width:`wide`,context:`formatting`})||n.day(e,{width:`abbreviated`,context:`formatting`})||n.day(e,{width:`short`,context:`formatting`})||n.day(e,{width:`narrow`,context:`formatting`}),r)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=RC(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=[`y`,`Y`,`u`,`q`,`Q`,`M`,`L`,`w`,`d`,`D`,`E`,`e`,`c`,`t`,`T`]},BC=class extends aC{priority=80;parse(e,t,n){switch(t){case`a`:case`aa`:case`aaa`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`aaaaa`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(hC(n),0,0,0),e}incompatibleTokens=[`b`,`B`,`H`,`k`,`t`,`T`]},VC=class extends aC{priority=80;parse(e,t,n){switch(t){case`b`:case`bb`:case`bbb`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`bbbbb`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(hC(n),0,0,0),e}incompatibleTokens=[`a`,`B`,`H`,`k`,`t`,`T`]},HC=class extends aC{priority=80;parse(e,t,n){switch(t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`});case`BBBBB`:return n.dayPeriod(e,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(e,{width:`wide`,context:`formatting`})||n.dayPeriod(e,{width:`abbreviated`,context:`formatting`})||n.dayPeriod(e,{width:`narrow`,context:`formatting`})}}set(e,t,n){return e.setHours(hC(n),0,0,0),e}incompatibleTokens=[`a`,`b`,`t`,`T`]},UC=class extends aC{priority=70;parse(e,t,n){switch(t){case`h`:return uC(sC.hour12h,e);case`ho`:return n.ordinalNumber(e,{unit:`hour`});default:return pC(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){let r=e.getHours()>=12;return r&&n<12?e.setHours(n+12,0,0,0):!r&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`H`,`K`,`k`,`t`,`T`]},WC=class extends aC{priority=70;parse(e,t,n){switch(t){case`H`:return uC(sC.hour23h,e);case`Ho`:return n.ordinalNumber(e,{unit:`hour`});default:return pC(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`K`,`k`,`t`,`T`]},GC=class extends aC{priority=70;parse(e,t,n){switch(t){case`K`:return uC(sC.hour11h,e);case`Ko`:return n.ordinalNumber(e,{unit:`hour`});default:return pC(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=[`h`,`H`,`k`,`t`,`T`]},KC=class extends aC{priority=70;parse(e,t,n){switch(t){case`k`:return uC(sC.hour24h,e);case`ko`:return n.ordinalNumber(e,{unit:`hour`});default:return pC(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){let r=n<=24?n%24:n;return e.setHours(r,0,0,0),e}incompatibleTokens=[`a`,`b`,`h`,`H`,`K`,`t`,`T`]},qC=class extends aC{priority=60;parse(e,t,n){switch(t){case`m`:return uC(sC.minute,e);case`mo`:return n.ordinalNumber(e,{unit:`minute`});default:return pC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=[`t`,`T`]},JC=class extends aC{priority=50;parse(e,t,n){switch(t){case`s`:return uC(sC.second,e);case`so`:return n.ordinalNumber(e,{unit:`second`});default:return pC(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=[`t`,`T`]},YC=class extends aC{priority=30;parse(e,t){return lC(pC(t.length,e),e=>Math.trunc(e*10**(-t.length+3)))}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=[`t`,`T`]},XC=class extends aC{priority=10;parse(e,t){switch(t){case`X`:return dC(cC.basicOptionalMinutes,e);case`XX`:return dC(cC.basic,e);case`XXXX`:return dC(cC.basicOptionalSeconds,e);case`XXXXX`:return dC(cC.extendedOptionalSeconds,e);default:return dC(cC.extended,e)}}set(e,t,n){return t.timestampIsSet?e:Dx(e,e.getTime()-Ix(e)-n)}incompatibleTokens=[`t`,`T`,`x`]},ZC=class extends aC{priority=10;parse(e,t){switch(t){case`x`:return dC(cC.basicOptionalMinutes,e);case`xx`:return dC(cC.basic,e);case`xxxx`:return dC(cC.basicOptionalSeconds,e);case`xxxxx`:return dC(cC.extendedOptionalSeconds,e);default:return dC(cC.extended,e)}}set(e,t,n){return t.timestampIsSet?e:Dx(e,e.getTime()-Ix(e)-n)}incompatibleTokens=[`t`,`T`,`X`]},QC=class extends aC{priority=40;parse(e){return fC(e)}set(e,t,n){return[Dx(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens=`*`},$C=class extends aC{priority=20;parse(e){return fC(e)}set(e,t,n){return[Dx(e,n),{timestampIsSet:!0}]}incompatibleTokens=`*`},ew={G:new oC,y:new vC,Y:new yC,R:new bC,u:new xC,Q:new SC,q:new CC,M:new wC,L:new TC,w:new DC,I:new kC,d:new MC,D:new NC,E:new FC,e:new IC,c:new LC,i:new zC,a:new BC,b:new VC,B:new HC,h:new UC,H:new WC,K:new GC,k:new KC,m:new qC,s:new JC,S:new YC,X:new XC,x:new ZC,t:new QC,T:new $C},tw=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,nw=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rw=/^'([^]*?)'?$/,iw=/''/g,aw=/\S/,ow=/[a-zA-Z]/;function sw(e,t,n,r){let i=()=>Dx(r?.in||n,NaN),a=qS(),o=r?.locale??a.locale??gS,s=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,c=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():Ox(n,r?.in);let l={firstWeekContainsDate:s,weekStartsOn:c,locale:o},u=[new iC(r?.in,n)],d=t.match(nw).map(e=>{let t=e[0];if(t in jS){let n=jS[t];return n(e,o.formatLong)}return e}).join(``).match(tw),f=[];for(let n of d){!r?.useAdditionalWeekYearTokens&&IS(n)&&LS(n,t,e),!r?.useAdditionalDayOfYearTokens&&FS(n)&&LS(n,t,e);let a=n[0],s=ew[a];if(s){let{incompatibleTokens:t}=s;if(Array.isArray(t)){let e=f.find(e=>t.includes(e.token)||e.token===a);if(e)throw RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${n}\` at the same time`)}else if(s.incompatibleTokens===`*`&&f.length>0)throw RangeError(`The format string mustn't contain \`${n}\` and any other token at the same time`);f.push({token:a,fullToken:n});let r=s.run(e,n,o.match,l);if(!r)return i();u.push(r.setter),e=r.rest}else{if(a.match(ow))throw RangeError("Format string contains an unescaped latin alphabet character `"+a+"`");if(n===`''`?n=`'`:a===`'`&&(n=cw(n)),e.indexOf(n)===0)e=e.slice(n.length);else return i()}}if(e.length>0&&aw.test(e))return i();let p=u.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,n)=>n.indexOf(e)===t).map(e=>u.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]),m=Ox(n,r?.in);if(isNaN(+m))return i();let h={};for(let e of p){if(!e.validate(m,l))return i();let t=e.set(m,h,l);Array.isArray(t)?(m=t[0],Object.assign(h,t[1])):m=t}return m}function cw(e){return e.match(rw)[1].replace(iw,`'`)}function lw(e,t,n){let[r,i]=Lx(n?.in,e,t);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function uw(e,t,n){let[r,i]=Lx(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function dw(e,t){let n=()=>Dx(t?.in,NaN),r=t?.additionalDigits??2,i=gw(e),a;if(i.date){let e=_w(i.date,r);a=vw(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=bw(i.time),isNaN(s)))return n();if(i.timezone){if(c=Sw(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=Ox(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return Ox(o+s+c,t?.in)}var fw={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},pw=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,mw=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,hw=/^([+-])(\d{2})(?::?(\d{2}))?$/;function gw(e){let t={},n=e.split(fw.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],fw.timeZoneDelimiter.test(t.date)&&(t.date=e.split(fw.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=fw.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function _w(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function vw(e,t){if(t===null)return new Date(NaN);let n=e.match(pw);if(!n)return new Date(NaN);let r=!!n[4],i=yw(n[1]),a=yw(n[2])-1,o=yw(n[3]),s=yw(n[4]),c=yw(n[5])-1;if(r)return Ow(t,s,c)?Cw(t,s,c):new Date(NaN);{let e=new Date(0);return!Ew(t,a,o)||!Dw(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function yw(e){return e?parseInt(e):1}function bw(e){let t=e.match(mw);if(!t)return NaN;let n=xw(t[1]),r=xw(t[2]),i=xw(t[3]);return kw(n,r,i)?n*Cx+r*Sx+i*1e3:NaN}function xw(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function Sw(e){if(e===`Z`)return 0;let t=e.match(hw);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return Aw(r,i)?n*(r*Cx+i*Sx):NaN}function Cw(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var ww=[31,null,31,30,31,30,31,31,30,31,30,31];function Tw(e){return e%400==0||e%4==0&&e%100!=0}function Ew(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(ww[t]||(Tw(e)?29:28))}function Dw(e,t){return t>=1&&t<=(Tw(e)?366:365)}function Ow(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function kw(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Aw(e,t){return t>=0&&t<=59}function jw(e,t,n){let r=Ox(e,n?.in),i=r.getFullYear(),a=r.getDate(),o=Dx(n?.in||e,0);o.setFullYear(i,t,15),o.setHours(0,0,0,0);let s=KS(o);return r.setMonth(t,Math.min(a,s)),r}function Mw(e,t,n){let r=Ox(e,n?.in);return isNaN(+r)?Dx(n?.in||e,NaN):(r.setFullYear(t),r)}function Nw(e,t,n=`long`){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,timeZone:e,timeZoneName:n}).format(t).split(/\s/g).slice(2).join(` `)}var Pw={},Fw={};function Iw(e,t){try{let n=(Pw[e]||=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}).format)(t).split(`GMT`)[1];return n in Fw?Fw[n]:Rw(n,n.split(`:`))}catch{if(e in Fw)return Fw[e];let t=e?.match(Lw);return t?Rw(e,t.slice(1)):NaN}}var Lw=/([+-]\d\d):?(\d\d)?/;function Rw(e,t){let n=+(t[0]||0),r=+(t[1]||0),i=(t[2]||0)/60;return Fw[e]=n*60+r>0?n*60+r+i:n*60-r-i}var zw=class e extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]==`string`&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Iw(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]==`number`&&(e.length===1||e.length===2&&typeof e[1]!=`number`)?this.setTime(e[0]):typeof e[0]==`string`?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),Uw(this,NaN),Vw(this)):this.setTime(Date.now())}static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}withTimeZone(t){return new e(+this,t)}getTimezoneOffset(){let e=-Iw(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Vw(this),+this}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},Bw=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Bw.test(e))return;let t=e.replace(Bw,`$1UTC`);zw.prototype[t]&&(e.startsWith(`get`)?zw.prototype[e]=function(){return this.internal[t]()}:(zw.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),Hw(this),+this},zw.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Vw(this),+this}))});function Vw(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-Iw(e.timeZone,e)*60))}function Hw(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),Uw(e)}function Uw(e){let t=Iw(e.timeZone,e),n=t>0?Math.floor(t):Math.ceil(t),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);let i=-new Date(+e).getTimezoneOffset(),a=i- -new Date(+r).getTimezoneOffset(),o=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();a&&o&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+a);let s=i-n;s&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+s);let c=new Date(+e);c.setUTCSeconds(0);let l=i>0?c.getSeconds():(c.getSeconds()-60)%60,u=Math.round(-(Iw(e.timeZone,e)*60))%60;(u||l)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+u),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+u+l));let d=Iw(e.timeZone,e),f=d>0?Math.floor(d):Math.ceil(d),p=-new Date(+e).getTimezoneOffset()-f,m=f!==n,h=p-s;if(m&&h){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+h);let t=Iw(e.timeZone,e),n=f-(t>0?Math.floor(t):Math.ceil(t));n&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+n),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+n))}}var Ww=class e extends zw{static tz(t,...n){return n.length?new e(...n,t):new e(Date.now(),t)}toISOString(){let[e,t,n]=this.tzComponents(),r=`${e}${t}:${n}`;return this.internal.toISOString().slice(0,-1)+r}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){let[e,t,n,r]=this.internal.toUTCString().split(` `);return`${e?.slice(0,-1)} ${n} ${t} ${r}`}toTimeString(){let e=this.internal.toUTCString().split(` `)[4],[t,n,r]=this.tzComponents();return`${e} GMT${t}${n}${r} (${Nw(this.timeZone,this)})`}toLocaleString(e,t){return Date.prototype.toLocaleString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleDateString(e,t){return Date.prototype.toLocaleDateString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}toLocaleTimeString(e,t){return Date.prototype.toLocaleTimeString.call(this,e,{...t,timeZone:t?.timeZone||this.timeZone})}tzComponents(){let e=this.getTimezoneOffset();return[e>0?`-`:`+`,String(Math.floor(Math.abs(e)/60)).padStart(2,`0`),String(Math.abs(e)%60).padStart(2,`0`)]}withTimeZone(t){return new e(+this,t)}[Symbol.for(`constructDateFrom`)](t){return new e(+new Date(t),this.timeZone)}},Gw=5,Kw=4;function qw(e,t){let n=t.startOfMonth(e),r=n.getDay()>0?n.getDay():7,i=t.addDays(e,-r+1),a=t.addDays(i,Gw*7-1);return t.getMonth(e)===t.getMonth(a)?Gw:Kw}function Jw(e,t){let n=t.startOfMonth(e),r=n.getDay();return r===1?n:r===0?t.addDays(n,-6):t.addDays(n,-1*(r-1))}function Yw(e,t){let n=Jw(e,t),r=qw(e,t);return t.addDays(n,r*7-1)}var Xw={...gS,labels:{labelDayButton:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>WS(e,t,{locale:gS,...n});let a=i(e,`PPPP`);return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a},labelMonthDropdown:`Choose the Month`,labelNext:`Go to the Next Month`,labelPrevious:`Go to the Previous Month`,labelWeekNumber:e=>`Week ${e}`,labelYearDropdown:`Choose the Year`,labelGrid:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>WS(e,n,{locale:gS,...t}),r(e,`LLLL yyyy`)},labelGridcell:(e,t,n,r)=>{let i;i=r&&typeof r.format==`function`?r.format.bind(r):(e,t)=>WS(e,t,{locale:gS,...n});let a=i(e,`PPPP`);return t?.today&&(a=`Today, ${a}`),a},labelNav:`Navigation bar`,labelWeekNumberHeader:`Week Number`,labelWeekday:(e,t,n)=>{let r;return r=n&&typeof n.format==`function`?n.format.bind(n):(e,n)=>WS(e,n,{locale:gS,...t}),r(e,`cccc`)}}},Zw=class e{constructor(e,t){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?Ww.tz(this.options.timeZone):new this.Date,this.newDate=(e,t,n)=>this.overrides?.newDate?this.overrides.newDate(e,t,n):this.options.timeZone?new Ww(e,t,n,this.options.timeZone):new Date(e,t,n),this.addDays=(e,t)=>this.overrides?.addDays?this.overrides.addDays(e,t):kx(e,t),this.addMonths=(e,t)=>this.overrides?.addMonths?this.overrides.addMonths(e,t):Ax(e,t),this.addWeeks=(e,t)=>this.overrides?.addWeeks?this.overrides.addWeeks(e,t):Vx(e,t),this.addYears=(e,t)=>this.overrides?.addYears?this.overrides.addYears(e,t):Hx(e,t),this.differenceInCalendarDays=(e,t)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(e,t):zx(e,t),this.differenceInCalendarMonths=(e,t)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(e,t):Jx(e,t),this.eachMonthOfInterval=e=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(e):Zx(e),this.eachYearOfInterval=e=>{let t=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(e):tS(e),n=new Set(t.map(e=>this.getYear(e)));if(n.size===t.length)return t;let r=[];return n.forEach(e=>{r.push(new Date(e,0,1))}),r},this.endOfBroadcastWeek=e=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(e):Yw(e,this),this.endOfISOWeek=e=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(e):rS(e),this.endOfMonth=e=>this.overrides?.endOfMonth?this.overrides.endOfMonth(e):Yx(e),this.endOfWeek=(e,t)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(e,t):nS(e,this.options),this.endOfYear=e=>this.overrides?.endOfYear?this.overrides.endOfYear(e):$x(e),this.format=(e,t,n)=>{let r=this.overrides?.format?this.overrides.format(e,t,this.options):WS(e,t,this.options);return this.options.numerals&&this.options.numerals!==`latn`?this.replaceDigits(r):r},this.getISOWeek=e=>this.overrides?.getISOWeek?this.overrides.getISOWeek(e):vS(e),this.getMonth=(e,t)=>this.overrides?.getMonth?this.overrides.getMonth(e,this.options):YS(e,this.options),this.getYear=(e,t)=>this.overrides?.getYear?this.overrides.getYear(e,this.options):XS(e,this.options),this.getWeek=(e,t)=>this.overrides?.getWeek?this.overrides.getWeek(e,this.options):xS(e,this.options),this.isAfter=(e,t)=>this.overrides?.isAfter?this.overrides.isAfter(e,t):ZS(e,t),this.isBefore=(e,t)=>this.overrides?.isBefore?this.overrides.isBefore(e,t):QS(e,t),this.isDate=e=>this.overrides?.isDate?this.overrides.isDate(e):Kx(e),this.isSameDay=(e,t)=>this.overrides?.isSameDay?this.overrides.isSameDay(e,t):Gx(e,t),this.isSameMonth=(e,t)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(e,t):lw(e,t),this.isSameYear=(e,t)=>this.overrides?.isSameYear?this.overrides.isSameYear(e,t):uw(e,t),this.max=e=>this.overrides?.max?this.overrides.max(e):Ux(e),this.min=e=>this.overrides?.min?this.overrides.min(e):Wx(e),this.setMonth=(e,t)=>this.overrides?.setMonth?this.overrides.setMonth(e,t):jw(e,t),this.setYear=(e,t)=>this.overrides?.setYear?this.overrides.setYear(e,t):Mw(e,t),this.startOfBroadcastWeek=(e,t)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(e,this):Jw(e,this),this.startOfDay=e=>this.overrides?.startOfDay?this.overrides.startOfDay(e):Rx(e),this.startOfISOWeek=e=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(e):Px(e),this.startOfMonth=e=>this.overrides?.startOfMonth?this.overrides.startOfMonth(e):Qx(e),this.startOfWeek=(e,t)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(e,this.options):Nx(e,this.options),this.startOfYear=e=>this.overrides?.startOfYear?this.overrides.startOfYear(e):eS(e),this.options={locale:Xw,...e},this.overrides=t}getDigitMap(){let{numerals:e=`latn`}=this.options,t=new Intl.NumberFormat(`en-US`,{numberingSystem:e}),n={};for(let e=0;e<10;e++)n[e.toString()]=t.format(e);return n}replaceDigits(e){let t=this.getDigitMap();return e.replace(/\d/g,e=>t[e]||e)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){let t=this.options.locale?.code;return t&&e.yearFirstLocales.has(t)?`year-first`:`month-first`}formatMonthYear(t){let{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&e.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:`long`,year:`numeric`,timeZone:r,numberingSystem:i}).format(t)}catch{}let o=this.getMonthYearOrder()===`year-first`?`y LLLL`:`LLLL y`;return this.format(t,o)}};Zw.yearFirstLocales=new Set([`eu`,`hu`,`ja`,`ja-Hira`,`ja-JP`,`ko`,`ko-KR`,`lt`,`lt-LT`,`lv`,`lv-LV`,`mn`,`mn-MN`,`zh`,`zh-CN`,`zh-HK`,`zh-TW`]);var Qw=new Zw,$w=class{constructor(e,t,n=Qw){this.date=e,this.displayMonth=t,this.outside=!!(t&&!n.isSameMonth(e,t)),this.dateLib=n,this.isoDate=n.format(e,`yyyy-MM-dd`),this.displayMonthId=n.format(t,`yyyy-MM`),this.dateMonthId=n.format(e,`yyyy-MM`)}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}},eT=class{constructor(e,t){this.date=e,this.weeks=t}},tT=class{constructor(e,t){this.days=t,this.weekNumber=e}};function nT(e){return Q.createElement(`button`,{...e})}function rT(e){return Q.createElement(`span`,{...e})}function iT(e){let{size:t=24,orientation:n=`left`,className:r}=e;return Q.createElement(`svg`,{className:r,width:t,height:t,viewBox:`0 0 24 24`},n===`up`&&Q.createElement(`polygon`,{points:`6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28`}),n===`down`&&Q.createElement(`polygon`,{points:`6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72`}),n===`left`&&Q.createElement(`polygon`,{points:`16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20`}),n===`right`&&Q.createElement(`polygon`,{points:`8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20`}))}function aT(e){let{day:t,modifiers:n,...r}=e;return Q.createElement(`td`,{...r})}function oT(e){let{day:t,modifiers:n,...r}=e,i=Q.useRef(null);return Q.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),Q.createElement(`button`,{ref:i,...r})}var sT;(function(e){e.Root=`root`,e.Chevron=`chevron`,e.Day=`day`,e.DayButton=`day_button`,e.CaptionLabel=`caption_label`,e.Dropdowns=`dropdowns`,e.Dropdown=`dropdown`,e.DropdownRoot=`dropdown_root`,e.Footer=`footer`,e.MonthGrid=`month_grid`,e.MonthCaption=`month_caption`,e.MonthsDropdown=`months_dropdown`,e.Month=`month`,e.Months=`months`,e.Nav=`nav`,e.NextMonthButton=`button_next`,e.PreviousMonthButton=`button_previous`,e.Week=`week`,e.Weeks=`weeks`,e.Weekday=`weekday`,e.Weekdays=`weekdays`,e.WeekNumber=`week_number`,e.WeekNumberHeader=`week_number_header`,e.YearsDropdown=`years_dropdown`})(sT||={});var cT;(function(e){e.disabled=`disabled`,e.hidden=`hidden`,e.outside=`outside`,e.focused=`focused`,e.today=`today`})(cT||={});var lT;(function(e){e.range_end=`range_end`,e.range_middle=`range_middle`,e.range_start=`range_start`,e.selected=`selected`})(lT||={});var uT;(function(e){e.weeks_before_enter=`weeks_before_enter`,e.weeks_before_exit=`weeks_before_exit`,e.weeks_after_enter=`weeks_after_enter`,e.weeks_after_exit=`weeks_after_exit`,e.caption_after_enter=`caption_after_enter`,e.caption_after_exit=`caption_after_exit`,e.caption_before_enter=`caption_before_enter`,e.caption_before_exit=`caption_before_exit`})(uT||={});function dT(e){let{options:t,className:n,components:r,classNames:i,...a}=e,o=[i[sT.Dropdown],n].join(` `),s=t?.find(({value:e})=>e===a.value);return Q.createElement(`span`,{"data-disabled":a.disabled,className:i[sT.DropdownRoot]},Q.createElement(r.Select,{className:o,...a},t?.map(({value:e,label:t,disabled:n})=>Q.createElement(r.Option,{key:e,value:e,disabled:n},t))),Q.createElement(`span`,{className:i[sT.CaptionLabel],"aria-hidden":!0},s?.label,Q.createElement(r.Chevron,{orientation:`down`,size:18,className:i[sT.Chevron]})))}function fT(e){return Q.createElement(`div`,{...e})}function pT(e){return Q.createElement(`div`,{...e})}function mT(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r},e.children)}function hT(e){let{calendarMonth:t,displayIndex:n,...r}=e;return Q.createElement(`div`,{...r})}function gT(e){return Q.createElement(`table`,{...e})}function _T(e){return Q.createElement(`div`,{...e})}var vT=(0,Q.createContext)(void 0);function yT(){let e=(0,Q.useContext)(vT);if(e===void 0)throw Error(`useDayPicker() must be used within a custom component.`);return e}function bT(e){let{components:t}=yT();return Q.createElement(t.Dropdown,{...e})}function xT(e){let{onPreviousClick:t,onNextClick:n,previousMonth:r,nextMonth:i,...a}=e,{components:o,classNames:s,labels:{labelPrevious:c,labelNext:l}}=yT(),u=(0,Q.useCallback)(e=>{i&&n?.(e)},[i,n]),d=(0,Q.useCallback)(e=>{r&&t?.(e)},[r,t]);return Q.createElement(`nav`,{...a},Q.createElement(o.PreviousMonthButton,{type:`button`,className:s[sT.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:d},Q.createElement(o.Chevron,{disabled:r?void 0:!0,className:s[sT.Chevron],orientation:`left`})),Q.createElement(o.NextMonthButton,{type:`button`,className:s[sT.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":l(i),onClick:u},Q.createElement(o.Chevron,{disabled:i?void 0:!0,orientation:`right`,className:s[sT.Chevron]})))}function ST(e){let{components:t}=yT();return Q.createElement(t.Button,{...e})}function CT(e){return Q.createElement(`option`,{...e})}function wT(e){let{components:t}=yT();return Q.createElement(t.Button,{...e})}function TT(e){let{rootRef:t,...n}=e;return Q.createElement(`div`,{...n,ref:t})}function ET(e){return Q.createElement(`select`,{...e})}function DT(e){let{week:t,...n}=e;return Q.createElement(`tr`,{...n})}function OT(e){return Q.createElement(`th`,{...e})}function kT(e){return Q.createElement(`thead`,{"aria-hidden":!0},Q.createElement(`tr`,{...e}))}function AT(e){let{week:t,...n}=e;return Q.createElement(`th`,{...n})}function jT(e){return Q.createElement(`th`,{...e})}function MT(e){return Q.createElement(`tbody`,{...e})}function NT(e){let{components:t}=yT();return Q.createElement(t.Dropdown,{...e})}var PT=t({Button:()=>nT,CaptionLabel:()=>rT,Chevron:()=>iT,Day:()=>aT,DayButton:()=>oT,Dropdown:()=>dT,DropdownNav:()=>fT,Footer:()=>pT,Month:()=>mT,MonthCaption:()=>hT,MonthGrid:()=>gT,Months:()=>_T,MonthsDropdown:()=>bT,Nav:()=>xT,NextMonthButton:()=>ST,Option:()=>CT,PreviousMonthButton:()=>wT,Root:()=>TT,Select:()=>ET,Week:()=>DT,WeekNumber:()=>AT,WeekNumberHeader:()=>jT,Weekday:()=>OT,Weekdays:()=>kT,Weeks:()=>MT,YearsDropdown:()=>NT});function FT(e,t,n=!1,r=Qw){let{from:i,to:a}=e,{differenceInCalendarDays:o,isSameDay:s}=r;return i&&a?(o(a,i)<0&&([i,a]=[a,i]),o(t,i)>=+!!n&&o(a,t)>=+!!n):!n&&a?s(a,t):!n&&i?s(i,t):!1}function IT(e){return!!(e&&typeof e==`object`&&`before`in e&&`after`in e)}function LT(e){return!!(e&&typeof e==`object`&&`from`in e)}function RT(e){return!!(e&&typeof e==`object`&&`after`in e)}function zT(e){return!!(e&&typeof e==`object`&&`before`in e)}function BT(e){return!!(e&&typeof e==`object`&&`dayOfWeek`in e)}function VT(e,t){return Array.isArray(e)&&e.every(t.isDate)}function HT(e,t,n=Qw){let r=Array.isArray(t)?t:[t],{isSameDay:i,differenceInCalendarDays:a,isAfter:o}=n;return r.some(t=>{if(typeof t==`boolean`)return t;if(n.isDate(t))return i(e,t);if(VT(t,n))return t.some(t=>i(e,t));if(LT(t))return FT(t,e,!1,n);if(BT(t))return Array.isArray(t.dayOfWeek)?t.dayOfWeek.includes(e.getDay()):t.dayOfWeek===e.getDay();if(IT(t)){let n=a(t.before,e),r=a(t.after,e),i=n>0,s=r<0;return o(t.before,t.after)?s&&i:i||s}return RT(t)?a(e,t.after)>0:zT(t)?a(t.before,e)>0:typeof t==`function`?t(e):!1})}function UT(e,t,n,r,i){let{disabled:a,hidden:o,modifiers:s,showOutsideDays:c,broadcastCalendar:l,today:u=i.today()}=t,{isSameDay:d,isSameMonth:f,startOfMonth:p,isBefore:m,endOfMonth:h,isAfter:g}=i,_=n&&p(n),v=r&&h(r),y={[cT.focused]:[],[cT.outside]:[],[cT.disabled]:[],[cT.hidden]:[],[cT.today]:[]},b={};for(let t of e){let{date:e,displayMonth:n}=t,r=!!(n&&!f(e,n)),p=!!(_&&m(e,_)),h=!!(v&&g(e,v)),x=!!(a&&HT(e,a,i)),S=!!(o&&HT(e,o,i))||p||h||!l&&!c&&r||l&&c===!1&&r,C=d(e,u);r&&y.outside.push(t),x&&y.disabled.push(t),S&&y.hidden.push(t),C&&y.today.push(t),s&&Object.keys(s).forEach(n=>{let r=s?.[n];r&&HT(e,r,i)&&(b[n]?b[n].push(t):b[n]=[t])})}return e=>{let t={[cT.focused]:!1,[cT.disabled]:!1,[cT.hidden]:!1,[cT.outside]:!1,[cT.today]:!1},n={};for(let n in y)t[n]=y[n].some(t=>t===e);for(let t in b)n[t]=b[t].some(t=>t===e);return{...t,...n}}}function WT(e,t,n={}){return Object.entries(e).filter(([,e])=>e===!0).reduce((e,[r])=>(n[r]?e.push(n[r]):t[cT[r]]?e.push(t[cT[r]]):t[lT[r]]&&e.push(t[lT[r]]),e),[t[sT.Day]])}function GT(e){return{...PT,...e}}function KT(e){let t={"data-mode":e.mode??void 0,"data-required":`required`in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([e,n])=>{e.startsWith(`data-`)&&(t[e]=n)}),t}function qT(){let e={};for(let t in sT)e[sT[t]]=`rdp-${sT[t]}`;for(let t in cT)e[cT[t]]=`rdp-${cT[t]}`;for(let t in lT)e[lT[t]]=`rdp-${lT[t]}`;for(let t in uT)e[uT[t]]=`rdp-${uT[t]}`;return e}function JT(e,t,n){return(n??new Zw(t)).formatMonthYear(e)}var YT=JT;function XT(e,t,n){return(n??new Zw(t)).format(e,`d`)}function ZT(e,t=Qw){return t.format(e,`LLLL`)}function QT(e,t,n){return(n??new Zw(t)).format(e,`cccccc`)}function $T(e,t=Qw){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function eE(){return``}function tE(e,t=Qw){return t.format(e,`yyyy`)}var nE=tE,rE=t({formatCaption:()=>JT,formatDay:()=>XT,formatMonthCaption:()=>YT,formatMonthDropdown:()=>ZT,formatWeekNumber:()=>$T,formatWeekNumberHeader:()=>eE,formatWeekdayName:()=>QT,formatYearCaption:()=>nE,formatYearDropdown:()=>tE});function iE(e){return e?.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e?.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...rE,...e}}function aE(e,t,n,r){let i=(r??new Zw(n)).format(e,`PPPP`);return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i}var oE=aE;function sE(e,t,n){return(n??new Zw(t)).formatMonthYear(e)}var cE=sE;function lE(e,t,n,r){let i=(r??new Zw(n)).format(e,`PPPP`);return t?.today&&(i=`Today, ${i}`),i}function uE(e){return`Choose the Month`}function dE(){return``}var fE=`Go to the Next Month`;function pE(e,t){return fE}function mE(e){return`Go to the Previous Month`}function hE(e,t,n){return(n??new Zw(t)).format(e,`cccc`)}function gE(e,t){return`Week ${e}`}function _E(e){return`Week Number`}function vE(e){return`Choose the Year`}var yE=t({labelCaption:()=>cE,labelDay:()=>oE,labelDayButton:()=>aE,labelGrid:()=>sE,labelGridcell:()=>lE,labelMonthDropdown:()=>uE,labelNav:()=>dE,labelNext:()=>pE,labelPrevious:()=>mE,labelWeekNumber:()=>gE,labelWeekNumberHeader:()=>_E,labelWeekday:()=>hE,labelYearDropdown:()=>vE}),bE=(e,t,n)=>t||(n?typeof n==`function`?n:(...e)=>n:e);function xE(e,t){let n=t.locale?.labels??{};return{...yE,...e??{},labelDayButton:bE(aE,e?.labelDayButton,n.labelDayButton),labelMonthDropdown:bE(uE,e?.labelMonthDropdown,n.labelMonthDropdown),labelNext:bE(pE,e?.labelNext,n.labelNext),labelPrevious:bE(mE,e?.labelPrevious,n.labelPrevious),labelWeekNumber:bE(gE,e?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:bE(vE,e?.labelYearDropdown,n.labelYearDropdown),labelGrid:bE(sE,e?.labelGrid,n.labelGrid),labelGridcell:bE(lE,e?.labelGridcell,n.labelGridcell),labelNav:bE(dE,e?.labelNav,n.labelNav),labelWeekNumberHeader:bE(_E,e?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:bE(hE,e?.labelWeekday,n.labelWeekday)}}function SE(e,t,n,r,i){let{startOfMonth:a,startOfYear:o,endOfYear:s,eachMonthOfInterval:c,getMonth:l}=i;return c({start:o(e),end:s(e)}).map(e=>{let o=r.formatMonthDropdown(e,i);return{value:l(e),label:o,disabled:t&&e<a(t)||n&&e>a(n)||!1}})}function CE(e,t={},n={}){let r={...t?.[sT.Day]};return Object.entries(e).filter(([,e])=>e===!0).forEach(([e])=>{r={...r,...n?.[e]}}),r}function wE(e,t,n,r){let i=r??e.today(),a=n?e.startOfBroadcastWeek(i,e):t?e.startOfISOWeek(i):e.startOfWeek(i),o=[];for(let t=0;t<7;t++){let n=e.addDays(a,t);o.push(n)}return o}function TE(e,t,n,r,i=!1){if(!e||!t)return;let{startOfYear:a,endOfYear:o,eachYearOfInterval:s,getYear:c}=r,l=s({start:a(e),end:o(t)});return i&&l.reverse(),l.map(e=>{let t=n.formatYearDropdown(e,r);return{value:c(e),label:t,disabled:!1}})}function EE(e,t={}){let{weekStartsOn:n,locale:r}=t,i=n??r?.options?.weekStartsOn??0,a=t=>{let n=typeof t==`number`||typeof t==`string`?new Date(t):t;return new Ww(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0,e)},o=e=>{let t=a(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)};return{today:()=>a(Ww.tz(e)),newDate:(t,n,r)=>new Ww(t,n,r,12,0,0,e),startOfDay:e=>a(e),startOfWeek:(e,t)=>{let n=a(e),r=t?.weekStartsOn??i,o=(n.getDay()-r+7)%7;return n.setDate(n.getDate()-o),n},startOfISOWeek:e=>{let t=a(e),n=(t.getDay()-1+7)%7;return t.setDate(t.getDate()-n),t},startOfMonth:e=>{let t=a(e);return t.setDate(1),t},startOfYear:e=>{let t=a(e);return t.setMonth(0,1),t},endOfWeek:(e,t)=>{let n=a(e),r=(((t?.weekStartsOn??i)+6)%7-n.getDay()+7)%7;return n.setDate(n.getDate()+r),n},endOfISOWeek:e=>{let t=a(e),n=(7-t.getDay())%7;return t.setDate(t.getDate()+n),t},endOfMonth:e=>{let t=a(e);return t.setMonth(t.getMonth()+1,0),t},endOfYear:e=>{let t=a(e);return t.setMonth(11,31),t},eachMonthOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new Ww(n.getFullYear(),n.getMonth(),1,12,0,0,e),s=r.getFullYear()*12+r.getMonth();for(;o.getFullYear()*12+o.getMonth()<=s;)i.push(new Ww(o,e)),o.setMonth(o.getMonth()+1,1);return i},addDays:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t),n},addWeeks:(e,t)=>{let n=a(e);return n.setDate(n.getDate()+t*7),n},addMonths:(e,t)=>{let n=a(e);return n.setMonth(n.getMonth()+t),n},addYears:(e,t)=>{let n=a(e);return n.setFullYear(n.getFullYear()+t),n},eachYearOfInterval:t=>{let n=a(t.start),r=a(t.end),i=[],o=new Ww(n.getFullYear(),0,1,12,0,0,e);for(;o.getFullYear()<=r.getFullYear();)i.push(new Ww(o,e)),o.setFullYear(o.getFullYear()+1,0,1);return i},getWeek:(e,t)=>xS(o(e),{weekStartsOn:t?.weekStartsOn??i,firstWeekContainsDate:t?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1}),getISOWeek:e=>vS(o(e)),differenceInCalendarDays:(e,t)=>zx(o(e),o(t)),differenceInCalendarMonths:(e,t)=>Jx(o(e),o(t))}}var DE=e=>e instanceof HTMLElement?e:null,OE=e=>[...e.querySelectorAll(`[data-animated-month]`)??[]],kE=e=>DE(e.querySelector(`[data-animated-month]`)),AE=e=>DE(e.querySelector(`[data-animated-caption]`)),jE=e=>DE(e.querySelector(`[data-animated-weeks]`)),ME=e=>DE(e.querySelector(`[data-animated-nav]`)),NE=e=>DE(e.querySelector(`[data-animated-weekdays]`));function PE(e,t,{classNames:n,months:r,focused:i,dateLib:a}){let o=(0,Q.useRef)(null),s=(0,Q.useRef)(r),c=(0,Q.useRef)(!1);(0,Q.useLayoutEffect)(()=>{let l=s.current;if(s.current=r,!t||!e.current||!(e.current instanceof HTMLElement)||r.length===0||l.length===0||r.length!==l.length)return;let u=a.isSameMonth(r[0].date,l[0].date),d=a.isAfter(r[0].date,l[0].date),f=d?n[uT.caption_after_enter]:n[uT.caption_before_enter],p=d?n[uT.weeks_after_enter]:n[uT.weeks_before_enter],m=o.current,h=e.current.cloneNode(!0);if(h instanceof HTMLElement?(OE(h).forEach(e=>{if(!(e instanceof HTMLElement))return;let t=kE(e);t&&e.contains(t)&&e.removeChild(t);let n=AE(e);n&&n.classList.remove(f);let r=jE(e);r&&r.classList.remove(p)}),o.current=h):o.current=null,c.current||u||i)return;let g=m instanceof HTMLElement?OE(m):[],_=OE(e.current);if(_?.every(e=>e instanceof HTMLElement)&&g&&g.every(e=>e instanceof HTMLElement)){c.current=!0;let t=[];e.current.style.isolation=`isolate`;let r=ME(e.current);r&&(r.style.zIndex=`1`),_.forEach((i,a)=>{let o=g[a];if(!o)return;i.style.position=`relative`,i.style.overflow=`hidden`;let s=AE(i);s&&s.classList.add(f);let l=jE(i);l&&l.classList.add(p);let u=()=>{c.current=!1,e.current&&(e.current.style.isolation=``),r&&(r.style.zIndex=``),s&&s.classList.remove(f),l&&l.classList.remove(p),i.style.position=``,i.style.overflow=``,i.contains(o)&&i.removeChild(o)};t.push(u),o.style.pointerEvents=`none`,o.style.position=`absolute`,o.style.overflow=`hidden`,o.setAttribute(`aria-hidden`,`true`);let m=NE(o);m&&(m.style.opacity=`0`);let h=AE(o);h&&(h.classList.add(d?n[uT.caption_before_exit]:n[uT.caption_after_exit]),h.addEventListener(`animationend`,u));let _=jE(o);_&&_.classList.add(d?n[uT.weeks_before_exit]:n[uT.weeks_after_exit]),i.insertBefore(o,i.firstChild)})}})}function FE(e,t,n,r){let i=e[0],a=e[e.length-1],{ISOWeek:o,fixedWeeks:s,broadcastCalendar:c}=n??{},{addDays:l,differenceInCalendarDays:u,differenceInCalendarMonths:d,endOfBroadcastWeek:f,endOfISOWeek:p,endOfMonth:m,endOfWeek:h,isAfter:g,startOfBroadcastWeek:_,startOfISOWeek:v,startOfWeek:y}=r,b=c?_(i,r):o?v(i):y(i),x=c?f(a):o?p(m(a)):h(m(a)),S=t&&(c?f(t):o?p(t):h(t)),C=u(S&&g(x,S)?S:x,b),w=d(a,i)+1,T=[];for(let e=0;e<=C;e++){let t=l(b,e);T.push(t)}let E=(c?35:42)*w;if(s&&T.length<E){let e=E-T.length;for(let t=0;t<e;t++){let e=l(T[T.length-1],1);T.push(e)}}return T}function IE(e){let t=[];return e.reduce((e,n)=>{let r=n.weeks.reduce((e,t)=>e.concat(t.days.slice()),t.slice());return e.concat(r.slice())},t.slice())}function LE(e,t,n,r){let{numberOfMonths:i=1}=n,a=[];for(let n=0;n<i;n++){let i=r.addMonths(e,n);if(t&&i>t)break;a.push(i)}return a}function RE(e,t,n,r){let{month:i,defaultMonth:a,today:o=r.today(),numberOfMonths:s=1}=e,c=i||a||o,{differenceInCalendarMonths:l,addMonths:u,startOfMonth:d}=r;return n&&l(n,c)<s-1&&(c=u(n,-1*(s-1))),t&&l(c,t)<0&&(c=t),d(c)}function zE(e,t,n,r){let{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:o,endOfMonth:s,endOfWeek:c,getISOWeek:l,getWeek:u,startOfBroadcastWeek:d,startOfISOWeek:f,startOfWeek:p}=r,m=e.reduce((e,m)=>{let h=n.broadcastCalendar?d(m,r):n.ISOWeek?f(m):p(m),g=n.broadcastCalendar?a(m):n.ISOWeek?o(s(m)):c(s(m)),_=t.filter(e=>e>=h&&e<=g),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&_.length<v){let e=t.filter(e=>{let t=v-_.length;return e>g&&e<=i(g,t)});_.push(...e)}let y=new eT(m,_.reduce((e,t)=>{let i=n.ISOWeek?l(t):u(t),a=e.find(e=>e.weekNumber===i),o=new $w(t,m,r);return a?a.days.push(o):e.push(new tT(i,[o])),e},[]));return e.push(y),e},[]);return n.reverseMonths?m.reverse():m}function BE(e,t){let{startMonth:n,endMonth:r}=e,{startOfYear:i,startOfDay:a,startOfMonth:o,endOfMonth:s,addYears:c,endOfYear:l,newDate:u,today:d}=t,{fromYear:f,toYear:p,fromMonth:m,toMonth:h}=e;!n&&m&&(n=m),!n&&f&&(n=t.newDate(f,0,1)),!r&&h&&(r=h),!r&&p&&(r=u(p,11,31));let g=e.captionLayout===`dropdown`||e.captionLayout===`dropdown-years`;return n?n=o(n):f?n=u(f,0,1):!n&&g&&(n=i(c(e.today??d(),-100))),r?r=s(r):p?r=u(p,11,31):!r&&g&&(r=l(e.today??d())),[n&&a(n),r&&a(r)]}function VE(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a:1,u=o(e);if(!t||!(c(t,e)<a))return s(u,l)}function HE(e,t,n,r){if(n.disableNavigation)return;let{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:o,addMonths:s,differenceInCalendarMonths:c}=r,l=i?a??1:1,u=o(e);if(!t||!(c(u,t)<=0))return s(u,-l)}function UE(e){return e.reduce((e,t)=>e.concat(t.weeks.slice()),[].slice())}function WE(e,t){let[n,r]=(0,Q.useState)(e);return[t===void 0?n:t,r]}function GE(e,t){let[n,r]=BE(e,t),{startOfMonth:i,endOfMonth:a}=t,o=RE(e,n,r,t),[s,c]=WE(o,e.month?o:void 0);(0,Q.useEffect)(()=>{c(RE(e,n,r,t))},[e.timeZone]);let{months:l,weeks:u,days:d,previousMonth:f,nextMonth:p}=(0,Q.useMemo)(()=>{let i=LE(s,r,{numberOfMonths:e.numberOfMonths},t),o=zE(i,FE(i,e.endMonth?a(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t);return{months:o,weeks:UE(o),days:IE(o),previousMonth:HE(s,n,e,t),nextMonth:VE(s,r,e,t)}},[t,s.getTime(),r?.getTime(),n?.getTime(),e.disableNavigation,e.broadcastCalendar,e.endMonth?.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:m,onMonthChange:h}=e,g=e=>u.some(t=>t.days.some(t=>t.isEqualTo(e))),_=e=>{if(m)return;let t=i(e);n&&t<i(n)&&(t=i(n)),r&&t>i(r)&&(t=i(r)),c(t),h?.(t)};return{months:l,weeks:u,days:d,navStart:n,navEnd:r,previousMonth:f,nextMonth:p,goToMonth:_,goToDay:e=>{g(e)||_(e.date)}}}var KE;(function(e){e[e.Today=0]=`Today`,e[e.Selected=1]=`Selected`,e[e.LastFocused=2]=`LastFocused`,e[e.FocusedModifier=3]=`FocusedModifier`})(KE||={});function qE(e){return!e[cT.disabled]&&!e[cT.hidden]&&!e[cT.outside]}function JE(e,t,n,r){let i,a=-1;for(let o of e){let e=t(o);qE(e)&&(e[cT.focused]&&a<KE.FocusedModifier?(i=o,a=KE.FocusedModifier):r?.isEqualTo(o)&&a<KE.LastFocused?(i=o,a=KE.LastFocused):n(o.date)&&a<KE.Selected?(i=o,a=KE.Selected):e[cT.today]&&a<KE.Today&&(i=o,a=KE.Today))}return i||=e.find(e=>qE(t(e))),i}function YE(e,t,n,r,i,a,o){let{ISOWeek:s,broadcastCalendar:c}=a,{addDays:l,addMonths:u,addWeeks:d,addYears:f,endOfBroadcastWeek:p,endOfISOWeek:m,endOfWeek:h,max:g,min:_,startOfBroadcastWeek:v,startOfISOWeek:y,startOfWeek:b}=o,x={day:l,week:d,month:u,year:f,startOfWeek:e=>c?v(e,o):s?y(e):b(e),endOfWeek:e=>c?p(e):s?m(e):h(e)}[e](n,t===`after`?1:-1);return t===`before`&&r?x=g([r,x]):t===`after`&&i&&(x=_([i,x])),x}function XE(e,t,n,r,i,a,o,s=0){if(s>365)return;let c=YE(e,t,n.date,r,i,a,o),l=!!(a.disabled&&HT(c,a.disabled,o)),u=!!(a.hidden&&HT(c,a.hidden,o)),d=new $w(c,c,o);return!l&&!u?d:XE(e,t,d,r,i,a,o,s+1)}function ZE(e,t,n,r,i){let{autoFocus:a}=e,[o,s]=(0,Q.useState)(),c=JE(t.days,n,r||(()=>!1),o),[l,u]=(0,Q.useState)(a?c:void 0);return{isFocusTarget:e=>!!c?.isEqualTo(e),setFocused:u,focused:l,blur:()=>{s(l),u(void 0)},moveFocus:(n,r)=>{if(!l)return;let a=XE(n,r,l,t.navStart,t.navEnd,e,i);a&&(e.disableNavigation&&!t.days.some(e=>e.isEqualTo(a))||(t.goToDay(a),u(a)))}}}function QE(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=WE(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t,l=e=>s?.some(t=>c(t,e))??!1,{min:u,max:d}=e;return{selected:s,select:(e,t,n)=>{let a=[...s??[]];if(l(e)){if(s?.length===u||r&&s?.length===1)return;a=s?.filter(t=>!c(t,e))}else a=s?.length===d?[e]:[...a,e];return i||o(a),i?.(a,e,t,n),a},isSelected:l}}function $E(e,t,n=0,r=0,i=!1,a=Qw){let{from:o,to:s}=t||{},{isSameDay:c,isAfter:l,isBefore:u}=a,d;if(!o&&!s)d={from:e,to:n>0?void 0:e};else if(o&&!s)d=c(o,e)?n===0?{from:o,to:e}:i?{from:o,to:void 0}:void 0:u(e,o)?{from:e,to:o}:{from:o,to:e};else if(o&&s)if(c(o,e)&&c(s,e))d=i?{from:o,to:s}:void 0;else if(c(o,e))d={from:o,to:n>0?void 0:e};else if(c(s,e))d={from:e,to:n>0?void 0:e};else if(u(e,o))d={from:e,to:s};else if(l(e,o))d={from:o,to:e};else if(l(e,s))d={from:o,to:e};else throw Error(`Invalid range`);if(d?.from&&d?.to){let t=a.differenceInCalendarDays(d.to,d.from);(r>0&&t>r||n>1&&t<n)&&(d={from:e,to:void 0})}return d}function eD(e,t,n=Qw){let r=Array.isArray(t)?t:[t],i=e.from,a=n.differenceInCalendarDays(e.to,e.from),o=Math.min(a,6);for(let e=0;e<=o;e++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function tD(e,t,n=Qw){return FT(e,t.from,!1,n)||FT(e,t.to,!1,n)||FT(t,e.from,!1,n)||FT(t,e.to,!1,n)}function nD(e,t,n=Qw){let r=Array.isArray(t)?t:[t];if(r.filter(e=>typeof e!=`function`).some(t=>typeof t==`boolean`?t:n.isDate(t)?FT(e,t,!1,n):VT(t,n)?t.some(t=>FT(e,t,!1,n)):LT(t)?t.from&&t.to?tD(e,{from:t.from,to:t.to},n):!1:BT(t)?eD(e,t.dayOfWeek,n):IT(t)?n.isAfter(t.before,t.after)?tD(e,{from:n.addDays(t.after,1),to:n.addDays(t.before,-1)},n):HT(e.from,t,n)||HT(e.to,t,n):RT(t)||zT(t)?HT(e.from,t,n)||HT(e.to,t,n):!1))return!0;let i=r.filter(e=>typeof e==`function`);if(i.length){let t=e.from,r=n.differenceInCalendarDays(e.to,e.from);for(let e=0;e<=r;e++){if(i.some(e=>e(t)))return!0;t=n.addDays(t,1)}}return!1}function rD(e,t){let{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:o,onSelect:s}=e,[c,l]=WE(a,s?a:void 0),u=s?a:c;return{selected:u,select:(a,c,d)=>{let{min:f,max:p}=e,m;if(a){let e=u?.from,n=u?.to,r=!!e&&!!n,s=!!e&&!!n&&t.isSameDay(e,n)&&t.isSameDay(a,e);m=i&&(r||!u?.from)?!o&&s?void 0:{from:a,to:void 0}:$E(a,u,f,p,o,t)}return r&&n&&m?.from&&m.to&&nD({from:m.from,to:m.to},n,t)&&(m.from=a,m.to=void 0),s||l(m),s?.(m,a,c,d),m},isSelected:e=>u&&FT(u,e,!1,t)}}function iD(e,t){let{selected:n,required:r,onSelect:i}=e,[a,o]=WE(n,i?n:void 0),s=i?n:a,{isSameDay:c}=t;return{selected:s,select:(e,t,n)=>{let a=e;return!r&&s&&s&&c(e,s)&&(a=void 0),i||o(a),i?.(a,e,t,n),a},isSelected:e=>s?c(s,e):!1}}function aD(e,t){let n=iD(e,t),r=QE(e,t),i=rD(e,t);switch(e.mode){case`single`:return n;case`multiple`:return r;case`range`:return i;default:return}}function oD(e,t){return e instanceof Ww&&e.timeZone===t?e:new Ww(e,t)}function sD(e,t,n){if(!n)return oD(e,t);let r=oD(e,t),i=new Ww(r.getFullYear(),r.getMonth(),r.getDate(),12,0,0,t);return new Date(i.getTime())}function cD(e,t,n){return typeof e==`boolean`||typeof e==`function`?e:e instanceof Date?sD(e,t,n):Array.isArray(e)?e.map(e=>e instanceof Date?sD(e,t,n):e):LT(e)?{...e,from:e.from?oD(e.from,t):e.from,to:e.to?oD(e.to,t):e.to}:IT(e)?{before:sD(e.before,t,n),after:sD(e.after,t,n)}:RT(e)?{after:sD(e.after,t,n)}:zT(e)?{before:sD(e.before,t,n)}:e}function lD(e,t,n){return e&&(Array.isArray(e)?e.map(e=>cD(e,t,n)):cD(e,t,n))}function uD(e){let t=e,n=t.timeZone;if(n&&(t={...e,timeZone:n},t.today&&=oD(t.today,n),t.month&&=oD(t.month,n),t.defaultMonth&&=oD(t.defaultMonth,n),t.startMonth&&=oD(t.startMonth,n),t.endMonth&&=oD(t.endMonth,n),t.mode===`single`&&t.selected?t.selected=oD(t.selected,n):t.mode===`multiple`&&t.selected?t.selected=t.selected?.map(e=>oD(e,n)):t.mode===`range`&&t.selected&&(t.selected={from:t.selected.from?oD(t.selected.from,n):t.selected.from,to:t.selected.to?oD(t.selected.to,n):t.selected.to}),t.disabled!==void 0&&(t.disabled=lD(t.disabled,n)),t.hidden!==void 0&&(t.hidden=lD(t.hidden,n)),t.modifiers)){let e={};Object.keys(t.modifiers).forEach(r=>{e[r]=lD(t.modifiers?.[r],n)}),t.modifiers=e}let{components:r,formatters:i,labels:a,dateLib:o,locale:s,classNames:c}=(0,Q.useMemo)(()=>{let e={...Xw,...t.locale},n=t.broadcastCalendar?1:t.weekStartsOn,r=t.noonSafe&&t.timeZone?EE(t.timeZone,{weekStartsOn:n,locale:e}):void 0,i=t.dateLib&&r?{...r,...t.dateLib}:t.dateLib??r,a=new Zw({locale:e,weekStartsOn:n,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},i);return{dateLib:a,components:GT(t.components),formatters:iE(t.formatters),labels:xE(t.labels,a.options),locale:e,classNames:{...qT(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});let{captionLayout:l,mode:u,navLayout:d,numberOfMonths:f=1,onDayBlur:p,onDayClick:m,onDayFocus:h,onDayKeyDown:g,onDayMouseEnter:_,onDayMouseLeave:v,onNextClick:y,onPrevClick:b,showWeekNumber:x,styles:S}=t,{formatCaption:C,formatDay:w,formatMonthDropdown:T,formatWeekNumber:E,formatWeekNumberHeader:D,formatWeekdayName:O,formatYearDropdown:k}=i,A=GE(t,o),{days:j,months:M,navStart:N,navEnd:P,previousMonth:F,nextMonth:I,goToMonth:L}=A,R=UT(j,t,N,P,o),{isSelected:z,select:B,selected:V}=aD(t,o)??{},{blur:H,focused:U,isFocusTarget:W,moveFocus:G,setFocused:K}=ZE(t,A,R,z??(()=>!1),o),{labelDayButton:q,labelGridcell:ee,labelGrid:te,labelMonthDropdown:ne,labelNav:re,labelPrevious:ie,labelNext:ae,labelWeekday:oe,labelWeekNumber:se,labelWeekNumberHeader:ce,labelYearDropdown:le}=a,ue=(0,Q.useMemo)(()=>wE(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),de=u!==void 0||m!==void 0,fe=(0,Q.useCallback)(()=>{F&&(L(F),b?.(F))},[F,L,b]),pe=(0,Q.useCallback)(()=>{I&&(L(I),y?.(I))},[L,I,y]),me=(0,Q.useCallback)((e,t)=>n=>{n.preventDefault(),n.stopPropagation(),K(e),!t.disabled&&(B?.(e.date,t,n),m?.(e.date,t,n))},[B,m,K]),he=(0,Q.useCallback)((e,t)=>n=>{K(e),h?.(e.date,t,n)},[h,K]),ge=(0,Q.useCallback)((e,t)=>n=>{H(),p?.(e.date,t,n)},[H,p]),_e=(0,Q.useCallback)((e,n)=>r=>{let i={ArrowLeft:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`after`:`before`],ArrowRight:[r.shiftKey?`month`:`day`,t.dir===`rtl`?`before`:`after`],ArrowDown:[r.shiftKey?`year`:`week`,`after`],ArrowUp:[r.shiftKey?`year`:`week`,`before`],PageUp:[r.shiftKey?`year`:`month`,`before`],PageDown:[r.shiftKey?`year`:`month`,`after`],Home:[`startOfWeek`,`before`],End:[`endOfWeek`,`after`]};if(i[r.key]){r.preventDefault(),r.stopPropagation();let[e,t]=i[r.key];G(e,t)}g?.(e.date,n,r)},[G,g,t.dir]),ve=(0,Q.useCallback)((e,t)=>n=>{_?.(e.date,t,n)},[_]),ye=(0,Q.useCallback)((e,t)=>n=>{v?.(e.date,t,n)},[v]),be=(0,Q.useCallback)(e=>t=>{let n=Number(t.target.value);L(o.setMonth(o.startOfMonth(e),n))},[o,L]),xe=(0,Q.useCallback)(e=>t=>{let n=Number(t.target.value);L(o.setYear(o.startOfMonth(e),n))},[o,L]),{className:Se,style:Ce}=(0,Q.useMemo)(()=>({className:[c[sT.Root],t.className].filter(Boolean).join(` `),style:{...S?.[sT.Root],...t.style}}),[c,t.className,t.style,S]),we=KT(t),J=(0,Q.useRef)(null);PE(J,!!t.animate,{classNames:c,months:M,focused:U,dateLib:o});let Te={dayPickerProps:t,selected:V,select:B,isSelected:z,months:M,nextMonth:I,previousMonth:F,goToMonth:L,getModifiers:R,components:r,classNames:c,styles:S,labels:a,formatters:i};return Q.createElement(vT.Provider,{value:Te},Q.createElement(r.Root,{rootRef:t.animate?J:void 0,className:Se,style:Ce,dir:t.dir,id:t.id,lang:t.lang??s.code,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t[`aria-label`],"aria-labelledby":t[`aria-labelledby`],...we},Q.createElement(r.Months,{className:c[sT.Months],style:S?.[sT.Months]},!t.hideNavigation&&!d&&Q.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[sT.Nav],style:S?.[sT.Nav],"aria-label":re(),onPreviousClick:fe,onNextClick:pe,previousMonth:F,nextMonth:I}),M.map((e,n)=>Q.createElement(r.Month,{"data-animated-month":t.animate?`true`:void 0,className:c[sT.Month],style:S?.[sT.Month],key:n,displayIndex:n,calendarMonth:e},d===`around`&&!t.hideNavigation&&n===0&&Q.createElement(r.PreviousMonthButton,{type:`button`,className:c[sT.PreviousMonthButton],tabIndex:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":ie(F),onClick:fe,"data-animated-button":t.animate?`true`:void 0},Q.createElement(r.Chevron,{disabled:F?void 0:!0,className:c[sT.Chevron],orientation:t.dir===`rtl`?`right`:`left`})),Q.createElement(r.MonthCaption,{"data-animated-caption":t.animate?`true`:void 0,className:c[sT.MonthCaption],style:S?.[sT.MonthCaption],calendarMonth:e,displayIndex:n},l?.startsWith(`dropdown`)?Q.createElement(r.DropdownNav,{className:c[sT.Dropdowns],style:S?.[sT.Dropdowns]},(()=>{let n=l===`dropdown`||l===`dropdown-months`?Q.createElement(r.MonthsDropdown,{key:`month`,className:c[sT.MonthsDropdown],"aria-label":ne(),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:be(e.date),options:SE(e.date,N,P,i,o),style:S?.[sT.Dropdown],value:o.getMonth(e.date)}):Q.createElement(`span`,{key:`month`},T(e.date,o)),a=l===`dropdown`||l===`dropdown-years`?Q.createElement(r.YearsDropdown,{key:`year`,className:c[sT.YearsDropdown],"aria-label":le(o.options),classNames:c,components:r,disabled:!!t.disableNavigation,onChange:xe(e.date),options:TE(N,P,i,o,!!t.reverseYears),style:S?.[sT.Dropdown],value:o.getYear(e.date)}):Q.createElement(`span`,{key:`year`},k(e.date,o));return o.getMonthYearOrder()===`year-first`?[a,n]:[n,a]})(),Q.createElement(`span`,{role:`status`,"aria-live":`polite`,style:{border:0,clip:`rect(0 0 0 0)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`,wordWrap:`normal`}},C(e.date,o.options,o))):Q.createElement(r.CaptionLabel,{className:c[sT.CaptionLabel],role:`status`,"aria-live":`polite`},C(e.date,o.options,o))),d===`around`&&!t.hideNavigation&&n===f-1&&Q.createElement(r.NextMonthButton,{type:`button`,className:c[sT.NextMonthButton],tabIndex:I?void 0:-1,"aria-disabled":I?void 0:!0,"aria-label":ae(I),onClick:pe,"data-animated-button":t.animate?`true`:void 0},Q.createElement(r.Chevron,{disabled:I?void 0:!0,className:c[sT.Chevron],orientation:t.dir===`rtl`?`left`:`right`})),n===f-1&&d===`after`&&!t.hideNavigation&&Q.createElement(r.Nav,{"data-animated-nav":t.animate?`true`:void 0,className:c[sT.Nav],style:S?.[sT.Nav],"aria-label":re(),onPreviousClick:fe,onNextClick:pe,previousMonth:F,nextMonth:I}),Q.createElement(r.MonthGrid,{role:`grid`,"aria-multiselectable":u===`multiple`||u===`range`,"aria-label":te(e.date,o.options,o)||void 0,className:c[sT.MonthGrid],style:S?.[sT.MonthGrid]},!t.hideWeekdays&&Q.createElement(r.Weekdays,{"data-animated-weekdays":t.animate?`true`:void 0,className:c[sT.Weekdays],style:S?.[sT.Weekdays]},x&&Q.createElement(r.WeekNumberHeader,{"aria-label":ce(o.options),className:c[sT.WeekNumberHeader],style:S?.[sT.WeekNumberHeader],scope:`col`},D()),ue.map(e=>Q.createElement(r.Weekday,{"aria-label":oe(e,o.options,o),className:c[sT.Weekday],key:String(e),style:S?.[sT.Weekday],scope:`col`},O(e,o.options,o)))),Q.createElement(r.Weeks,{"data-animated-weeks":t.animate?`true`:void 0,className:c[sT.Weeks],style:S?.[sT.Weeks]},e.weeks.map(e=>Q.createElement(r.Week,{className:c[sT.Week],key:e.weekNumber,style:S?.[sT.Week],week:e},x&&Q.createElement(r.WeekNumber,{week:e,style:S?.[sT.WeekNumber],"aria-label":se(e.weekNumber,{locale:s}),className:c[sT.WeekNumber],scope:`row`,role:`rowheader`},E(e.weekNumber,o)),e.days.map(e=>{let{date:n}=e,i=R(e);if(i[cT.focused]=!i.hidden&&!!U?.isEqualTo(e),i[lT.selected]=z?.(n)||i.selected,LT(V)){let{from:e,to:t}=V;i[lT.range_start]=!!(e&&t&&o.isSameDay(n,e)),i[lT.range_end]=!!(e&&t&&o.isSameDay(n,t)),i[lT.range_middle]=FT(V,n,!0,o)}let a=CE(i,S,t.modifiersStyles),s=WT(i,c,t.modifiersClassNames),l=!de&&!i.hidden?ee(n,i,o.options,o):void 0;return Q.createElement(r.Day,{key:`${e.isoDate}_${e.displayMonthId}`,day:e,modifiers:i,className:s.join(` `),style:a,role:`gridcell`,"aria-selected":i.selected||void 0,"aria-label":l,"data-day":e.isoDate,"data-month":e.outside?e.dateMonthId:void 0,"data-selected":i.selected||void 0,"data-disabled":i.disabled||void 0,"data-hidden":i.hidden||void 0,"data-outside":e.outside||void 0,"data-focused":i.focused||void 0,"data-today":i.today||void 0},!i.hidden&&de?Q.createElement(r.DayButton,{className:c[sT.DayButton],style:S?.[sT.DayButton],type:`button`,day:e,modifiers:i,disabled:!i.focused&&i.disabled||void 0,"aria-disabled":i.focused&&i.disabled||void 0,tabIndex:W(e)?0:-1,"aria-label":q(n,i,o.options,o),onClick:me(e,i),onBlur:ge(e,i),onFocus:he(e,i),onKeyDown:_e(e,i),onMouseEnter:ve(e,i),onMouseLeave:ye(e,i)},w(n,o.options,o)):!i.hidden&&w(e.date,o.options,o))})))))))),t.footer&&Q.createElement(r.Footer,{className:c[sT.Footer],style:S?.[sT.Footer],role:`status`,"aria-live":`polite`},t.footer)))}function dD(e){let t=(0,$.c)(97),n,r,i,a,o,s,c,l,u;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],u=t[9]):({className:n,classNames:r,showOutsideDays:c,captionLayout:l,buttonVariant:u,locale:o,formatters:a,components:i,...s}=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,t[9]=u);let d=c===void 0?!0:c,f=l===void 0?`label`:l,p=u===void 0?`ghost`:u,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W;if(t[10]!==p||t[11]!==f||t[12]!==n||t[13]!==a||t[14]!==o||t[15]!==s.showWeekNumber||t[16]!==d){let e=qT();m=uD,P=d,t[48]===n?F=t[49]:(F=Y(`group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent`,`rtl:**:[.rdp-button\\_next>svg]:rotate-180`,`rtl:**:[.rdp-button\\_previous>svg]:rotate-180`,n),t[48]=n,t[49]=F),I=f,L=o;let r;t[50]===o?.code?r=t[51]:(r=e=>e.toLocaleString(o?.code,{month:`short`}),t[50]=o?.code,t[51]=r),t[52]!==a||t[53]!==r?(R={formatMonthDropdown:r,...a},t[52]=a,t[53]=r,t[54]=R):R=t[54],z=Y(`w-fit`,e.root),B=Y(`relative flex flex-col gap-4 md:flex-row`,e.months),V=Y(`flex w-full flex-col gap-4`,e.month),H=Y(`absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1`,e.nav),U=Y(Wr({variant:p}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,e.button_previous),W=Y(Wr({variant:p}),`size-(--cell-size) p-0 select-none aria-disabled:opacity-50`,e.button_next),h=Y(`flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)`,e.month_caption),g=Y(`flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium`,e.dropdowns),_=Y(`relative rounded-(--cell-radius)`,e.dropdown_root),v=Y(`absolute inset-0 bg-popover opacity-0`,e.dropdown),y=Y(`font-medium select-none`,f===`label`?`text-sm`:`flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground`,e.caption_label),b=`w-full border-collapse`,x=Y(`flex`,e.weekdays),S=Y(`flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none`,e.weekday),C=Y(`mt-2 flex w-full`,e.week),w=Y(`w-(--cell-size) select-none`,e.week_number_header),T=Y(`text-[0.8rem] text-muted-foreground select-none`,e.week_number),E=Y(`group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)`,s.showWeekNumber?`[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)`:`[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)`,e.day),D=Y(`relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted`,e.range_start),O=Y(`rounded-none`,e.range_middle),k=Y(`relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted`,e.range_end),A=Y(`rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none`,e.today),j=Y(`text-muted-foreground aria-selected:text-muted-foreground`,e.outside),M=Y(`text-muted-foreground opacity-50`,e.disabled),N=Y(`invisible`,e.hidden),t[10]=p,t[11]=f,t[12]=n,t[13]=a,t[14]=o,t[15]=s.showWeekNumber,t[16]=d,t[17]=m,t[18]=h,t[19]=g,t[20]=_,t[21]=v,t[22]=y,t[23]=b,t[24]=x,t[25]=S,t[26]=C,t[27]=w,t[28]=T,t[29]=E,t[30]=D,t[31]=O,t[32]=k,t[33]=A,t[34]=j,t[35]=M,t[36]=N,t[37]=P,t[38]=F,t[39]=I,t[40]=L,t[41]=R,t[42]=z,t[43]=B,t[44]=V,t[45]=H,t[46]=U,t[47]=W}else m=t[17],h=t[18],g=t[19],_=t[20],v=t[21],y=t[22],b=t[23],x=t[24],S=t[25],C=t[26],w=t[27],T=t[28],E=t[29],D=t[30],O=t[31],k=t[32],A=t[33],j=t[34],M=t[35],N=t[36],P=t[37],F=t[38],I=t[39],L=t[40],R=t[41],z=t[42],B=t[43],V=t[44],H=t[45],U=t[46],W=t[47];let G;t[55]!==r||t[56]!==h||t[57]!==g||t[58]!==_||t[59]!==v||t[60]!==y||t[61]!==b||t[62]!==x||t[63]!==S||t[64]!==C||t[65]!==w||t[66]!==T||t[67]!==E||t[68]!==D||t[69]!==O||t[70]!==k||t[71]!==A||t[72]!==j||t[73]!==M||t[74]!==N||t[75]!==z||t[76]!==B||t[77]!==V||t[78]!==H||t[79]!==U||t[80]!==W?(G={root:z,months:B,month:V,nav:H,button_previous:U,button_next:W,month_caption:h,dropdowns:g,dropdown_root:_,dropdown:v,caption_label:y,table:b,weekdays:x,weekday:S,week:C,week_number_header:w,week_number:T,day:E,range_start:D,range_middle:O,range_end:k,today:A,outside:j,disabled:M,hidden:N,...r},t[55]=r,t[56]=h,t[57]=g,t[58]=_,t[59]=v,t[60]=y,t[61]=b,t[62]=x,t[63]=S,t[64]=C,t[65]=w,t[66]=T,t[67]=E,t[68]=D,t[69]=O,t[70]=k,t[71]=A,t[72]=j,t[73]=M,t[74]=N,t[75]=z,t[76]=B,t[77]=V,t[78]=H,t[79]=U,t[80]=W,t[81]=G):G=t[81];let K;t[82]===o?K=t[83]:(K=e=>{let{...t}=e;return(0,Z.jsx)(hD,{locale:o,...t})},t[82]=o,t[83]=K);let q;t[84]!==i||t[85]!==K?(q={Root:mD,Chevron:pD,DayButton:K,WeekNumber:fD,...i},t[84]=i,t[85]=K,t[86]=q):q=t[86];let ee;return t[87]!==m||t[88]!==s||t[89]!==P||t[90]!==F||t[91]!==I||t[92]!==L||t[93]!==R||t[94]!==G||t[95]!==q?(ee=(0,Z.jsx)(m,{showOutsideDays:P,className:F,captionLayout:I,locale:L,formatters:R,classNames:G,components:q,...s}),t[87]=m,t[88]=s,t[89]=P,t[90]=F,t[91]=I,t[92]=L,t[93]=R,t[94]=G,t[95]=q,t[96]=ee):ee=t[96],ee}function fD(e){let{children:t,...n}=e;return(0,Z.jsx)(`td`,{...n,children:(0,Z.jsx)(`div`,{className:`flex size-(--cell-size) items-center justify-center text-center`,children:t})})}function pD(e){let{className:t,orientation:n,...r}=e;return n===`left`?(0,Z.jsx)(ls,{className:Y(`size-4`,t),...r}):n===`right`?(0,Z.jsx)(l,{className:Y(`size-4`,t),...r}):(0,Z.jsx)(Ie,{className:Y(`size-4`,t),...r})}function mD(e){let{className:t,rootRef:n,...r}=e;return(0,Z.jsx)(`div`,{"data-slot":`calendar`,ref:n,className:Y(t),...r})}function hD(e){let t=(0,$.c)(21),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,day:r,modifiers:a,locale:i,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=qT(),c=Q.useRef(null),l,u;t[6]===a.focused?(l=t[7],u=t[8]):(l=()=>{a.focused&&c.current?.focus()},u=[a.focused],t[6]=a.focused,t[7]=l,t[8]=u),Q.useEffect(l,u);let d=X,f;t[9]!==r.date||t[10]!==i?.code?(f=r.date.toLocaleDateString(i?.code),t[9]=r.date,t[10]=i?.code,t[11]=f):f=t[11];let p=a.selected&&!a.range_start&&!a.range_end&&!a.range_middle,m=a.range_start,h=a.range_end,g=a.range_middle,_=Y(`relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70`,s.day,n),v;return t[12]!==d||t[13]!==a.range_end||t[14]!==a.range_middle||t[15]!==a.range_start||t[16]!==o||t[17]!==_||t[18]!==f||t[19]!==p?(v=(0,Z.jsx)(d,{ref:c,variant:`ghost`,size:`icon`,"data-day":f,"data-selected-single":p,"data-range-start":m,"data-range-end":h,"data-range-middle":g,className:_,...o}),t[12]=d,t[13]=a.range_end,t[14]=a.range_middle,t[15]=a.range_start,t[16]=o,t[17]=_,t[18]=f,t[19]=p,t[20]=v):v=t[20],v}function gD(e){let t=(0,$.c)(16),{keyName:n,value:r,onCommit:i}=e,[a,o]=(0,Q.useState)(r),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(!1),l,u;t[0]===r?(l=t[1],u=t[2]):(l=()=>{s.current||o(r)},u=[r],t[0]=r,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d=`${n} value`,f,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>o(e.target.value),p=()=>{s.current=!0},t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m,h;t[5]!==a||t[6]!==i||t[7]!==r?(m=()=>{if(s.current=!1,c.current){c.current=!1;return}a!==r&&i(a)},h=e=>{e.key===`Enter`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey?(e.preventDefault(),a!==r&&i(a),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c.current=!0,o(r),e.currentTarget.blur())},t[5]=a,t[6]=i,t[7]=r,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g;return t[10]!==a||t[11]!==n||t[12]!==d||t[13]!==m||t[14]!==h?(g=(0,Z.jsx)(`textarea`,{"data-testid":`text-widget`,"data-key":n,rows:1,value:a,placeholder:`Empty`,"aria-label":d,onChange:f,onFocus:p,onBlur:m,onKeyDown:h,className:`block w-full min-h-7 resize-none field-sizing-content border-transparent bg-transparent px-2 py-1 text-sm leading-tight shadow-none placeholder:text-muted-foreground/60 focus-visible:border-transparent focus-visible:bg-muted focus-visible:outline-none focus-visible:ring-0 rounded-sm dark:bg-transparent dark:focus-visible:bg-muted`}),t[10]=a,t[11]=n,t[12]=d,t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function _D(e){let t=(0,$.c)(17),{keyName:n,value:r,onCommit:i}=e,[a,o]=(0,Q.useState)(String(r)),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(!1),l,u;t[0]===r?(l=t[1],u=t[2]):(l=()=>{s.current||o(String(r))},u=[r],t[0]=r,t[1]=l,t[2]=u),(0,Q.useEffect)(l,u);let d=`${n} value`,f,p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>o(e.target.value),p=()=>{s.current=!0},t[3]=f,t[4]=p):(f=t[3],p=t[4]);let m;t[5]!==a||t[6]!==i||t[7]!==r?(m=()=>{if(s.current=!1,c.current){c.current=!1,o(String(r));return}let e=Number.parseFloat(a),t=Number.isFinite(e)?e:0;t===r?o(String(r)):i(t)},t[5]=a,t[6]=i,t[7]=r,t[8]=m):m=t[8];let h;t[9]===r?h=t[10]:(h=e=>{e.key===`Enter`?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),c.current=!0,o(String(r)),e.currentTarget.blur())},t[9]=r,t[10]=h);let g;return t[11]!==a||t[12]!==n||t[13]!==d||t[14]!==m||t[15]!==h?(g=(0,Z.jsx)(fo,{"data-testid":`number-widget`,"data-key":n,type:`number`,value:a,"aria-label":d,onChange:f,onFocus:p,onBlur:m,onKeyDown:h,className:`h-7 border-transparent bg-transparent dark:bg-transparent px-2 text-sm shadow-none focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm dark:focus-visible:bg-muted`}),t[11]=a,t[12]=n,t[13]=d,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function vD(e){let t=(0,$.c)(7),{keyName:n,value:r,onCommit:i}=e,a;t[0]===i?a=t[1]:(a=e=>i(e===!0),t[0]=i,t[1]=a);let o=`${n} value`,s;return t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r?(s=(0,Z.jsx)(`div`,{className:`flex h-7 items-center px-2`,children:(0,Z.jsx)($a,{"data-testid":`boolean-widget`,"data-key":n,checked:r,onCheckedChange:a,"aria-label":o,className:`size-5 rounded-full`})}),t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=s):s=t[6],s}function yD(e){let t=(0,$.c)(42),{keyName:n,value:r,onCommit:i}=e,a,o,s;t[0]===r?(a=t[1],o=t[2],s=t[3]):(a=xD(r),o=Q.useState,s=SD(a),t[0]=r,t[1]=a,t[2]=o,t[3]=s);let[c,l]=o(s),[u,d]=(0,Q.useState)(a),[f,p]=(0,Q.useState)(!1),m=(0,Q.useRef)(!1),h=(0,Q.useRef)(!1),g,_;t[4]===r?(g=t[5],_=t[6]):(g=()=>{if(!m.current){let e=xD(r);l(SD(e)),d(e)}},_=[r],t[4]=r,t[5]=g,t[6]=_),(0,Q.useEffect)(g,_);let v;t[7]!==a||t[8]!==c||t[9]!==i||t[10]!==r?(v=function(){let e=wD(c);if(e){let t=WS(e,`yyyy-MM-dd`);t!==r&&i(t),l(SD(e)),d(e)}else l(SD(a)),d(a)},t[7]=a,t[8]=c,t[9]=i,t[10]=r,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==r?(b=function(e){if(!e)return;let t=WS(e,`yyyy-MM-dd`);t!==r&&i(t),l(SD(e)),d(e),p(!1)},t[12]=i,t[13]=r,t[14]=b):b=t[14];let x=b,S=`${n} value`,C,w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{l(e.target.value);let t=wD(e.target.value);t&&d(t)},w=()=>{m.current=!0},t[15]=C,t[16]=w):(C=t[15],w=t[16]);let T;t[17]===y?T=t[18]:(T=()=>{if(m.current=!1,h.current){h.current=!1;return}y()},t[17]=y,t[18]=T);let D;t[19]!==y||t[20]!==a?(D=e=>{e.key===`Enter`?(e.preventDefault(),y(),e.currentTarget.blur()):e.key===`Escape`?(e.preventDefault(),h.current=!0,l(SD(a)),e.currentTarget.blur()):e.key===`ArrowDown`&&(e.preventDefault(),p(!0))},t[19]=y,t[20]=a,t[21]=D):D=t[21];let O;t[22]!==c||t[23]!==T||t[24]!==D||t[25]!==S?(O=(0,Z.jsx)(fo,{type:`text`,value:c,placeholder:`Empty`,"aria-label":S,onChange:C,onFocus:w,onBlur:T,onKeyDown:D,className:`h-7 border-transparent bg-transparent dark:bg-transparent pr-7 pl-2 text-sm shadow-none placeholder:text-muted-foreground/60 focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm dark:focus-visible:bg-muted`}),t[22]=c,t[23]=T,t[24]=D,t[25]=S,t[26]=O):O=t[26];let k=`Open date picker for ${n}`,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(ss,{className:`size-3.5`}),t[27]=A):A=t[27];let j;t[28]===k?j=t[29]:(j=(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":k,className:`absolute right-0 size-6 p-0 text-muted-foreground hover:bg-muted hover:text-foreground`,children:A})}),t[28]=k,t[29]=j);let M;t[30]!==a||t[31]!==x||t[32]!==u?(M=(0,Z.jsx)(ae,{className:`w-auto overflow-hidden p-0`,align:`end`,children:(0,Z.jsx)(dD,{mode:`single`,selected:a,month:u,onMonthChange:d,onSelect:x,captionLayout:`dropdown`})}),t[30]=a,t[31]=x,t[32]=u,t[33]=M):M=t[33];let N;t[34]!==f||t[35]!==j||t[36]!==M?(N=(0,Z.jsxs)(E,{open:f,onOpenChange:p,children:[j,M]}),t[34]=f,t[35]=j,t[36]=M,t[37]=N):N=t[37];let P;return t[38]!==n||t[39]!==O||t[40]!==N?(P=(0,Z.jsxs)(`div`,{"data-testid":`date-widget`,"data-key":n,className:`relative flex h-7 items-center`,children:[O,N]}),t[38]=n,t[39]=O,t[40]=N,t[41]=P):P=t[41],P}var bD=`MMM d, yyyy`;function xD(e){if(!e)return;let t=dw(e);return Number.isNaN(t.getTime())?void 0:t}function SD(e){return e?WS(e,bD):``}var CD=[`MMM d, yyyy`,`MMMM d, yyyy`,`yyyy-MM-dd`,`M/d/yyyy`,`MM/dd/yyyy`];function wD(e){let t=e.trim();if(!t)return;let n=new Date;for(let e of CD){let r=sw(t,e,n);if(!Number.isNaN(r.getTime()))return r}}function TD(e){let t=(0,$.c)(32),{keyName:n,value:r,onCommit:i}=e,[a,o]=(0,Q.useState)(``),s;t[0]!==i||t[1]!==r?(s=function(e){let t=e.trim();t&&(i([...r,t]),o(``))},t[0]=i,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]!==i||t[4]!==r?(l=function(e){let t=r.slice();t.splice(e,1),i(t)},t[3]=i,t[4]=r,t[5]=l):l=t[5];let u=l,d=n===`tags`,f;if(t[6]!==d||t[7]!==u||t[8]!==r){let e;t[10]!==d||t[11]!==u?(e=(e,t)=>{let n=d&&$n.test(e);return(0,Z.jsxs)(`span`,{"data-testid":`list-chip`,"data-index":t,className:Y(`inline-flex items-center text-1sm gap-0.5 rounded-full py-0.5 pl-2 pr-1.5 transition-colors`,n?`bg-primary/10 font-medium text-primary has-[button[data-tag]:hover]:bg-primary/20 has-[button[data-tag]:active]:bg-primary/25`:`bg-muted `),children:[n?(0,Z.jsxs)(`button`,{type:`button`,"data-tag":e,"aria-label":`Open documents tagged #${e}`,onClick:()=>ke(e),className:`cursor-pointer rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[`#`,e]}):(0,Z.jsx)(`span`,{children:e}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e}`,onClick:()=>u(t),className:Y(`inline-flex items-center justify-center rounded-sm p-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,n?`text-primary opacity-70 hover:text-primary hover:opacity-100`:`text-muted-foreground hover:text-foreground`),children:(0,Z.jsx)(Fa,{className:`size-3`,"aria-hidden":`true`})})]},`${t}-${e}`)},t[10]=d,t[11]=u,t[12]=e):e=t[12],f=r.map(e),t[6]=d,t[7]=u,t[8]=r,t[9]=f}else f=t[9];let p=r.length===0?`Empty`:``,m=`${n} value`,h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>o(e.target.value),t[13]=h):h=t[13];let g;t[14]!==c||t[15]!==a||t[16]!==u||t[17]!==r.length?(g=e=>{e.key===`Enter`?(e.preventDefault(),c(a)):e.key===`Backspace`&&a===``&&r.length>0?(e.preventDefault(),u(r.length-1)):e.key===`Escape`&&(e.preventDefault(),o(``),e.currentTarget.blur())},t[14]=c,t[15]=a,t[16]=u,t[17]=r.length,t[18]=g):g=t[18];let _;t[19]!==c||t[20]!==a?(_=()=>{a&&c(a)},t[19]=c,t[20]=a,t[21]=_):_=t[21];let v;t[22]!==a||t[23]!==p||t[24]!==m||t[25]!==g||t[26]!==_?(v=(0,Z.jsx)(`input`,{"data-testid":`list-chip-input`,type:`text`,value:a,placeholder:p,"aria-label":m,onChange:h,onKeyDown:g,onBlur:_,className:`min-w-16 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60`}),t[22]=a,t[23]=p,t[24]=m,t[25]=g,t[26]=_,t[27]=v):v=t[27];let y;return t[28]!==n||t[29]!==f||t[30]!==v?(y=(0,Z.jsxs)(`div`,{"data-testid":`list-widget`,"data-key":n,className:`flex min-h-7 w-full min-w-0 flex-wrap items-center gap-1 rounded-md px-2 py-1 focus-within:bg-background`,children:[f,v]}),t[28]=n,t[29]=f,t[30]=v,t[31]=y):y=t[31],y}var ED={text:hc,number:_t,boolean:oc,date:ss,list:He},DD={text:`Text`,number:`Number`,boolean:`Checkbox`,date:`Date`,list:`List`};function OD(e){let t=(0,$.c)(27),{keyName:n,type:r,onChangeType:i,disabled:a}=e,o=a===void 0?!1:a,s=ED[r];if(o){let e=`${n} type: ${DD[r]} (inherited from folder defaults; not editable here)`,i;t[0]===s?i=t[1]:(i=(0,Z.jsx)(s,{className:`size-3.5`}),t[0]=s,t[1]=i);let a;t[2]!==n||t[3]!==e||t[4]!==i||t[5]!==r?(a=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`inline-flex`,children:(0,Z.jsx)(`button`,{type:`button`,disabled:!0,"data-testid":`type-icon-button`,"data-key":n,"data-type":r,"aria-label":e,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground disabled:cursor-default`,children:i})})}),t[2]=n,t[3]=e,t[4]=i,t[5]=r,t[6]=a):a=t[6];let o;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(co,{children:`Inherited — set a value to override.`}),t[7]=o):o=t[7];let c;return t[8]===a?c=t[9]:(c=(0,Z.jsxs)(uo,{children:[a,o]}),t[8]=a,t[9]=c),c}let c=`${n} type: ${DD[r]}. Click to change.`,l;t[10]===s?l=t[11]:(l=(0,Z.jsx)(s,{className:`size-3.5`}),t[10]=s,t[11]=l);let u;t[12]!==n||t[13]!==c||t[14]!==l||t[15]!==r?(u=(0,Z.jsx)(Ii,{"data-testid":`type-icon-button`,"data-key":n,"data-type":r,"aria-label":c,className:`flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:l}),t[12]=n,t[13]=c,t[14]=l,t[15]=r,t[16]=u):u=t[16];let d;t[17]===i?d=t[18]:(d=e=>i(e),t[17]=i,t[18]=d);let f;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=Object.keys(ED),t[19]=f):f=t[19];let p;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=f.map(kD),t[20]=p):p=t[20];let m;t[21]!==d||t[22]!==r?(m=(0,Z.jsx)(ki,{align:`start`,"data-testid":`type-picker-menu`,children:(0,Z.jsx)(wi,{value:r,onValueChange:d,children:p})}),t[21]=d,t[22]=r,t[23]=m):m=t[23];let h;return t[24]!==u||t[25]!==m?(h=(0,Z.jsxs)(Ei,{children:[u,m]}),t[24]=u,t[25]=m,t[26]=h):h=t[26],h}function kD(e){let t=ED[e];return(0,Z.jsxs)(ji,{value:e,"data-testid":`type-picker-item`,"data-type":e,children:[(0,Z.jsx)(t,{className:`size-3.5 text-muted-foreground`}),(0,Z.jsx)(`span`,{children:DD[e]})]},e)}function AD(e,t){switch(t){case`text`:return Array.isArray(e)?e.join(`, `):String(e);case`number`:{if(typeof e==`number`)return e;let t=Array.isArray(e)?e[0]:String(e),n=Number.parseFloat(t??``);return Number.isFinite(n)?n:0}case`boolean`:return typeof e==`boolean`?e:typeof e==`number`?e!==0:((Array.isArray(e)?e[0]:String(e))??``).toLowerCase()===`true`;case`date`:return typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e)?e:new Date().toISOString().slice(0,10);case`list`:{if(Array.isArray(e))return e;let t=String(e);return t?[t]:[]}}}function jD(e,t){return Array.isArray(e)?`list`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:t===`list`?`text`:t}function MD(e){let t=(0,$.c)(21),{keyName:n,value:r,declared:i,error:a,resetCounter:o,sortableId:s,rename:c,isDuplicate:l,badge:u,isInherited:d,onCommit:f,onChangeType:p,onRemove:m}=e,h=o===void 0?0:o,g=l===void 0?!1:l,_=d===void 0?!1:d,v;t[0]!==u||t[1]!==i||t[2]!==a||t[3]!==g||t[4]!==_||t[5]!==n||t[6]!==p||t[7]!==f||t[8]!==m||t[9]!==c||t[10]!==h||t[11]!==r?(v=e=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-1`,children:[e,(0,Z.jsxs)(`div`,{className:`flex items-center gap-1${_?` opacity-60`:``}`,"data-testid":`property-row-identity`,children:[(0,Z.jsx)(OD,{keyName:n,type:i,onChangeType:p,disabled:_}),(0,Z.jsx)(`div`,{className:`w-32 shrink-0`,children:c?.state?(0,Z.jsx)(FD,{keyName:n,draft:c.state.draft,error:c.state.error,onChangeDraft:c.onChangeDraft,onCommit:c.onCommit,onCancel:c.onCancel}):(0,Z.jsx)(ID,{keyName:n,onBegin:c?.onBegin,disabled:!c,isInherited:_})})]}),g?(0,Z.jsx)(`span`,{"data-testid":`property-duplicate-marker`,"data-key":n,title:`Duplicate name "${n}"`,className:`flex size-4 items-center justify-center text-amber-600`,children:(0,Z.jsx)(Dn,{className:`size-3.5`})}):null,(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:_&&i===`list`?(0,Z.jsx)(BD,{keyName:n,value:Array.isArray(r)?r:[]}):(0,Z.jsx)(RD,{keyName:n,value:r,widgetType:i,onCommit:f},`widget-${h}`)}),u?(0,Z.jsx)(`div`,{className:`shrink-0 min-h-7 flex items-center`,children:u}):null,m?(0,Z.jsx)(X,{type:`button`,"data-testid":`property-remove-button`,"data-key":n,"aria-label":`Remove ${n}`,onClick:m,variant:`ghost`,size:`icon-sm`,className:`flex shrink-0 items-center justify-center rounded text-muted-foreground/0 hover:bg-muted hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:text-muted-foreground`,children:(0,Z.jsx)(fe,{className:`size-3.5`})}):null]}),a?(0,Z.jsx)(`div`,{role:`alert`,"data-testid":`property-error`,"data-key":n,className:`pl-9 text-[10px] text-destructive`,children:a}):null]}),t[0]=u,t[1]=i,t[2]=a,t[3]=g,t[4]=_,t[5]=n,t[6]=p,t[7]=f,t[8]=m,t[9]=c,t[10]=h,t[11]=r,t[12]=v):v=t[12];let y;return t[13]!==i||t[14]!==a||t[15]!==g||t[16]!==_||t[17]!==n||t[18]!==s||t[19]!==v?(y=(0,Z.jsx)(ND,{sortableId:s,keyName:n,declared:i,error:a,isDuplicate:g,isInherited:_,children:v}),t[13]=i,t[14]=a,t[15]=g,t[16]=_,t[17]=n,t[18]=s,t[19]=v,t[20]=y):y=t[20],y}function ND(e){let t=(0,$.c)(19),{sortableId:n,keyName:r,declared:i,error:a,isDuplicate:o,isInherited:s,children:c}=e;if(n){let e;return t[0]!==c||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==r||t[5]!==n?(e=(0,Z.jsx)(PD,{sortableId:n,keyName:r,declared:i,error:a,isDuplicate:o,children:c}),t[0]=c,t[1]=i,t[2]=a,t[3]=o,t[4]=r,t[5]=n,t[6]=e):e=t[6],e}let l;t[7]===s?l=t[8]:(l=s?(0,Z.jsx)(`span`,{"aria-hidden":!0,className:`h-7 w-4 shrink-0`}):null,t[7]=s,t[8]=l);let u=l,d=a??void 0,f=o||void 0,p=s||void 0,m;t[9]!==c||t[10]!==u?(m=c(u),t[9]=c,t[10]=u,t[11]=m):m=t[11];let h;return t[12]!==i||t[13]!==r||t[14]!==d||t[15]!==f||t[16]!==p||t[17]!==m?(h=(0,Z.jsx)(`div`,{className:`group py-0.5`,"data-testid":`property-row`,"data-key":r,"data-widget-type":i,"data-error":d,"data-duplicate":f,"data-inherited":p,children:m}),t[12]=i,t[13]=r,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h):h=t[18],h}function PD(e){let t=(0,$.c)(27),{sortableId:n,keyName:r,declared:i,error:a,isDuplicate:o,children:s}=e,c;t[0]===n?c=t[1]:(c={id:n},t[0]=n,t[1]=c);let{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:p,isDragging:m}=wa(c),h;t[2]===f?h=t[3]:(h=Ti.Transform.toString(f),t[2]=f,t[3]=h);let g=m?.5:void 0,_=m?1:void 0,v;t[4]!==h||t[5]!==g||t[6]!==_||t[7]!==p?(v={transform:h,transition:p,opacity:g,zIndex:_},t[4]=h,t[5]=g,t[6]=_,t[7]=p,t[8]=v):v=t[8];let y=v,b=`Drag ${r} to reorder`,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(_i,{className:`size-3.5`}),t[9]=x):x=t[9];let S;t[10]!==l||t[11]!==r||t[12]!==u||t[13]!==b?(S=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`property-drag-handle`,"data-key":r,"aria-label":b,...l,...u,className:`h-7 w-4 shrink-0 cursor-grab touch-none px-0 text-muted-foreground/0 hover:text-foreground focus-visible:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing group-hover:text-muted-foreground/60`,children:x}),t[10]=l,t[11]=r,t[12]=u,t[13]=b,t[14]=S):S=t[14];let C=S,w=a??void 0,T=o||void 0,E=m||void 0,D;t[15]!==s||t[16]!==C?(D=s(C),t[15]=s,t[16]=C,t[17]=D):D=t[17];let O;return t[18]!==i||t[19]!==r||t[20]!==d||t[21]!==y||t[22]!==T||t[23]!==E||t[24]!==D||t[25]!==w?(O=(0,Z.jsx)(`div`,{ref:d,style:y,className:`group py-0.5`,"data-testid":`property-row`,"data-key":r,"data-widget-type":i,"data-error":w,"data-duplicate":T,"data-dragging":E,children:D}),t[18]=i,t[19]=r,t[20]=d,t[21]=y,t[22]=T,t[23]=E,t[24]=D,t[25]=w,t[26]=O):O=t[26],O}function FD(e){let t=(0,$.c)(20),{keyName:n,draft:r,error:i,onChangeDraft:a,onCommit:o,onCancel:s}=e,c=i?`property-rename-error-${n}`:void 0,l=`Rename ${n}`,u=i?!0:void 0,d;t[0]===a?d=t[1]:(d=e=>a(e.target.value),t[0]=a,t[1]=d);let f;t[2]!==s||t[3]!==o?(f=e=>{e.key===`Enter`?(e.preventDefault(),o()):e.key===`Escape`&&(e.preventDefault(),s())},t[2]=s,t[3]=o,t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c||t[7]!==n||t[8]!==o||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Z.jsx)(fo,{"data-testid":`property-name-rename-input`,"data-key":n,type:`text`,value:r,autoFocus:!0,"aria-label":l,"aria-invalid":u,"aria-describedby":c,onChange:d,onBlur:o,onKeyDown:f,className:`h-7 border-transparent bg-transparent dark:bg-transparent px-2 text-sm shadow-none focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm dark:focus-visible:bg-muted`}),t[5]=r,t[6]=c,t[7]=n,t[8]=o,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]!==i||t[15]!==c?(m=i?(0,Z.jsx)(`div`,{id:c,"data-testid":`property-name-rename-error`,className:`text-[10px] text-destructive`,children:i}):null,t[14]=i,t[15]=c,t[16]=m):m=t[16];let h;return t[17]!==p||t[18]!==m?(h=(0,Z.jsxs)(`div`,{children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19],h}function ID(e){let t=(0,$.c)(9),{keyName:n,onBegin:r,disabled:i,isInherited:a}=e,o;t[0]!==i||t[1]!==n||t[2]!==r?(o=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,"data-testid":`property-name-button`,"data-key":n,onClick:r,disabled:i,className:`block h-7 w-full truncate px-2 py-0.5 text-left text-sm rounded-sm font-normal text-muted-foreground hover:bg-transparent hover:text-foreground disabled:opacity-100 disabled:cursor-default`,children:n}),t[0]=i,t[1]=n,t[2]=r,t[3]=o):o=t[3];let s=o;if(!a)return s;let c;t[4]===s?c=t[5]:(c=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`span`,{tabIndex:0,className:`block w-full`,children:s})}),t[4]=s,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(co,{children:`Inherited — set a value to override.`}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,Z.jsxs)(uo,{children:[c,l]}),t[7]=c,t[8]=u),u}function LD(e){let t=(0,$.c)(35),{draft:n,onChangeName:r,onChangeType:i,onChangeValue:a,onCommit:o,onCancel:s}=e,c=n.error?`add-property-error-id`:void 0,l;t[0]!==n.type||t[1]!==i?(l=(0,Z.jsx)(OD,{keyName:`__add__`,type:n.type,onChangeType:i}),t[0]=n.type,t[1]=i,t[2]=l):l=t[2];let u=n.error?!0:void 0,d;t[3]===r?d=t[4]:(d=e=>r(e.target.value),t[3]=r,t[4]=d);let f;t[5]!==s||t[6]!==o?(f=e=>{e.key===`Enter`?(e.preventDefault(),o()):e.key===`Escape`&&(e.preventDefault(),s())},t[5]=s,t[6]=o,t[7]=f):f=t[7];let p;t[8]!==n.name||t[9]!==c||t[10]!==u||t[11]!==d||t[12]!==f?(p=(0,Z.jsx)(fo,{"data-testid":`add-property-name-input`,type:`text`,value:n.name,autoFocus:!0,placeholder:`Property name`,"aria-label":`New property name`,"aria-invalid":u,"aria-describedby":c,onChange:d,onKeyDown:f,className:`h-7 w-32 border-transparent bg-transparent px-2 text-sm shadow-none placeholder:text-muted-foreground/60 focus-visible:border-transparent focus-visible:bg-muted focus-visible:ring-0 rounded-sm`}),t[8]=n.name,t[9]=c,t[10]=u,t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]!==n.type||t[15]!==n.value||t[16]!==a?(m=(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(RD,{keyName:`__add__`,value:n.value,widgetType:n.type,onCommit:a})}),t[14]=n.type,t[15]=n.value,t[16]=a,t[17]=m):m=t[17];let h;t[18]===o?h=t[19]:(h=(0,Z.jsx)(X,{type:`button`,"data-testid":`add-property-commit`,onClick:o,size:`sm`,className:`rounded bg-primary text-xs text-primary-foreground hover:bg-primary/90`,children:`Add`}),t[18]=o,t[19]=h);let g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Fa,{className:`size-3.5`}),t[20]=g):g=t[20];let _;t[21]===s?_=t[22]:(_=(0,Z.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"data-testid":`add-property-cancel`,onClick:s,"aria-label":`Cancel`,className:`rounded px-1 py-0.5 text-xs text-muted-foreground hover:text-foreground`,children:g}),t[21]=s,t[22]=_);let v;t[23]!==l||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-start gap-1`,children:[l,p,m,h,_]}),t[23]=l,t[24]=p,t[25]=m,t[26]=h,t[27]=_,t[28]=v):v=t[28];let y;t[29]!==n.error||t[30]!==c?(y=n.error?(0,Z.jsx)(`div`,{id:c,role:`alert`,"data-testid":`add-property-error`,className:`mt-0.5 pl-7 text-[10px] text-destructive`,children:n.error}):null,t[29]=n.error,t[30]=c,t[31]=y):y=t[31];let b;return t[32]!==v||t[33]!==y?(b=(0,Z.jsxs)(`div`,{className:`mt-1 rounded border border-dashed bg-background/40 p-1`,"data-testid":`add-property-row`,children:[v,y]}),t[32]=v,t[33]=y,t[34]=b):b=t[34],b}function RD(e){let t=(0,$.c)(24),{keyName:n,value:r,widgetType:i,onCommit:a}=e;if(i===`list`){let e;t[0]===r?e=t[1]:(e=Array.isArray(r)?r:[],t[0]=r,t[1]=e);let i=e,o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,Z.jsx)(TD,{keyName:n,value:i,onCommit:a}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}if(i===`boolean`){let e=typeof r==`boolean`?r:!1,i;return t[6]!==e||t[7]!==n||t[8]!==a?(i=(0,Z.jsx)(vD,{keyName:n,value:e,onCommit:a}),t[6]=e,t[7]=n,t[8]=a,t[9]=i):i=t[9],i}if(i===`number`){let e=typeof r==`number`?r:0,i;return t[10]!==n||t[11]!==e||t[12]!==a?(i=(0,Z.jsx)(_D,{keyName:n,value:e,onCommit:a}),t[10]=n,t[11]=e,t[12]=a,t[13]=i):i=t[13],i}if(i===`date`){let e=typeof r==`string`?r:``,i;return t[14]!==n||t[15]!==a||t[16]!==e?(i=(0,Z.jsx)(yD,{keyName:n,value:e,onCommit:a}),t[14]=n,t[15]=a,t[16]=e,t[17]=i):i=t[17],i}let o;t[18]===r?o=t[19]:(o=typeof r==`string`?r:Array.isArray(r)?r.join(`, `):String(r),t[18]=r,t[19]=o);let s=o,c;return t[20]!==n||t[21]!==a||t[22]!==s?(c=(0,Z.jsx)(gD,{keyName:n,value:s,onCommit:a}),t[20]=n,t[21]=a,t[22]=s,t[23]=c):c=t[23],c}function zD(e){let t=(0,$.c)(2),{source:n}=e,r=`Inherited from ${n===``?`.ok/frontmatter.yml`:`${n}/.ok/frontmatter.yml`}`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(Ne,{variant:`gray`,"data-testid":`property-inherited-badge`,title:r,className:`text-2xs`,children:`inherited`}),t[0]=r,t[1]=i),i}function BD(e){let t=(0,$.c)(5),{keyName:n,value:r}=e,i;t[0]===r?i=t[1]:(i=r.length===0?(0,Z.jsx)(`span`,{className:`text-sm text-muted-foreground/60`,children:`Empty`}):r.map(VD),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`list-widget-readonly`,"data-key":n,className:`flex min-h-7 w-full min-w-0 flex-wrap items-center gap-1 rounded-md px-2`,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function VD(e,t){return(0,Z.jsx)(`span`,{"data-testid":`list-chip-readonly`,"data-index":t,className:`inline-flex items-center text-1sm rounded-full bg-muted py-0.5 px-2`,children:String(e)},`${t}-${String(e)}`)}var HD={text:``,number:0,boolean:!1,date:``,list:[]};function UD(e){let t=(0,$.c)(74),{folderPath:n,state:r,onChange:i}=e,[a,o]=(0,Q.useState)(!1),[s,c]=(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)(GD,{}),(0,Z.jsx)(Gi,{className:`h-7 w-full`}),(0,Z.jsx)(Gi,{className:`h-7 w-full`}),(0,Z.jsx)(Gi,{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]:(_=Oa(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,j,M;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 Ea(n,{[e]:t});if(!r.ok){Xa.error(`Save failed: ${r.error}`);return}i()},f=async function(e){let t=await Ea(n,{[e]:null});if(!t.ok){Xa.error(`Remove failed: ${t.error}`);return}i()},m=function(e,t){let n=p[e];r(e,AD(n,t))},_;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(){c({name:``,type:`text`,value:``,error:null}),o(!1)},t[31]=_):_=t[31],x=_;let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){c(t=>{if(!t)return t;let n=e===`date`?new Date().toISOString().slice(0,10):HD[e];return{...t,type:e,value:n,error:null}})},t[32]=P):P=t[32],C=P;let F;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){c(t=>t&&{...t,value:e})},t[33]=F):F=t[33],w=F;let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){c(t=>t&&{...t,name:e,error:null})},t[34]=I):I=t[34],S=I;let L;t[35]!==s||t[36]!==n||t[37]!==p||t[38]!==i?(L=async function(){if(!s)return;let e=s.name.trim();if(!e){c({...s,error:`Name is required`});return}if(Object.hasOwn(p,e)){c({...s,error:`Key "${e}" already resolves here`});return}let t=await Ea(n,{[e]:s.value});if(!t.ok){c({...s,error:t.error});return}c(null),i()},t[35]=s,t[36]=n,t[37]=p,t[38]=i,t[39]=L):L=t[39],T=L;let z=function(e){d({key:e,draft:e,error:null})},B=function(e){d(t=>t&&{...t,draft:e,error:null})},V=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 Ea(n,{[u.key]:null,[e]:t});if(!r.ok){d({...u,error:r.error});return}d(null),i()},H=function(){d(null)};M=`rounded-lg border bg-card`,b=A,O=!a,t[40]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>o(!e),t[40]=k):k=t[40];let U=`size-3 transition-transform ${a?``:`rotate-90`}`,W;t[41]===U?W=t[42]:(W=(0,Z.jsx)(l,{className:U,"aria-hidden":!0}),t[41]=U,t[42]=W);let G;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,Z.jsx)(`span`,{children:`Folder defaults`}),t[43]=G):G=t[43];let K;t[44]===W?K=t[45]:(K=(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:[W,G]}),t[44]=W,t[45]=K);let q;t[46]===v?q=t[47]:(q=(0,Z.jsx)(`code`,{className:`text-xs text-muted-foreground font-mono cursor-text select-text`,onClick:WD,children:v}),t[46]=v,t[47]=q),t[48]!==K||t[49]!==q?(j=(0,Z.jsxs)(R,{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:[K,q]}),t[48]=K,t[49]=q,t[50]=j):j=t[50],y=N,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)(MD,{keyName:e,value:t,declared:jD(t,on(t)),rename:n?{state:u?.key===e?u:null,onBegin:()=>z(e),onChangeDraft:B,onCommit:V,onCancel:H}:void 0,badge:n?null:(0,Z.jsx)(zD,{source:g[e]??``}),isInherited:!n,onCommit:t=>void r(e,t),onChangeType:t=>m(e,t),onRemove:n?()=>void f(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]=j,t[30]=M}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],j=t[29],M=t[30];let P;t[51]!==s||t[52]!==x||t[53]!==S||t[54]!==C||t[55]!==w||t[56]!==T?(P=s?(0,Z.jsx)(LD,{draft:s,onChangeName:S,onChangeType:C,onChangeValue:w,onCommit:()=>void T(),onCancel:()=>c(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)(Fi,{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]=P):P=t[57];let F;t[58]!==P||t[59]!==E||t[60]!==D?(F=(0,Z.jsxs)(`div`,{className:E,children:[D,P]}),t[58]=P,t[59]=E,t[60]=D,t[61]=F):F=t[61];let I;t[62]!==y||t[63]!==F?(I=(0,Z.jsx)(y,{children:F}),t[62]=y,t[63]=F,t[64]=I):I=t[64];let L;t[65]!==b||t[66]!==I||t[67]!==O||t[68]!==k||t[69]!==j?(L=(0,Z.jsxs)(b,{open:O,onOpenChange:k,children:[j,I]}),t[65]=b,t[66]=I,t[67]=O,t[68]=k,t[69]=j,t[70]=L):L=t[70];let z;return t[71]!==L||t[72]!==M?(z=(0,Z.jsx)(`section`,{className:M,children:L}),t[71]=L,t[72]=M,t[73]=z):z=t[73],z}function WD(e){return e.stopPropagation()}function GD(){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)(Ds,{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 KD(e){let t=e.split(`/`).pop();return t?`${e}/${t}`:null}function qD(e,t){let n=t.get(`${e}/index`);if(n)return n;let r=KD(e);if(r){let e=t.get(r);if(e)return e}return e.split(`/`).pop()??e}function JD(e,t,n){let r=n.get(e);return r&&r!==e?r:t}function YD(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:qD(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:JD(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:qD(e,t.pageTitles),children:a}}function XD(e){let t=(0,$.c)(63),{folderPath:n,state:r,onChange:i,folderConfigHandle:a}=e,[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),g;t[0]===i?g=t[1]:(g=async function(e){p(!0);let t=e.scope===`user`?`user`:`project`,n=await Ki(e.scope===`user`?``:e.source_folder,e.name,t);if(p(!1),!n.ok){Xa.error(`Delete failed: ${n.error}`);return}Xa.success(`Template "${e.name}" deleted`),l(null),i()},t[0]=i,t[1]=g);let _=g;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)(Gi,{className:`h-12 w-full`}),(0,Z.jsx)(Gi,{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 v;t[5]===r.data.folder.templates_available?v=t[6]:(v=r.data.folder.templates_available??[],t[5]=r.data.folder.templates_available,t[6]=v);let y,b,x,S,C,w;if(t[7]!==c||t[8]!==f||t[9]!==o||t[10]!==n||t[11]!==_||t[12]!==i||t[13]!==v){let e=v.filter(QD),r;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(`h2`,{className:`text-xs font-semibold uppercase font-mono tracking-wider text-muted-foreground`,children:`Templates available`}),t[20]=r):r=t[20];let a=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r,(0,Z.jsx)(Ne,{className:`text-xs`,variant:`secondary`,children:e.length})]}),u;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsxs)(X,{variant:`ghost`,className:`font-mono uppercase`,size:`sm`,onClick:()=>h(!0),children:[(0,Z.jsx)(Fi,{className:`size-3.5`,"aria-hidden":!0}),`New template`]}),t[21]=u):u=t[21];let p;t[22]===a?p=t[23]:(p=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1`,children:[a,u]}),t[22]=a,t[23]=p);let m=e.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:e.map(e=>(0,Z.jsx)($D,{template:e,onCreate:()=>d(e.name),onEdit:()=>s(e),onDelete:()=>l(e)},e.path))}),g;t[24]===m?g=t[25]:(g=(0,Z.jsx)(`div`,{className:`px-3 py-2.5`,children:m}),t[24]=m,t[25]=g),t[26]!==p||t[27]!==g?(S=(0,Z.jsxs)(`section`,{className:`rounded-lg border bg-card`,children:[p,g]}),t[26]=p,t[27]=g,t[28]=S):S=t[28];let T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{e||s(null)},t[29]=T):T=t[29];let E=o?.scope===`user`?`user`:`project`;t[30]!==o||t[31]!==n||t[32]!==i||t[33]!==E?(C=(0,Z.jsx)($i,{folderPath:n,template:o,onOpenChange:T,onSaved:i,target:E}),t[30]=o,t[31]=n,t[32]=i,t[33]=E,t[34]=C):C=t[34];let D=!!c,O;t[35]===f?O=t[36]:(O=e=>{!e&&!f&&l(null)},t[35]=f,t[36]=O);let k;t[37]!==c||t[38]!==f||t[39]!==_?(k=c&&(0,Z.jsx)(Sa,{itemName:`template "${c.name}"`,isSubmitting:f,onDelete:()=>_(c),customDescription:`This permanently removes ${c.path}. Agents that reference this template by name will fail until it's recreated or shadowed by an ancestor.${c.scope===`inherited`?`
28
28
 
29
29
  This template lives at an ancestor folder — deleting affects every folder under that ancestor that does not shadow it locally.`:c.scope===`user`?`
30
30
 
31
- This template lives in your user home (~/.ok/templates/) — deleting affects every OK project you open with this user account.`:``}`}),t[37]=c,t[38]=f,t[39]=_,t[40]=k):k=t[40],t[41]!==D||t[42]!==O||t[43]!==k?(w=(0,Z.jsx)(Ja,{open:D,onOpenChange:O,children:k}),t[41]=D,t[42]=O,t[43]=k,t[44]=w):w=t[44],y=Hi,b=n,x=new Set(e.map($D)),t[7]=c,t[8]=f,t[9]=o,t[10]=n,t[11]=_,t[12]=i,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19];let T;t[45]!==y||t[46]!==m||t[47]!==i||t[48]!==b||t[49]!==x?(T=(0,Z.jsx)(y,{folderPath:b,existingNames:x,open:m,onOpenChange:h,onCreated:i}),t[45]=y,t[46]=m,t[47]=i,t[48]=b,t[49]=x,t[50]=T):T=t[50];let E=u!==null,D;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||d(null)},t[51]=D):D=t[51];let O=u??void 0,k;t[52]!==a||t[53]!==n||t[54]!==O||t[55]!==E?(k=(0,Z.jsx)(Pf,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[52]=a,t[53]=n,t[54]=O,t[55]=E,t[56]=k):k=t[56];let A;return t[57]!==k||t[58]!==S||t[59]!==C||t[60]!==w||t[61]!==T?(A=(0,Z.jsxs)(Z.Fragment,{children:[S,C,w,T,k]}),t[57]=k,t[58]=S,t[59]=C,t[60]=w,t[61]=T,t[62]=A):A=t[62],A}function $D(e){return e.name}function eO(e){return e.scope!==`user`}function tO(e){let t=(0,$.c)(43),{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.scope?u=t[6]:(u=n.scope===`inherited`?(0,Z.jsx)(Ne,{variant:`gray`,className:`ml-auto shrink-0 text-2xs`,children:`inherited`}):null,t[5]=n.scope,t[6]=u);let d;t[7]===n.scope?d=t[8]:(d=n.scope===`user`?(0,Z.jsx)(Ne,{variant:`primary`,className:`ml-auto shrink-0 text-2xs`,children:`user`}):null,t[7]=n.scope,t[8]=d);let f;t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[c,l,u,d]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.description?p=t[15]:(p=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[14]=n.description,t[15]=p);let m;t[16]!==i||t[17]!==f||t[18]!==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[16]=i,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h=`Create note from ${s}`,g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Cs,{className:`size-3.5`,"aria-hidden":!0}),t[20]=g):g=t[20];let _;t[21]!==r||t[22]!==h?(_=(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,`Create`]}),t[21]=r,t[22]=h,t[23]=_):_=t[23];let v=`Actions for ${s}`,y;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(hi,{className:`size-4`,"aria-hidden":!0}),t[24]=y):y=t[24];let b;t[25]===v?b=t[26]:(b=(0,Z.jsx)(Si,{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":v,children:y})}),t[25]=v,t[26]=b);let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(be,{"aria-hidden":!0}),t[27]=x):x=t[27];let S;t[28]===i?S=t[29]:(S=(0,Z.jsxs)(di,{onSelect:i,children:[x,`Edit`]}),t[28]=i,t[29]=S);let C;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(fe,{"aria-hidden":!0}),t[30]=C):C=t[30];let w;t[31]===a?w=t[32]:(w=(0,Z.jsxs)(di,{variant:`destructive`,onSelect:a,children:[C,`Delete`]}),t[31]=a,t[32]=w);let T;t[33]!==S||t[34]!==w?(T=(0,Z.jsxs)(Aa,{align:`end`,children:[S,w]}),t[33]=S,t[34]=w,t[35]=T):T=t[35];let E;t[36]!==b||t[37]!==T?(E=(0,Z.jsxs)(ji,{children:[b,T]}),t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==_||t[40]!==E||t[41]!==m?(D=(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,_,E]}),t[39]=_,t[40]=E,t[41]=m,t[42]=D):D=t[42],D}function nO(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=Y(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Y(`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 rO(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=Y(`[&_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 iO(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=Y(`[&_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 aO(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=Y(`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 oO(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=Y(`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 sO(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=Y(`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 cO(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 lO(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 uO(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)(P,{className:`ml-1 size-3`}):(0,Z.jsx)(z,{className:`ml-1 size-3`}):(0,Z.jsx)(ts,{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 dO(e){let t=(0,$.c)(81),{folderPath:n}=e,{folderPaths:r,loading:i,pages:a,pageTitles:o,pageMeta:s}=wr(),c=ra(n),{state:l,refresh:u}=c,[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(`name`),[h,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)(Gi,{className:`size-5 rounded`}),(0,Z.jsx)(Gi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Gi,{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)(Gi,{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)(Gi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(mO)]})]})}),t[2]=r):r=t[2],r}let _,v,y,b,x,S,C,w,T,E;if(t[3]!==l||t[4]!==c||t[5]!==n||t[6]!==r||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==u||t[11]!==h||t[12]!==p){let e=ZD(n,{pages:a,pageTitles:o,pageMeta:s,folderPaths:r}),i=lO(e.children,p,h),d;t[23]===p?d=t[24]:(d=function(e){e===p?g(pO):(m(e),g(`asc`))},t[23]=p,t[24]=d);let D=d;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,S=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let O;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(G,{className:`size-5 text-muted-foreground`}),t[25]=O):O=t[25];let k=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsxs)(X,{onClick:()=>f(!0),children:[(0,Z.jsx)(Fi,{className:`size-4`}),`New`]}),t[26]=A):A=t[26],t[27]===k?C=t[28]:(C=(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:[k,A]})}),t[27]=k,t[28]=C),t[29]!==l||t[30]!==n||t[31]!==u?(w=(0,Z.jsx)(GD,{folderPath:n,state:l,onChange:u}),t[29]=l,t[30]=n,t[31]=u,t[32]=w):w=t[32],t[33]!==l||t[34]!==c||t[35]!==n||t[36]!==u?(T=(0,Z.jsx)(QD,{folderPath:n,state:l,onChange:u,folderConfigHandle:c}),t[33]=l,t[34]=c,t[35]=n,t[36]=u,t[37]=T):T=t[37],x=`rounded-lg border`,v=nO;let j=p===`name`?h===`asc`?`ascending`:`descending`:`none`,M;t[38]!==D||t[39]!==h||t[40]!==p?(M=(0,Z.jsx)(uO,{label:`Name`,sortKey:`name`,activeKey:p,activeDir:h,onSort:D}),t[38]=D,t[39]=h,t[40]=p,t[41]=M):M=t[41];let N;t[42]!==j||t[43]!==M?(N=(0,Z.jsx)(oO,{"aria-sort":j,children:M}),t[42]=j,t[43]=M,t[44]=N):N=t[44];let P=p===`modified`?h===`asc`?`ascending`:`descending`:`none`,F;t[45]!==D||t[46]!==h||t[47]!==p?(F=(0,Z.jsx)(uO,{label:`Modified`,sortKey:`modified`,activeKey:p,activeDir:h,onSort:D}),t[45]=D,t[46]=h,t[47]=p,t[48]=F):F=t[48];let I;t[49]!==P||t[50]!==F?(I=(0,Z.jsx)(oO,{className:`w-32`,"aria-sort":P,children:F}),t[49]=P,t[50]=F,t[51]=I):I=t[51],t[52]!==N||t[53]!==I?(b=(0,Z.jsx)(rO,{children:(0,Z.jsxs)(aO,{children:[N,I]})}),t[52]=N,t[53]=I,t[54]=b):b=t[54],_=iO,y=i.length?i.map(fO):(0,Z.jsx)(aO,{children:(0,Z.jsx)(sO,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=l,t[4]=c,t[5]=n,t[6]=r,t[7]=s,t[8]=o,t[9]=a,t[10]=u,t[11]=h,t[12]=p,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E}else _=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22];let D;t[55]!==_||t[56]!==y?(D=(0,Z.jsx)(_,{children:y}),t[55]=_,t[56]=y,t[57]=D):D=t[57];let O;t[58]!==v||t[59]!==b||t[60]!==D?(O=(0,Z.jsxs)(v,{children:[b,D]}),t[58]=v,t[59]=b,t[60]=D,t[61]=O):O=t[61];let k;t[62]!==O||t[63]!==x?(k=(0,Z.jsx)(`div`,{className:x,children:O}),t[62]=O,t[63]=x,t[64]=k):k=t[64];let A;t[65]!==k||t[66]!==S||t[67]!==C||t[68]!==w||t[69]!==T?(A=(0,Z.jsxs)(`div`,{className:S,children:[C,w,T,k]}),t[65]=k,t[66]=S,t[67]=C,t[68]=w,t[69]=T,t[70]=A):A=t[70];let j;t[71]!==A||t[72]!==E?(j=(0,Z.jsx)(`div`,{className:E,children:A}),t[71]=A,t[72]=E,t[73]=j):j=t[73];let M;t[74]!==d||t[75]!==c||t[76]!==n?(M=(0,Z.jsx)(Pf,{open:d,onOpenChange:f,kind:`file`,initialDir:n,folderConfig:c,suggestedName:`index`}),t[74]=d,t[75]=c,t[76]=n,t[77]=M):M=t[77];let N;return t[78]!==j||t[79]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[j,M]}),t[78]=j,t[79]=M,t[80]=N):N=t[80],N}function fO(e){return(0,Z.jsxs)(aO,{children:[(0,Z.jsx)(sO,{children:(0,Z.jsxs)(`a`,{href:er(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)(ks,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(p,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(sO,{className:`text-muted-foreground`,children:e.kind===`file`?cO(e.modified):`—`})]},e.path)}function pO(e){return e===`asc`?`desc`:`asc`}function mO(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)(Gi,{className:`size-4 rounded`}),(0,Z.jsx)(Gi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Gi,{className:`h-4 w-16`})})]},e)}function hO(e){let t=(0,$.c)(7),{docName:n}=e,[r,i]=(0,Q.useState)(gO),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ue(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(){Ue(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 gO(){return new Set}var _O=(0,Q.createContext)(null);function vO(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(yO),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)(_O,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function yO(){return new Map}function bO(){let e=(0,Q.use)(_O);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function xO(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=Y(`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)(Ly,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function SO(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)(By,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function CO(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=Y(`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)(Wy,{"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}var wO=960,TO=1024;function EO(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(OO),[r,i]=(0,Q.useState)(DO),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${wO-1}px)`),t=window.matchMedia(`(max-width: ${TO-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 DO(){return window.innerWidth>=wO&&window.innerWidth<TO}function OO(){return window.innerWidth<wO?`sheet`:`panel`}var kO={words:0,chars:0,tokens:0},AO=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,jO=/[\p{L}\p{N}]/u,MO=new Set([`text`,`inlineCode`,`code`,`tag`]),NO=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),PO=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function FO(e,t){if(!e)return;let n=e.type;if(!NO.has(n)){if(MO.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
32
- `));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)FO(n,t);if(PO.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
31
+ This template lives in your user home (~/.ok/templates/) — deleting affects every OK project you open with this user account.`:``}`}),t[37]=c,t[38]=f,t[39]=_,t[40]=k):k=t[40],t[41]!==D||t[42]!==O||t[43]!==k?(w=(0,Z.jsx)(Ja,{open:D,onOpenChange:O,children:k}),t[41]=D,t[42]=O,t[43]=k,t[44]=w):w=t[44],y=Hi,b=n,x=new Set(e.map(ZD)),t[7]=c,t[8]=f,t[9]=o,t[10]=n,t[11]=_,t[12]=i,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C,t[19]=w}else y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19];let T;t[45]!==y||t[46]!==m||t[47]!==i||t[48]!==b||t[49]!==x?(T=(0,Z.jsx)(y,{folderPath:b,existingNames:x,open:m,onOpenChange:h,onCreated:i}),t[45]=y,t[46]=m,t[47]=i,t[48]=b,t[49]=x,t[50]=T):T=t[50];let E=u!==null,D;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>{e||d(null)},t[51]=D):D=t[51];let O=u??void 0,k;t[52]!==a||t[53]!==n||t[54]!==O||t[55]!==E?(k=(0,Z.jsx)(Pf,{open:E,onOpenChange:D,kind:`file`,initialDir:n,initialTemplate:O,folderConfig:a}),t[52]=a,t[53]=n,t[54]=O,t[55]=E,t[56]=k):k=t[56];let A;return t[57]!==k||t[58]!==S||t[59]!==C||t[60]!==w||t[61]!==T?(A=(0,Z.jsxs)(Z.Fragment,{children:[S,C,w,T,k]}),t[57]=k,t[58]=S,t[59]=C,t[60]=w,t[61]=T,t[62]=A):A=t[62],A}function ZD(e){return e.name}function QD(e){return e.scope!==`user`}function $D(e){let t=(0,$.c)(43),{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.scope?u=t[6]:(u=n.scope===`inherited`?(0,Z.jsx)(Ne,{variant:`gray`,className:`ml-auto shrink-0 text-2xs`,children:`inherited`}):null,t[5]=n.scope,t[6]=u);let d;t[7]===n.scope?d=t[8]:(d=n.scope===`user`?(0,Z.jsx)(Ne,{variant:`primary`,className:`ml-auto shrink-0 text-2xs`,children:`user`}):null,t[7]=n.scope,t[8]=d);let f;t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[c,l,u,d]}),t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.description?p=t[15]:(p=n.description?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground truncate mt-0.5`,children:n.description}):null,t[14]=n.description,t[15]=p);let m;t[16]!==i||t[17]!==f||t[18]!==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[16]=i,t[17]=f,t[18]=p,t[19]=m):m=t[19];let h=`Create note from ${s}`,g;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(Cs,{className:`size-3.5`,"aria-hidden":!0}),t[20]=g):g=t[20];let _;t[21]!==r||t[22]!==h?(_=(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,`Create`]}),t[21]=r,t[22]=h,t[23]=_):_=t[23];let v=`Actions for ${s}`,y;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(hi,{className:`size-4`,"aria-hidden":!0}),t[24]=y):y=t[24];let b;t[25]===v?b=t[26]:(b=(0,Z.jsx)(Ii,{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":v,children:y})}),t[25]=v,t[26]=b);let x;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(be,{"aria-hidden":!0}),t[27]=x):x=t[27];let S;t[28]===i?S=t[29]:(S=(0,Z.jsxs)(vi,{onSelect:i,children:[x,`Edit`]}),t[28]=i,t[29]=S);let C;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(fe,{"aria-hidden":!0}),t[30]=C):C=t[30];let w;t[31]===a?w=t[32]:(w=(0,Z.jsxs)(vi,{variant:`destructive`,onSelect:a,children:[C,`Delete`]}),t[31]=a,t[32]=w);let T;t[33]!==S||t[34]!==w?(T=(0,Z.jsxs)(ki,{align:`end`,children:[S,w]}),t[33]=S,t[34]=w,t[35]=T):T=t[35];let E;t[36]!==b||t[37]!==T?(E=(0,Z.jsxs)(Ei,{children:[b,T]}),t[36]=b,t[37]=T,t[38]=E):E=t[38];let D;return t[39]!==_||t[40]!==E||t[41]!==m?(D=(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,_,E]}),t[39]=_,t[40]=E,t[41]=m,t[42]=D):D=t[42],D}function eO(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=Y(`relative w-full overflow-x-auto subtle-scrollbar`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=Y(`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 tO(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=Y(`[&_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 nO(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=Y(`[&_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 rO(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=Y(`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 iO(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=Y(`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 aO(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=Y(`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 oO(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 sO(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 cO(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)(P,{className:`ml-1 size-3`}):(0,Z.jsx)(z,{className:`ml-1 size-3`}):(0,Z.jsx)(ts,{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 lO(e){let t=(0,$.c)(81),{folderPath:n}=e,{folderPaths:r,loading:i,pages:a,pageTitles:o,pageMeta:s}=wr(),c=ra(n),{state:l,refresh:u}=c,[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(`name`),[h,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)(Gi,{className:`size-5 rounded`}),(0,Z.jsx)(Gi,{className:`h-7 w-48`})]}),(0,Z.jsx)(Gi,{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)(Gi,{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)(Gi,{className:`h-4 w-20`})})]}),[`a`,`b`,`c`,`d`].map(fO)]})]})}),t[2]=r):r=t[2],r}let _,v,y,b,x,S,C,w,T,E;if(t[3]!==l||t[4]!==c||t[5]!==n||t[6]!==r||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==u||t[11]!==h||t[12]!==p){let e=YD(n,{pages:a,pageTitles:o,pageMeta:s,folderPaths:r}),i=sO(e.children,p,h),d;t[23]===p?d=t[24]:(d=function(e){e===p?g(dO):(m(e),g(`asc`))},t[23]=p,t[24]=d);let D=d;E=`flex min-h-0 flex-1 items-start overflow-y-auto subtle-scrollbar`,S=`mx-auto flex w-full max-w-4xl flex-col gap-6 px-6 py-8`;let O;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(G,{className:`size-5 text-muted-foreground`}),t[25]=O):O=t[25];let k=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:e.title})]}),A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsxs)(X,{onClick:()=>f(!0),children:[(0,Z.jsx)(Fi,{className:`size-4`}),`New`]}),t[26]=A):A=t[26],t[27]===k?C=t[28]:(C=(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:[k,A]})}),t[27]=k,t[28]=C),t[29]!==l||t[30]!==n||t[31]!==u?(w=(0,Z.jsx)(UD,{folderPath:n,state:l,onChange:u}),t[29]=l,t[30]=n,t[31]=u,t[32]=w):w=t[32],t[33]!==l||t[34]!==c||t[35]!==n||t[36]!==u?(T=(0,Z.jsx)(XD,{folderPath:n,state:l,onChange:u,folderConfigHandle:c}),t[33]=l,t[34]=c,t[35]=n,t[36]=u,t[37]=T):T=t[37],x=`rounded-lg border`,v=eO;let j=p===`name`?h===`asc`?`ascending`:`descending`:`none`,M;t[38]!==D||t[39]!==h||t[40]!==p?(M=(0,Z.jsx)(cO,{label:`Name`,sortKey:`name`,activeKey:p,activeDir:h,onSort:D}),t[38]=D,t[39]=h,t[40]=p,t[41]=M):M=t[41];let N;t[42]!==j||t[43]!==M?(N=(0,Z.jsx)(iO,{"aria-sort":j,children:M}),t[42]=j,t[43]=M,t[44]=N):N=t[44];let P=p===`modified`?h===`asc`?`ascending`:`descending`:`none`,F;t[45]!==D||t[46]!==h||t[47]!==p?(F=(0,Z.jsx)(cO,{label:`Modified`,sortKey:`modified`,activeKey:p,activeDir:h,onSort:D}),t[45]=D,t[46]=h,t[47]=p,t[48]=F):F=t[48];let I;t[49]!==P||t[50]!==F?(I=(0,Z.jsx)(iO,{className:`w-32`,"aria-sort":P,children:F}),t[49]=P,t[50]=F,t[51]=I):I=t[51],t[52]!==N||t[53]!==I?(b=(0,Z.jsx)(tO,{children:(0,Z.jsxs)(rO,{children:[N,I]})}),t[52]=N,t[53]=I,t[54]=b):b=t[54],_=nO,y=i.length?i.map(uO):(0,Z.jsx)(rO,{children:(0,Z.jsx)(aO,{colSpan:2,className:`h-24 text-center text-muted-foreground`,children:`This folder is empty.`})}),t[3]=l,t[4]=c,t[5]=n,t[6]=r,t[7]=s,t[8]=o,t[9]=a,t[10]=u,t[11]=h,t[12]=p,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C,t[20]=w,t[21]=T,t[22]=E}else _=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19],w=t[20],T=t[21],E=t[22];let D;t[55]!==_||t[56]!==y?(D=(0,Z.jsx)(_,{children:y}),t[55]=_,t[56]=y,t[57]=D):D=t[57];let O;t[58]!==v||t[59]!==b||t[60]!==D?(O=(0,Z.jsxs)(v,{children:[b,D]}),t[58]=v,t[59]=b,t[60]=D,t[61]=O):O=t[61];let k;t[62]!==O||t[63]!==x?(k=(0,Z.jsx)(`div`,{className:x,children:O}),t[62]=O,t[63]=x,t[64]=k):k=t[64];let A;t[65]!==k||t[66]!==S||t[67]!==C||t[68]!==w||t[69]!==T?(A=(0,Z.jsxs)(`div`,{className:S,children:[C,w,T,k]}),t[65]=k,t[66]=S,t[67]=C,t[68]=w,t[69]=T,t[70]=A):A=t[70];let j;t[71]!==A||t[72]!==E?(j=(0,Z.jsx)(`div`,{className:E,children:A}),t[71]=A,t[72]=E,t[73]=j):j=t[73];let M;t[74]!==d||t[75]!==c||t[76]!==n?(M=(0,Z.jsx)(Pf,{open:d,onOpenChange:f,kind:`file`,initialDir:n,folderConfig:c,suggestedName:`index`}),t[74]=d,t[75]=c,t[76]=n,t[77]=M):M=t[77];let N;return t[78]!==j||t[79]!==M?(N=(0,Z.jsxs)(Z.Fragment,{children:[j,M]}),t[78]=j,t[79]=M,t[80]=N):N=t[80],N}function uO(e){return(0,Z.jsxs)(rO,{children:[(0,Z.jsx)(aO,{children:(0,Z.jsxs)(`a`,{href:er(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)(ks,{className:`size-4 shrink-0 text-muted-foreground`}):(0,Z.jsx)(p,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.title})]})}),(0,Z.jsx)(aO,{className:`text-muted-foreground`,children:e.kind===`file`?oO(e.modified):`—`})]},e.path)}function dO(e){return e===`asc`?`desc`:`asc`}function fO(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)(Gi,{className:`size-4 rounded`}),(0,Z.jsx)(Gi,{className:`h-4 w-40`}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(Gi,{className:`h-4 w-16`})})]},e)}function pO(e){let t=(0,$.c)(7),{docName:n}=e,[r,i]=(0,Q.useState)(mO),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>ue(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(){Ue(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 mO(){return new Set}var hO=(0,Q.createContext)(null);function gO(e){let t=(0,$.c)(7),{children:n}=e,[r,i]=(0,Q.useState)(_O),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)(hO,{value:u,children:n}),t[4]=n,t[5]=u,t[6]=d):d=t[6],d}function _O(){return new Map}function vO(){let e=(0,Q.use)(hO);if(e===null)throw Error(`useProperties must be used within <PropertyProvider />`);return e}function yO(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=Y(`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)(ib,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bO(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)(sb,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function xO(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=Y(`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)(db,{"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}var SO=960,CO=1024;function wO(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(EO),[r,i]=(0,Q.useState)(TO),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.matchMedia(`(max-width: ${SO-1}px)`),t=window.matchMedia(`(max-width: ${CO-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 TO(){return window.innerWidth>=SO&&window.innerWidth<CO}function EO(){return window.innerWidth<SO?`sheet`:`panel`}var DO={words:0,chars:0,tokens:0},OO=/[ -〿぀-ゟ゠-ヿ㐀-䶿一-鿿豈-﫿＀-￯฀-๿ក-៿]/,kO=/[\p{L}\p{N}]/u,AO=new Set([`text`,`inlineCode`,`code`,`tag`]),jO=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),MO=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function NO(e,t){if(!e)return;let n=e.type;if(!jO.has(n)){if(AO.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
32
+ `));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)NO(n,t);if(MO.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
33
33
  `)&&t.push(`
34
- `)}}}}function IO(e){try{let t=f().parseToMdast(e),n=[];return FO(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function LO(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))jO.test(n)&&t++;return t}function RO(e){let t=globalThis.Intl.Segmenter;if(!t)return LO(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function zO(e){let t=AO.test(e)?1.5:4;return Math.ceil(e.length/t)}function BO(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Sn(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=IO(t);return n?{words:AO.test(n)?RO(n):LO(n),chars:n.length,tokens:zO(n)}:{words:0,chars:0,tokens:0}}var VO=300;function HO(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(kO),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(kO);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(BO(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,VO)};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 UO(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`?WO: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 WO(e){return e===`synced`?`synced`:`connected`}var GO=nr;function KO(e,t={}){let n=oe(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var qO=200,JO=`Outside any block`;function YO(e){let t=(0,$.c)(5),{editor:n}=e,r=ce(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?XO(n,r):o.current?JO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},qO),()=>{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 XO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=KO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=KO(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 ZO(){let[e]=(0,Q.useState)(jr);return e}function QO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Yn(e.display_name),color:Sr(e.id,In),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Sr(e.id,In),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function $O(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 ek=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&&Fr(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(Qt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(xn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_n(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(an(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(tn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(rr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(hn(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=Nr(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof nn){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 zn){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():$O(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&ar(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()}},tk=e=>new bn({key:typeof e.pluginKey==`string`?new or(e.pluginKey):e.pluginKey,view:t=>new ek({view:t,...e})});Tr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[tk({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 nk=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 Qn(e,{textSerializers:Xn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Qt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(xn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_n(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(an(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(tn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(rr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(hn(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=Nr(this.view,e.from,e.to);ar({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()}},rk=e=>new bn({key:typeof e.pluginKey==`string`?new or(e.pluginKey):e.pluginKey,view:t=>new nk({view:t,...e})});Tr.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?[rk({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 ik(e,t){return e??new or(t)}var ak=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,ok=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),sk=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(`.`)),ck=new Set([`children`,`className`,`style`]),lk=new Set([`tabIndex`]),uk=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),dk={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function fk(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function pk(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function mk(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||uk.has(e)}function hk(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function gk(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:dk[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function _k(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 vk(e){return lk.has(e)}function yk(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function bk(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 xk(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||sk.has(e)?String(t):`${t}px`}function Sk(e,t){ok.has(t)||e.style.removeProperty(hk(t))}function Ck(e,t,n){ok.has(t)||e.style.setProperty(hk(t),xk(t,n))}function wk(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(ck.has(r)||!mk(r)||fk(r,t[r])||fk(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=pk(r);if(a==null||a===!1){vk(r)&&bk(e,r),e.removeAttribute(o);return}if(a===!0){vk(r)&&yk(e,r,!0),e.setAttribute(o,``);return}if(vk(r)){yk(e,r,a);return}e.setAttribute(o,String(a))})}function Tk(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Ek(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){Sk(e,t);return}Ck(e,t,a)}})}function Dk(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(!fk(t,n))return;let{eventName:i,options:a}=gk(t),o=t=>{n(_k(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Ok(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);ak(()=>{let i=n.current;return Tk(e,i.className,t.className),Ek(e,i.style,t.style),wk(e,i,t),r.current=Dk(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 kk=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:l,...u},d)=>{let f=(0,Q.useRef)(document.createElement(`div`)),p=(0,Q.useRef)(ik(e,`bubbleMenu`)).current;Ok(f.current,u),typeof d==`function`?d(f.current):d&&(d.current=f.current);let{editor:m}=c(),h=t||m,g={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:p,shouldShow:a,getReferencedVirtualElement:o,options:s},_=(0,Q.useRef)(g);_.current=g;let[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(h?.isDestroyed)return;if(!h){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=f.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=tk({..._.current,editor:h,element:e});h.registerPlugin(t);let n=_.current.pluginKey;return b.current=!0,y(!0),()=>{y(!1),h.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[h]),(0,Q.useEffect)(()=>{if(!(!v||!h||h.isDestroyed)){if(b.current){b.current=!1;return}h.view.dispatch(h.state.tr.setMeta(p,{type:`updateOptions`,options:_.current}))}},[v,h,n,r,a,s,i,o,p]),(0,is.createPortal)(l,f.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(ik(e,`floatingMenu`)).current;Ok(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=c(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,options:o},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(`FloatingMenu 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=rk({...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,o,i,f]),(0,is.createPortal)(s,d.current)});var Ak=[{name:`paragraph`,label:`Text`,icon:Xs,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:me,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:yt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:dt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:He,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:De,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ae,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:ut,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:sc,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function jk(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Mk},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Se(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)(Ie,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Si,{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=Ak.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(di,{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)(Aa,{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)(ji,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Mk(e){let t=Object.fromEntries(Ak.map(t=>[t.name,t.isActive(e.editor)]));return{current:Ak.find(e=>t[e.name])??Ak[0],activeStates:t}}function Nk(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 Pk(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:V(typeof n.src==`string`?n.src:``)}function Fk(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 Ik(e){let t=(0,$.c)(10),{editor:n}=e,r;if(t[0]===n?r=t[1]:(r={editor:n,selector:Lk},t[0]=n,t[1]=r),Se(r)===null)return null;let i;t[2]===n?i=t[3]:(i=e=>{e.preventDefault();let t=Nk(n);t&&Fk(t,Pk(n))},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Oi,{className:`size-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(so,{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)(co,{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)(uo,{children:[o,s]})}),t[8]=o,t[9]=c),c}function Lk(e){return Nk(e.editor)}function Rk(e){return Nk(e)!==null}var zk=[{value:`left`,label:`Align left`,icon:Je},{value:`center`,label:`Align center`,icon:_e},{value:`right`,label:`Align right`,icon:it}];function Bk(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 Vk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Hk},t[0]=n,t[1]=r);let i=Se(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=zk.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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(nn.create(u.doc,s)),Ee(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(co,{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 Hk(e){return Bk(e.editor)}function Uk(e){return Bk(e)!==null}var Wk=[{name:`bold`,icon:rs,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:Ps,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:gc,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:dc,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:ms,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:Ns,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function Gk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Kk},t[0]=n,t[1]=r);let i=Se(r),a;t[2]!==i||t[3]!==n?(a=Wk.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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)(co,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:e.shortcut})]})]},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 Kk(e){return Object.fromEntries(Wk.map(t=>[t.name,t.isActive(e.editor)]))}function qk(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)(ys,{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)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),ne(d)},children:(0,Z.jsx)(Ma,{className:`size-3.5`})})}),(0,Z.jsx)(co,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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)(fe,{className:`size-3.5`})})}),(0,Z.jsx)(co,{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)(zs,{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)(so,{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)(co,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:`⌘K`})]}),t[43]=E):E=t[43];let D;return t[44]===T?D=t[45]:(D=(0,Z.jsxs)(uo,{children:[T,E]}),t[44]=T,t[45]=D),D}function Jk({editor:e}){if(e.isActive(`codeBlock`))return!1;if(Uk(e)||Rk(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 Yk(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:eA},t[0]=n,t[1]=s);let c=Se(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:$k},t[2]=n,t[3]=l);let u=Se(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return Nr(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=yn(e,t,()=>{ar(e,t,{placement:`top`,strategy:`fixed`,middleware:[_n(8),Qt(),xn({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(Qk)}))},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(Zk)},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)(Vk,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(Ik,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(jk,{editor:n}),(0,Z.jsx)(Bi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Gk,{editor:n},i),(0,Z.jsx)(Bi,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(qk,{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)(kk,{ref:r,editor:n,appendTo:Xk,shouldShow:Jk,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 Xk(){return document.body}function Zk(e){return e+1}function Qk(){}function $k(e){return Rk(e.editor)}function eA(e){return Uk(e.editor)}var tA=[{name:`addRowBefore`,icon:P,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:z,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:fe,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],nA=[{name:`addColumnBefore`,icon:ti,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:oa,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:fe,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],rA=[{name:`toggleHeaderRow`,icon:pc,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:gs,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:js,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function iA({editor:e}){return e.isActive(`table`)}function aA(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)(so,{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)(co,{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)(uo,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function oA(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=tA.map(e=>(0,Z.jsx)(aA,{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)(Bi,{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=nA.map(e=>(0,Z.jsx)(aA,{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)(Bi,{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=rA.map(e=>(0,Z.jsx)(aA,{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)(kk,{editor:n,shouldShow:iA,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 sA=new WeakMap;function cA(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=Or(e.color),n.textContent=e.name,t.append(n),t}var lA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function uA(){let e=new Mr({extensions:Nn});return{mdManager:e,text:S({mdManager:e}),html:re({mdManager:e}),paste:$e({mdManager:e}),drop:D({mdManager:e})}}function dA(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...Xe.map(e=>e.name===`link`||e.name===`wikiLink`?e.configure({docName:t.configuration.name??``}):e),GO.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),C.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Tr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[s]}}),Tr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[k(e,{cursorBuilder:cA})]}})]}function fA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{sA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=sA.get(e);if(sA.delete(e),r==null)return;let i=performance.now();Ge(`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:ld(dA(e))}}function pA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=ur(dA({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=T(t.document.getXmlFragment(`default`),a);return{...fA({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var mA=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(lA),c=ZO(),{principal:l,activeDocName:u}=We(),d=n.configuration.name??``,[f]=(0,Q.useState)(uA),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new hr(pA({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),h,g;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=bt(d)??crypto.randomUUID();h=Q.use,g=Oe({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=h,t[8]=g}else h=t[7],g=t[8];let _=h(g),v=_.editor,y,b;t[9]===_?(y=t[10],b=t[11]):(y=()=>()=>{xe(_)},b=[_],t[9]=_,t[10]=y,t[11]=b),(0,Q.useEffect)(y,b);let x;return t[12]!==u||t[13]!==d||t[14]!==v||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(x=(0,Z.jsx)(hA,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:v,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=v,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=x):x=t[20],x},hA=e=>{let t=(0,$.c)(71),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),p,m;t[0]===d?(p=t[1],m=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},m=[d],t[0]=d,t[1]=p,t[2]=m),(0,Q.useLayoutEffect)(p,m);let h;t[3]!==c||t[4]!==n.configuration.name?(h=()=>(ct(c,n.configuration.name??null),()=>{ct(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=h):h=t[5];let g;t[6]!==c||t[7]!==n?(g=[c,n],t[6]=c,t[7]=n,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==c||t[10]!==n.configuration.name?(_=()=>{},t[9]=c,t[10]=n.configuration.name,t[11]=_):_=t[11];let v;t[12]!==c||t[13]!==n?(v=[c,n],t[12]=c,t[13]=n,t[14]=v):v=t[14],(0,Q.useEffect)(_,v);let y;t[15]!==c||t[16]!==n.configuration.name?(y=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=y):y=t[17];let b;t[18]!==c||t[19]!==n?(b=[c,n],t[18]=c,t[19]=n,t[20]=b):b=t[20],(0,Q.useEffect)(y,b);let x,S;t[21]===c?(x=t[22],S=t[23]):(S=()=>{let e=gA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=pt(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 pt(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},x=[c],t[21]=c,t[22]=x,t[23]=S),(0,Q.useEffect)(S,x);let C,T;t[24]!==u||t[25]!==n.document||t[26]!==l?(C=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},dr)};c(lA);let f=()=>{if(Wn(e),!Vn(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Vn(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},T=[n.document,u,l],t[24]=u,t[25]=n.document,t[26]=l,t[27]=C,t[28]=T):(C=t[27],T=t[28]),(0,Q.useEffect)(C,T);let E,D;t[29]===n?(E=t[30],D=t[31]):(E=()=>{let e=window.location.hash,t=e.indexOf(`?`),r=t>=0?new URLSearchParams(e.slice(t+1)).get(`anchor`):null;if(!r)return;let i=r,a=0,o,s=!1;function c(){if(s)return;let e=document.getElementById(i);e?(e.scrollIntoView({behavior:`smooth`,block:`start`}),s=!0,n.off(`synced`,c)):a<20&&(a+=1,o=window.setTimeout(c,100))}return c(),n.on(`synced`,c),()=>{o!==void 0&&clearTimeout(o),n.off(`synced`,c)}},D=[n],t[29]=n,t[30]=E,t[31]=D),(0,Q.useEffect)(E,D);let k,A;t[32]===c?(k=t[33],A=t[34]):(k=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=pt(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(zo,e),()=>window.removeEventListener(zo,e)},A=[c],t[32]=c,t[33]=k,t[34]=A),(0,Q.useEffect)(k,A);let j;t[35]!==a||t[36]!==i||t[37]!==o||t[38]!==r||t[39]!==s||t[40]!==n.awareness?(j=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:QO({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[35]=a,t[36]=i,t[37]=o,t[38]=r,t[39]=s,t[40]=n.awareness,t[41]=j):j=t[41];let M;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n?(M=[n,i,a,o,s,r],t[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n,t[48]=M):M=t[48],(0,Q.useEffect)(j,M);let N,P;t[49]===c?(N=t[50],P=t[51]):(N=(0,Z.jsx)(Yk,{editor:c}),P=(0,Z.jsx)(oA,{editor:c}),t[49]=c,t[50]=N,t[51]=P);let F;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[52]=F):F=t[52];let I;t[53]===c?I=t[54]:(I=(0,Z.jsx)(se,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[53]=c,t[54]=I);let L;t[55]!==d||t[56]!==I?(L=(0,is.createPortal)(I,d),t[55]=d,t[56]=I,t[57]=L):L=t[57];let R;t[58]===c?R=t[59]:(R=(0,Z.jsx)(YO,{editor:c}),t[58]=c,t[59]=R);let z;t[60]===c?z=t[61]:(z=w(c),t[60]=c,t[61]=z);let B;t[62]===z.store?B=t[63]:(B=(0,Z.jsx)(O,{store:z.store}),t[62]=z.store,t[63]=B);let V;return t[64]!==N||t[65]!==P||t[66]!==L||t[67]!==R||t[68]!==B||t[69]!==l?(V=(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:[N,P,F,L,R,B]}),t[64]=N,t[65]=P,t[66]=L,t[67]=R,t[68]=B,t[69]=l,t[70]=V):V=t[70],V};function gA(){return q()}function _A(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(lt(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 vA=`__back-nav__`;function yA(e){return e instanceof ge||e instanceof qe||e instanceof de||e instanceof Me||e instanceof rt||e instanceof Qe?e.docName:null}function bA(e){return e instanceof ge?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof qe?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof de?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof Me?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof rt?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:e instanceof Qe?{title:`Cancelled`,summary:`You cancelled loading "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function xA(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=bA(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)(jb,{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||(ze(yA(n)??i),o(a),r(vA))},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 SA(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)(xA,{...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]===vA){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}: ${bA(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)(b,{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}var CA={text:``,number:0,boolean:!1,date:``,list:[]};function wA(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=vr(t);return{map:n,keys:pn(t),parseError:r}}function TA(e){let t=(0,$.c)(169),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>wA(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),c,u;t[2]===n?(c=t[3],u=t[4]):(c=()=>{let e=br(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]=c,t[4]=u),(0,Q.useEffect)(c,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??``,j;t[8]===k?j=t[9]:(j=DA(k),t[8]=k,t[9]=j);let M=ra(j),P;t[10]!==M.state.data||t[11]!==M.state.status?(P=M.state.status===`ready`?M.state.data.folder.frontmatter_defaults??{}:{},t[10]=M.state.data,t[11]=M.state.status,t[12]=P):P=t[12];let F=P,I;t[13]!==M.state.data||t[14]!==M.state.status?(I=M.state.status===`ready`?M.state.data.frontmatterSources:{},t[13]=M.state.data,t[14]=M.state.status,t[15]=I):I=t[15];let L=I,z;t[16]===r?z=t[17]:(z=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=lr(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[16]=r,t[17]=z);let B=z,V;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){T(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[18]=V):V=t[18];let H=V,U;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(U=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[19]=U):U=t[19];let W=U,G;t[20]===B?G=t[21]:(G=function(e,t){H(e),W(B({[e]:t}),[e])},t[20]=B,t[21]=G);let K=G,q;t[22]===B?q=t[23]:(q=function(e){H(e),W(B({[e]:null}),[e])},t[22]=B,t[23]=q);let ee=q,te;t[24]===r?te=t[25]:(te=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=lr(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[24]=r,t[25]=te);let ne=te,re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e,t){return`${e} ${t}`},t[26]=re):re=t[26];let ie=re,ae;t[27]!==r||t[28]!==f?(ae=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)=>ie(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[27]=r,t[28]=f,t[29]=ae):ae=t[29];let oe=ae,se;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(se={activationConstraint:{distance:4}},t[30]=se):se=t[30];let ce;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ce={coordinateGetter:fi},t[31]=ce):ce=t[31];let le=ia(ui(Di,se),ui(mi,ce)),ue;t[32]!==F||t[33]!==K||t[34]!==d?(ue=function(e,t){let n=d[e]??OA(F[e]);if(n===void 0)return;v(n=>({...n,[e]:t}));let r=MD(n,t);(!Object.hasOwn(d,e)||!EA(n,r))&&K(e,r)},t[32]=F,t[33]=K,t[34]=d,t[35]=ue):ue=t[35];let de=ue,fe;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(fe=function(){b({name:``,type:`text`,value:``,error:null}),h(!1)},t[36]=fe):fe=t[36];let pe=fe,{addPropertySignal:me,clearAddProperty:he}=bO(),ge;t[37]!==me||t[38]!==k?(ge=me.get(k)??0,t[37]=me,t[38]=k,t[39]=ge):ge=t[39];let _e=ge,ve,ye;t[40]===_e?(ve=t[41],ye=t[42]):(ve=()=>{_e>0&&(b({name:``,type:`text`,value:``,error:null}),h(!1))},ye=[_e],t[40]=_e,t[41]=ve,t[42]=ye),(0,Q.useEffect)(ve,ye);let be,xe;t[43]!==he||t[44]!==k?(be=()=>()=>he(k),xe=[k,he],t[43]=he,t[44]=k,t[45]=be,t[46]=xe):(be=t[45],xe=t[46]),(0,Q.useEffect)(be,xe);let Se;t[47]===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):CA[e];return{...t,type:e,value:n,error:null}})},t[47]=Se):Se=t[47];let Ce=Se,we;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){b(t=>t&&{...t,value:e})},t[48]=we):we=t[48];let J=we,Te;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){b(t=>t&&{...t,name:e,error:null})},t[49]=Te):Te=t[49];let Ee=Te,De;t[50]!==y||t[51]!==B||t[52]!==d?(De=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=B({[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[50]=y,t[51]=B,t[52]=d,t[53]=De):De=t[53];let Oe=De,ke;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(){b(null)},t[54]=ke):ke=t[54];let Ae=ke,je;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(e){S({key:e,draft:e,error:null})},t[55]=je):je=t[55];let Me=je,Ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){S(t=>t&&{...t,draft:e,error:null})},t[56]=Ne):Ne=t[56];let Pe=Ne,Fe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){S(null)},t[57]=Fe):Fe=t[57];let Ie=Fe,Le;t[58]!==d||t[59]!==ne||t[60]!==x?(Le=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=ne(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}),H(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[58]=d,t[59]=ne,t[60]=x,t[61]=Le):Le=t[61];let Re=Le,ze;t[62]!==d||t[63]!==f?(ze=f.length>0?f:Object.keys(d),t[62]=d,t[63]=f,t[64]=ze):ze=t[64];let Be=ze,Ve;if(t[65]!==Be){Ve=new Map;for(let e of Be)Ve.set(e,(Ve.get(e)??0)+1);t[65]=Be,t[66]=Ve}else Ve=t[66];let He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e;if(t[67]!==y||t[68]!==F||t[69]!==L||t[70]!==m||t[71]!==K||t[72]!==Re||t[73]!==Ve||t[74]!==w||t[75]!==oe||t[76]!==d||t[77]!==_||t[78]!==p||t[79]!==ee||t[80]!==x||t[81]!==Be||t[82]!==D||t[83]!==le||t[84]!==de){$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=A,Je=!m,t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=e=>h(!e),t[97]=Ye):Ye=t[97];let n=!m,r;t[98]===n?r=t[99]:(r=(0,Z.jsx)(l,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[98]=n,t[99]=r);let i;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:`Properties`}),t[100]=i):i=t[100],t[101]===r?Xe=t[102]:(Xe=(0,Z.jsx)(R,{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[101]=r,t[102]=Xe),He=N,We=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[103]===p?Ge=t[104]:(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)(Dn,{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[103]=p,t[104]=Ge);let a;if(t[105]!==Be){let e;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>ie(e,t),t[107]=e):e=t[107],a=Be.map(e),t[105]=Be,t[106]=a}else a=t[106];let o;if(t[108]!==F||t[109]!==L||t[110]!==K||t[111]!==Re||t[112]!==Ve||t[113]!==w||t[114]!==d||t[115]!==_||t[116]!==ee||t[117]!==x||t[118]!==Be||t[119]!==D||t[120]!==de){let e;t[122]!==F||t[123]!==L||t[124]!==K||t[125]!==Re||t[126]!==Ve||t[127]!==w||t[128]!==d||t[129]!==_||t[130]!==ee||t[131]!==x||t[132]!==D||t[133]!==de?(e=(e,t)=>{let n=d[e];if(n===void 0)return null;let r=_[e]??on(n),i=x?.key===e?x:null,a=(Ve.get(e)??0)>1,o=Object.hasOwn(F,e)?(0,Z.jsx)(kA,{source:L[e]??``}):void 0;return(0,Z.jsx)(PD,{sortableId:ie(e,t),keyName:e,value:n,declared:r,error:w[e]??null,resetCounter:D[e]??0,isDuplicate:a,badge:o,rename:{state:i,onBegin:()=>Me(e),onChangeDraft:Pe,onCommit:Re,onCancel:Ie},onCommit:t=>K(e,t),onChangeType:t=>de(e,t),onRemove:()=>ee(e)},`${e}-${t}`)},t[122]=F,t[123]=L,t[124]=K,t[125]=Re,t[126]=Ve,t[127]=w,t[128]=d,t[129]=_,t[130]=ee,t[131]=x,t[132]=D,t[133]=de,t[134]=e):e=t[134],o=Be.map(e),t[108]=F,t[109]=L,t[110]=K,t[111]=Re,t[112]=Ve,t[113]=w,t[114]=d,t[115]=_,t[116]=ee,t[117]=x,t[118]=Be,t[119]=D,t[120]=de,t[121]=o}else o=t[121];let s;t[135]!==a||t[136]!==o?(s=(0,Z.jsx)(Mi,{items:a,strategy:Pi,children:o}),t[135]=a,t[136]=o,t[137]=s):s=t[137],t[138]!==oe||t[139]!==le||t[140]!==s?(Ke=(0,Z.jsx)(gi,{sensors:le,collisionDetection:aa,onDragEnd:oe,children:s}),t[138]=oe,t[139]=le,t[140]=s,t[141]=Ke):Ke=t[141];let c;t[142]!==F||t[143]!==L||t[144]!==K||t[145]!==w||t[146]!==D||t[147]!==de?(c=e=>{let t=F[e],n=OA(t),r=on(n),i=L[e]??``;return(0,Z.jsx)(PD,{keyName:e,value:n,declared:r,error:w[e]??null,resetCounter:D[e]??0,isInherited:!0,badge:(0,Z.jsx)(VD,{source:i}),onCommit:t=>K(e,t),onChangeType:t=>de(e,t)},`inherited-${e}`)},t[142]=F,t[143]=L,t[144]=K,t[145]=w,t[146]=D,t[147]=de,t[148]=c):c=t[148],qe=e.map(c)}t[67]=y,t[68]=F,t[69]=L,t[70]=m,t[71]=K,t[72]=Re,t[73]=Ve,t[74]=w,t[75]=oe,t[76]=d,t[77]=_,t[78]=p,t[79]=ee,t[80]=x,t[81]=Be,t[82]=D,t[83]=le,t[84]=de,t[85]=He,t[86]=Ue,t[87]=We,t[88]=Ge,t[89]=Ke,t[90]=qe,t[91]=Je,t[92]=Ye,t[93]=Xe,t[94]=Ze,t[95]=Qe,t[96]=$e}else He=t[85],Ue=t[86],We=t[87],Ge=t[88],Ke=t[89],qe=t[90],Je=t[91],Ye=t[92],Xe=t[93],Ze=t[94],Qe=t[95],$e=t[96];if($e!==Symbol.for(`react.early_return_sentinel`))return $e;let et;t[149]!==y||t[150]!==Oe?(et=y?(0,Z.jsx)(zD,{draft:y,onChangeName:Ee,onChangeType:Ce,onChangeValue:J,onCommit:Oe,onCancel:Ae}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:pe,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)(Fi,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[149]=y,t[150]=Oe,t[151]=et):et=t[151];let tt;t[152]!==He||t[153]!==We||t[154]!==Ge||t[155]!==Ke||t[156]!==qe||t[157]!==et?(tt=(0,Z.jsxs)(He,{className:We,children:[Ge,Ke,qe,et]}),t[152]=He,t[153]=We,t[154]=Ge,t[155]=Ke,t[156]=qe,t[157]=et,t[158]=tt):tt=t[158];let nt;t[159]!==Ue||t[160]!==Je||t[161]!==Ye||t[162]!==Xe||t[163]!==tt?(nt=(0,Z.jsxs)(Ue,{open:Je,onOpenChange:Ye,children:[Xe,tt]}),t[159]=Ue,t[160]=Je,t[161]=Ye,t[162]=Xe,t[163]=tt,t[164]=nt):nt=t[164];let rt;return t[165]!==Ze||t[166]!==Qe||t[167]!==nt?(rt=(0,Z.jsx)(`div`,{className:Ze,"data-testid":Qe,children:nt}),t[165]=Ze,t[166]=Qe,t[167]=nt,t[168]=rt):rt=t[168],rt}function EA(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function DA(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function OA(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)}function kA(e){let t=(0,$.c)(2),{source:n}=e,r=`Overrides default from ${n===``?`.ok/frontmatter.yml`:`${n}/.ok/frontmatter.yml`}. Remove to revert.`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(Ne,{variant:`primary`,"data-testid":`property-override-badge`,title:r,className:`text-2xs`,children:`overrides`}),t[0]=r,t[1]=i),i}var AA=tt(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function jA(e){let t=e.threshold??AA;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function MA(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var NA=tt(`ACTIVITY_MOUNT_LIMIT`,3);function PA(){return r(()=>import(`./SourceEditor-CSsFAy0n.js`),__vite__mapDeps([43,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,44,24]),import.meta.url)}var FA=(0,Q.lazy)(async()=>({default:(await PA()).SourceEditor}));function IA(e,t,n){if(n<=0)return[];let r=e.filter(e=>!we(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 LA(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 RA(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(st,{name:`activity-pool`,children:(0,Z.jsx)(zA,{...e})}),t[0]=e,t[1]=n),n}function zA(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=We(),{pages:u,loading:d}=wr(),f=IA(c,n,NA),p=(0,Q.useRef)(``),m=f.map(BA).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)ft(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;he(e,t&&t.length>0?t:crypto.randomUUID())}Ge(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Te(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(GA,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function BA(e){return e.docName}function VA(e){let t=(0,$.c)(8),{isActive:n,children:r}=e,i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=i.current;if(!e)return;let t=()=>{e.scrollTop>0&&(a.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{if(!n)return;let e=i.current;if(!e)return;let t=a.current;if(t===0||(e.scrollTop=t,e.scrollTop===t))return;let r=!1,o=()=>{r||(r=!0,s.disconnect(),clearTimeout(c))},s=new ResizeObserver(()=>{r||!e||e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&o())});s.observe(e);let c=setTimeout(o,500);return o},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useLayoutEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={overflowAnchor:`auto`},t[5]=u):u=t[5];let d;return t[6]===r?d=t[7]:(d=(0,Z.jsx)(`div`,{ref:i,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:u,children:r}),t[6]=r,t[7]=d),d}function HA(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)(qy,{}),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)(FA,{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 UA(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)(ec,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Ze,{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:WA,children:[(0,Z.jsx)(ec,{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 WA(){return window.location.reload()}function GA(e){let t=(0,$.c)(48),{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=LA(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,x;t[5]!==i||t[6]!==g||t[7]!==v?(b=()=>{i&&!g?_(!0):!i&&!v&&y(!0)},x=[i,g,v],t[5]=i,t[6]=g,t[7]=v,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let S=jA({ytextLength:h,isSourceMode:i,visitedSource:g,visitedVisual:v}),C=(0,Q.useRef)(``),w=`${S.isLarge}-${S.renderSource}-${S.renderVisual}`,T,E;t[10]!==n.docName||t[11]!==S.isLarge||t[12]!==S.renderSource||t[13]!==S.renderVisual||t[14]!==w||t[15]!==i||t[16]!==h?(T=()=>{C.current!==w&&(C.current=w,S.isLarge&&Ge(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:h,isSourceMode:i,renderSource:S.renderSource,renderVisual:S.renderVisual}))},E=[w,S.isLarge,S.renderSource,S.renderVisual,n.docName,h,i],t[10]=n.docName,t[11]=S.isLarge,t[12]=S.renderSource,t[13]=S.renderVisual,t[14]=w,t[15]=i,t[16]=h,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,Q.useEffect)(T,E);let[D,O]=(0,Q.useState)(!1),k,A;t[19]!==n.docName||t[20]!==S.isLarge||t[21]!==S.renderSource||t[22]!==S.renderVisual||t[23]!==D||t[24]!==i||t[25]!==h?(k=()=>{MA({isLarge:S.isLarge,renderSource:S.renderSource,renderVisual:S.renderVisual,hasEmittedFirstToggle:D})&&(Ge(`ok/cold/first-toggle`,{docName:n.docName,mountId:bt(n.docName),ytextLength:h,modeEnteredFirst:i?`source`:`visual`}),O(!0))},A=[D,S.isLarge,S.renderSource,S.renderVisual,n.docName,h,i],t[19]=n.docName,t[20]=S.isLarge,t[21]=S.renderSource,t[22]=S.renderVisual,t[23]=D,t[24]=i,t[25]=h,t[26]=k,t[27]=A):(k=t[26],A=t[27]),(0,Q.useEffect)(k,A);let j=r?`visible`:`hidden`,M=`editor:${n.docName}`,N;t[28]!==a||t[29]!==n||t[30]!==S.renderSource||t[31]!==S.renderVisual||t[32]!==r||t[33]!==o||t[34]!==i||t[35]!==c||t[36]!==l||t[37]!==m||t[38]!==s||t[39]!==f?(N=f?(0,Z.jsx)(UA,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(SA,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(qy,{}),children:(0,Z.jsx)(_A,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(TA,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[S.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(HA,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,S.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(mA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:m},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[28]=a,t[29]=n,t[30]=S.renderSource,t[31]=S.renderVisual,t[32]=r,t[33]=o,t[34]=i,t[35]=c,t[36]=l,t[37]=m,t[38]=s,t[39]=f,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==N?(P=(0,Z.jsx)(VA,{isActive:r,children:N}),t[41]=r,t[42]=N,t[43]=P):P=t[43];let F;return t[44]!==M||t[45]!==P||t[46]!==j?(F=(0,Z.jsx)(Q.Activity,{mode:j,name:M,children:P}),t[44]=M,t[45]=P,t[46]=j,t[47]=F):F=t[47],F}function KA(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],_}var qA={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`},JA=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`,...qA,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},YA=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)(JA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},XA=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)(JA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function ZA(e){let t=(0,$.c)(39),{isSourceMode:n,sourceDisabled:r,onModeChange:i,showAddPropertyButton:a,onAddProperty:o,showPanelOpen:s,onTogglePanel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{}),t[0]=l):l=t[0];let u=n?`source`:`wysiwyg`,d;t[1]===i?d=t[2]:(d=e=>{e&&i(e)},t[1]=i,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(ro,{value:`wysiwyg`,"aria-label":`Visual editor`,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:(0,Z.jsx)(so,{children:(0,Z.jsx)(XA,{className:`size-4`})})}),(0,Z.jsx)(co,{side:`bottom`,children:`Visual`})]}),t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(YA,{className:`size-4`}),t[4]=p):p=t[4];let m;t[5]===r?m=t[6]:(m=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(ro,{value:`source`,"aria-label":`Markdown source`,disabled:r,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:p})})}),t[5]=r,t[6]=m);let h=r?`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`:`Markdown`,g;t[7]===h?g=t[8]:(g=(0,Z.jsx)(co,{side:`bottom`,children:h}),t[7]=h,t[8]=g);let _;t[9]!==m||t[10]!==g?(_=(0,Z.jsxs)(uo,{children:[m,g]}),t[9]=m,t[10]=g,t[11]=_):_=t[11];let v;t[12]!==u||t[13]!==d||t[14]!==_?(v=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(ao,{type:`single`,value:u,onValueChange:d,"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[f,_]})}),t[12]=u,t[13]=d,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==o||t[17]!==a?(y=a&&(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:o,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(so,{children:(0,Z.jsx)(Vs,{})})}),(0,Z.jsx)(co,{side:`bottom`,children:`Add properties`})]}),t[16]=o,t[17]=a,t[18]=y):y=t[18];let b=s?`Show document panel`:`Hide document panel`,x;t[19]===s?x=t[20]:(x=(0,Z.jsx)(so,{children:s?(0,Z.jsx)(Js,{}):(0,Z.jsx)(qs,{})}),t[19]=s,t[20]=x);let S;t[21]!==c||t[22]!==b||t[23]!==x?(S=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:c,"aria-label":b,asChild:!0,children:x}),t[21]=c,t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=s?`Show panel`:`Hide panel`,w;t[25]===C?w=t[26]:(w=(0,Z.jsx)(co,{side:`bottom`,children:C}),t[25]=C,t[26]=w);let T;t[27]!==S||t[28]!==w?(T=(0,Z.jsxs)(uo,{children:[S,w]}),t[27]=S,t[28]=w,t[29]=T):T=t[29];let E;t[30]!==y||t[31]!==T?(E=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex items-center justify-end gap-1`,children:[y,T]}),t[30]=y,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==v||t[34]!==E?(D=(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center px-2 py-2 bg-background`,children:[l,v,E]}),t[33]=v,t[34]=E,t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[36]=O):O=t[36];let k;return t[37]===D?k=t[38]:(k=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[D,O]}),t[37]=D,t[38]=k),k}function QA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var $A=(0,Q.lazy)(()=>r(()=>import(`./SettingsDialog-x6fsBA_3.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([45,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,46,16,22,10,23]),import.meta.url));function ej(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(nj,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(tj,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(st,{name:`editor-area`,children:(0,Z.jsxs)(vO,{children:[n,r]})}),t[3]=n,t[4]=i),i}function tj(){let e=(0,$.c)(8),t=Wf(),[n,r]=(0,Q.useState)(!1),i,a;if(e[0]===t.open?(i=e[1],a=e[2]):(i=()=>{t.open&&r(!0)},a=[t.open],e[0]=t.open,e[1]=i,e[2]=a),(0,Q.useEffect)(i,a),!n)return null;let o;e[3]===t?o=e[4]:(o=e=>{e||t.close()},e[3]=t,e[4]=o);let s;return e[5]!==t.open||e[6]!==o?(s=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)($A,{open:t.open,onOpenChange:o})}),e[5]=t.open,e[6]=o,e[7]=s):s=e[7],s}function nj(e){let t=(0,$.c)(93),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a}=e,{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelExpandSignal:d}=We(),{openDocumentTransition:f}=et(),{requestAddProperty:p}=bO(),m=HO(s,o),h=UO(s),g=h===`connected`||h===`synced`,_=(0,Q.useDeferredValue)(o),v=c?.kind===`missing`,y=!!o&&c?.kind!==`folder`,b=v?`Start writing to create this page`:void 0,x=Hy(),[S,C]=(0,Q.useState)(!1),{layout:w,autoCollapse:T}=EO(),E=w===`sheet`,[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(!1),A,j;t[0]!==T||t[1]!==w||t[2]!==x?(A=()=>{if(w!==`panel`)return;let e=requestAnimationFrame(()=>{T?(k.current=!1,x.current?.collapse()):k.current||x.current?.expand()});return()=>cancelAnimationFrame(e)},j=[T,w,x],t[0]=T,t[1]=w,t[2]=x,t[3]=A,t[4]=j):(A=t[3],j=t[4]),(0,Q.useEffect)(A,j);let M,N;t[5]!==E||t[6]!==a||t[7]!==x?(M=()=>{let e=e=>{a(e),E?O(!0):(k.current=!1,x.current?.expand())},t=yf();return t&&e(t),xf(t=>{yf(),e(t)})},N=[E,a,x],t[5]=E,t[6]=a,t[7]=x,t[8]=M,t[9]=N):(M=t[8],N=t[9]),(0,Q.useEffect)(M,N);let P,F;t[10]!==d||t[11]!==E||t[12]!==x?(P=()=>{d!==0&&(E?O(!0):(k.current=!1,x.current?.expand()))},F=[d,E,x],t[10]=d,t[11]=E,t[12]=x,t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I=(0,Q.useRef)(null),[L,R]=(0,Q.useState)(null),z,B;if(t[15]===o?(z=t[16],B=t[17]):(z=()=>{if(o&&o!==I.current){let e=I.current;I.current=o,R(e)}},B=[o],t[15]=o,t[16]=z,t[17]=B),(0,Q.useEffect)(z,B),c?.kind===`folder`){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(dO,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}if(c?.kind===`asset`){let e;return t[20]!==c.assetPath||t[21]!==c.mediaKind?(e=(0,Z.jsx)(Ky,{assetPath:c.assetPath,mediaKind:c.mediaKind}),t[20]=c.assetPath,t[21]=c.mediaKind,t[22]=e):e=t[22],e}if(!s||!o){if((typeof window<`u`?fr(window.location.hash):null)!==null){let e;return t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(qy,{}),t[23]=e):e=t[23],e}let e;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(px,{}),t[24]=e):e=t[24],e}let V=n===`source`,H=!g,U=E?!D:S,W;t[25]!==o||t[26]!==p?(W=function(){o&&p(o)},t[25]=o,t[26]=p,t[27]=W):W=t[27];let G=W,K;t[28]!==S||t[29]!==E||t[30]!==x?(K=function(){E?O(rj):S?(k.current=!1,x.current?.expand()):(k.current=!0,x.current?.collapse())},t[28]=S,t[29]=E,t[30]=x,t[31]=K):K=t[31];let q=K,ee=_??o,te=L??void 0,ne;t[32]===f?ne=t[33]:(ne=e=>{let t=er(e);window.location.hash===t?f(e):window.location.hash=t},t[32]=f,t[33]=ne);let re;t[34]!==b||t[35]!==V||t[36]!==l||t[37]!==ee||t[38]!==te||t[39]!==ne?(re=(0,Z.jsx)(RA,{activeDocName:ee,isSourceMode:V,editorPlaceholder:b,previousDocName:te,onNavigateBack:ne,onRecycle:l}),t[34]=b,t[35]=V,t[36]=l,t[37]=ee,t[38]=te,t[39]=ne,t[40]=re):re=t[40];let ie;t[41]!==o||t[42]!==_?(ie=QA({activeDocName:o,deferredActiveDocName:_,mountResolved:o!==null&&je(o),syncResolved:o!==null&&ye(o)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(qy,{}),o===null?null:(0,Z.jsx)(hO,{docName:o})]}):null,t[41]=o,t[42]=_,t[43]=ie):ie=t[43];let ae;t[44]!==re||t[45]!==ie?(ae=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[re,ie]}),t[44]=re,t[45]=ie,t[46]=ae):ae=t[46];let oe=!V,se;t[47]!==V||t[48]!==r||t[49]!==G||t[50]!==U||t[51]!==H||t[52]!==oe||t[53]!==q?(se=(0,Z.jsx)(ZA,{isSourceMode:V,sourceDisabled:H,onModeChange:r,showAddPropertyButton:oe,onAddProperty:G,showPanelOpen:U,onTogglePanel:q}),t[47]=V,t[48]=r,t[49]=G,t[50]=U,t[51]=H,t[52]=oe,t[53]=q,t[54]=se):se=t[54];let ce;t[55]!==ae||t[56]!==se?(ce=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ae,se]}),t[55]=ae,t[56]=se,t[57]=ce):ce=t[57];let le;t[58]!==y||t[59]!==m?(le=y&&(0,Z.jsx)(KA,{stats:m}),t[58]=y,t[59]=m,t[60]=le):le=t[60];let ue;t[61]!==ce||t[62]!==le?(ue=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ce,le]}),t[61]=ce,t[62]=le,t[63]=ue):ue=t[63];let de=ue,fe=E?`100%`:`30%`,pe=E?`100%`:`75%`,me;t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(0,Z.jsx)(SO,{minSize:fe,defaultSize:pe,children:de}),t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;t[68]===E?he=t[69]:(he=E?null:(0,Z.jsx)(CO,{withHandle:!0}),t[68]=E,t[69]=he);let ge;t[70]!==o||t[71]!==i||t[72]!==u||t[73]!==E||t[74]!==V||t[75]!==a||t[76]!==x?(ge=E?null:(0,Z.jsx)(SO,{panelRef:x,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>C(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(Y_,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u})}),t[70]=o,t[71]=i,t[72]=u,t[73]=E,t[74]=V,t[75]=a,t[76]=x,t[77]=ge):ge=t[77];let _e;t[78]!==me||t[79]!==he||t[80]!==ge?(_e=(0,Z.jsxs)(xO,{orientation:`horizontal`,children:[me,he,ge]}),t[78]=me,t[79]=he,t[80]=ge,t[81]=_e):_e=t[81];let ve;t[82]!==o||t[83]!==i||t[84]!==u||t[85]!==E||t[86]!==V||t[87]!==a||t[88]!==D?(ve=E?(0,Z.jsx)(mg,{open:D,onOpenChange:O,children:(0,Z.jsxs)(_g,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(vg,{className:`sr-only`,children:(0,Z.jsx)(yg,{children:`Document panel`})}),(0,Z.jsx)(Y_,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u})]})}):null,t[82]=o,t[83]=i,t[84]=u,t[85]=E,t[86]=V,t[87]=a,t[88]=D,t[89]=ve):ve=t[89];let be;return t[90]!==_e||t[91]!==ve?(be=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[_e,ve]}),t[90]=_e,t[91]=ve,t[92]=be):be=t[92],be}function rj(e){return!e}var ij=1280;function aj(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(oj),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${ij-1}px)`),t=()=>{n(window.innerWidth<ij)};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 oj(){return window.innerWidth<ij}function sj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function cj(e){let{value:t,unit:n}=sj(e);return n===`rem`?t*16:t}function lj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var uj=3600*24*7;function dj(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?fj:m,O=g===void 0?uj:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=cj(b),ee;t[6]===x?ee=t[7]:(ee=cj(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:cj(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=sj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(te,t)),u=lj(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(te,u)),f=lj(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function fj(){}var pj=`sidebar_state`,mj=3600*24*7,hj=`18rem`,gj=`3rem`,_j=`\\`,vj=`app-file-sidebar`,yj=`14.625rem`,bj=`22rem`,xj=`sidebar_width`,Sj=/^\d+(?:\.\d+)?(?:rem|px)$/,Cj=Q.createContext(null);function wj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${xj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return Sj.test(n)?n:e}function Tj(){let e=Q.use(Cj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Ej(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?hj:l,f=aj(),p;t[9]===d?p=t[10]:(p=()=>wj(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=`${pj}=${t}; path=/; max-age=${mj}`},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?_(Oj):D(Dj)},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===_j&&(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":gj,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(Cj.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function Dj(e){return!e}function Oj(e){return!e}function kj(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}=Tj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`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=Y(`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:vj,"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]:(_=Y(`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=Y(`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)(`div`,{"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 Aj(e){let t=(0,$.c)(16),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}=Tj(),s=o===`expanded`,c;t[4]===n?c=t[5]:(c=Y(n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{}),d=(0,Z.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l?(f=(0,Z.jsxs)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":vj,className:c,onClick:l,...i,children:[u,d]}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=f):f=t[15],f}function jj(e){let t=(0,$.c)(24),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}=Tj(),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:yj,maxResizeWidth:bj,setIsDraggingRail:p,widthCookieName:xj,widthCookieMaxAge:mj},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:_}=dj(h),v;t[14]!==_||t[15]!==r?(v=e=>{r?.(e),e.defaultPrevented||_(e)},t[14]=_,t[15]=r,t[16]=v):v=t[16];let y;t[17]===n?y=t[18]:(y=Y(`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]=y);let b;return t[19]!==g||t[20]!==i||t[21]!==v||t[22]!==y?(b=(0,Z.jsx)(`button`,{ref:g,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onMouseDown:v,title:`Toggle Sidebar`,className:y,...i}),t[19]=g,t[20]=i,t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function Mj(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}=Tj(),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=Y(`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 Nj(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=Y(`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 Pj(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=Y(`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 Fj(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=Y(`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 Ij(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`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 Lj(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=Y(`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 Rj=Lr(`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 zj(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?Rr:`button`,{isMobile:m,state:h}=Tj(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Y(Rj({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)(so,{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)(co,{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)(uo,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function Bj(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 Vj(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 Hj=1e3,Uj=!1;function Wj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Gj(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:si(i)?a=i:(a=void 0,Uj||(Uj=!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`&&(Wj({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=Vj(i),{current:c,crossDoc:l}=a?ni(a,n,Date.now()):{current:[],crossDoc:[]},u=Kj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Bj(e.current,p)&&Bj(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,Hj);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 Kj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var qj=`sync-status`;function Jj(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,Xa.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:qj,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,Xa.success(`Reconnected`,{id:qj,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 Yj=4,Xj=3,Zj={Bird:ns,Cat:cs,Dog:xs,Fish:Ts,Mouse:$s,Rabbit:Qs,Shrimp:ic,Snail:ac,Squirrel:lc,Turtle:mc};Object.freeze([...Object.keys(Zj)]);function Qj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Zj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var $j={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function eM(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=Qj(n),o=a.kind===`animal`?Zj[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Rn(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Or(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)(so,{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)(co,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(uo,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function tM(e){let t=$j[e.icon];return e.displayName||t||`Agent`}function nM(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 rM(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=tM(o),t[0]=o,t[1]=c);let l=c,u=nM(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)(ai,{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)(so,{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)(co,{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)(uo,{children:[D,A]}),t[33]=D,t[34]=A,t[35]=j):j=t[35],j}function iM(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)(ie,{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)(eM,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(rM,{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)(ae,{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)(E,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function aM(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(eM,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(rM,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function oM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=We(),{current:s,crossDoc:c}=Gj(t,r,n);Jj(UO(t),n);let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,Yj),n;e[6]===s?n=e[7]:(n=s.slice(Yj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Xj),d;e[8]===c?d=e[9]:(d=c.slice(Xj),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=>aM(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)(iM,{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=>aM(e,p,!0,m)),f.length>0?(0,Z.jsx)(iM,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function sM(e,t){return t.trim()}function cM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function lM(e,t){let n=sM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function uM(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=>Ar(e)?{...e,docName:r.get(e.docName)??e.docName}:Pr(e)||Fn(e)?{...e,path:pM(e.path,n)}:e)}function dM(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Ar(e)?!r.has(e.docName)&&!mM(e.docName,n):Pr(e)||Fn(e)?!mM(e.path,n):!0)}function fM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function pM(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 mM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function hM(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)(bl,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function gM(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=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xl,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _M(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=Y(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Sl,{children:(0,Z.jsx)(Cl,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vM(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=Y(`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)(wl,{"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 yM(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=Y(`-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)(Tl,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function bM(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=Y(`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 xM=Lr(`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 SM(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=Y(xM({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:CM,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function CM(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Lr(`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 wM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`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 TM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`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)(fo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var EM=[`.md`,`.mdx`],DM=`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`,OM=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,kM=Y(OM,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),AM=`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`,jM=`mr-2 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 MM(e){return Y(jM,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 NM(e,t){let n=e.lastIndexOf(`/`),r=n<0?e:e.slice(n+1),i=`${r}${t}`;return n<0?{baseName:r,extension:t,label:i,prefix:``}:{baseName:r,extension:t,label:i,prefix:`${e.slice(0,n)}/`}}function PM(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function FM(e){let t=er(e);window.location.hash!==t&&(window.location.hash=t)}function IM(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function LM(e,t){let n=[t,...EM].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 RM(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=Pe(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?(_=Pe(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)(gM,{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)(vM,{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)(vM,{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)(vM,{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)(yM,{}),(0,Z.jsx)(vM,{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)(_M,{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)(hM,{children:[b,A]}),t[45]=A,t[46]=b,t[47]=j):j=t[47],j}function zM(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)(Zs,{"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-2 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)(Fa,{"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-2`,onClick:c,children:l}),t[11]=s,t[12]=c,t[13]=u):u=t[13],u}function BM(){let e=(0,$.c)(68),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,isNewTabActive:d,newTabIds:f,openNewTab:p,openTabs:m,pinTab:h,pinnedTabIds:g,remapTabsForRename:_,unpinTab:v,visibleTabIds:y}=We(),{pageMeta:b}=wr(),x=(0,Q.useRef)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useRef)(!1),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(null),F=(0,Q.useRef)(t),I;e[0]!==n||e[1]!==t||e[2]!==i?(I=n??(i?ve(i):t?nt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=I):I=e[3];let L=I,R;e[4]!==r||e[5]!==L||e[6]!==d||e[7]!==f||e[8]!==m?(R=d?`${r??`__new-tab__`}\u0000${m.join(`\0`)}\u0000${f.join(`\0`)}`:L?`${L}\u0000${m.join(`\0`)}`:``,e[4]=r,e[5]=L,e[6]=d,e[7]=f,e[8]=m,e[9]=R):R=e[9];let z=R,B,V;e[10]===t?(B=e[11],V=e[12]):(B=()=>{F.current=t},V=[t],e[10]=t,e[11]=B,e[12]=V),(0,Q.useEffect)(B,V);let H,U;e[13]===z?(H=e[14],U=e[15]):(H=()=>{z&&(x.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},U=[z],e[13]=z,e[14]=H,e[15]=U),(0,Q.useEffect)(H,U);let W,G;e[16]===S?(W=e[17],G=e[18]):(W=()=>{S&&(A.current?.focus(),A.current?.select())},G=[S],e[16]=S,e[17]=W,e[18]=G),(0,Q.useEffect)(W,G);let K,q;e[19]!==m||e[20]!==S?(K=()=>{!S||m.includes(S.tabId)||(N.current=!0,P.current=null,C(null),T(``),D(null),k(!1))},q=[m,S],e[19]=m,e[20]=S,e[21]=K,e[22]=q):(K=e[21],q=e[22]),(0,Q.useEffect)(K,q);let ee,te,ne,re,ie;if(e[23]!==o||e[24]!==a||e[25]!==r||e[26]!==L||e[27]!==s||e[28]!==c||e[29]!==l||e[30]!==u||e[31]!==O||e[32]!==f||e[33]!==b||e[34]!==h||e[35]!==g||e[36]!==_||e[37]!==E||e[38]!==w||e[39]!==S?.docName||e[40]!==S?.tabId||e[41]!==v||e[42]!==y){let t=function(e,t){let n=t.split(`/`);N.current=!1,P.current=null,C({docName:t,tabId:e}),T(n[n.length-1]),D(null)},n=function(){N.current=!0,P.current=null,C(null),T(``),D(null),k(!1)},i=async function(){if(N.current){N.current=!1;return}if(j.current)return;let e=S?.docName;if(!e){n();return}let t=sM(`file`,LM(w,b.get(e)?.docExt??`.md`)),r=e.split(`/`),i=r[r.length-1];if(t===i){n();return}if(t===P.current){A.current?.focus();return}if(!cM(t)){D(`Name can’t be empty, ".", "..", or contain / or \\`),A.current?.focus();return}let a=lM({kind:`file`,path:e,name:i},t);j.current=!0,k(!0),D(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:a})});if(N.current){k(!1),j.current=!1;return}let r=await Le(n,`Server error (HTTP ${n.status})`);if(!r.ok){D(r.title),k(!1),j.current=!1,P.current=t,A.current?.focus();return}let i=M(vn,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=F.current,c=fM(o,i);await Promise.all(i.flatMap(e=>[s(e.fromDocName),s(e.toDocName)])),_(i),Kn([`files`,`backlinks`,`graph`]),N.current=!0,C(null),T(``),D(null),k(!1),j.current=!1,P.current=null,c&&c!==o&&FM(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:a,normalized:t}),D(`Network error — please try again`),k(!1),j.current=!1,P.current=t,A.current?.focus()}};ee=typeof window<`u`&&window.okDesktop!=null;let d;e[48]===f?d=e[49]:(d=new Set(f),e[48]=f,e[49]=d);let p=d,m;e[50]!==c||e[51]!==u||e[52]!==p?(m=function(e){let t=[],n=[];for(let r of e)p.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[50]=c,e[51]=u,e[52]=p,e[53]=m):m=e[53];let I=m;te=x,e[54]===Symbol.for(`react.memo_cache_sentinel`)?(ne=Y(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ee&&`[-webkit-app-region:drag]`),e[54]=ne):ne=e[54],re=IM,ie=y.map(e=>{if(p.has(e)){let t=e===r;return(0,Z.jsx)(RM,{tabId:e,canPin:!1,openTabs:y,closeTab:c,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":t?`true`:void 0,className:Y(DM,t?OM:kM,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Activate new tab`,className:AM,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:MM(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(Fa,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=Ye(e),u=e===L,d=g.includes(e);if(s.kind===`folder`){let{baseName:t,label:n,prefix:r}=NM(s.folderPath,`/`),i=`${r}${n}`;return(0,Z.jsx)(RM,{tabId:e,openTabs:y,closeTab:l,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":u?`true`:void 0,className:Y(DM,u?OM:kM,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i,className:AM,onClick:()=>{a(e)},children:[r&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:r}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,r?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(zM,{accessibleLabel:i,closeTab:l,isPinned:d,tabId:e,unpinTab:v})]})},e)}if(s.kind===`asset`){let{baseName:t,label:n,prefix:r}=NM(s.assetPath,``),i=`${r}${n}`;return(0,Z.jsx)(RM,{tabId:e,openTabs:y,closeTab:l,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":u?`true`:void 0,className:Y(DM,u?OM:kM,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i,className:AM,onClick:()=>{a(e)},children:[r?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:r}):null,(0,Z.jsx)(`span`,{className:Y(`min-w-0 truncate`,r?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(zM,{accessibleLabel:i,closeTab:l,isPinned:d,tabId:e,unpinTab:v})]})},e)}let f=s.docName,m=b.get(f)?.docExt??`.md`,{baseName:_,extension:x,label:C,prefix:k}=NM(f,m),j=`${k}${C}`,M=S?.tabId===e,N=`editor-tab-rename-error-${PM(f)}`;return(0,Z.jsx)(RM,{disabled:M,tabId:e,openTabs:y,closeTab:l,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsx)(`div`,{role:`presentation`,"data-active-tab":u?`true`:void 0,className:Y(DM,u?OM:kM,M&&E&&`border-destructive`,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:M?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(bM,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(TM,{ref:A,value:w,disabled:O,"aria-label":`Rename ${C}`,"aria-invalid":E?!0:void 0,"aria-describedby":E?N:void 0,"aria-busy":O||void 0,title:E??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{T(LM(e.target.value,m)),D(null),P.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),n())},onBlur:i}),(0,Z.jsx)(SM,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(wM,{className:`text-muted-foreground/60 text-xs`,children:m})})]}),E?(0,Z.jsx)(`span`,{id:N,role:`alert`,className:`sr-only`,children:E}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":j,className:AM,onClick:()=>{a(e)},onDoubleClick:n=>{n.preventDefault(),n.stopPropagation(),t(e,f)},children:[k&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:k}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,k?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:_}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:x})]})]}),(0,Z.jsx)(zM,{accessibleLabel:j,closeTab:l,isPinned:d,tabId:e,unpinTab:v})]})})},e)}),e[23]=o,e[24]=a,e[25]=r,e[26]=L,e[27]=s,e[28]=c,e[29]=l,e[30]=u,e[31]=O,e[32]=f,e[33]=b,e[34]=h,e[35]=g,e[36]=_,e[37]=E,e[38]=w,e[39]=S?.docName,e[40]=S?.tabId,e[41]=v,e[42]=y,e[43]=ee,e[44]=te,e[45]=ne,e[46]=re,e[47]=ie}else ee=e[43],te=e[44],ne=e[45],re=e[46],ie=e[47];let ae;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(ae=Y(`first:mb-3 mb-1.5`,ee&&`[-webkit-app-region:no-drag]`),e[55]=ae):ae=e[55];let oe;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Fi,{"aria-hidden":`true`}),e[56]=oe):oe=e[56];let se;e[57]===p?se=e[58]:(se=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`New tab`,className:ae,onClick:p,children:oe})}),e[57]=p,e[58]=se);let ce;e[59]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(co,{children:`New tab`}),e[59]=ce):ce=e[59];let le;e[60]===se?le=e[61]:(le=(0,Z.jsxs)(uo,{children:[se,ce]}),e[60]=se,e[61]=le);let ue;return e[62]!==te||e[63]!==ne||e[64]!==re||e[65]!==ie||e[66]!==le?(ue=(0,Z.jsxs)(`div`,{ref:te,className:ne,onWheel:re,children:[ie,le]}),e[62]=te,e[63]=ne,e[64]=re,e[65]=ie,e[66]=le,e[67]=ue):ue=e[67],ue}function VM(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 HM(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 UM=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:j},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Du},{label:`Website`,href:`https://openknowledge.ai/`,icon:ja},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:VM},{label:`Twitter`,href:`https://x.com/inkeep`,icon:HM}],WM=()=>{let e=(0,$.c)(5),[t,n]=(0,Q.useState)(!1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(I,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Resources`})]})})}),(0,Z.jsx)(co,{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)(ae,{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:UM.map(GM)})})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Z.jsxs)(E,{open:t,onOpenChange:n,children:[r,a]}),e[3]=t,e[4]=o),o};function GM(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=>pi(e,n),onAuxClick:e=>pi(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 KM(e){let t=(0,$.c)(70),{input:n}=e,{states:r,refresh:i}=Wp(),{dispatch:a}=Np(),{skillInstalled:o,refresh:s}=la(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=typeof window<`u`&&window.okDesktop!=null,p;t[0]===i?p=t[1]:(p=e=>{l(e),e&&i()},t[0]=i,t[1]=p);let m=p,h=n===null,g;t[2]===n?g=t[3]:(g=n!==null&&n.docContext!==null?tr(n.docContext):``,t[2]=n,t[3]=g);let _=g,y;t[4]!==a||t[5]!==n?(y=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=y):y=t[6];let b=y,x,S,C,w,T,E,D,O,k,A,j,M;if(t[7]!==m||t[8]!==b||t[9]!==n||t[10]!==c||t[11]!==_||t[12]!==o||t[13]!==r||t[14]!==h){let e;t[27]===r?e=t[28]:(e=e=>r[e.id]?.installed===!0,t[27]=r,t[28]=e);let i=zf.filter(e);C=r[`claude-cowork`]?.installed===!0;let a;t[29]!==n||t[30]!==_?(a=()=>{n!==null&&tb(_)},t[29]=n,t[30]=_,t[31]=a):a=t[31],w=a,S=ji,M=c,T=m;let s;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ii,{className:`size-4`}),t[32]=s):s=t[32];let l;t[33]===h?l=t[34]:(l=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(Si,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:h,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:s})})}),t[33]=h,t[34]=l);let u;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(co,{children:`Edit with AI`}),t[35]=u):u=t[35],t[36]===l?E=t[37]:(E=(0,Z.jsxs)(uo,{children:[l,u]}),t[36]=l,t[37]=E),x=Aa,D=`end`,O=`min-w-[220px]`,k=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(Li,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in`}),t[38]=A):A=t[38];let p;t[39]!==b||t[40]!==_||t[41]!==o||t[42]!==r?(p=e=>{let t=r[e.id];return(0,Z.jsx)(rb,{target:e,installState:t,isElectronHost:f,prompt:_,onSelect:()=>b(e),onInstallSkillRequest:e.id===`claude-cowork`&&!o?()=>d(!0):void 0},e.id)},t[39]=b,t[40]=_,t[41]=o,t[42]=r,t[43]=p):p=t[43],j=i.map(p),t[7]=m,t[8]=b,t[9]=n,t[10]=c,t[11]=_,t[12]=o,t[13]=r,t[14]=h,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M}else x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21],O=t[22],k=t[23],A=t[24],j=t[25],M=t[26];let N;t[44]!==C||t[45]!==w||t[46]!==n?(N=C?null:(0,Z.jsxs)(di,{onSelect:w,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)(v,{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[44]=C,t[45]=w,t[46]=n,t[47]=N):N=t[47];let P;t[48]!==x||t[49]!==N||t[50]!==D||t[51]!==O||t[52]!==k||t[53]!==A||t[54]!==j?(P=(0,Z.jsxs)(x,{align:D,className:O,"data-testid":k,children:[A,j,N]}),t[48]=x,t[49]=N,t[50]=D,t[51]=O,t[52]=k,t[53]=A,t[54]=j,t[55]=P):P=t[55];let F;t[56]!==S||t[57]!==T||t[58]!==E||t[59]!==P||t[60]!==M?(F=(0,Z.jsxs)(S,{open:M,onOpenChange:T,children:[E,P]}),t[56]=S,t[57]=T,t[58]=E,t[59]=P,t[60]=M,t[61]=F):F=t[61];let I;t[62]===s?I=t[63]:(I=e=>{d(e),e||s()},t[62]=s,t[63]=I);let L;t[64]!==u||t[65]!==I?(L=(0,Z.jsx)(ta,{open:u,onOpenChange:I}),t[64]=u,t[65]=I,t[66]=L):L=t[66];let R;return t[67]!==F||t[68]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[F,L]}),t[67]=F,t[68]=L,t[69]=R):R=t[69],R}var qM=()=>{let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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`,onClick:JM,children:[(0,Z.jsx)(rc,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Z.jsx)(co,{children:`Settings`})]}),e[0]=t):t=e[0],t};function JM(){window.location.hash!==`#settings`&&(window.location.hash=Bf)}function YM(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 XM(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function ZM(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)(ps,{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)(ec,{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)(ps,{className:`size-3.5 text-emerald-500`}),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)(ec,{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)(Dn,{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)(fs,{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)(Us,{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)(Dn,{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)(ps,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function QM(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 $M(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 eN(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 tN(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`}`:$M(e.state):`Sync off`}function nN(e){let t=(0,$.c)(76),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,{projectLocalConfig:o,projectLocalSynced:s}=ba(),c=o?.autoSync?.enabled??!1,{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=zi(Vi()),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(ZM,{status:n}),t[0]=n,t[1]=p);let m;t[2]===n.state?m=t[3]:(m=$M(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`,y;t[9]!==c||t[10]!==d||t[11]!==_||t[12]!==v?(y=(0,Z.jsx)(Fe,{checked:c,disabled:_,onCheckedChange:d,"aria-label":v}),t[9]=c,t[10]=d,t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]!==g||t[15]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[g,y]}),t[14]=g,t[15]=y,t[16]=b):b=t[16];let x;t[17]!==l||t[18]!==f||t[19]!==u?(x=(0,Z.jsx)(pa,{open:l,onOpenChange:u,onConfirm:f}),t[17]=l,t[18]=f,t[19]=u,t[20]=x):x=t[20];let S;t[21]===n.error?S=t[22]:(S=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[21]=n.error,t[22]=S);let C;t[23]===n.pausedReason?C=t[24]:(C=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:eN(n.pausedReason)}),t[23]=n.pausedReason,t[24]=C);let w;t[25]===n.state?w=t[26]:(w=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]=w);let T;t[27]!==c||t[28]!==n.lastSyncUtc||t[29]!==n.state?(T=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,YM(n.lastSyncUtc)]}),t[27]=c,t[28]=n.lastSyncUtc,t[29]=n.state,t[30]=T):T=t[30];let E;t[31]===n.ahead?E=t[32]:(E=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[31]=n.ahead,t[32]=E);let D;t[33]===n.behind?D=t[34]:(D=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[33]=n.behind,t[34]=D);let O;t[35]===n.conflictCount?O=t[36]:(O=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[35]=n.conflictCount,t[36]=O);let k;t[37]===c?k=t[38]:(k=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[37]=c,t[38]=k);let A;t[39]!==T||t[40]!==E||t[41]!==D||t[42]!==O||t[43]!==k?(A=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[T,E,D,O,k]}),t[39]=T,t[40]=E,t[41]=D,t[42]=O,t[43]=k,t[44]=A):A=t[44];let j;t[45]!==a||t[46]!==n.identityUnresolved?(j=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(vc,{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]=j):j=t[47];let M;t[48]!==c||t[49]!==n.state?(M=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:iN,children:`Sync now`}),t[48]=c,t[49]=n.state,t[50]=M):M=t[50];let N;t[51]!==c||t[52]!==r||t[53]!==n.state?(N=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]=N):N=t[54];let P;t[55]!==c||t[56]!==n.state?(P=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:rN,children:`Retry`}),t[55]=c,t[56]=n.state,t[57]=P):P=t[57];let F;t[58]!==c||t[59]!==i||t[60]!==n.state?(F=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]=F):F=t[61];let I;t[62]!==M||t[63]!==N||t[64]!==P||t[65]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[M,N,P,F]}),t[62]=M,t[63]=N,t[64]=P,t[65]=F,t[66]=I):I=t[66];let L;return t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==A||t[71]!==j||t[72]!==I||t[73]!==b||t[74]!==x?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[b,x,S,C,w,A,j,I]}),t[67]=S,t[68]=C,t[69]=w,t[70]=A,t[71]=j,t[72]=I,t[73]=b,t[74]=x,t[75]=L):L=t[75],L}function rN(){XM(`sync`)}function iN(){XM(`sync`)}function aN(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}=_a();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(so,{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)(fs,{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)(uo,{children:[e,(0,Z.jsx)(co,{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=QM(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=$M(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)(ZM,{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)(so,{asChild:!0,children:(0,Z.jsx)(ie,{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]:(_=tN(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(co,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(uo,{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)(ae,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(nN,{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)(E,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var oN=[{value:`light`,label:`Light`,icon:fc},{value:`dark`,label:`Dark`,icon:Ws},{value:`system`,label:`System`,icon:vs}],sN=()=>{let e=(0,$.c)(16),{theme:t}=yr(),{merged:n,userBinding:r}=ba(),i=n?.appearance?.theme??t??`system`,a;e[0]===r?a=e[1]:(a=e=>{if(e!==`light`&&e!==`dark`&&e!==`system`||!r)return;let t=r.patch({appearance:{theme:e}});t.ok||Xa.error(wn(t.error))},e[0]=r,e[1]=a);let o=a,s=i===`system`?vs:i===`dark`?Ws:fc,c;e[2]===s?c=e[3]:(c=(0,Z.jsx)(s,{}),e[2]=s,e[3]=c);let l;e[4]===i?l=e[5]:(l=(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`Toggle theme (current: `,i,`)`]}),e[4]=i,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,Z.jsx)(Si,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[c,l]})}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=oN.map(cN),e[9]=d):d=e[9];let f;e[10]!==i||e[11]!==o?(f=(0,Z.jsx)(Aa,{align:`end`,children:(0,Z.jsx)(bi,{value:i,onValueChange:o,children:d})}),e[10]=i,e[11]=o,e[12]=f):f=e[12];let p;return e[13]!==u||e[14]!==f?(p=(0,Z.jsxs)(ji,{children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15],p};function cN(e){let{value:t,label:n,icon:r}=e;return(0,Z.jsxs)(Ii,{value:t,className:`capitalize`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function lN(e){let t=(0,$.c)(38),{onSaveVersion:n,saving:r,onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}=e,{activeDocName:s}=We(),{state:c}=Tj(),l=qf(),u;t[0]!==s||t[1]!==l?(u=Sp({docName:s,workspace:l}),t[0]=s,t[1]=l,t[2]=u):u=t[2];let d=u,f=typeof window<`u`&&window.okDesktop!=null,p=f&&c===`collapsed`&&`pl-[78px]`,m;t[3]===p?m=t[4]:(m=Y(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,f&&`[-webkit-app-region:drag]`,p,f&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[3]=p,t[4]=m);let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(Aj,{className:Y(`-ml-1 shrink-0 text-muted-foreground`,f&&`[-webkit-app-region:no-drag]`)})}),t[5]=h):h=t[5];let g=c===`expanded`?`Hide Files`:`Show Files`,_;t[6]===g?_=t[7]:(_=(0,Z.jsxs)(uo,{children:[h,(0,Z.jsx)(co,{children:g})]}),t[6]=g,t[7]=_);let v,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(Bi,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),y=(0,Z.jsx)(BM,{}),t[8]=v,t[9]=y):(v=t[8],y=t[9]);let b;t[10]===_?b=t[11]:(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[_,v,y]}),t[10]=_,t[11]=b);let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[12]=x):x=t[12];let S;t[13]!==s||t[14]!==n||t[15]!==r?(S=s&&(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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)(nc,{className:`size-3.5`})})}),(0,Z.jsx)(co,{children:r?`Saving`:`Checkpoint version`})]}),t[13]=s,t[14]=n,t[15]=r,t[16]=S):S=t[16];let C;t[17]!==s||t[18]!==d?(C=s&&(0,Z.jsx)(KM,{input:d}),t[17]=s,t[18]=d,t[19]=C):C=t[19];let w;t[20]!==o||t[21]!==a||t[22]!==i?(w=(0,Z.jsx)(aN,{onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}),t[20]=o,t[21]=a,t[22]=i,t[23]=w):w=t[23];let T,E,D,O,k,A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(oM,{}),E=(0,Z.jsx)(Bi,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),D=(0,Z.jsx)(cu,{}),O=(0,Z.jsx)(qM,{}),k=(0,Z.jsx)(WM,{}),A=(0,Z.jsx)(sN,{}),t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A):(T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29]);let j;t[30]!==S||t[31]!==C||t[32]!==w?(j=(0,Z.jsxs)(`div`,{className:x,children:[S,C,w,T,E,D,O,k,A]}),t[30]=S,t[31]=C,t[32]=w,t[33]=j):j=t[33];let M;return t[34]!==j||t[35]!==m||t[36]!==b?(M=(0,Z.jsxs)(`header`,{className:m,children:[b,j]}),t[34]=j,t[35]=m,t[36]=b,t[37]=M):M=t[37],M}function uN(){let e=(0,$.c)(32),[t,n]=bm(),[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)(G_[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=da(),{projectLocalConfig:v,projectLocalSynced:y}=ba(),{activeDocName:b}=We(),x=!h&&_?.hasRemote===!0&&y===!0&&v!==null&&v.autoSync?.enabled===null,S,C;e[0]===b?(S=e[1],C=e[2]):(S=()=>{let e=function(e){let t=e.detail;t&&b&&Lo(b,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(fm,e),()=>window.removeEventListener(fm,e)},C=[b],e[0]=b,e[1]=S,e[2]=C),(0,Q.useEffect)(S,C);let w;e[3]===n?w=e[4]:(w=function(e){i(e),n(e)},e[3]=n,e[4]=w);let T=w,E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?Xa.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),Xa.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),Xa.error(`Checkpoint failed — try again`)}m(!1)},e[5]=E):E=e[5];let D=E,O;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Cm,{onOpenResolver:()=>o(!0)}),e[6]=O):O=e[6];let k,A,j;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(`auth`),c(!0)},A=()=>{u(`identity`),c(!0)},j=()=>o(!0),e[7]=k,e[8]=A,e[9]=j):(k=e[7],A=e[8],j=e[9]);let M;e[10]===p?M=e[11]:(M=(0,Z.jsx)(lN,{onSaveVersion:D,saving:p,onSignIn:k,onSetIdentity:A,onOpenConflictResolver:j}),e[10]=p,e[11]=M);let N;e[12]!==d||e[13]!==r||e[14]!==T?(N=(0,Z.jsx)(ej,{editorMode:r,onModeChange:T,activeTab:d,onActiveTabChange:f}),e[12]=d,e[13]=r,e[14]=T,e[15]=N):N=e[15];let P;e[16]===a?P=e[17]:(P=(0,Z.jsx)(Tg,{open:a,onOpenChange:o}),e[16]=a,e[17]=P);let F=l===`identity`,I;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{c(!1)},e[18]=I):I=e[18];let L;e[19]!==s||e[20]!==F?(L=(0,Z.jsx)(ou,{open:s,onOpenChange:c,identityPrompt:F,onSuccess:I}),e[19]=s,e[20]=F,e[21]=L):L=e[21];let R;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>g(!0),e[22]=R):R=e[22];let z;e[23]===x?z=e[24]:(z=(0,Z.jsx)(xm,{open:x,onResolved:R}),e[23]=x,e[24]=z);let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(lm,{}),e[25]=B):B=e[25];let V;return e[26]!==P||e[27]!==L||e[28]!==z||e[29]!==M||e[30]!==N?(V=(0,Z.jsxs)(Z.Fragment,{children:[O,M,N,P,L,z,B]}),e[26]=P,e[27]=L,e[28]=z,e[29]=M,e[30]=N,e[31]=V):V=e[31],V}var dN=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
34
+ `)}}}}function PO(e){try{let t=f().parseToMdast(e),n=[];return NO(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function FO(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))kO.test(n)&&t++;return t}function IO(e){let t=globalThis.Intl.Segmenter;if(!t)return FO(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function LO(e){let t=OO.test(e)?1.5:4;return Math.ceil(e.length/t)}function RO(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=Sn(e);if(!t.trim())return{words:0,chars:0,tokens:0};let n=PO(t);return n?{words:OO.test(n)?IO(n):FO(n),chars:n.length,tokens:LO(n)}:{words:0,chars:0,tokens:0}}var zO=300;function BO(e,t){let n=(0,$.c)(4),[r,i]=(0,Q.useState)(DO),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e||!t){i(DO);return}let n=e.document.getText(`source`),r=!1,a=null,o=function(){r||i(RO(n.toString()))};o();let s=function(){a&&clearTimeout(a),a=setTimeout(o,zO)};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 VO(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`?HO: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 HO(e){return e===`synced`?`synced`:`connected`}var UO=nr;function WO(e,t={}){let n=oe(e.componentName);return n.name===`*`?t.unregisteredSuffix?`${e.componentName} (unregistered)`:e.componentName:n.displayName??n.name}var GO=200,KO=`Outside any block`;function qO(e){let t=(0,$.c)(5),{editor:n}=e,r=ce(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?JO(n,r):o.current?KO:``,a.current=window.setTimeout(()=>{i.current&&(i.current.textContent=``,i.current.textContent=t),o.current=e,a.current=null},GO),()=>{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 JO(e,t){if(!t||t.ancestorChain.length===0)return``;let n=t.ancestorChain,r=n[n.length-1],i=WO(r,{unregisteredSuffix:!0});if(n.length===1)return`Selected: ${i}`;let a=n[n.length-2],o=WO(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 YO(){let[e]=(0,Q.useState)(jr);return e}function XO({principal:e,identity:t}){return e&&e.source===`git-config`?{type:`human`,name:Yn(e.display_name),color:Sr(e.id,In),coeditor:t.coeditor,tabId:t.tabId,principalId:e.id}:e&&e.source===`synthesized`?{type:`human`,name:t.name,color:Sr(e.id,In),coeditor:t.coeditor,tabId:t.tabId}:{type:`human`,name:t.name,color:t.color,coeditor:t.coeditor,tabId:t.tabId}}function ZO(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 QO=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&&Fr(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(Qt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(xn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_n(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(an(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(tn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(rr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(hn(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=Nr(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof nn){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 zn){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():ZO(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&ar(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()}},$O=e=>new bn({key:typeof e.pluginKey==`string`?new or(e.pluginKey):e.pluginKey,view:t=>new QO({view:t,...e})});Tr.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[$O({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 ek=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 Qn(e,{textSerializers:Xn(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Qt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(xn(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(_n(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(rn(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(an(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(tn(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(rr(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(hn(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=Nr(this.view,e.from,e.to);ar({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()}},tk=e=>new bn({key:typeof e.pluginKey==`string`?new or(e.pluginKey):e.pluginKey,view:t=>new ek({view:t,...e})});Tr.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?[tk({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 nk(e,t){return e??new or(t)}var rk=typeof window<`u`?Q.useLayoutEffect:Q.useEffect,ik=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),ak=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(`.`)),ok=new Set([`children`,`className`,`style`]),sk=new Set([`tabIndex`]),ck=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),lk={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function uk(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function dk(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function fk(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||ck.has(e)}function pk(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function mk(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:lk[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function hk(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 gk(e){return sk.has(e)}function _k(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function vk(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 yk(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||ak.has(e)?String(t):`${t}px`}function bk(e,t){ik.has(t)||e.style.removeProperty(pk(t))}function xk(e,t,n){ik.has(t)||e.style.setProperty(pk(t),yk(t,n))}function Sk(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(ok.has(r)||!fk(r)||uk(r,t[r])||uk(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=dk(r);if(a==null||a===!1){gk(r)&&vk(e,r),e.removeAttribute(o);return}if(a===!0){gk(r)&&_k(e,r,!0),e.setAttribute(o,``);return}if(gk(r)){_k(e,r,a);return}e.setAttribute(o,String(a))})}function Ck(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function wk(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){bk(e,t);return}xk(e,t,a)}})}function Tk(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(!uk(t,n))return;let{eventName:i,options:a}=mk(t),o=t=>{n(hk(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Ek(e,t){let n=(0,Q.useRef)({}),r=(0,Q.useRef)([]);rk(()=>{let i=n.current;return Ck(e,i.className,t.className),wk(e,i.style,t.style),Sk(e,i,t),r.current=Tk(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 Dk=Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:l,...u},d)=>{let f=(0,Q.useRef)(document.createElement(`div`)),p=(0,Q.useRef)(nk(e,`bubbleMenu`)).current;Ek(f.current,u),typeof d==`function`?d(f.current):d&&(d.current=f.current);let{editor:m}=c(),h=t||m,g={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:p,shouldShow:a,getReferencedVirtualElement:o,options:s},_=(0,Q.useRef)(g);_.current=g;let[v,y]=(0,Q.useState)(!1),b=(0,Q.useRef)(!0);return(0,Q.useEffect)(()=>{if(h?.isDestroyed)return;if(!h){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=f.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=$O({..._.current,editor:h,element:e});h.registerPlugin(t);let n=_.current.pluginKey;return b.current=!0,y(!0),()=>{y(!1),h.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[h]),(0,Q.useEffect)(()=>{if(!(!v||!h||h.isDestroyed)){if(b.current){b.current=!1;return}h.view.dispatch(h.state.tr.setMeta(p,{type:`updateOptions`,options:_.current}))}},[v,h,n,r,a,s,i,o,p]),(0,is.createPortal)(l,f.current)});Q.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...l},u)=>{let d=(0,Q.useRef)(document.createElement(`div`)),f=(0,Q.useRef)(nk(e,`floatingMenu`)).current;Ek(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=c(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,options:o},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(`FloatingMenu 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=tk({...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,o,i,f]),(0,is.createPortal)(s,d.current)});var Ok=[{name:`paragraph`,label:`Text`,icon:Xs,isActive:e=>e.isActive(`paragraph`)&&!e.isActive(`list`),command:e=>e.chain().focus().setParagraph().run()},{name:`heading1`,label:`Heading 1`,icon:me,isActive:e=>e.isActive(`heading`,{level:1}),command:e=>e.chain().focus().toggleHeading({level:1}).run()},{name:`heading2`,label:`Heading 2`,icon:yt,isActive:e=>e.isActive(`heading`,{level:2}),command:e=>e.chain().focus().toggleHeading({level:2}).run()},{name:`heading3`,label:`Heading 3`,icon:dt,isActive:e=>e.isActive(`heading`,{level:3}),command:e=>e.chain().focus().toggleHeading({level:3}).run()},{name:`bulletList`,label:`Bullet List`,icon:He,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:De,isActive:e=>e.isActive(`list`,{ordered:!0}),command:e=>e.chain().focus().toggleOrderedList().run()},{name:`taskList`,label:`Task List`,icon:Ae,isActive:e=>e.isActive(`listItem`,{checked:!0})||e.isActive(`listItem`,{checked:!1}),command:e=>e.chain().focus().toggleTaskList().run()},{name:`blockquote`,label:`Quote`,icon:ut,isActive:e=>e.isActive(`blockquote`),command:e=>e.chain().focus().toggleBlockquote().run()},{name:`codeBlock`,label:`Code Block`,icon:sc,isActive:e=>e.isActive(`codeBlock`),command:e=>e.chain().focus().toggleCodeBlock().run()}];function kk(e){let t=(0,$.c)(18),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Ak},t[0]=n,t[1]=r);let{current:i,activeStates:a}=Se(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)(Ie,{className:`size-3 opacity-50`}),t[6]=l):l=t[6];let u;t[7]!==s||t[8]!==c?(u=(0,Z.jsx)(Ii,{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=Ok.map(e=>{let t=e.icon,r=a[e.name];return(0,Z.jsxs)(vi,{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)(ki,{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)(Ei,{children:[u,f]}),t[15]=u,t[16]=f,t[17]=p):p=t[17],p}function Ak(e){let t=Object.fromEntries(Ok.map(t=>[t.name,t.isActive(e.editor)]));return{current:Ok.find(e=>t[e.name])??Ok[0],activeStates:t}}function jk(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 Mk(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:V(typeof n.src==`string`?n.src:``)}function Nk(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 Pk(e){let t=(0,$.c)(10),{editor:n}=e,r;if(t[0]===n?r=t[1]:(r={editor:n,selector:Fk},t[0]=n,t[1]=r),Se(r)===null)return null;let i;t[2]===n?i=t[3]:(i=e=>{e.preventDefault();let t=jk(n);t&&Nk(t,Mk(n))},t[2]=n,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Oi,{className:`size-3.5`}),t[4]=a):a=t[4];let o;t[5]===i?o=t[6]:(o=(0,Z.jsx)(so,{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)(co,{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)(uo,{children:[o,s]})}),t[8]=o,t[9]=c),c}function Fk(e){return jk(e.editor)}function Ik(e){return jk(e)!==null}var Lk=[{value:`left`,label:`Align left`,icon:Je},{value:`center`,label:`Align center`,icon:_e},{value:`right`,label:`Align right`,icon:it}];function Rk(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 zk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Bk},t[0]=n,t[1]=r);let i=Se(r);if(i===null)return null;let a;t[2]!==i||t[3]!==n?(a=Lk.map(e=>{let{value:t,label:r,icon:a}=e,o=i===t;return(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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(nn.create(u.doc,s)),Ee(n.view.nodeDOM(s),()=>{n.view.dispatch(u)})},children:(0,Z.jsx)(a,{className:`size-3.5`})})}),(0,Z.jsx)(co,{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 Bk(e){return Rk(e.editor)}function Vk(e){return Rk(e)!==null}var Hk=[{name:`bold`,icon:rs,command:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`strong`),shortcut:`⌘B`},{name:`italic`,icon:Ps,command:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`emphasis`),shortcut:`⌘I`},{name:`underline`,icon:gc,command:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`),shortcut:`⌘U`},{name:`strikethrough`,icon:dc,command:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`),shortcut:`⌘⇧X`},{name:`code`,icon:ms,command:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`),shortcut:`⌘E`},{name:`highlight`,icon:Ns,command:e=>e.chain().focus().toggleHighlight().run(),isActive:e=>e.isActive(`highlight`),shortcut:`⌘⇧H`}];function Uk(e){let t=(0,$.c)(7),{editor:n}=e,r;t[0]===n?r=t[1]:(r={editor:n,selector:Wk},t[0]=n,t[1]=r);let i=Se(r),a;t[2]!==i||t[3]!==n?(a=Hk.map(e=>{let t=e.icon,r=i[e.name];return(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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)(co,{side:`bottom`,sideOffset:8,children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:e.shortcut})]})]},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 Wk(e){return Object.fromEntries(Hk.map(t=>[t.name,t.isActive(e.editor)]))}function Gk(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)(ys,{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)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-xs`,"aria-label":`Open link in new tab`,onMouseDown:e=>{e.preventDefault(),ne(d)},children:(0,Z.jsx)(Ma,{className:`size-3.5`})})}),(0,Z.jsx)(co,{side:`bottom`,sideOffset:8,children:`Open link in new tab`})]}),(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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)(fe,{className:`size-3.5`})})}),(0,Z.jsx)(co,{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)(zs,{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)(so,{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)(co,{side:`bottom`,sideOffset:8,children:[`Link`,(0,Z.jsx)(`kbd`,{className:`ml-1.5 text-[10px] opacity-60`,children:`⌘K`})]}),t[43]=E):E=t[43];let D;return t[44]===T?D=t[45]:(D=(0,Z.jsxs)(uo,{children:[T,E]}),t[44]=T,t[45]=D),D}function Kk({editor:e}){if(e.isActive(`codeBlock`))return!1;if(Vk(e)||Ik(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 qk(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:Qk},t[0]=n,t[1]=s);let c=Se(s),l;t[2]===n?l=t[3]:(l={editor:n,selector:Zk},t[2]=n,t[3]=l);let u=Se(l),d;t[4]!==n.state||t[5]!==n.view?(d=()=>{try{let{from:e,to:t}=n.state.selection;return Nr(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=yn(e,t,()=>{ar(e,t,{placement:`top`,strategy:`fixed`,middleware:[_n(8),Qt(),xn({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(Xk)}))},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(Yk)},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)(zk,{editor:n},`${i}-img-align`):u?(0,Z.jsx)(Pk,{editor:n},`${i}-file`):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kk,{editor:n}),(0,Z.jsx)(_a,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Uk,{editor:n},i),(0,Z.jsx)(_a,{orientation:`vertical`,className:`mx-0.5 h-5 data-vertical:self-center`}),(0,Z.jsx)(Gk,{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)(Dk,{ref:r,editor:n,appendTo:Jk,shouldShow:Kk,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 Jk(){return document.body}function Yk(e){return e+1}function Xk(){}function Zk(e){return Ik(e.editor)}function Qk(e){return Vk(e.editor)}var $k=[{name:`addRowBefore`,icon:P,label:`Add row above`,command:e=>e.chain().focus().addRowBefore().run()},{name:`addRowAfter`,icon:z,label:`Add row below`,command:e=>e.chain().focus().addRowAfter().run()},{name:`deleteRow`,icon:fe,label:`Delete row`,command:e=>e.chain().focus().deleteRow().run()}],eA=[{name:`addColumnBefore`,icon:ti,label:`Add column left`,command:e=>e.chain().focus().addColumnBefore().run()},{name:`addColumnAfter`,icon:oa,label:`Add column right`,command:e=>e.chain().focus().addColumnAfter().run()},{name:`deleteColumn`,icon:fe,label:`Delete column`,command:e=>e.chain().focus().deleteColumn().run()}],tA=[{name:`toggleHeaderRow`,icon:pc,label:`Toggle header row`,command:e=>e.chain().focus().toggleHeaderRow().run()},{name:`toggleHeaderColumn`,icon:gs,label:`Toggle header column`,command:e=>e.chain().focus().toggleHeaderColumn().run()},{name:`deleteTable`,icon:js,label:`Delete table`,command:e=>e.chain().focus().deleteTable().run()}];function nA({editor:e}){return e.isActive(`table`)}function rA(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)(so,{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)(co,{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)(uo,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function iA(e){let t=(0,$.c)(13),{editor:n}=e,r;t[0]===n?r=t[1]:(r=$k.map(e=>(0,Z.jsx)(rA,{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)(_a,{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=eA.map(e=>(0,Z.jsx)(rA,{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)(_a,{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=tA.map(e=>(0,Z.jsx)(rA,{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)(Dk,{editor:n,shouldShow:nA,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 aA=new WeakMap;function oA(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=Or(e.color),n.textContent=e.name,t.append(n),t}var sA={state:`idle`,count:0,lastFiredAt:null,position:`append`,lastAgentId:null};function cA(){let e=new Mr({extensions:Nn});return{mdManager:e,text:S({mdManager:e}),html:re({mdManager:e}),paste:$e({mdManager:e}),drop:D({mdManager:e})}}function lA(e){let{provider:t,placeholder:n,prebuiltMapping:r}=e;return[...Xe.map(e=>e.name===`link`||e.name===`wikiLink`?e.configure({docName:t.configuration.name??``}):e),UO.configure({placeholder:n??`Type '/' for commands`,showOnlyCurrent:!0}),C.configure({document:t.document,...r?{ySyncOptions:{mapping:r}}:{}}),Tr.create({name:`imageUploadDecoration`,addProseMirrorPlugins(){return[s]}}),Tr.create({name:`collaborationCursor`,addProseMirrorPlugins(){let e=t.awareness;if(!e)throw Error(`[TiptapEditor] HocuspocusProvider has no awareness instance — cursor plugin cannot initialize`);return[k(e,{cursorBuilder:oA})]}})]}function uA(e){let{provider:t,clipboard:n,ctorStart:r}=e;return{onBeforeCreate:({editor:e})=>{aA.set(e,r)},onCreate:({editor:e})=>{n.html.setView(e.view);let r=aA.get(e);if(aA.delete(e),r==null)return;let i=performance.now();Ge(`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:ld(lA(e))}}function dA(e){let{provider:t,placeholder:n,clipboard:r,ctorStart:i}=e,a=ur(lA({provider:t,placeholder:n,clipboard:r,ctorStart:i})),{doc:o,mapping:s}=T(t.document.getXmlFragment(`default`),a);return{...uA({provider:t,placeholder:n,clipboard:r,ctorStart:i,prebuiltMapping:s}),content:o.toJSON(),element:null}}var fA=e=>{let t=(0,$.c)(21),{provider:n,placeholder:r,isSourceMode:i,portalTarget:a}=e,o=(0,Q.useRef)(null),s=(0,Q.useRef)(sA),c=YO(),{principal:l,activeDocName:u}=We(),d=n.configuration.name??``,[f]=(0,Q.useState)(cA),p;t[0]!==f||t[1]!==r||t[2]!==n?(p=()=>()=>({editor:new hr(dA({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),h,g;if(t[4]!==m||t[5]!==d||t[6]!==n.document){let e={viewCount:0,bytes:n.document.getText(`source`).length},r=bt(d)??crypto.randomUUID();h=Q.use,g=Oe({docName:d,mountId:r,construct:m,sizeStats:e}),t[4]=m,t[5]=d,t[6]=n.document,t[7]=h,t[8]=g}else h=t[7],g=t[8];let _=h(g),v=_.editor,y,b;t[9]===_?(y=t[10],b=t[11]):(y=()=>()=>{xe(_)},b=[_],t[9]=_,t[10]=y,t[11]=b),(0,Q.useEffect)(y,b);let x;return t[12]!==u||t[13]!==d||t[14]!==v||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==l||t[19]!==n?(x=(0,Z.jsx)(pA,{provider:n,isSourceMode:i,docName:d,activeDocName:u,identity:c,principal:l,editor:v,wrapperRef:o,flashStateRef:s,portalTarget:a}),t[12]=u,t[13]=d,t[14]=v,t[15]=c,t[16]=i,t[17]=a,t[18]=l,t[19]=n,t[20]=x):x=t[20],x},pA=e=>{let t=(0,$.c)(71),{provider:n,isSourceMode:r,docName:i,activeDocName:a,identity:o,principal:s,editor:c,wrapperRef:l,flashStateRef:u,portalTarget:d}=e,f=(0,Q.useRef)(null),p,m;t[0]===d?(p=t[1],m=t[2]):(p=()=>{let e=f.current;if(e)return e.appendChild(d),()=>{d.parentNode===e&&e.removeChild(d)}},m=[d],t[0]=d,t[1]=p,t[2]=m),(0,Q.useLayoutEffect)(p,m);let h;t[3]!==c||t[4]!==n.configuration.name?(h=()=>(ct(c,n.configuration.name??null),()=>{ct(c,null)}),t[3]=c,t[4]=n.configuration.name,t[5]=h):h=t[5];let g;t[6]!==c||t[7]!==n?(g=[c,n],t[6]=c,t[7]=n,t[8]=g):g=t[8],(0,Q.useEffect)(h,g);let _;t[9]!==c||t[10]!==n.configuration.name?(_=()=>{},t[9]=c,t[10]=n.configuration.name,t[11]=_):_=t[11];let v;t[12]!==c||t[13]!==n?(v=[c,n],t[12]=c,t[13]=n,t[14]=v):v=t[14],(0,Q.useEffect)(_,v);let y;t[15]!==c||t[16]!==n.configuration.name?(y=()=>{},t[15]=c,t[16]=n.configuration.name,t[17]=y):y=t[17];let b;t[18]!==c||t[19]!==n?(b=[c,n],t[18]=c,t[19]=n,t[20]=b):b=t[20],(0,Q.useEffect)(y,b);let x,S;t[21]===c?(x=t[22],S=t[23]):(S=()=>{let e=mA,t=null,n=()=>{if(t||c.isDestroyed)return;let n=pt(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 pt(c)?n():c.on(`create`,n),()=>{c.off(`create`,n),r()}},x=[c],t[21]=c,t[22]=x,t[23]=S),(0,Q.useEffect)(S,x);let C,T;t[24]!==u||t[25]!==n.document||t[26]!==l?(C=()=>{let e=n.document.getMap(`agent-flash`),t=Date.now(),r=0,i=null,a=null,o=null,s=()=>{let t=null;for(let[,n]of e.entries()){let e=n;e.timestamp&&(!t||e.timestamp>t.timestamp)&&(t={agentId:e.agentId??`unknown`,timestamp:e.timestamp,type:e.type??`insert`,description:e.description})}return t},c=e=>{u.current=e;let t=l.current;t&&(t.setAttribute(`data-agent-flash-state`,e.state),t.setAttribute(`data-agent-flash-count`,String(e.count)),t.setAttribute(`data-agent-flash-position`,e.position),t.setAttribute(`data-agent-flash-agent-id`,e.lastAgentId??``))},d=()=>{let e=s(),t=e?.description?.toLowerCase().includes(`prepend`)?`prepend`:`append`,n={state:`editing`,count:(u.current?.count??0)+1,lastFiredAt:Date.now(),position:t,lastAgentId:e?.agentId??null};c(n),document.dispatchEvent(new CustomEvent(`agent-flash`,{detail:n})),a&&clearTimeout(a),o&&clearTimeout(o),a=window.setTimeout(()=>{let e={...n,state:`settled`};c(e),document.dispatchEvent(new CustomEvent(`agent-flash-end`,{detail:e})),o=window.setTimeout(()=>{c({...e,state:`idle`})},300)},dr)};c(sA);let f=()=>{if(Wn(e),!Vn(e,t)||document.visibilityState!==`visible`)return;let n=Date.now();if(t=n,n-r<500){if(!i){let e=500-(n-r);i=window.setTimeout(()=>{i=null,r=Date.now(),d()},e)}return}r=n,d()};e.observe(f);let p=()=>{document.visibilityState===`visible`?Vn(e,t)&&(t=Date.now(),r=Date.now(),d()):t=Date.now()};return document.addEventListener(`visibilitychange`,p),()=>{e.unobserve(f),document.removeEventListener(`visibilitychange`,p),i&&clearTimeout(i),a&&clearTimeout(a),o&&clearTimeout(o)}},T=[n.document,u,l],t[24]=u,t[25]=n.document,t[26]=l,t[27]=C,t[28]=T):(C=t[27],T=t[28]),(0,Q.useEffect)(C,T);let E,D;t[29]===n?(E=t[30],D=t[31]):(E=()=>{let e=window.location.hash,t=e.indexOf(`?`),r=t>=0?new URLSearchParams(e.slice(t+1)).get(`anchor`):null;if(!r)return;let i=r,a=0,o,s=!1;function c(){if(s)return;let e=document.getElementById(i);e?(e.scrollIntoView({behavior:`smooth`,block:`start`}),s=!0,n.off(`synced`,c)):a<20&&(a+=1,o=window.setTimeout(c,100))}return c(),n.on(`synced`,c),()=>{o!==void 0&&clearTimeout(o),n.off(`synced`,c)}},D=[n],t[29]=n,t[30]=E,t[31]=D),(0,Q.useEffect)(E,D);let k,A;t[32]===c?(k=t[33],A=t[34]):(k=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`wysiwyg`||c.isDestroyed)return;let n=pt(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(zo,e),()=>window.removeEventListener(zo,e)},A=[c],t[32]=c,t[33]=k,t[34]=A),(0,Q.useEffect)(k,A);let j;t[35]!==a||t[36]!==i||t[37]!==o||t[38]!==r||t[39]!==s||t[40]!==n.awareness?(j=()=>{let e=n.awareness;if(e){if(i!==a){e.setLocalState(null);return}e.setLocalState({user:XO({principal:s,identity:o}),mode:r?`source`:`wysiwyg`})}},t[35]=a,t[36]=i,t[37]=o,t[38]=r,t[39]=s,t[40]=n.awareness,t[41]=j):j=t[41];let M;t[42]!==a||t[43]!==i||t[44]!==o||t[45]!==r||t[46]!==s||t[47]!==n?(M=[n,i,a,o,s,r],t[42]=a,t[43]=i,t[44]=o,t[45]=r,t[46]=s,t[47]=n,t[48]=M):M=t[48],(0,Q.useEffect)(j,M);let N,P;t[49]===c?(N=t[50],P=t[51]):(N=(0,Z.jsx)(qk,{editor:c}),P=(0,Z.jsx)(iA,{editor:c}),t[49]=c,t[50]=N,t[51]=P);let F;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(`div`,{ref:f,style:{display:`contents`}}),t[52]=F):F=t[52];let I;t[53]===c?I=t[54]:(I=(0,Z.jsx)(se,{editor:c,className:`tiptap-editor-portal-content h-full`}),t[53]=c,t[54]=I);let L;t[55]!==d||t[56]!==I?(L=(0,is.createPortal)(I,d),t[55]=d,t[56]=I,t[57]=L):L=t[57];let R;t[58]===c?R=t[59]:(R=(0,Z.jsx)(qO,{editor:c}),t[58]=c,t[59]=R);let z;t[60]===c?z=t[61]:(z=w(c),t[60]=c,t[61]=z);let B;t[62]===z.store?B=t[63]:(B=(0,Z.jsx)(O,{store:z.store}),t[62]=z.store,t[63]=B);let V;return t[64]!==N||t[65]!==P||t[66]!==L||t[67]!==R||t[68]!==B||t[69]!==l?(V=(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:[N,P,F,L,R,B]}),t[64]=N,t[65]=P,t[66]=L,t[67]=R,t[68]=B,t[69]=l,t[70]=V):V=t[70],V};function mA(){return q()}function hA(e){let t=(0,$.c)(2),{docName:n,provider:r,children:i}=e;(0,Q.use)(lt(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 gA=`__back-nav__`;function _A(e){return e instanceof ge||e instanceof qe||e instanceof de||e instanceof Me||e instanceof rt||e instanceof Qe?e.docName:null}function vA(e){return e instanceof ge?{title:`Couldn't load document`,summary:`"${e.docName}" took too long. Check your connection.`}:e instanceof qe?{title:`Connection dropped`,summary:`Lost connection to "${e.docName}".`}:e instanceof de?{title:`Document not found`,summary:`"${e.docName}" doesn't exist.`}:e instanceof Me?{title:`Couldn't open document`,summary:`Something went wrong opening "${e.docName}".`}:e instanceof rt?{title:`Server can't open documents`,summary:`This project's running server doesn't support live editing. Restart Open Knowledge to fix.`}:e instanceof Qe?{title:`Cancelled`,summary:`You cancelled loading "${e.docName}".`}:{title:`Unknown error`,summary:e instanceof Error&&e.message?e.message:`An unexpected error occurred.`}}function yA(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=vA(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)(Qb,{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||(ze(_A(n)??i),o(a),r(gA))},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 bA(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)(yA,{...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]===gA){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}: ${vA(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)(b,{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}var xA={text:``,number:0,boolean:!1,date:``,list:[]};function SA(e){let t=e.document.getText(`source`).toString(),{map:n,parseError:r}=vr(t);return{map:n,keys:pn(t),parseError:r}}function CA(e){let t=(0,$.c)(169),{provider:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]===n?a=t[1]:(a=()=>SA(n),t[0]=n,t[1]=a);let[o,s]=(0,Q.useState)(a),c,u;t[2]===n?(c=t[3],u=t[4]):(c=()=>{let e=br(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]=c,t[4]=u),(0,Q.useEffect)(c,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??``,j;t[8]===k?j=t[9]:(j=TA(k),t[8]=k,t[9]=j);let M=ra(j),P;t[10]!==M.state.data||t[11]!==M.state.status?(P=M.state.status===`ready`?M.state.data.folder.frontmatter_defaults??{}:{},t[10]=M.state.data,t[11]=M.state.status,t[12]=P):P=t[12];let F=P,I;t[13]!==M.state.data||t[14]!==M.state.status?(I=M.state.status===`ready`?M.state.data.frontmatterSources:{},t[13]=M.state.data,t[14]=M.state.status,t[15]=I):I=t[15];let L=I,z;t[16]===r?z=t[17]:(z=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=lr(t.error);return{ok:!1,error:t.error.issues[0]?.message??`Invalid patch payload`,fieldErrors:Object.keys(n).length>0?n:void 0}},t[16]=r,t[17]=z);let B=z,V;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(V=function(e){T(t=>{if(!Object.hasOwn(t,e))return t;let n={...t};return delete n[e],n})},t[18]=V):V=t[18];let H=V,U;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(U=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[19]=U):U=t[19];let W=U,G;t[20]===B?G=t[21]:(G=function(e,t){H(e),W(B({[e]:t}),[e])},t[20]=B,t[21]=G);let K=G,q;t[22]===B?q=t[23]:(q=function(e){H(e),W(B({[e]:null}),[e])},t[22]=B,t[23]=q);let ee=q,te;t[24]===r?te=t[25]:(te=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=lr(n.error);return{ok:!1,error:n.error.issues[0]?.message??`Failed to rename`,fieldErrors:Object.keys(i).length>0?i:void 0}},t[24]=r,t[25]=te);let ne=te,re;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(re=function(e,t){return`${e} ${t}`},t[26]=re):re=t[26];let ie=re,ae;t[27]!==r||t[28]!==f?(ae=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)=>ie(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[27]=r,t[28]=f,t[29]=ae):ae=t[29];let oe=ae,se;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(se={activationConstraint:{distance:4}},t[30]=se):se=t[30];let ce;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ce={coordinateGetter:fi},t[31]=ce):ce=t[31];let le=ia(ui(Di,se),ui(mi,ce)),ue;t[32]!==F||t[33]!==K||t[34]!==d?(ue=function(e,t){let n=d[e]??EA(F[e]);if(n===void 0)return;v(n=>({...n,[e]:t}));let r=AD(n,t);(!Object.hasOwn(d,e)||!wA(n,r))&&K(e,r)},t[32]=F,t[33]=K,t[34]=d,t[35]=ue):ue=t[35];let de=ue,fe;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(fe=function(){b({name:``,type:`text`,value:``,error:null}),h(!1)},t[36]=fe):fe=t[36];let pe=fe,{addPropertySignal:me,clearAddProperty:he}=vO(),ge;t[37]!==me||t[38]!==k?(ge=me.get(k)??0,t[37]=me,t[38]=k,t[39]=ge):ge=t[39];let _e=ge,ve,ye;t[40]===_e?(ve=t[41],ye=t[42]):(ve=()=>{_e>0&&(b({name:``,type:`text`,value:``,error:null}),h(!1))},ye=[_e],t[40]=_e,t[41]=ve,t[42]=ye),(0,Q.useEffect)(ve,ye);let be,xe;t[43]!==he||t[44]!==k?(be=()=>()=>he(k),xe=[k,he],t[43]=he,t[44]=k,t[45]=be,t[46]=xe):(be=t[45],xe=t[46]),(0,Q.useEffect)(be,xe);let Se;t[47]===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):xA[e];return{...t,type:e,value:n,error:null}})},t[47]=Se):Se=t[47];let Ce=Se,we;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(we=function(e){b(t=>t&&{...t,value:e})},t[48]=we):we=t[48];let J=we,Te;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Te=function(e){b(t=>t&&{...t,name:e,error:null})},t[49]=Te):Te=t[49];let Ee=Te,De;t[50]!==y||t[51]!==B||t[52]!==d?(De=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=B({[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[50]=y,t[51]=B,t[52]=d,t[53]=De):De=t[53];let Oe=De,ke;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ke=function(){b(null)},t[54]=ke):ke=t[54];let Ae=ke,je;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(e){S({key:e,draft:e,error:null})},t[55]=je):je=t[55];let Me=je,Ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=function(e){S(t=>t&&{...t,draft:e,error:null})},t[56]=Ne):Ne=t[56];let Pe=Ne,Fe;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=function(){S(null)},t[57]=Fe):Fe=t[57];let Ie=Fe,Le;t[58]!==d||t[59]!==ne||t[60]!==x?(Le=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=ne(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}),H(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[58]=d,t[59]=ne,t[60]=x,t[61]=Le):Le=t[61];let Re=Le,ze;t[62]!==d||t[63]!==f?(ze=f.length>0?f:Object.keys(d),t[62]=d,t[63]=f,t[64]=ze):ze=t[64];let Be=ze,Ve;if(t[65]!==Be){Ve=new Map;for(let e of Be)Ve.set(e,(Ve.get(e)??0)+1);t[65]=Be,t[66]=Ve}else Ve=t[66];let He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e;if(t[67]!==y||t[68]!==F||t[69]!==L||t[70]!==m||t[71]!==K||t[72]!==Re||t[73]!==Ve||t[74]!==w||t[75]!==oe||t[76]!==d||t[77]!==_||t[78]!==p||t[79]!==ee||t[80]!==x||t[81]!==Be||t[82]!==D||t[83]!==le||t[84]!==de){$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=A,Je=!m,t[97]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=e=>h(!e),t[97]=Ye):Ye=t[97];let n=!m,r;t[98]===n?r=t[99]:(r=(0,Z.jsx)(l,{"data-expanded":n,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-150 ease-out data-[expanded=true]:rotate-90`}),t[98]=n,t[99]=r);let i;t[100]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`span`,{children:`Properties`}),t[100]=i):i=t[100],t[101]===r?Xe=t[102]:(Xe=(0,Z.jsx)(R,{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[101]=r,t[102]=Xe),He=N,We=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[103]===p?Ge=t[104]:(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)(Dn,{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[103]=p,t[104]=Ge);let a;if(t[105]!==Be){let e;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(e=(e,t)=>ie(e,t),t[107]=e):e=t[107],a=Be.map(e),t[105]=Be,t[106]=a}else a=t[106];let o;if(t[108]!==F||t[109]!==L||t[110]!==K||t[111]!==Re||t[112]!==Ve||t[113]!==w||t[114]!==d||t[115]!==_||t[116]!==ee||t[117]!==x||t[118]!==Be||t[119]!==D||t[120]!==de){let e;t[122]!==F||t[123]!==L||t[124]!==K||t[125]!==Re||t[126]!==Ve||t[127]!==w||t[128]!==d||t[129]!==_||t[130]!==ee||t[131]!==x||t[132]!==D||t[133]!==de?(e=(e,t)=>{let n=d[e];if(n===void 0)return null;let r=_[e]??on(n),i=x?.key===e?x:null,a=(Ve.get(e)??0)>1,o=Object.hasOwn(F,e)?(0,Z.jsx)(DA,{source:L[e]??``}):void 0;return(0,Z.jsx)(MD,{sortableId:ie(e,t),keyName:e,value:n,declared:r,error:w[e]??null,resetCounter:D[e]??0,isDuplicate:a,badge:o,rename:{state:i,onBegin:()=>Me(e),onChangeDraft:Pe,onCommit:Re,onCancel:Ie},onCommit:t=>K(e,t),onChangeType:t=>de(e,t),onRemove:()=>ee(e)},`${e}-${t}`)},t[122]=F,t[123]=L,t[124]=K,t[125]=Re,t[126]=Ve,t[127]=w,t[128]=d,t[129]=_,t[130]=ee,t[131]=x,t[132]=D,t[133]=de,t[134]=e):e=t[134],o=Be.map(e),t[108]=F,t[109]=L,t[110]=K,t[111]=Re,t[112]=Ve,t[113]=w,t[114]=d,t[115]=_,t[116]=ee,t[117]=x,t[118]=Be,t[119]=D,t[120]=de,t[121]=o}else o=t[121];let s;t[135]!==a||t[136]!==o?(s=(0,Z.jsx)(Mi,{items:a,strategy:Pi,children:o}),t[135]=a,t[136]=o,t[137]=s):s=t[137],t[138]!==oe||t[139]!==le||t[140]!==s?(Ke=(0,Z.jsx)(gi,{sensors:le,collisionDetection:aa,onDragEnd:oe,children:s}),t[138]=oe,t[139]=le,t[140]=s,t[141]=Ke):Ke=t[141];let c;t[142]!==F||t[143]!==L||t[144]!==K||t[145]!==w||t[146]!==D||t[147]!==de?(c=e=>{let t=F[e],n=EA(t),r=on(n),i=L[e]??``;return(0,Z.jsx)(MD,{keyName:e,value:n,declared:r,error:w[e]??null,resetCounter:D[e]??0,isInherited:!0,badge:(0,Z.jsx)(zD,{source:i}),onCommit:t=>K(e,t),onChangeType:t=>de(e,t)},`inherited-${e}`)},t[142]=F,t[143]=L,t[144]=K,t[145]=w,t[146]=D,t[147]=de,t[148]=c):c=t[148],qe=e.map(c)}t[67]=y,t[68]=F,t[69]=L,t[70]=m,t[71]=K,t[72]=Re,t[73]=Ve,t[74]=w,t[75]=oe,t[76]=d,t[77]=_,t[78]=p,t[79]=ee,t[80]=x,t[81]=Be,t[82]=D,t[83]=le,t[84]=de,t[85]=He,t[86]=Ue,t[87]=We,t[88]=Ge,t[89]=Ke,t[90]=qe,t[91]=Je,t[92]=Ye,t[93]=Xe,t[94]=Ze,t[95]=Qe,t[96]=$e}else He=t[85],Ue=t[86],We=t[87],Ge=t[88],Ke=t[89],qe=t[90],Je=t[91],Ye=t[92],Xe=t[93],Ze=t[94],Qe=t[95],$e=t[96];if($e!==Symbol.for(`react.early_return_sentinel`))return $e;let et;t[149]!==y||t[150]!==Oe?(et=y?(0,Z.jsx)(LD,{draft:y,onChangeName:Ee,onChangeType:Ce,onChangeValue:J,onCommit:Oe,onCancel:Ae}):(0,Z.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,"data-testid":`add-property-trigger`,onClick:pe,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)(Fi,{className:`size-3.5`}),(0,Z.jsx)(`span`,{children:`Add property`})]}),t[149]=y,t[150]=Oe,t[151]=et):et=t[151];let tt;t[152]!==He||t[153]!==We||t[154]!==Ge||t[155]!==Ke||t[156]!==qe||t[157]!==et?(tt=(0,Z.jsxs)(He,{className:We,children:[Ge,Ke,qe,et]}),t[152]=He,t[153]=We,t[154]=Ge,t[155]=Ke,t[156]=qe,t[157]=et,t[158]=tt):tt=t[158];let nt;t[159]!==Ue||t[160]!==Je||t[161]!==Ye||t[162]!==Xe||t[163]!==tt?(nt=(0,Z.jsxs)(Ue,{open:Je,onOpenChange:Ye,children:[Xe,tt]}),t[159]=Ue,t[160]=Je,t[161]=Ye,t[162]=Xe,t[163]=tt,t[164]=nt):nt=t[164];let rt;return t[165]!==Ze||t[166]!==Qe||t[167]!==nt?(rt=(0,Z.jsx)(`div`,{className:Ze,"data-testid":Qe,children:nt}),t[165]=Ze,t[166]=Qe,t[167]=nt,t[168]=rt):rt=t[168],rt}function wA(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length?e.every((e,n)=>e===t[n]):!1:e===t}function TA(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function EA(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)}function DA(e){let t=(0,$.c)(2),{source:n}=e,r=`Overrides default from ${n===``?`.ok/frontmatter.yml`:`${n}/.ok/frontmatter.yml`}. Remove to revert.`,i;return t[0]===r?i=t[1]:(i=(0,Z.jsx)(Ne,{variant:`primary`,"data-testid":`property-override-badge`,title:r,className:`text-2xs`,children:`overrides`}),t[0]=r,t[1]=i),i}var OA=tt(`LARGE_DOC_CHAR_THRESHOLD`,5e5);function kA(e){let t=e.threshold??OA;return e.ytextLength>t?{renderSource:e.isSourceMode||e.visitedSource,renderVisual:!e.isSourceMode||e.visitedVisual,isLarge:!0}:{renderSource:!0,renderVisual:!0,isLarge:!1}}function AA(e){return e.hasEmittedFirstToggle||!e.isLarge?!1:e.renderSource&&e.renderVisual}var jA=tt(`ACTIVITY_MOUNT_LIMIT`,3);function MA(){return r(()=>import(`./SourceEditor-CSsFAy0n.js`),__vite__mapDeps([43,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,44,24]),import.meta.url)}var NA=(0,Q.lazy)(async()=>({default:(await MA()).SourceEditor}));function PA(e,t,n){if(n<=0)return[];let r=e.filter(e=>!we(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 FA(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 IA(e){let t=(0,$.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(st,{name:`activity-pool`,children:(0,Z.jsx)(LA,{...e})}),t[0]=e,t[1]=n),n}function LA(e){let t=(0,$.c)(15),{activeDocName:n,isSourceMode:r,editorPlaceholder:i,previousDocName:a,onNavigateBack:o,onRecycle:s}=e,{poolEntries:c,serverRestartRecovery:l}=We(),{pages:u,loading:d}=wr(),f=PA(c,n,jA),p=(0,Q.useRef)(``),m=f.map(RA).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)ft(e);for(let e of i){let t=h.current.find(t=>t.docName===e)?.poolEventId;he(e,t&&t.length>0?t:crypto.randomUUID())}Ge(`ok/activity/mount-list-change`,{active:n,mounted:t,evicted:r}),p.current=m,Te(t)},[m,n]);let v;t[3]!==n||t[4]!==i||t[5]!==r||t[6]!==d||t[7]!==o||t[8]!==s||t[9]!==u||t[10]!==a||t[11]!==l?(v=e=>(0,Z.jsx)(UA,{entry:e,isActive:e.docName===n,isSourceMode:r,editorPlaceholder:i,isNewDoc:!d&&!u.has(e.docName),previousDocName:a,onNavigateBack:o,onRecycle:s,serverRestartRecovery:l},e.docName),t[3]=n,t[4]=i,t[5]=r,t[6]=d,t[7]=o,t[8]=s,t[9]=u,t[10]=a,t[11]=l,t[12]=v):v=t[12];let y=f.map(v),b;return t[13]===y?b=t[14]:(b=(0,Z.jsx)(Z.Fragment,{children:y}),t[13]=y,t[14]=b),b}function RA(e){return e.docName}function zA(e){let t=(0,$.c)(8),{isActive:n,children:r}=e,i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=i.current;if(!e)return;let t=()=>{e.scrollTop>0&&(a.current=e.scrollTop)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,Q.useEffect)(o,s);let c,l;t[2]===n?(c=t[3],l=t[4]):(c=()=>{if(!n)return;let e=i.current;if(!e)return;let t=a.current;if(t===0||(e.scrollTop=t,e.scrollTop===t))return;let r=!1,o=()=>{r||(r=!0,s.disconnect(),clearTimeout(c))},s=new ResizeObserver(()=>{r||!e||e.scrollHeight>t&&(e.scrollTop=t,e.scrollTop===t&&o())});s.observe(e);let c=setTimeout(o,500);return o},l=[n],t[2]=n,t[3]=c,t[4]=l),(0,Q.useLayoutEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u={overflowAnchor:`auto`},t[5]=u):u=t[5];let d;return t[6]===r?d=t[7]:(d=(0,Z.jsx)(`div`,{ref:i,"data-testid":`editor-scroll-container`,className:`subtle-scrollbar h-full overflow-y-auto pt-14 scroll-pt-14`,style:u,children:r}),t[6]=r,t[7]=d),d}function BA(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)(mb,{}),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)(NA,{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 VA(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)(ec,{className:`size-5`,"aria-hidden":`true`}):(0,Z.jsx)(Ze,{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:HA,children:[(0,Z.jsx)(ec,{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 HA(){return window.location.reload()}function UA(e){let t=(0,$.c)(48),{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=FA(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,x;t[5]!==i||t[6]!==g||t[7]!==v?(b=()=>{i&&!g?_(!0):!i&&!v&&y(!0)},x=[i,g,v],t[5]=i,t[6]=g,t[7]=v,t[8]=b,t[9]=x):(b=t[8],x=t[9]),(0,Q.useEffect)(b,x);let S=kA({ytextLength:h,isSourceMode:i,visitedSource:g,visitedVisual:v}),C=(0,Q.useRef)(``),w=`${S.isLarge}-${S.renderSource}-${S.renderVisual}`,T,E;t[10]!==n.docName||t[11]!==S.isLarge||t[12]!==S.renderSource||t[13]!==S.renderVisual||t[14]!==w||t[15]!==i||t[16]!==h?(T=()=>{C.current!==w&&(C.current=w,S.isLarge&&Ge(`ok/activity/defer-mount`,{docName:n.docName,ytextLength:h,isSourceMode:i,renderSource:S.renderSource,renderVisual:S.renderVisual}))},E=[w,S.isLarge,S.renderSource,S.renderVisual,n.docName,h,i],t[10]=n.docName,t[11]=S.isLarge,t[12]=S.renderSource,t[13]=S.renderVisual,t[14]=w,t[15]=i,t[16]=h,t[17]=T,t[18]=E):(T=t[17],E=t[18]),(0,Q.useEffect)(T,E);let[D,O]=(0,Q.useState)(!1),k,A;t[19]!==n.docName||t[20]!==S.isLarge||t[21]!==S.renderSource||t[22]!==S.renderVisual||t[23]!==D||t[24]!==i||t[25]!==h?(k=()=>{AA({isLarge:S.isLarge,renderSource:S.renderSource,renderVisual:S.renderVisual,hasEmittedFirstToggle:D})&&(Ge(`ok/cold/first-toggle`,{docName:n.docName,mountId:bt(n.docName),ytextLength:h,modeEnteredFirst:i?`source`:`visual`}),O(!0))},A=[D,S.isLarge,S.renderSource,S.renderVisual,n.docName,h,i],t[19]=n.docName,t[20]=S.isLarge,t[21]=S.renderSource,t[22]=S.renderVisual,t[23]=D,t[24]=i,t[25]=h,t[26]=k,t[27]=A):(k=t[26],A=t[27]),(0,Q.useEffect)(k,A);let j=r?`visible`:`hidden`,M=`editor:${n.docName}`,N;t[28]!==a||t[29]!==n||t[30]!==S.renderSource||t[31]!==S.renderVisual||t[32]!==r||t[33]!==o||t[34]!==i||t[35]!==c||t[36]!==l||t[37]!==m||t[38]!==s||t[39]!==f?(N=f?(0,Z.jsx)(VA,{view:f}):(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(bA,{activeDocName:n.docName,previousDocName:s,onNavigateBack:c,onRecycle:l,children:(0,Z.jsx)(Q.Suspense,{fallback:(0,Z.jsx)(mb,{}),children:(0,Z.jsx)(hA,{docName:n.docName,provider:n.provider,children:(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[!i&&(0,Z.jsx)(CA,{provider:n.provider}),(0,Z.jsxs)(`div`,{className:`relative flex-1`,children:[S.renderSource?(0,Z.jsx)(`div`,{className:i?`h-full`:`ok-mode-hidden h-full`,children:(0,Z.jsx)(BA,{entry:n,isActive:r,isSourceMode:i,editorPlaceholder:a})}):null,S.renderVisual?(0,Z.jsx)(`div`,{className:i?`ok-mode-hidden h-full`:`h-full`,children:(0,Z.jsx)(fA,{provider:n.provider,placeholder:a,isSourceMode:i,portalTarget:m},`${n.docName}-${String(o)}`)}):null]})]})})})})}),t[28]=a,t[29]=n,t[30]=S.renderSource,t[31]=S.renderVisual,t[32]=r,t[33]=o,t[34]=i,t[35]=c,t[36]=l,t[37]=m,t[38]=s,t[39]=f,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==N?(P=(0,Z.jsx)(zA,{isActive:r,children:N}),t[41]=r,t[42]=N,t[43]=P):P=t[43];let F;return t[44]!==M||t[45]!==P||t[46]!==j?(F=(0,Z.jsx)(Q.Activity,{mode:j,name:M,children:P}),t[44]=M,t[45]=P,t[46]=j,t[47]=F):F=t[47],F}function WA(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],_}var GA={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`},KA=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`,...GA,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},qA=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)(KA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i},JA=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)(KA,{...e,viewBox:`0 0 256 256`,fill:`currentColor`,children:[n,r]}),t[2]=e,t[3]=i),i};function YA(e){let t=(0,$.c)(39),{isSourceMode:n,sourceDisabled:r,onModeChange:i,showAddPropertyButton:a,onAddProperty:o,showPanelOpen:s,onTogglePanel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(`div`,{}),t[0]=l):l=t[0];let u=n?`source`:`wysiwyg`,d;t[1]===i?d=t[2]:(d=e=>{e&&i(e)},t[1]=i,t[2]=d);let f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(ro,{value:`wysiwyg`,"aria-label":`Visual editor`,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,asChild:!0,children:(0,Z.jsx)(so,{children:(0,Z.jsx)(JA,{className:`size-4`})})}),(0,Z.jsx)(co,{side:`bottom`,children:`Visual`})]}),t[3]=f):f=t[3];let p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(qA,{className:`size-4`}),t[4]=p):p=t[4];let m;t[5]===r?m=t[6]:(m=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(`div`,{children:(0,Z.jsx)(ro,{value:`source`,"aria-label":`Markdown source`,disabled:r,className:`size-7 px-0 dark:data-[state=on]:bg-foreground/15`,children:p})})}),t[5]=r,t[6]=m);let h=r?`Source mode requires a live connection — your edits are saved and will appear when you reconnect.`:`Markdown`,g;t[7]===h?g=t[8]:(g=(0,Z.jsx)(co,{side:`bottom`,children:h}),t[7]=h,t[8]=g);let _;t[9]!==m||t[10]!==g?(_=(0,Z.jsxs)(uo,{children:[m,g]}),t[9]=m,t[10]=g,t[11]=_):_=t[11];let v;t[12]!==u||t[13]!==d||t[14]!==_?(v=(0,Z.jsx)(`div`,{className:`pointer-events-auto flex justify-center`,children:(0,Z.jsxs)(ao,{type:`single`,value:u,onValueChange:d,"aria-label":`Editor mode`,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 data-[size=sm]:rounded-[10px] bg-muted p-0.5`,children:[f,_]})}),t[12]=u,t[13]=d,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==o||t[17]!==a?(y=a&&(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,"aria-label":`Add properties`,onClick:o,"data-testid":`add-properties-button`,asChild:!0,children:(0,Z.jsx)(so,{children:(0,Z.jsx)(Vs,{})})}),(0,Z.jsx)(co,{side:`bottom`,children:`Add properties`})]}),t[16]=o,t[17]=a,t[18]=y):y=t[18];let b=s?`Show document panel`:`Hide document panel`,x;t[19]===s?x=t[20]:(x=(0,Z.jsx)(so,{children:s?(0,Z.jsx)(Js,{}):(0,Z.jsx)(qs,{})}),t[19]=s,t[20]=x);let S;t[21]!==c||t[22]!==b||t[23]!==x?(S=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,onClick:c,"aria-label":b,asChild:!0,children:x}),t[21]=c,t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=s?`Show panel`:`Hide panel`,w;t[25]===C?w=t[26]:(w=(0,Z.jsx)(co,{side:`bottom`,children:C}),t[25]=C,t[26]=w);let T;t[27]!==S||t[28]!==w?(T=(0,Z.jsxs)(uo,{children:[S,w]}),t[27]=S,t[28]=w,t[29]=T):T=t[29];let E;t[30]!==y||t[31]!==T?(E=(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex items-center justify-end gap-1`,children:[y,T]}),t[30]=y,t[31]=T,t[32]=E):E=t[32];let D;t[33]!==v||t[34]!==E?(D=(0,Z.jsxs)(`div`,{className:`grid grid-cols-3 items-center px-2 py-2 bg-background`,children:[l,v,E]}),t[33]=v,t[34]=E,t[35]=D):D=t[35];let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none h-2 bg-linear-to-b from-background to-transparent`}),t[36]=O):O=t[36];let k;return t[37]===D?k=t[38]:(k=(0,Z.jsxs)(`div`,{"data-testid":`editor-toolbar`,className:`pointer-events-none absolute inset-x-0 top-0 z-10`,children:[D,O]}),t[37]=D,t[38]=k),k}function XA(e){let{activeDocName:t,deferredActiveDocName:n,mountResolved:r,syncResolved:i}=e;return t===null||t===n?!1:!(r&&i)}var ZA=(0,Q.lazy)(()=>r(()=>import(`./SettingsDialog-CV-8Vjqz.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([45,1,35,2,36,37,21,38,39,40,41,20,3,6,7,15,4,8,14,9,46,16,22,10,23]),import.meta.url));function QA(e){let t=(0,$.c)(5),n;t[0]===e?n=t[1]:(n=(0,Z.jsx)(ej,{...e}),t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)($A,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(st,{name:`editor-area`,children:(0,Z.jsxs)(gO,{children:[n,r]})}),t[3]=n,t[4]=i),i}function $A(){let e=(0,$.c)(8),t=dp(),[n,r]=(0,Q.useState)(!1),i,a;if(e[0]===t.open?(i=e[1],a=e[2]):(i=()=>{t.open&&r(!0)},a=[t.open],e[0]=t.open,e[1]=i,e[2]=a),(0,Q.useEffect)(i,a),!n)return null;let o;e[3]===t?o=e[4]:(o=e=>{e||t.close()},e[3]=t,e[4]=o);let s;return e[5]!==t.open||e[6]!==o?(s=(0,Z.jsx)(Q.Suspense,{fallback:null,children:(0,Z.jsx)(ZA,{open:t.open,onOpenChange:o})}),e[5]=t.open,e[6]=o,e[7]=s):s=e[7],s}function ej(e){let t=(0,$.c)(93),{editorMode:n,onModeChange:r,activeTab:i,onActiveTabChange:a}=e,{activeDocName:o,activeProvider:s,activeTarget:c,recycleDocument:l,docPanelMode:u,docPanelExpandSignal:d}=We(),{openDocumentTransition:f}=et(),{requestAddProperty:p}=vO(),m=BO(s,o),h=VO(s),g=h===`connected`||h===`synced`,_=(0,Q.useDeferredValue)(o),v=c?.kind===`missing`,y=!!o&&c?.kind!==`folder`,b=v?`Start writing to create this page`:void 0,x=lb(),[S,C]=(0,Q.useState)(!1),{layout:w,autoCollapse:T}=wO(),E=w===`sheet`,[D,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(!1),A,j;t[0]!==T||t[1]!==w||t[2]!==x?(A=()=>{if(w!==`panel`)return;let e=requestAnimationFrame(()=>{T?(k.current=!1,x.current?.collapse()):k.current||x.current?.expand()});return()=>cancelAnimationFrame(e)},j=[T,w,x],t[0]=T,t[1]=w,t[2]=x,t[3]=A,t[4]=j):(A=t[3],j=t[4]),(0,Q.useEffect)(A,j);let M,N;t[5]!==E||t[6]!==a||t[7]!==x?(M=()=>{let e=e=>{a(e),E?O(!0):(k.current=!1,x.current?.expand())},t=yf();return t&&e(t),xf(t=>{yf(),e(t)})},N=[E,a,x],t[5]=E,t[6]=a,t[7]=x,t[8]=M,t[9]=N):(M=t[8],N=t[9]),(0,Q.useEffect)(M,N);let P,F;t[10]!==d||t[11]!==E||t[12]!==x?(P=()=>{d!==0&&(E?O(!0):(k.current=!1,x.current?.expand()))},F=[d,E,x],t[10]=d,t[11]=E,t[12]=x,t[13]=P,t[14]=F):(P=t[13],F=t[14]),(0,Q.useEffect)(P,F);let I=(0,Q.useRef)(null),[L,R]=(0,Q.useState)(null),z,B;if(t[15]===o?(z=t[16],B=t[17]):(z=()=>{if(o&&o!==I.current){let e=I.current;I.current=o,R(e)}},B=[o],t[15]=o,t[16]=z,t[17]=B),(0,Q.useEffect)(z,B),c?.kind===`folder`){let e;return t[18]===c.folderPath?e=t[19]:(e=(0,Z.jsx)(lO,{folderPath:c.folderPath}),t[18]=c.folderPath,t[19]=e),e}if(c?.kind===`asset`){let e;return t[20]!==c.assetPath||t[21]!==c.mediaKind?(e=(0,Z.jsx)(pb,{assetPath:c.assetPath,mediaKind:c.mediaKind}),t[20]=c.assetPath,t[21]=c.mediaKind,t[22]=e):e=t[22],e}if(!s||!o){if((typeof window<`u`?fr(window.location.hash):null)!==null){let e;return t[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(mb,{}),t[23]=e):e=t[23],e}let e;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(dx,{}),t[24]=e):e=t[24],e}let V=n===`source`,H=!g,U=E?!D:S,W;t[25]!==o||t[26]!==p?(W=function(){o&&p(o)},t[25]=o,t[26]=p,t[27]=W):W=t[27];let G=W,K;t[28]!==S||t[29]!==E||t[30]!==x?(K=function(){E?O(tj):S?(k.current=!1,x.current?.expand()):(k.current=!0,x.current?.collapse())},t[28]=S,t[29]=E,t[30]=x,t[31]=K):K=t[31];let q=K,ee=_??o,te=L??void 0,ne;t[32]===f?ne=t[33]:(ne=e=>{let t=er(e);window.location.hash===t?f(e):window.location.hash=t},t[32]=f,t[33]=ne);let re;t[34]!==b||t[35]!==V||t[36]!==l||t[37]!==ee||t[38]!==te||t[39]!==ne?(re=(0,Z.jsx)(IA,{activeDocName:ee,isSourceMode:V,editorPlaceholder:b,previousDocName:te,onNavigateBack:ne,onRecycle:l}),t[34]=b,t[35]=V,t[36]=l,t[37]=ee,t[38]=te,t[39]=ne,t[40]=re):re=t[40];let ie;t[41]!==o||t[42]!==_?(ie=XA({activeDocName:o,deferredActiveDocName:_,mountResolved:o!==null&&je(o),syncResolved:o!==null&&ye(o)})?(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-10 bg-background`,children:[(0,Z.jsx)(mb,{}),o===null?null:(0,Z.jsx)(pO,{docName:o})]}):null,t[41]=o,t[42]=_,t[43]=ie):ie=t[43];let ae;t[44]!==re||t[45]!==ie?(ae=(0,Z.jsxs)(`div`,{className:`relative h-full`,children:[re,ie]}),t[44]=re,t[45]=ie,t[46]=ae):ae=t[46];let oe=!V,se;t[47]!==V||t[48]!==r||t[49]!==G||t[50]!==U||t[51]!==H||t[52]!==oe||t[53]!==q?(se=(0,Z.jsx)(YA,{isSourceMode:V,sourceDisabled:H,onModeChange:r,showAddPropertyButton:oe,onAddProperty:G,showPanelOpen:U,onTogglePanel:q}),t[47]=V,t[48]=r,t[49]=G,t[50]=U,t[51]=H,t[52]=oe,t[53]=q,t[54]=se):se=t[54];let ce;t[55]!==ae||t[56]!==se?(ce=(0,Z.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[ae,se]}),t[55]=ae,t[56]=se,t[57]=ce):ce=t[57];let le;t[58]!==y||t[59]!==m?(le=y&&(0,Z.jsx)(WA,{stats:m}),t[58]=y,t[59]=m,t[60]=le):le=t[60];let ue;t[61]!==ce||t[62]!==le?(ue=(0,Z.jsxs)(`div`,{className:`relative flex h-full flex-col`,children:[ce,le]}),t[61]=ce,t[62]=le,t[63]=ue):ue=t[63];let de=ue,fe=E?`100%`:`30%`,pe=E?`100%`:`75%`,me;t[64]!==de||t[65]!==fe||t[66]!==pe?(me=(0,Z.jsx)(bO,{minSize:fe,defaultSize:pe,children:de}),t[64]=de,t[65]=fe,t[66]=pe,t[67]=me):me=t[67];let he;t[68]===E?he=t[69]:(he=E?null:(0,Z.jsx)(xO,{withHandle:!0}),t[68]=E,t[69]=he);let ge;t[70]!==o||t[71]!==i||t[72]!==u||t[73]!==E||t[74]!==V||t[75]!==a||t[76]!==x?(ge=E?null:(0,Z.jsx)(bO,{panelRef:x,defaultSize:`25%`,minSize:`300px`,maxSize:`40%`,collapsible:!0,collapsedSize:0,onResize:e=>C(e.asPercentage===0),className:`flex flex-col bg-muted/20`,children:(0,Z.jsx)(gv,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u})}),t[70]=o,t[71]=i,t[72]=u,t[73]=E,t[74]=V,t[75]=a,t[76]=x,t[77]=ge):ge=t[77];let _e;t[78]!==me||t[79]!==he||t[80]!==ge?(_e=(0,Z.jsxs)(yO,{orientation:`horizontal`,children:[me,he,ge]}),t[78]=me,t[79]=he,t[80]=ge,t[81]=_e):_e=t[81];let ve;t[82]!==o||t[83]!==i||t[84]!==u||t[85]!==E||t[86]!==V||t[87]!==a||t[88]!==D?(ve=E?(0,Z.jsx)(Fg,{open:D,onOpenChange:O,children:(0,Z.jsxs)(Rg,{side:`right`,className:`flex w-80 sm:w-96 flex-col gap-0 p-0`,children:[(0,Z.jsx)(zg,{className:`sr-only`,children:(0,Z.jsx)(Bg,{children:`Document panel`})}),(0,Z.jsx)(gv,{docName:o,isSourceMode:V,activeTab:i,onActiveTabChange:a,mode:u})]})}):null,t[82]=o,t[83]=i,t[84]=u,t[85]=E,t[86]=V,t[87]=a,t[88]=D,t[89]=ve):ve=t[89];let be;return t[90]!==_e||t[91]!==ve?(be=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[_e,ve]}),t[90]=_e,t[91]=ve,t[92]=be):be=t[92],be}function tj(e){return!e}var nj=1280;function rj(){let e=(0,$.c)(2),[t,n]=(0,Q.useState)(ij),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${nj-1}px)`),t=()=>{n(window.innerWidth<nj)};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 ij(){return window.innerWidth<nj}function aj(e){let t=e.endsWith(`rem`)?`rem`:`px`;return{value:Number.parseFloat(e),unit:t}}function oj(e){let{value:t,unit:n}=aj(e);return n===`rem`?t*16:t}function sj(e,t){return`${t===`rem`?e.toFixed(1):Math.round(e)}${t}`}var cj=3600*24*7;function lj(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?uj:m,O=g===void 0?cj:g,k=_===void 0?!1:_,A=(0,Q.useRef)(null),j=(0,Q.useRef)(0),M=(0,Q.useRef)(0),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(null),I=(0,Q.useRef)(0),L=(0,Q.useRef)(!1),R=(0,Q.useRef)(0),z=(0,Q.useRef)(0),B=(0,Q.useRef)(null),V=(0,Q.useRef)(r),H=(0,Q.useRef)(y),U,W;t[0]===r?(U=t[1],W=t[2]):(U=()=>{V.current=r},W=[r],t[0]=r,t[1]=U,t[2]=W),(0,Q.useEffect)(U,W);let G,K;t[3]===y?(G=t[4],K=t[5]):(G=()=>{H.current=y},K=[y],t[3]=y,t[4]=G,t[5]=K),(0,Q.useEffect)(G,K);let q=oj(b),ee;t[6]===x?ee=t[7]:(ee=oj(x),t[6]=x,t[7]=ee);let te=ee,ne;t[8]!==E||t[9]!==k?(ne=function(e){P.current=!0,E&&(j.current=H.current?0:oj(V.current),M.current=e.clientX,I.current=e.clientX,F.current=null,L.current=!1,R.current=0,z.current=0,B.current=k&&A.current?A.current.getBoundingClientRect():null,e.preventDefault())},t[8]=E,t[9]=k,t[10]=ne):ne=t[10];let re=ne,ie,ae;t[11]!==w||t[12]!==v||t[13]!==C||t[14]!==S||t[15]!==T||t[16]!==k||t[17]!==te||t[18]!==q||t[19]!==i||t[20]!==a||t[21]!==D||t[22]!==O||t[23]!==h?(ie=()=>{let e=function(e){h&&(document.cookie=`${h}=${e}; path=/; max-age=${O}`)},t=function(e,t){return v===`left`?e<t:e>t},n=function(e,t,n,r){if(k&&r){let r=e.clientX-t;return v===`left`?n-r:n+r}return v===`left`?window.innerWidth-e.clientX:e.clientX},r=function(r){if(!P.current)return;let o=Math.abs(r.clientX-M.current);if(!N.current&&o>5&&(N.current=!0,D(!0)),N.current){let{unit:o}=aj(V.current),s=B.current;k&&A.current&&(s=A.current.getBoundingClientRect());let c=t(r.clientX,I.current)?`expand`:`collapse`;F.current!==c&&(F.current=c),z.current=Math.abs(r.clientX-I.current);let l=Date.now();if(L.current&&l-R.current>200&&(L.current=!1),!L.current){if(C&&a&&!H.current){let e=n(r,M.current,j.current,s),t=!1;if(w<=1)t=e<=q*w;else if(e<=q){let n=q*(w-1);t=q-e>=n}if(c===`collapse`&&t){a(),I.current=r.clientX,L.current=!0,R.current=l;return}}if(a&&H.current&&c===`expand`&&z.current>q*T){a();let t=n(r,M.current,j.current,s),c=Math.max(q,Math.min(te,t)),u=sj(o===`rem`?c/16:c,o);i(u),e(u),I.current=r.clientX,L.current=!0,R.current=l;return}}if(H.current)return;let u=n(r,M.current,j.current,s),d=Math.max(q,Math.min(te,u)),f=sj(o===`rem`?d/16:d,o);i(f),e(f)}},o=function(){P.current&&(!N.current&&a&&S&&a(),N.current=!1,P.current=!1,F.current=null,I.current=0,L.current=!1,R.current=0,z.current=0,B.current=null,D(!1))};return document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,o),()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,o)}},ae=[i,a,D,q,te,k,C,w,T,S,h,O,v],t[11]=w,t[12]=v,t[13]=C,t[14]=S,t[15]=T,t[16]=k,t[17]=te,t[18]=q,t[19]=i,t[20]=a,t[21]=D,t[22]=O,t[23]=h,t[24]=ie,t[25]=ae):(ie=t[24],ae=t[25]),(0,Q.useEffect)(ie,ae);let oe;return t[26]===re?oe=t[27]:(oe={dragRef:A,isDragging:N,handleMouseDown:re},t[26]=re,t[27]=oe),oe}function uj(){}var dj=`sidebar_state`,fj=3600*24*7,pj=`18rem`,mj=`3rem`,hj=`\\`,gj=`app-file-sidebar`,_j=`14.625rem`,vj=`22rem`,yj=`sidebar_width`,bj=/^\d+(?:\.\d+)?(?:rem|px)$/,xj=Q.createContext(null);function Sj(e){if(typeof document>`u`)return e;let t=document.cookie.split(`; `).find(e=>e.startsWith(`${yj}=`))?.split(`=`)[1];if(!t)return e;let n;try{n=decodeURIComponent(t)}catch{return e}return bj.test(n)?n:e}function Cj(){let e=Q.use(xj);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function wj(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?pj:l,f=rj(),p;t[9]===d?p=t[10]:(p=()=>Sj(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=`${dj}=${t}; path=/; max-age=${fj}`},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?_(Ej):D(Tj)},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===hj&&(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":mj,...s},t[40]=s,t[41]=m,t[42]=H):H=t[42];let U=H,W;t[43]===r?W=t[44]:(W=Y(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),t[43]=r,t[44]=W);let G;t[45]!==n||t[46]!==a||t[47]!==U||t[48]!==W?(G=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:U,className:W,...a,children:n}),t[45]=n,t[46]=a,t[47]=U,t[48]=W,t[49]=G):G=t[49];let K;return t[50]!==V||t[51]!==G?(K=(0,Z.jsx)(xj.Provider,{value:V,children:G}),t[50]=V,t[51]=G,t[52]=K):K=t[52],K}function Tj(e){return!e}function Ej(e){return!e}function Dj(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}=Cj();if(u===`none`){let e;t[7]===r?e=t[8]:(e=Y(`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=Y(`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:gj,"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]:(_=Y(`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=Y(`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)(`div`,{"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 Oj(e){let t=(0,$.c)(16),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}=Cj(),s=o===`expanded`,c;t[4]===n?c=t[5]:(c=Y(n),t[4]=n,t[5]=c);let l;t[6]!==r||t[7]!==a?(l=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=l):l=t[8];let u,d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(J,{}),d=(0,Z.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=u,t[10]=d):(u=t[9],d=t[10]);let f;return t[11]!==i||t[12]!==s||t[13]!==c||t[14]!==l?(f=(0,Z.jsxs)(X,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,"aria-expanded":s,"aria-controls":gj,className:c,onClick:l,...i,children:[u,d]}),t[11]=i,t[12]=s,t[13]=c,t[14]=l,t[15]=f):f=t[15],f}function kj(e){let t=(0,$.c)(24),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}=Cj(),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:_j,maxResizeWidth:vj,setIsDraggingRail:p,widthCookieName:yj,widthCookieMaxAge:fj},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:_}=lj(h),v;t[14]!==_||t[15]!==r?(v=e=>{r?.(e),e.defaultPrevented||_(e)},t[14]=_,t[15]=r,t[16]=v):v=t[16];let y;t[17]===n?y=t[18]:(y=Y(`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]=y);let b;return t[19]!==g||t[20]!==i||t[21]!==v||t[22]!==y?(b=(0,Z.jsx)(`button`,{ref:g,"data-sidebar":`rail`,"data-slot":`sidebar-rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onMouseDown:v,title:`Toggle Sidebar`,className:y,...i}),t[19]=g,t[20]=i,t[21]=v,t[22]=y,t[23]=b):b=t[23],b}function Aj(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}=Cj(),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=Y(`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 jj(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=Y(`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 Mj(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=Y(`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 Nj(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=Y(`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 Pj(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=Y(`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 Fj(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=Y(`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 Ij=Lr(`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 Lj(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?Rr:`button`,{isMobile:m,state:h}=Cj(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=Y(Ij({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)(so,{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)(co,{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)(uo,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function Rj(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.kind!==i.kind)return!1;if(r.kind===`human`&&i.kind===`human`){if(r.clientId!==i.clientId||r.mode!==i.mode||r.tabCount!==i.tabCount)return!1;let e=r.user,t=i.user;if(e.name!==t.name||e.color!==t.color||e.icon!==t.icon)return!1}else if(r.kind===`agent`&&i.kind===`agent`){if(r.agentId!==i.agentId)return!1;let e=r.presence,t=i.presence;if(e.displayName!==t.displayName||e.icon!==t.icon||e.color!==t.color||e.currentDoc!==t.currentDoc||e.mode!==t.mode)return!1}}return!0}function zj(e){let t=new Map;for(let n of e){let e=n.user.principalId;if(typeof e==`string`&&e.length>0){let r=t.get(e);r?r.push(n):t.set(e,[n])}}let n=new Map;for(let[e,r]of t){let t=r.reduce((e,t)=>Math.min(e,t.clientId),1/0);n.set(e,{repClientId:t,count:r.length})}let r=[];for(let t of e){let e=t.user.principalId;if(typeof e==`string`&&e.length>0){let i=n.get(e);i&&i.repClientId===t.clientId&&r.push({...t,tabCount:i.count})}else r.push({...t,tabCount:1})}return r}var Bj=1e3,Vj=!1;function Hj(e){return!!(e.localPrincipalId&&e.entryPrincipalId===e.localPrincipalId||!e.localPrincipalId&&e.entryClientId===e.localClientId)}function Uj(e,t,n){let r=(0,$.c)(9),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={current:[],crossDoc:[]},r[0]=i):i=r[0];let[a,o]=(0,Q.useState)(i),s;r[1]!==n||r[2]!==e?.awareness||r[3]!==t?.awareness?(s=()=>{let r=e?.awareness,i=t?.awareness,a;i==null?a=void 0:si(i)?a=i:(a=void 0,Vj||(Vj=!0,console.warn(`[agent-presence] __system__ provider awareness missing getStates() — presence bar will render without agent peers`)));let s=()=>{let e=(r?.getLocalState())?.user?.principalId??null,t=r?.clientID??null,i=[];if(r)for(let[n,a]of r.getStates().entries()){let r=a;if(!r.user||typeof r.user!=`object`)continue;let o=r.user;o.type===`human`&&(Hj({entryPrincipalId:o.principalId,entryClientId:n,localPrincipalId:e,localClientId:t})||i.push({kind:`human`,clientId:n,user:o,mode:r.mode??`wysiwyg`,tabCount:1}))}let s=zj(i),{current:c,crossDoc:l}=a?ni(a,n,Date.now()):{current:[],crossDoc:[]},u=Wj,d=c.map(u),f=l.map(u),p=[...s,...d],m=f;o(e=>Rj(e.current,p)&&Rj(e.crossDoc,m)?e:{current:p,crossDoc:m})};s();let c=()=>s(),l=()=>s();r?.on(`change`,c),t?.awareness?.on(`change`,l);let u=setInterval(s,Bj);return()=>{r?.off(`change`,c),t?.awareness?.off(`change`,l),clearInterval(u)}},r[1]=n,r[2]=e?.awareness,r[3]=t?.awareness,r[4]=s):s=r[4];let c;return r[5]!==n||r[6]!==e||r[7]!==t?(c=[e,t,n],r[5]=n,r[6]=e,r[7]=t,r[8]=c):c=r[8],(0,Q.useEffect)(s,c),a}function Wj(e){let{agentId:t,entry:n}=e;return{kind:`agent`,agentId:t,presence:n}}var Gj=`sync-status`;function Kj(e,t){let n=(0,$.c)(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,Xa.warning(`Connection lost — keep this tab open, your edits will sync when reconnected`,{id:Gj,duration:1/0})):i.current&&e===`synced`&&(i.current=!1,Xa.success(`Reconnected`,{id:Gj,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 qj=4,Jj=3,Yj={Bird:ns,Cat:cs,Dog:xs,Fish:Ts,Mouse:$s,Rabbit:Qs,Shrimp:ic,Snail:ac,Squirrel:lc,Turtle:mc};Object.freeze([...Object.keys(Yj)]);function Xj(e){if(typeof e.principalId==`string`&&e.principalId.length>0)return{kind:`initials`};let t=e.name.split(` `)[1];return t&&Object.hasOwn(Yj,t)?{kind:`animal`,animal:t}:{kind:`initials`}}var Zj={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`,bot:`Agent`};function Qj(e){let t=(0,$.c)(20),{user:n,mode:r,tabCount:i}=e,a=Xj(n),o=a.kind===`animal`?Yj[a.animal]:void 0,s;t[0]===n.name?s=t[1]:(s=Rn(n.name),t[0]=n.name,t[1]=s);let c=s,l;t[2]===n.color?l=t[3]:(l=Or(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)(so,{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)(co,{children:d}),t[15]=d,t[16]=g);let _;return t[17]!==h||t[18]!==g?(_=(0,Z.jsxs)(uo,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19],_}function $j(e){let t=Zj[e.icon];return e.displayName||t||`Agent`}function eM(e){let t=(0,$.c)(3),[n,r]=(0,Q.useState)(e===`writing`),i=(0,Q.useRef)(null),a,o;return t[0]===e?(a=t[1],o=t[2]):(a=()=>{if(e===`writing`){i.current!==null&&(clearTimeout(i.current),i.current=null),r(!0);return}return i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,r(!1)},600),()=>{i.current!==null&&(clearTimeout(i.current),i.current=null)}},o=[e],t[0]=e,t[1]=a,t[2]=o),(0,Q.useEffect)(a,o),n}function tM(e){let t=(0,$.c)(36),{participant:n,crossDoc:r,scoped:i,onClickAgent:a}=e,{presence:o,agentId:s}=n,c;t[0]===o?c=t[1]:(c=$j(o),t[0]=o,t[1]=c);let l=c,u=eM(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)(ai,{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)(so,{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)(co,{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)(uo,{children:[D,A]}),t[33]=D,t[34]=A,t[35]=j):j=t[35],j}function nM(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)(ie,{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)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:i,scoped:a===e.agentId,onClickAgent:o},e.agentId),t[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)(ae,{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)(E,{children:[l,d]}),t[15]=l,t[16]=d,t[17]=f):f=t[17],f}function rM(e,t,n,r){return e.kind===`human`?(0,Z.jsx)(Qj,{user:e.user,mode:e.mode,tabCount:e.tabCount},e.clientId):(0,Z.jsx)(tM,{participant:e,crossDoc:n,scoped:r===e.agentId,onClickAgent:t},e.agentId)}function iM(){let e=(0,$.c)(20),{activeProvider:t,activeDocName:n,systemProvider:r,openActivityPanel:i,docPanelMode:a,docPanelAgentId:o}=We(),{current:s,crossDoc:c}=Uj(t,r,n);Kj(VO(t),n);let l;if(e[0]!==c||e[1]!==s||e[2]!==o||e[3]!==a||e[4]!==i){let t=s.slice(0,qj),n;e[6]===s?n=e[7]:(n=s.slice(qj),e[6]=s,e[7]=n);let r=n,u=c.slice(0,Jj),d;e[8]===c?d=e[9]:(d=c.slice(Jj),e[8]=c,e[9]=d);let f=d,p=i,m=a===`agent`?o:null,h;e[10]!==p||e[11]!==m?(h=e=>rM(e,p,!1,m),e[10]=p,e[11]=m,e[12]=h):h=e[12];let g=t.map(h),_;e[13]!==r||e[14]!==p||e[15]!==m?(_=r.length>0?(0,Z.jsx)(nM,{count:r.length,remainder:r,crossDoc:!1,scopedAgentId:m,onClickAgent:p}):null,e[13]=r,e[14]=p,e[15]=m,e[16]=_):_=e[16];let v;e[17]!==g||e[18]!==_?(v=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,"data-presence-section":`current`,children:[g,_]}),e[17]=g,e[18]=_,e[19]=v):v=e[19],l=(0,Z.jsxs)(`div`,{"data-slot":`presence-bar`,className:`flex items-center px-1 py-1.5`,children:[v,c.length>0?(0,Z.jsxs)(`div`,{className:`ml-1.5 flex items-center gap-1.5`,"data-presence-section":`crossdoc`,children:[u.map(e=>rM(e,p,!0,m)),f.length>0?(0,Z.jsx)(nM,{count:f.length,remainder:f,crossDoc:!0,scopedAgentId:m,onClickAgent:p}):null]}):null]}),e[0]=c,e[1]=s,e[2]=o,e[3]=a,e[4]=i,e[5]=l}else l=e[5];return l}function aM(e,t){return t.trim()}function oM(e){return![``,`.`,`..`].includes(e)&&!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`\0`)}function sM(e,t){let n=aM(e.kind,t),r=e.path.split(`/`);return r[r.length-1]=n,r.join(`/`)}function cM(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=>Ar(e)?{...e,docName:r.get(e.docName)??e.docName}:Pr(e)||Fn(e)?{...e,path:dM(e.path,n)}:e)}function lM(e,t,n){if(t.length===0&&!n)return e;let r=new Set(t);return e.filter(e=>Ar(e)?!r.has(e.docName)&&!fM(e.docName,n):Pr(e)||Fn(e)?!fM(e.path,n):!0)}function uM(e,t){return e?t.find(t=>t.fromDocName===e)?.toDocName??e:null}function dM(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 fM(e,t){return!!t&&(e===t||e.startsWith(`${t}/`))}function pM(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)(bl,{"data-slot":`context-menu`,...n}),t[2]=n,t[3]=r),r}function mM(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=Y(`select-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(xl,{"data-slot":`context-menu-trigger`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hM(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=Y(`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`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Sl,{children:(0,Z.jsx)(Cl,{"data-slot":`context-menu-content`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gM(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=Y(`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)(wl,{"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 _M(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=Y(`-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)(Tl,{"data-slot":`context-menu-separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function vM(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=Y(`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 yM=Lr(`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 bM(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=Y(yM({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:xM,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function xM(e){e.target.closest(`button`)||(e.preventDefault(),e.currentTarget.parentElement?.querySelector(`input`)?.focus())}Lr(`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 SM(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=Y(`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 CM(e){let t=(0,$.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Y(`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)(fo,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var wM=[`.md`,`.mdx`],TM=`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`,EM=`z-10 rounded-t-lg rounded-b-none border-border border-b-0 bg-background text-foreground`,DM=Y(EM,`bg-transparent hover:bg-muted focus-visible:bg-muted border-transparent hover:border-border focus-visible:border-border`),OM=`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`,kM=`mr-2 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 AM(e){return Y(kM,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 jM(e,t){let n=e.lastIndexOf(`/`),r=n<0?e:e.slice(n+1),i=`${r}${t}`;return n<0?{baseName:r,extension:t,label:i,prefix:``}:{baseName:r,extension:t,label:i,prefix:`${e.slice(0,n)}/`}}function MM(e){return e.replace(/[^A-Za-z0-9_-]/g,`-`)}function NM(e){let t=er(e);window.location.hash!==t&&(window.location.hash=t)}function PM(e){Math.abs(e.deltaX)>=Math.abs(e.deltaY)||e.currentTarget.scrollWidth<=e.currentTarget.clientWidth||(e.preventDefault(),e.currentTarget.scrollLeft+=e.deltaY)}function FM(e,t){let n=[t,...wM].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 IM(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=Pe(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?(_=Pe(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)(mM,{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)(gM,{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)(gM,{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)(gM,{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)(_M,{}),(0,Z.jsx)(gM,{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)(hM,{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)(pM,{children:[b,A]}),t[45]=A,t[46]=b,t[47]=j):j=t[47],j}function LM(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)(Zs,{"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-2 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)(Fa,{"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-2`,onClick:c,children:l}),t[11]=s,t[12]=c,t[13]=u):u=t[13],u}function RM(){let e=(0,$.c)(68),{activeDocName:t,activeTabId:n,activeNewTabId:r,activeTarget:i,activateTab:a,activateNewTab:o,closeAndClearForRename:s,closeNewTab:c,closeTab:l,closeTabs:u,isNewTabActive:d,newTabIds:f,openNewTab:p,openTabs:m,pinTab:h,pinnedTabIds:g,remapTabsForRename:_,unpinTab:v,visibleTabIds:y}=We(),{pageMeta:b}=wr(),x=(0,Q.useRef)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(!1),A=(0,Q.useRef)(null),j=(0,Q.useRef)(!1),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(null),F=(0,Q.useRef)(t),I;e[0]!==n||e[1]!==t||e[2]!==i?(I=n??(i?ve(i):t?nt(t):null),e[0]=n,e[1]=t,e[2]=i,e[3]=I):I=e[3];let L=I,R;e[4]!==r||e[5]!==L||e[6]!==d||e[7]!==f||e[8]!==m?(R=d?`${r??`__new-tab__`}\u0000${m.join(`\0`)}\u0000${f.join(`\0`)}`:L?`${L}\u0000${m.join(`\0`)}`:``,e[4]=r,e[5]=L,e[6]=d,e[7]=f,e[8]=m,e[9]=R):R=e[9];let z=R,B,V;e[10]===t?(B=e[11],V=e[12]):(B=()=>{F.current=t},V=[t],e[10]=t,e[11]=B,e[12]=V),(0,Q.useEffect)(B,V);let H,U;e[13]===z?(H=e[14],U=e[15]):(H=()=>{z&&(x.current?.querySelector(`[data-active-tab="true"]`))?.scrollIntoView({block:`nearest`,inline:`nearest`})},U=[z],e[13]=z,e[14]=H,e[15]=U),(0,Q.useEffect)(H,U);let W,G;e[16]===S?(W=e[17],G=e[18]):(W=()=>{S&&(A.current?.focus(),A.current?.select())},G=[S],e[16]=S,e[17]=W,e[18]=G),(0,Q.useEffect)(W,G);let K,q;e[19]!==m||e[20]!==S?(K=()=>{!S||m.includes(S.tabId)||(N.current=!0,P.current=null,C(null),T(``),D(null),k(!1))},q=[m,S],e[19]=m,e[20]=S,e[21]=K,e[22]=q):(K=e[21],q=e[22]),(0,Q.useEffect)(K,q);let ee,te,ne,re,ie;if(e[23]!==o||e[24]!==a||e[25]!==r||e[26]!==L||e[27]!==s||e[28]!==c||e[29]!==l||e[30]!==u||e[31]!==O||e[32]!==f||e[33]!==b||e[34]!==h||e[35]!==g||e[36]!==_||e[37]!==E||e[38]!==w||e[39]!==S?.docName||e[40]!==S?.tabId||e[41]!==v||e[42]!==y){let t=function(e,t){let n=t.split(`/`);N.current=!1,P.current=null,C({docName:t,tabId:e}),T(n[n.length-1]),D(null)},n=function(){N.current=!0,P.current=null,C(null),T(``),D(null),k(!1)},i=async function(){if(N.current){N.current=!1;return}if(j.current)return;let e=S?.docName;if(!e){n();return}let t=aM(`file`,FM(w,b.get(e)?.docExt??`.md`)),r=e.split(`/`),i=r[r.length-1];if(t===i){n();return}if(t===P.current){A.current?.focus();return}if(!oM(t)){D(`Name can’t be empty, ".", "..", or contain / or \\`),A.current?.focus();return}let a=sM({kind:`file`,path:e,name:i},t);j.current=!0,k(!0),D(null);try{let n=await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:`file`,fromPath:e,toPath:a})});if(N.current){k(!1),j.current=!1;return}let r=await Le(n,`Server error (HTTP ${n.status})`);if(!r.ok){D(r.title),k(!1),j.current=!1,P.current=t,A.current?.focus();return}let i=M(vn,r.body,`rename-path:tab`,{renamed:[]}).renamed,o=F.current,c=uM(o,i);await Promise.all(i.flatMap(e=>[s(e.fromDocName),s(e.toDocName)])),_(i),Kn([`files`,`backlinks`,`graph`]),N.current=!0,C(null),T(``),D(null),k(!1),j.current=!1,P.current=null,c&&c!==o&&NM(c)}catch(n){console.warn(`[EditorTabs] rename failed`,{err:n,docName:e,newDocName:a,normalized:t}),D(`Network error — please try again`),k(!1),j.current=!1,P.current=t,A.current?.focus()}};ee=typeof window<`u`&&window.okDesktop!=null;let d;e[48]===f?d=e[49]:(d=new Set(f),e[48]=f,e[49]=d);let p=d,m;e[50]!==c||e[51]!==u||e[52]!==p?(m=function(e){let t=[],n=[];for(let r of e)p.has(r)?n.push(r):t.push(r);t.length>0&&u(t);for(let e of n)c(e)},e[50]=c,e[51]=u,e[52]=p,e[53]=m):m=e[53];let I=m;te=x,e[54]===Symbol.for(`react.memo_cache_sentinel`)?(ne=Y(`pl-2 flex h-12 min-w-0 touch-manipulation flex-1 items-end gap-1 overflow-x-auto overflow-y-hidden overscroll-x-contain scroll-fade-mask-x [scrollbar-width:none]`,ee&&`[-webkit-app-region:drag]`),e[54]=ne):ne=e[54],re=PM,ie=y.map(e=>{if(p.has(e)){let t=e===r;return(0,Z.jsx)(IM,{tabId:e,canPin:!1,openTabs:y,closeTab:c,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":t?`true`:void 0,className:Y(TM,t?EM:DM,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),c(e))},onClick:t=>{t.target===t.currentTarget&&o(e)},children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Activate new tab`,className:OM,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:AM(t),onClick:t=>{t.stopPropagation(),c(e)},children:(0,Z.jsx)(Fa,{"aria-hidden":`true`,className:`size-3.5`})})]})},e)}let s=Ye(e),u=e===L,d=g.includes(e);if(s.kind===`folder`){let{baseName:t,label:n,prefix:r}=jM(s.folderPath,`/`),i=`${r}${n}`;return(0,Z.jsx)(IM,{tabId:e,openTabs:y,closeTab:l,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":u?`true`:void 0,className:Y(TM,u?EM:DM,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i,className:OM,onClick:()=>{a(e)},children:[r&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate`,u&&`text-muted-foreground`),children:r}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,r?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`/`})]})]}),(0,Z.jsx)(LM,{accessibleLabel:i,closeTab:l,isPinned:d,tabId:e,unpinTab:v})]})},e)}if(s.kind===`asset`){let{baseName:t,label:n,prefix:r}=jM(s.assetPath,``),i=`${r}${n}`;return(0,Z.jsx)(IM,{tabId:e,openTabs:y,closeTab:l,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsxs)(`div`,{role:`presentation`,"data-active-tab":u?`true`:void 0,className:Y(TM,u?EM:DM,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i,className:OM,onClick:()=>{a(e)},children:[r?(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:r}):null,(0,Z.jsx)(`span`,{className:Y(`min-w-0 truncate`,r?`max-w-[70%] shrink-0`:`flex-1`),children:t})]}),(0,Z.jsx)(LM,{accessibleLabel:i,closeTab:l,isPinned:d,tabId:e,unpinTab:v})]})},e)}let f=s.docName,m=b.get(f)?.docExt??`.md`,{baseName:_,extension:x,label:C,prefix:k}=jM(f,m),j=`${k}${C}`,M=S?.tabId===e,N=`editor-tab-rename-error-${MM(f)}`;return(0,Z.jsx)(IM,{disabled:M,tabId:e,openTabs:y,closeTab:l,closeTabs:I,pinTab:h,pinnedTabIds:g,unpinTab:v,children:(0,Z.jsx)(`div`,{role:`presentation`,"data-active-tab":u?`true`:void 0,className:Y(TM,u?EM:DM,M&&E&&`border-destructive`,ee&&`[-webkit-app-region:no-drag]`),onAuxClick:t=>{t.button===1&&(t.preventDefault(),!d&&l(e))},onClick:t=>{t.target===t.currentTarget&&a(e)},children:M?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vM,{className:`h-full min-w-0 flex-1 rounded-none border-0 bg-transparent dark:bg-transparent`,children:[(0,Z.jsx)(CM,{ref:A,value:w,disabled:O,"aria-label":`Rename ${C}`,"aria-invalid":E?!0:void 0,"aria-describedby":E?N:void 0,"aria-busy":O||void 0,title:E??f,className:`h-full min-w-0 px-2 py-0 font-medium text-foreground text-xs selection:bg-primary selection:text-primary-foreground`,onChange:e=>{T(FM(e.target.value,m)),D(null),P.current=null},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),n())},onBlur:i}),(0,Z.jsx)(bM,{align:`inline-end`,"aria-hidden":`true`,className:`pr-2 text-xs`,children:(0,Z.jsx)(SM,{className:`text-muted-foreground/60 text-xs`,children:m})})]}),E?(0,Z.jsx)(`span`,{id:N,role:`alert`,className:`sr-only`,children:E}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":j,className:OM,onClick:()=>{a(e)},onDoubleClick:n=>{n.preventDefault(),n.stopPropagation(),t(e,f)},children:[k&&(0,Z.jsx)(`span`,{className:Y(`min-w-0 flex-1 truncate text-muted-foreground/60`,u&&`text-muted-foreground`),children:k}),(0,Z.jsxs)(`span`,{className:Y(`flex min-w-0 items-center`,k?`max-w-[70%] shrink-0`:`flex-1`),children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:_}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:x})]})]}),(0,Z.jsx)(LM,{accessibleLabel:j,closeTab:l,isPinned:d,tabId:e,unpinTab:v})]})})},e)}),e[23]=o,e[24]=a,e[25]=r,e[26]=L,e[27]=s,e[28]=c,e[29]=l,e[30]=u,e[31]=O,e[32]=f,e[33]=b,e[34]=h,e[35]=g,e[36]=_,e[37]=E,e[38]=w,e[39]=S?.docName,e[40]=S?.tabId,e[41]=v,e[42]=y,e[43]=ee,e[44]=te,e[45]=ne,e[46]=re,e[47]=ie}else ee=e[43],te=e[44],ne=e[45],re=e[46],ie=e[47];let ae;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(ae=Y(`first:mb-3 mb-1.5`,ee&&`[-webkit-app-region:no-drag]`),e[55]=ae):ae=e[55];let oe;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(Fi,{"aria-hidden":`true`}),e[56]=oe):oe=e[56];let se;e[57]===p?se=e[58]:(se=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(X,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`New tab`,className:ae,onClick:p,children:oe})}),e[57]=p,e[58]=se);let ce;e[59]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Z.jsx)(co,{children:`New tab`}),e[59]=ce):ce=e[59];let le;e[60]===se?le=e[61]:(le=(0,Z.jsxs)(uo,{children:[se,ce]}),e[60]=se,e[61]=le);let ue;return e[62]!==te||e[63]!==ne||e[64]!==re||e[65]!==ie||e[66]!==le?(ue=(0,Z.jsxs)(`div`,{ref:te,className:ne,onWheel:re,children:[ie,le]}),e[62]=te,e[63]=ne,e[64]=re,e[65]=ie,e[66]=le,e[67]=ue):ue=e[67],ue}function zM(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 BM(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 VM=[{label:`Documentation`,href:`https://openknowledge.ai/docs`,icon:j},{label:`GitHub`,href:`https://github.com/inkeep/open-knowledge`,icon:Du},{label:`Website`,href:`https://openknowledge.ai/`,icon:ja},{label:`Discord`,href:`https://go.inkeep.com/ok-discord`,icon:zM},{label:`Twitter`,href:`https://x.com/inkeep`,icon:BM}],HM=()=>{let e=(0,$.c)(5),[t,n]=(0,Q.useState)(!1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(ie,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[(0,Z.jsx)(I,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Resources`})]})})}),(0,Z.jsx)(co,{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)(ae,{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:VM.map(UM)})})]}),e[2]=a):a=e[2];let o;return e[3]===t?o=e[4]:(o=(0,Z.jsxs)(E,{open:t,onOpenChange:n,children:[r,a]}),e[3]=t,e[4]=o),o};function UM(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=>pi(e,n),onAuxClick:e=>pi(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 WM(e){let t=(0,$.c)(70),{input:n}=e,{states:r,refresh:i}=dm(),{dispatch:a}=em(),{skillInstalled:o,refresh:s}=la(),[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),f=typeof window<`u`&&window.okDesktop!=null,p;t[0]===i?p=t[1]:(p=e=>{l(e),e&&i()},t[0]=i,t[1]=p);let m=p,h=n===null,g;t[2]===n?g=t[3]:(g=n!==null&&n.docContext!==null?tr(n.docContext):``,t[2]=n,t[3]=g);let _=g,y;t[4]!==a||t[5]!==n?(y=e=>{n!==null&&a(e.id,n)},t[4]=a,t[5]=n,t[6]=y):y=t[6];let b=y,x,S,C,w,T,E,D,O,k,A,j,M;if(t[7]!==m||t[8]!==b||t[9]!==n||t[10]!==c||t[11]!==_||t[12]!==o||t[13]!==r||t[14]!==h){let e;t[27]===r?e=t[28]:(e=e=>r[e.id]?.installed===!0,t[27]=r,t[28]=e);let i=op.filter(e);C=r[`claude-cowork`]?.installed===!0;let a;t[29]!==n||t[30]!==_?(a=()=>{n!==null&&Sb(_)},t[29]=n,t[30]=_,t[31]=a):a=t[31],w=a,S=Ei,M=c,T=m;let s;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(ii,{className:`size-4`}),t[32]=s):s=t[32];let l;t[33]===h?l=t[34]:(l=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(Ii,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit with AI`,disabled:h,className:`text-muted-foreground`,"data-testid":`open-in-agent-trigger`,children:s})})}),t[33]=h,t[34]=l);let u;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(co,{children:`Edit with AI`}),t[35]=u):u=t[35],t[36]===l?E=t[37]:(E=(0,Z.jsxs)(uo,{children:[l,u]}),t[36]=l,t[37]=E),x=ki,D=`end`,O=`min-w-[220px]`,k=`open-in-agent-menu`,t[38]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Z.jsx)(xi,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Open in`}),t[38]=A):A=t[38];let p;t[39]!==b||t[40]!==_||t[41]!==o||t[42]!==r?(p=e=>{let t=r[e.id];return(0,Z.jsx)(wb,{target:e,installState:t,isElectronHost:f,prompt:_,onSelect:()=>b(e),onInstallSkillRequest:e.id===`claude-cowork`&&!o?()=>d(!0):void 0},e.id)},t[39]=b,t[40]=_,t[41]=o,t[42]=r,t[43]=p):p=t[43],j=i.map(p),t[7]=m,t[8]=b,t[9]=n,t[10]=c,t[11]=_,t[12]=o,t[13]=r,t[14]=h,t[15]=x,t[16]=S,t[17]=C,t[18]=w,t[19]=T,t[20]=E,t[21]=D,t[22]=O,t[23]=k,t[24]=A,t[25]=j,t[26]=M}else x=t[15],S=t[16],C=t[17],w=t[18],T=t[19],E=t[20],D=t[21],O=t[22],k=t[23],A=t[24],j=t[25],M=t[26];let N;t[44]!==C||t[45]!==w||t[46]!==n?(N=C?null:(0,Z.jsxs)(vi,{onSelect:w,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)(v,{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[44]=C,t[45]=w,t[46]=n,t[47]=N):N=t[47];let P;t[48]!==x||t[49]!==N||t[50]!==D||t[51]!==O||t[52]!==k||t[53]!==A||t[54]!==j?(P=(0,Z.jsxs)(x,{align:D,className:O,"data-testid":k,children:[A,j,N]}),t[48]=x,t[49]=N,t[50]=D,t[51]=O,t[52]=k,t[53]=A,t[54]=j,t[55]=P):P=t[55];let F;t[56]!==S||t[57]!==T||t[58]!==E||t[59]!==P||t[60]!==M?(F=(0,Z.jsxs)(S,{open:M,onOpenChange:T,children:[E,P]}),t[56]=S,t[57]=T,t[58]=E,t[59]=P,t[60]=M,t[61]=F):F=t[61];let I;t[62]===s?I=t[63]:(I=e=>{d(e),e||s()},t[62]=s,t[63]=I);let L;t[64]!==u||t[65]!==I?(L=(0,Z.jsx)(ta,{open:u,onOpenChange:I}),t[64]=u,t[65]=I,t[66]=L):L=t[66];let R;return t[67]!==F||t[68]!==L?(R=(0,Z.jsxs)(Z.Fragment,{children:[F,L]}),t[67]=F,t[68]=L,t[69]=R):R=t[69],R}var GM=()=>{let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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`,onClick:KM,children:[(0,Z.jsx)(rc,{className:`size-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Z.jsx)(co,{children:`Settings`})]}),e[0]=t):t=e[0],t};function KM(){window.location.hash!==`#settings`&&(window.location.hash=sp)}function qM(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 JM(e){await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})})}function YM(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)(ps,{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)(ec,{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)(ps,{className:`size-3.5 text-emerald-500`}),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)(ec,{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)(Dn,{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)(fs,{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)(Us,{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)(Dn,{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)(ps,{className:`size-3.5 text-muted-foreground`}),t[8]=e):e=t[8],e}}}function XM(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 ZM(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 QM(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 $M(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`}`:ZM(e.state):`Sync off`}function eN(e){let t=(0,$.c)(76),{status:n,onSignIn:r,onOpenConflictResolver:i,onSetIdentity:a}=e,{projectLocalConfig:o,projectLocalSynced:s}=Bi(),c=o?.autoSync?.enabled??!1,{confirmOpen:l,setConfirmOpen:u,onToggleRequest:d,onConfirm:f}=Ri(yi()),p;t[0]===n?p=t[1]:(p=(0,Z.jsx)(YM,{status:n}),t[0]=n,t[1]=p);let m;t[2]===n.state?m=t[3]:(m=ZM(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`,y;t[9]!==c||t[10]!==d||t[11]!==_||t[12]!==v?(y=(0,Z.jsx)(Fe,{checked:c,disabled:_,onCheckedChange:d,"aria-label":v}),t[9]=c,t[10]=d,t[11]=_,t[12]=v,t[13]=y):y=t[13];let b;t[14]!==g||t[15]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[g,y]}),t[14]=g,t[15]=y,t[16]=b):b=t[16];let x;t[17]!==l||t[18]!==f||t[19]!==u?(x=(0,Z.jsx)(pa,{open:l,onOpenChange:u,onConfirm:f}),t[17]=l,t[18]=f,t[19]=u,t[20]=x):x=t[20];let S;t[21]===n.error?S=t[22]:(S=n.error&&(0,Z.jsx)(`p`,{className:`text-xs text-destructive`,children:n.error}),t[21]=n.error,t[22]=S);let C;t[23]===n.pausedReason?C=t[24]:(C=n.pausedReason&&(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:QM(n.pausedReason)}),t[23]=n.pausedReason,t[24]=C);let w;t[25]===n.state?w=t[26]:(w=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]=w);let T;t[27]!==c||t[28]!==n.lastSyncUtc||t[29]!==n.state?(T=c&&n.state!==`dormant`&&(0,Z.jsxs)(`div`,{children:[`Last synced: `,qM(n.lastSyncUtc)]}),t[27]=c,t[28]=n.lastSyncUtc,t[29]=n.state,t[30]=T):T=t[30];let E;t[31]===n.ahead?E=t[32]:(E=n.ahead>0&&(0,Z.jsxs)(`div`,{children:[n.ahead,` commit`,n.ahead===1?``:`s`,` ahead`]}),t[31]=n.ahead,t[32]=E);let D;t[33]===n.behind?D=t[34]:(D=n.behind>0&&(0,Z.jsxs)(`div`,{children:[n.behind,` commit`,n.behind===1?``:`s`,` behind`]}),t[33]=n.behind,t[34]=D);let O;t[35]===n.conflictCount?O=t[36]:(O=n.conflictCount>0&&(0,Z.jsxs)(`div`,{children:[n.conflictCount,` file`,n.conflictCount===1?``:`s`,` conflicted`]}),t[35]=n.conflictCount,t[36]=O);let k;t[37]===c?k=t[38]:(k=!c&&(0,Z.jsx)(`div`,{children:`Sync is off — your edits will not sync to the remote repository.`}),t[37]=c,t[38]=k);let A;t[39]!==T||t[40]!==E||t[41]!==D||t[42]!==O||t[43]!==k?(A=(0,Z.jsxs)(`div`,{className:`text-xs text-muted-foreground space-y-0.5`,children:[T,E,D,O,k]}),t[39]=T,t[40]=E,t[41]=D,t[42]=O,t[43]=k,t[44]=A):A=t[44];let j;t[45]!==a||t[46]!==n.identityUnresolved?(j=n.identityUnresolved&&a&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,Z.jsx)(vc,{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]=j):j=t[47];let M;t[48]!==c||t[49]!==n.state?(M=c&&n.state!==`dormant`&&n.state!==`disabled`&&n.state!==`auth-error`&&n.state!==`conflict`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:nN,children:`Sync now`}),t[48]=c,t[49]=n.state,t[50]=M):M=t[50];let N;t[51]!==c||t[52]!==r||t[53]!==n.state?(N=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]=N):N=t[54];let P;t[55]!==c||t[56]!==n.state?(P=c&&n.state===`offline`&&(0,Z.jsx)(X,{variant:`outline`,size:`xs`,onClick:tN,children:`Retry`}),t[55]=c,t[56]=n.state,t[57]=P):P=t[57];let F;t[58]!==c||t[59]!==i||t[60]!==n.state?(F=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]=F):F=t[61];let I;t[62]!==M||t[63]!==N||t[64]!==P||t[65]!==F?(I=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:[M,N,P,F]}),t[62]=M,t[63]=N,t[64]=P,t[65]=F,t[66]=I):I=t[66];let L;return t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==A||t[71]!==j||t[72]!==I||t[73]!==b||t[74]!==x?(L=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[b,x,S,C,w,A,j,I]}),t[67]=S,t[68]=C,t[69]=w,t[70]=A,t[71]=j,t[72]=I,t[73]=b,t[74]=x,t[75]=L):L=t[75],L}function tN(){JM(`sync`)}function nN(){JM(`sync`)}function rN(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}=Vi();if(!o){if(s){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(so,{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)(fs,{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)(uo,{children:[e,(0,Z.jsx)(co,{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=XM(o),t[5]=o,t[6]=c);let l=c,u=!!o.identityUnresolved,d;t[7]===o.state?d=t[8]:(d=ZM(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)(YM,{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)(so,{asChild:!0,children:(0,Z.jsx)(ie,{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]:(_=$M(o),t[21]=o,t[22]=_);let v;t[23]===_?v=t[24]:(v=(0,Z.jsx)(co,{children:_}),t[23]=_,t[24]=v);let y;t[25]!==v||t[26]!==g?(y=(0,Z.jsxs)(uo,{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)(ae,{align:`end`,className:`w-64 p-3`,children:(0,Z.jsx)(eN,{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)(E,{children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35],x}var iN=[{value:`light`,label:`Light`,icon:fc},{value:`dark`,label:`Dark`,icon:Ws},{value:`system`,label:`System`,icon:vs}],aN=()=>{let e=(0,$.c)(16),{theme:t}=yr(),{merged:n,userBinding:r}=Bi(),i=n?.appearance?.theme??t??`system`,a;e[0]===r?a=e[1]:(a=e=>{if(e!==`light`&&e!==`dark`&&e!==`system`||!r)return;let t=r.patch({appearance:{theme:e}});t.ok||Xa.error(wn(t.error))},e[0]=r,e[1]=a);let o=a,s=i===`system`?vs:i===`dark`?Ws:fc,c;e[2]===s?c=e[3]:(c=(0,Z.jsx)(s,{}),e[2]=s,e[3]=c);let l;e[4]===i?l=e[5]:(l=(0,Z.jsxs)(`span`,{className:`sr-only`,children:[`Toggle theme (current: `,i,`)`]}),e[4]=i,e[5]=l);let u;e[6]!==c||e[7]!==l?(u=(0,Z.jsx)(Ii,{asChild:!0,children:(0,Z.jsxs)(X,{variant:`ghost`,size:`icon`,className:`size-7 hover:bg-accent text-muted-foreground`,children:[c,l]})}),e[6]=c,e[7]=l,e[8]=u):u=e[8];let d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=iN.map(oN),e[9]=d):d=e[9];let f;e[10]!==i||e[11]!==o?(f=(0,Z.jsx)(ki,{align:`end`,children:(0,Z.jsx)(wi,{value:i,onValueChange:o,children:d})}),e[10]=i,e[11]=o,e[12]=f):f=e[12];let p;return e[13]!==u||e[14]!==f?(p=(0,Z.jsxs)(Ei,{children:[u,f]}),e[13]=u,e[14]=f,e[15]=p):p=e[15],p};function oN(e){let{value:t,label:n,icon:r}=e;return(0,Z.jsxs)(ji,{value:t,className:`capitalize`,children:[(0,Z.jsx)(r,{className:`text-muted-foreground`}),n]},t)}function sN(e){let t=(0,$.c)(38),{onSaveVersion:n,saving:r,onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}=e,{activeDocName:s}=We(),{state:c}=Cj(),l=mp(),u;t[0]!==s||t[1]!==l?(u=Up({docName:s,workspace:l}),t[0]=s,t[1]=l,t[2]=u):u=t[2];let d=u,f=typeof window<`u`&&window.okDesktop!=null,p=f&&c===`collapsed`&&`pl-[78px]`,m;t[3]===p?m=t[4]:(m=Y(`flex h-12 shrink-0 items-center bg-muted/35 shadow-[inset_0_-1px_0_var(--border)]`,f&&`[-webkit-app-region:drag]`,p,f&&`motion-safe:transition-[padding] motion-safe:duration-200 motion-safe:ease-linear`),t[3]=p,t[4]=m);let h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(Oj,{className:Y(`-ml-1 shrink-0 text-muted-foreground`,f&&`[-webkit-app-region:no-drag]`)})}),t[5]=h):h=t[5];let g=c===`expanded`?`Hide Files`:`Show Files`,_;t[6]===g?_=t[7]:(_=(0,Z.jsxs)(uo,{children:[h,(0,Z.jsx)(co,{children:g})]}),t[6]=g,t[7]=_);let v,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(_a,{orientation:`vertical`,className:`mr-1 h-4 shrink-0 data-vertical:self-center`}),y=(0,Z.jsx)(RM,{}),t[8]=v,t[9]=y):(v=t[8],y=t[9]);let b;t[10]===_?b=t[11]:(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 px-3`,children:[_,v,y]}),t[10]=_,t[11]=b);let x;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(x=Y(`flex shrink-0 items-center justify-end gap-2 px-3`,f&&`[&>*]:[-webkit-app-region:no-drag]`),t[12]=x):x=t[12];let S;t[13]!==s||t[14]!==n||t[15]!==r?(S=s&&(0,Z.jsxs)(uo,{children:[(0,Z.jsx)(so,{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)(nc,{className:`size-3.5`})})}),(0,Z.jsx)(co,{children:r?`Saving`:`Checkpoint version`})]}),t[13]=s,t[14]=n,t[15]=r,t[16]=S):S=t[16];let C;t[17]!==s||t[18]!==d?(C=s&&(0,Z.jsx)(WM,{input:d}),t[17]=s,t[18]=d,t[19]=C):C=t[19];let w;t[20]!==o||t[21]!==a||t[22]!==i?(w=(0,Z.jsx)(rN,{onSignIn:i,onSetIdentity:a,onOpenConflictResolver:o}),t[20]=o,t[21]=a,t[22]=i,t[23]=w):w=t[23];let T,E,D,O,k,A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Z.jsx)(iM,{}),E=(0,Z.jsx)(_a,{orientation:`vertical`,className:`h-4 shrink-0 data-vertical:self-center`}),D=(0,Z.jsx)(cu,{}),O=(0,Z.jsx)(GM,{}),k=(0,Z.jsx)(HM,{}),A=(0,Z.jsx)(aN,{}),t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A):(T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29]);let j;t[30]!==S||t[31]!==C||t[32]!==w?(j=(0,Z.jsxs)(`div`,{className:x,children:[S,C,w,T,E,D,O,k,A]}),t[30]=S,t[31]=C,t[32]=w,t[33]=j):j=t[33];let M;return t[34]!==j||t[35]!==m||t[36]!==b?(M=(0,Z.jsxs)(`header`,{className:m,children:[b,j]}),t[34]=j,t[35]=m,t[36]=b,t[37]=M):M=t[37],M}function cN(){let e=(0,$.c)(32),[t,n]=Vm(),[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)(fv[0].id),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),_=zi(),{projectLocalConfig:v,projectLocalSynced:y}=Bi(),{activeDocName:b}=We(),x=!h&&_?.hasRemote===!0&&y===!0&&v!==null&&v.autoSync?.enabled===null,S,C;e[0]===b?(S=e[1],C=e[2]):(S=()=>{let e=function(e){let t=e.detail;t&&b&&Lo(b,{kind:`raw-mdx`,detail:t}),i(`source`)};return window.addEventListener(Nm,e),()=>window.removeEventListener(Nm,e)},C=[b],e[0]=b,e[1]=S,e[2]=C),(0,Q.useEffect)(S,C);let w;e[3]===n?w=e[4]:(w=function(e){i(e),n(e)},e[3]=n,e[4]=w);let T=w,E;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(E=async function(){m(!0);try{let e=await fetch(`/api/save-version`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})});e.ok?Xa.success(`Checkpoint saved`):(console.error(`[save-version] failed:`,await e.text()),Xa.error(`Checkpoint failed — try again`))}catch(e){console.error(`[save-version] failed:`,e),Xa.error(`Checkpoint failed — try again`)}m(!1)},e[5]=E):E=e[5];let D=E,O;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Wm,{onOpenResolver:()=>o(!0)}),e[6]=O):O=e[6];let k,A,j;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{u(`auth`),c(!0)},A=()=>{u(`identity`),c(!0)},j=()=>o(!0),e[7]=k,e[8]=A,e[9]=j):(k=e[7],A=e[8],j=e[9]);let M;e[10]===p?M=e[11]:(M=(0,Z.jsx)(sN,{onSaveVersion:D,saving:p,onSignIn:k,onSetIdentity:A,onOpenConflictResolver:j}),e[10]=p,e[11]=M);let N;e[12]!==d||e[13]!==r||e[14]!==T?(N=(0,Z.jsx)(QA,{editorMode:r,onModeChange:T,activeTab:d,onActiveTabChange:f}),e[12]=d,e[13]=r,e[14]=T,e[15]=N):N=e[15];let P;e[16]===a?P=e[17]:(P=(0,Z.jsx)(Kg,{open:a,onOpenChange:o}),e[16]=a,e[17]=P);let F=l===`identity`,I;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>{c(!1)},e[18]=I):I=e[18];let L;e[19]!==s||e[20]!==F?(L=(0,Z.jsx)(ou,{open:s,onOpenChange:c,identityPrompt:F,onSuccess:I}),e[19]=s,e[20]=F,e[21]=L):L=e[21];let R;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>g(!0),e[22]=R):R=e[22];let z;e[23]===x?z=e[24]:(z=(0,Z.jsx)(Hm,{open:x,onResolved:R}),e[23]=x,e[24]=z);let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(Am,{}),e[25]=B):B=e[25];let V;return e[26]!==P||e[27]!==L||e[28]!==z||e[29]!==M||e[30]!==N?(V=(0,Z.jsxs)(Z.Fragment,{children:[O,M,N,P,L,z,B]}),e[26]=P,e[27]=L,e[28]=z,e[29]=M,e[30]=N,e[31]=V):V=e[31],V}var lN=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
35
35
  <symbol id="file-tree-icon-chevron" viewBox="0 0 16 16">
36
36
  <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"/>
37
37
  </symbol>
@@ -48,68 +48,68 @@ This template lives in your user home (~/.ok/templates/) — deleting affects ev
48
48
  <symbol id="file-tree-icon-ellipsis" viewBox="0 0 16 16">
49
49
  <path d="M5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M9.5 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0M14 8.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" />
50
50
  </symbol>
51
- </svg>`,fN=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
51
+ </svg>`,uN=`<symbol id="file-tree-builtin-astro" viewBox="0 0 16 16">
52
52
  <path fill="currentColor" d="M6.08 13.92c-.63-.57-.81-1.79-.55-2.67.45.56 1.08.73 1.73.83 1 .15 1.99.1 2.92-.37l.32-.19q.13.38.08.78a2.1 2.1 0 0 1-.9 1.5q-.3.24-.61.43c-.64.44-.81.95-.57 1.69l.02.08a1.7 1.7 0 0 1-.74-.64 2 2 0 0 1-.3-.98q0-.27-.02-.52-.07-.61-.61-.62a.7.7 0 0 0-.75.6z" class="bg" opacity=".6"/>
53
53
  <path fill="currentColor" d="M2.5 11.1s1.86-.9 3.72-.9l1.4-4.39c.05-.21.2-.36.38-.36s.33.15.38.36l1.4 4.38c2.2 0 3.72.92 3.72.92l-3.16-8.69q-.13-.4-.45-.42H6.11q-.3.02-.45.42z" class="fg"/>
54
- </symbol>`,pN=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
54
+ </symbol>`,dN=`<symbol id="file-tree-builtin-babel" viewBox="0 0 16 16">
55
55
  <path fill="currentColor" fill-rule="evenodd" d="M9.49.5q1.92.05 2.66.54 1.27.6 1.35 1.52v.23a4 4 0 0 1-.53 1.9l-1.38 1.24q-.74.38-.72.63c.77.82 1.33 1.29.85 2.42q-.47 1.1-2.04 2.28c-.5.32-1.88 1.35-2.96 1.86-1.64.77-3.1 1.4-4.65 1.89-.51.16-1.5.16-1.5.16L.5 15A76 76 0 0 0 5.76 3.49q-.1-.08-.1-.2.1 0 .32-.35l-.03-.09q-1.17.39-2.38 1.3l-.13.03q0-.1-.21-.16-.46.31-.82.7l-.13-.19.16-.06-.03-.16-.34.29L2 4.5q.36-.48.72-.54l.04-.1V3.8q.16 0 .15-.06l.13-.06a6 6 0 0 0 1.13-.9v-.03H4.1l-.12.07q0-.1-.1-.1l-.15.07-.04-.1q.93-.52 1.63-1.05Q7.89.65 9.5.5M8.46 7.83l-.32.04c-1.31.54-2.31.82-2.91.88a71 71 0 0 0-2.2 4.54h.07q.58-.04 3.04-1.42.13 0 1.66-1.05L9.18 9.7v.03q.45-.2.81-1.3v-.2q-.5-.46-1.53-.4m.28-5.75c-.5.1-.75.19-.72.38l-1.16 2.6q-.17.1-.34.95-.3.48-.25.77v.1l.22.05A15 15 0 0 1 8.86 6c1.1-.71 2.12-1.38 2.8-2.54q.24-.33.21-.54-.02-.33-.4-.54c-.54 0-1.07-.34-1.63-.28l-.94-.03z" clip-rule="evenodd"/>
56
- </symbol>`,mN=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
56
+ </symbol>`,fN=`<symbol id="file-tree-builtin-bash" viewBox="0 0 16 16">
57
57
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
58
58
  <path fill="currentColor" d="M11.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zM7 6.75C7 6.42 6.64 6 6 6s-1 .42-1 .75q-.01.25.22.41.26.21.89.35.74.14 1.28.53c.37.29.61.7.61 1.21 0 .87-.68 1.5-1.5 1.7v.55a.5.5 0 0 1-1 0v-.56c-.82-.18-1.5-.82-1.5-1.69a.5.5 0 0 1 1 0c0 .33.36.75 1 .75s1-.42 1-.75q.01-.25-.22-.41a2 2 0 0 0-.89-.35q-.74-.14-1.28-.53A1.5 1.5 0 0 1 4 6.75c0-.87.68-1.5 1.5-1.7V4.5a.5.5 0 0 1 1 0v.56c.82.18 1.5.82 1.5 1.69a.5.5 0 0 1-1 0" class="fg-stroke"/>
59
- </symbol>`,hN=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
59
+ </symbol>`,pN=`<symbol id="file-tree-builtin-biome" viewBox="0 0 16 16">
60
60
  <path fill="currentColor" d="M8 2 4.88 7.35a7 7 0 0 1 3.7-.13l1.04.25-.99 4.16-1.05-.25a2.7 2.7 0 0 0-3.07 1.45l-.98-.47a4 4 0 0 1 1.07-1.31 3.8 3.8 0 0 1 3.23-.71l.5-2.08a6 6 0 0 0-5.07 1.12A5.9 5.9 0 0 0 1 14h14z"/>
61
- </symbol>`,gN=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
61
+ </symbol>`,mN=`<symbol id="file-tree-builtin-bootstrap" viewBox="0 0 16 16">
62
62
  <path fill="currentColor" fill-rule="evenodd" d="M11.72 1.5A2.5 2.5 0 0 1 14.2 4q.02 1.08.3 2.09c.22.73.56 1.24 1.08 1.45.22.08.4.27.4.5s-.18.43-.4.51q-.76.34-1.08 1.45c-.2.65-.27 1.32-.3 2a2.5 2.5 0 0 1-2.48 2.5H4.25A2.6 2.6 0 0 1 1.7 12c-.04-.85-.1-1.68-.22-2.04C1.26 9.23.92 8.7.4 8.5.18 8.42 0 8.23 0 8s.18-.42.4-.5q.77-.35 1.09-1.46c.1-.36.17-1.19.2-2.04a2.6 2.6 0 0 1 2.56-2.5z" class="bg" clip-rule="evenodd" opacity=".2"/>
63
63
  <path fill="currentColor" fill-rule="evenodd" d="M8.47 4.54c1.23 0 2.04.68 2.04 1.73 0 .73-.55 1.39-1.24 1.5v.04c.94.1 1.58.77 1.58 1.7 0 1.2-.9 1.95-2.37 1.95H5.97a.3.3 0 0 1-.2-.08.3.3 0 0 1-.08-.2V4.82a.3.3 0 0 1 .08-.2.3.3 0 0 1 .2-.08zm-1.7 6.04h1.49q1.47-.01 1.49-1.15Q9.74 8.31 8.2 8.3H6.77zm0-5.16v2.06h1.21c.93 0 1.45-.38 1.45-1.06 0-.65-.44-1-1.22-1z" class="fg" clip-rule="evenodd"/>
64
- </symbol>`,_N=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
64
+ </symbol>`,hN=`<symbol id="file-tree-builtin-browserslist" viewBox="0 0 16 16">
65
65
  <path fill="currentColor" d="M8.88 6.96c0 3.82 3.72 4.7 5.7 3.74-.23.9-1.04 1.67-2.35 1.93-.02.4.42 1.28.82 1.63-.9.35-1.94-.12-2.51-.48a5 5 0 0 0-.32 1.87c-.68 0-1.57-1-1.8-1.37-.3.18-.85 1.15-.96 1.72a2.4 2.4 0 0 1-.81-.86 2.4 2.4 0 0 1-.3-1.15c-.38.27-1.48.95-1.99 1.18-.25-.58-.15-1.3 0-2.06-.21.12-1.8.27-2.43.12.32-.36.75-1.19.94-1.57A4.5 4.5 0 0 1 .44 10.6c.48-.22.97-.53 1.49-1.06C1.26 9.17.24 8.64 0 7.7a6 6 0 0 0 1.79-.32C1.28 7.08.44 6.15.6 5.01c.42.21 1.3.37 1.73.3a3.4 3.4 0 0 1-.25-2.75 5 5 0 0 0 1.48 1c-.08-.8.3-2.31.8-2.71.2.46.73 1.21 1.08 1.4.09-.61.87-2.06 1.57-2.25 0 .5.27 1.4.5 1.67.51-.54 2.25-1.44 3.64-1.13-.43.45-.75.61-.86.98 1.05 0 2.78.34 4.27 1.93-2.34-.89-5.69.56-5.69 3.5" class="bg" opacity=".5"/>
66
66
  <path fill="currentColor" d="M11.21 3.59a4.1 4.1 0 0 0 2.47 2.89c.24-.22.61-.38.95-.19.76.44.2 1.26-.34 1.66l-.07.06a13 13 0 0 1-4.49 1.61l-.3-.43a10.5 10.5 0 0 0 4.13-1.31 1 1 0 0 0 .23-.25.5.5 0 0 0-.21-.69l-.15-.06a4.5 4.5 0 0 1-1.77-1.31 4.5 4.5 0 0 1-.88-1.77q.2-.12.43-.21"/>
67
67
  <path fill="currentColor" d="M10.36 5.18a.4.4 0 0 0-.03.38c.09.2.3.3.46.23s.24-.3.15-.5l-.01-.02q.23.13.34.39a.83.83 0 0 1-.43 1.08.8.8 0 0 1-1.08-.43.83.83 0 0 1 .6-1.13"/>
68
- </symbol>`,vN=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
68
+ </symbol>`,gN=`<symbol id="file-tree-builtin-bun" viewBox="0 0 16 16">
69
69
  <path fill="currentColor" d="M8 14c3.87 0 7-2.46 7-5.49 0-1.88-1.2-3.53-3.04-4.52q-1.1-.61-1.84-1.07C9.2 2.35 8.64 2 8 2s-1.36.45-2.31 1.03A29 29 0 0 1 4.04 4C2.2 4.98 1 6.63 1 8.51 1 11.54 4.13 14 8 14M7.18 3.88q.3-.66.3-1.37c0-.08.11-.1.13-.01.38 1.57-.53 2.35-1.2 2.61-.08.03-.12-.07-.06-.12a3 3 0 0 0 .83-1.12m1.2-.05a3 3 0 0 0-.45-1.3V2.5c-.04-.07.05-.15.1-.1 1.15 1.2.77 2.3.33 2.87-.05.05-.13 0-.11-.08q.21-.67.13-1.37m1.04-.32a3 3 0 0 0-.94-1.02v-.01c-.06-.05-.01-.16.07-.12 1.51.61 1.61 1.8 1.43 2.5l-.03.03a.07.07 0 0 1-.1-.06 3 3 0 0 0-.43-1.32m-2.97.32c-.36.3-.74.43-1.2.56q-.11 0-.1-.1a3.5 3.5 0 0 0 1.76-1.57s.09-.07.1.04c0 .18-.2.76-.56 1.07m2.89 6.36q-.13.52-.55.88a1.3 1.3 0 0 1-.75.35 1.3 1.3 0 0 1-.77-.35 1.7 1.7 0 0 1-.54-.88.13.13 0 0 1 .15-.15h2.31a.14.14 0 0 1 .15.15M6.15 8.95a1.1 1.1 0 0 1-1.39-.14A1.1 1.1 0 0 1 5.12 7a1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1-.17 1.69m4.96 0a1.1 1.1 0 0 1-1.4-.14 1.1 1.1 0 0 1 .37-1.8 1.1 1.1 0 0 1 1.2.25 1.1 1.1 0 0 1 .24 1.2 1 1 0 0 1-.41.5"/>
70
- </symbol>`,yN=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
70
+ </symbol>`,_N=`<symbol id="file-tree-builtin-claude" viewBox="0 0 16 16">
71
71
  <path fill="currentColor" d="M3.75 10.31 6.5 8.77l.04-.14-.04-.07h-.14l-.46-.03-1.57-.04-1.38-.07-1.33-.07-.34-.07L1 7.86l.03-.21.28-.18.4.03.89.07 1.33.08.97.06 1.43.16h.22l.03-.1-.07-.05-.06-.06-1.39-.92-1.48-.98-.79-.57-.42-.28-.2-.28-.1-.6.39-.41.52.04.12.03.52.4 1.12.86L6.2 6.04l.2.17.09-.06.01-.04-.1-.15-.76-1.46-.85-1.46-.37-.6-.1-.36a1 1 0 0 1-.06-.42l.42-.59.25-.07.6.08.22.2.36.84.58 1.3.9 1.77.29.53.14.47.04.14h.1v-.07l.07-1 .14-1.22.14-1.57.04-.45.23-.53.42-.28.36.15.28.41-.04.25-.16 1.08-.36 1.7-.21 1.14h.12l.14-.15.58-.76.97-1.2.42-.5.5-.51.32-.25h.6l.44.66-.2.68-.61.79-.52.65-.74 1-.45.8.04.05h.1l1.68-.36.9-.16 1.06-.18.5.23.05.22-.2.48-1.15.28-1.34.28-2 .46-.04.01.03.04.9.09.4.03h.94l1.77.14.46.28.27.37-.04.28-.72.37-.95-.23-2.24-.53-.76-.18h-.11v.06l.64.63L12 10.86l1.48 1.35.07.34-.18.28-.2-.03-1.29-.98-.5-.42-1.12-.95h-.07v.1l.25.38 1.37 2.05.07.63-.1.2-.36.14-.38-.08-.8-1.12-.85-1.26-.66-1.15-.07.05-.4 4.23-.19.21-.42.17-.35-.28-.2-.42.2-.87.23-1.12.18-.9.17-1.1.1-.36v-.03h-.1l-.84 1.16-1.27 1.72-1 1.07-.24.1-.42-.22.04-.39.22-.32 1.4-1.8.84-1.1.57-.64-.02-.07h-.04l-3.7 2.4-.66.09-.28-.28.03-.42.14-.14 1.12-.77z"/>
72
- </symbol>`,bN=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
72
+ </symbol>`,vN=`<symbol id="file-tree-builtin-css" viewBox="0 0 16 16">
73
73
  <path fill="currentColor" d="M8 15c-5.76 0-7-1.24-7-7V2a1 1 0 0 1 1-1h6c5.77 0 7 1.24 7 7s-1.24 7-7 7" class="vector" opacity=".2"/>
74
74
  <path fill="currentColor" d="M10.1 9.19h.73c.03.49.22.6 1 .6.76 0 .93-.12.93-.68 0-.52-.17-.67-.94-.85-1.38-.3-1.68-.56-1.68-1.47 0-1.05.3-1.29 1.67-1.29 1.29 0 1.57.2 1.6 1.13h-.74c-.01-.34-.17-.42-.85-.42-.77 0-.94.1-.94.58 0 .42.17.55.96.73 1.36.3 1.66.58 1.66 1.59 0 1.14-.31 1.39-1.73 1.39-1.39 0-1.69-.24-1.67-1.31m-3.9 0h.74c.03.49.21.6.99.6.76 0 .93-.12.93-.68 0-.52-.17-.67-.93-.85-1.39-.3-1.69-.56-1.69-1.47 0-1.05.3-1.29 1.67-1.29 1.3 0 1.58.2 1.6 1.13h-.73c-.02-.34-.18-.42-.85-.42-.78 0-.95.1-.95.58 0 .42.17.55.96.73 1.37.3 1.67.58 1.67 1.59 0 1.14-.32 1.39-1.74 1.39-1.38 0-1.68-.24-1.66-1.31m-1.22 0h.75c-.09 1.07-.37 1.31-1.56 1.31-1.37 0-1.68-.45-1.68-2.5 0-1.96.36-2.5 1.68-2.5 1.16 0 1.44.25 1.52 1.35h-.76c-.08-.52-.22-.64-.76-.64-.74 0-.9.33-.9 1.78 0 1.47.16 1.8.9 1.8.58 0 .74-.11.8-.6"/>
75
- </symbol>`,xN=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
75
+ </symbol>`,yN=`<symbol id="file-tree-builtin-database" viewBox="0 0 16 16">
76
76
  <path fill="currentColor" d="M14.953 9.733a12.4 12.4 0 0 1-.244 1.936c-.207.933-.532 1.58-.996 2.044s-1.11.789-2.044.996C10.73 14.918 9.533 15 8 15s-2.73-.082-3.669-.291c-.933-.207-1.58-.532-2.044-.996s-.789-1.11-.996-2.044c-.122-.547-.2-1.182-.244-1.92q.23.364.532.667c.64.639 1.482 1.031 2.533 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265a4 4 0 0 0 .541-.683"/>
77
77
  <path fill="currentColor" d="M14.93 5.924c-.046.663-.118 1.24-.23 1.743-.207.932-.532 1.579-.995 2.042s-1.11.789-2.042.996c-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997s-.789-1.11-.996-2.042a12 12 0 0 1-.227-1.683l.016-.188a4 4 0 0 0 .5.62c.638.639 1.48 1.031 2.532 1.265 1.046.232 2.33.315 3.884.315 1.555 0 2.838-.083 3.884-.315 1.051-.234 1.893-.626 2.532-1.265.192-.192.357-.404.506-.633z"/>
78
78
  <path fill="currentColor" d="M8 1c1.533 0 2.73.082 3.669.291.933.207 1.58.533 2.044.996.403.404.904.944.91 1.695.004.764-.509 1.318-.918 1.727-.463.463-1.11.789-2.042.996-.938.209-2.135.291-3.667.291-1.531 0-2.729-.082-3.667-.29-.932-.208-1.579-.534-2.042-.997-.406-.406-.915-.953-.915-1.71 0-.758.509-1.305.915-1.712.464-.463 1.11-.789 2.044-.996C5.27 1.082 6.467 1 8 1"/>
79
- </symbol>`,SN=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
79
+ </symbol>`,bN=`<symbol id="file-tree-builtin-default" viewBox="0 0 16 16">
80
80
  <path fill="currentColor" d="M8 1v3a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1z" class="bg" opacity=".4"/>
81
81
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
82
- </symbol>`,CN=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
82
+ </symbol>`,xN=`<symbol id="file-tree-builtin-docker" viewBox="0 0 16 16">
83
83
  <path fill="currentColor" d="M15.85 6.54c-.05-.04-.45-.36-1.31-.36q-.34 0-.68.06a2.7 2.7 0 0 0-1.14-1.79l-.23-.14-.15.23a3 3 0 0 0-.4 1q-.24 1.01.26 1.84c-.4.24-1.03.3-1.17.3H.5a.5.5 0 0 0-.5.52q-.01 1.46.46 2.83.55 1.5 1.6 2.18c.79.5 2.08.79 3.54.79q.96 0 1.94-.18a8 8 0 0 0 2.55-.97 7 7 0 0 0 1.73-1.5 10 10 0 0 0 1.7-3.06h.15a2.4 2.4 0 0 0 1.8-.7 2 2 0 0 0 .47-.74l.06-.2z"/>
84
84
  <path fill="currentColor" d="M1.48 7.36h1.4a.14.14 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H1.48a.13.13 0 0 0-.13.14v1.32q.02.13.13.13m1.94 0h1.41a.14.14 0 0 0 .13-.13V5.91q-.01-.12-.13-.14h-1.4a.13.13 0 0 0-.13.14v1.32q0 .13.12.13m1.98 0h1.4q.13 0 .14-.13V5.91a.13.13 0 0 0-.14-.14H5.4q-.1.01-.12.14v1.32q0 .13.12.13m1.95 0h1.42q.1 0 .12-.13V5.91q0-.12-.12-.14H7.35q-.1.01-.12.14v1.32q.01.13.12.13M3.42 5.5h1.41c.07 0 .13-.08.13-.15V4.03a.13.13 0 0 0-.13-.14h-1.4q-.12 0-.13.14v1.31q0 .13.12.15m1.98 0h1.4c.08 0 .14-.08.14-.15V4.03q0-.13-.14-.14H5.4q-.1 0-.12.14v1.31q0 .13.12.15m1.95 0h1.42c.06 0 .12-.08.12-.15V4.03q-.01-.13-.12-.14H7.35q-.1 0-.12.14v1.31q.01.13.12.15m0-1.9h1.42q.1-.02.12-.14v-1.3Q8.88 2 8.77 2H7.35q-.1 0-.12.14v1.3q.01.13.12.14m1.97 3.78h1.4a.13.13 0 0 0 .14-.13V5.91q-.01-.12-.13-.14H9.32q-.1.01-.12.14v1.32q.01.13.12.13" opacity=".5"/>
85
- </symbol>`,wN=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
85
+ </symbol>`,SN=`<symbol id="file-tree-builtin-eslint" viewBox="0 0 16 16">
86
86
  <path fill="currentColor" d="M11.16 6.1 8.12 4.35a.3.3 0 0 0-.24 0L4.84 6.1a.3.3 0 0 0-.12.2v3.5q0 .14.12.22l3.04 1.74q.12.08.24 0l3.04-1.74a.2.2 0 0 0 .13-.22V6.3a.3.3 0 0 0-.13-.2" opacity=".5"/>
87
87
  <path fill="currentColor" d="m.1 7.69 3.63-6.3A.8.8 0 0 1 4.37 1h7.26c.26 0 .5.17.64.4l3.63 6.27a.8.8 0 0 1 0 .75l-3.63 6.24a.7.7 0 0 1-.64.34H4.37a.7.7 0 0 1-.64-.34L.1 8.41a.7.7 0 0 1 0-.72m3 3.02q.01.15.14.23l4.63 2.66q.13.06.26 0l4.63-2.66a.3.3 0 0 0 .14-.23V5.4a.3.3 0 0 0-.14-.23L8.13 2.52a.3.3 0 0 0-.26 0L3.24 5.17a.3.3 0 0 0-.14.23z"/>
88
- </symbol>`,TN=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
88
+ </symbol>`,CN=`<symbol id="file-tree-builtin-font" viewBox="0 0 16 16">
89
89
  <path fill="currentColor" d="M12.3 13c-1.59 0-2.68-.99-2.68-2.5 0-1.43 1-2.34 2.88-2.35h2.16v-.83c0-1.08-.62-1.68-1.73-1.68-1.05 0-1.66.54-1.73 1.36H9.93c.09-1.43 1.06-2.48 3.05-2.48 1.75 0 3.02.95 3.02 2.68v5.66h-1.29v-1.02h-.04c-.41.66-1.16 1.16-2.37 1.16m.36-1.12c1.14 0 2-.72 2-1.74v-.96H12.6c-1.12 0-1.6.54-1.6 1.28 0 .97.8 1.42 1.66 1.42m-11.24.98H0L3.8 2h1.39l3.8 10.86H7.54l-1.08-3.2H2.5zm3.09-9.25h-.04l-1.6 4.95H6.1z"/>
90
- </symbol>`,EN=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
90
+ </symbol>`,wN=`<symbol id="file-tree-builtin-git" viewBox="0 0 16 16">
91
91
  <path fill="currentColor" d="M14.74 7.38 8.62 1.26a.9.9 0 0 0-1.27 0L6.08 2.53l1.61 1.61a1.07 1.07 0 0 1 1.36 1.37l1.55 1.55a1.07 1.07 0 0 1 1.1 1.77 1.07 1.07 0 0 1-1.74-1.16L8.5 6.22v3.8a1.07 1.07 0 1 1-.89-.02V6.15a1.07 1.07 0 0 1-.58-1.4l-1.58-1.6-4.2 4.2a.9.9 0 0 0 0 1.27l6.12 6.12a.9.9 0 0 0 1.27 0l6.09-6.09a.9.9 0 0 0 0-1.27"/>
92
- </symbol>`,DN=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
92
+ </symbol>`,TN=`<symbol id="file-tree-builtin-go" viewBox="0 0 16 16">
93
93
  <path fill="currentColor" fill-rule="evenodd" d="M4.41 4.57A3.2 3.2 0 0 1 6.87 5q.74.49 1.08 1.29.08.12-.1.16l-1.55.4c-.14.03-.15.04-.27-.1a1 1 0 0 0-.44-.34 1.6 1.6 0 0 0-1.68.14q-.95.61-.94 1.73c0 .73.52 1.33 1.25 1.43q.95.1 1.58-.6l.25-.34h-1.8c-.19 0-.24-.12-.17-.27.12-.28.34-.76.47-1a.3.3 0 0 1 .24-.14h2.98a4 4 0 0 1 .64-1.19 4 4 0 0 1 2.6-1.52 3.5 3.5 0 0 1 2.64.46q1.13.73 1.31 2.04a3.5 3.5 0 0 1-1.06 3.09q-.93.92-2.23 1.17l-.74.08a3.5 3.5 0 0 1-2.27-.8 3 3 0 0 1-.93-1.42 4 4 0 0 1-.39.61 4 4 0 0 1-2.64 1.56 3.3 3.3 0 0 1-2.5-.6 3 3 0 0 1-1.18-2.03 3.5 3.5 0 0 1 .8-2.67 4 4 0 0 1 2.6-1.58M13.1 7.5a1.53 1.53 0 0 0-1.9-1.21q-1.3.3-1.62 1.59a1.5 1.5 0 0 0 .85 1.72q.77.33 1.52-.05a2 2 0 0 0 1.18-1.74q0-.17-.03-.3" clip-rule="evenodd"/>
94
- </symbol>`,ON=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
94
+ </symbol>`,EN=`<symbol id="file-tree-builtin-graphql" viewBox="0 0 16 16">
95
95
  <path fill="currentColor" fill-rule="evenodd" d="M8 1a1.25 1.25 0 0 1 1.18 1.65l2.8 1.61q.33-.25.77-.26a1.25 1.25 0 0 1 .48 2.4v3.2a1.25 1.25 0 1 1-1.25 2.13l-2.8 1.62A1.25 1.25 0 0 1 8 15a1.25 1.25 0 0 1-1.18-1.65l-2.8-1.62q-.33.26-.77.27a1.25 1.25 0 0 1-.48-2.4V6.4a1.25 1.25 0 1 1 1.25-2.14l2.8-1.61A1.25 1.25 0 0 1 8 1M4.44 11.14l-.06.13 2.75 1.58a1.25 1.25 0 0 1 1.74 0l2.74-1.58-.05-.13zm3.89-7.68a1.3 1.3 0 0 1-.66 0L4.03 9.77q.37.3.45.78h7.04q.08-.48.45-.78zM4.38 4.73a1.24 1.24 0 0 1-1.02 1.76v3.02l.13.01 3.67-6.35-.03-.02zm4.46-1.56 3.67 6.35.13-.01V6.49a1.25 1.25 0 0 1-1.03-1.76L8.87 3.15z" clip-rule="evenodd"/>
96
- </symbol>`,kN=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
96
+ </symbol>`,DN=`<symbol id="file-tree-builtin-html" viewBox="0 0 16 16">
97
97
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
98
98
  <path fill="currentColor" d="M10.48 3.76a.5.5 0 0 1 .4.58L10.6 5.8h1.14a.5.5 0 0 1 0 1h-1.32L10 9.2h1.08a.5.5 0 0 1 0 1H9.8l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H6.4l-.3 1.64a.5.5 0 1 1-.98-.18l.27-1.46H4.25a.5.5 0 0 1 0-1h1.32L6 6.8H4.93a.5.5 0 0 1 0-1H6.2l.3-1.64a.5.5 0 1 1 .98.18L7.2 5.8h2.4l.3-1.64a.5.5 0 0 1 .58-.4M6.58 9.2h2.4l.44-2.4h-2.4z" class="fg"/>
99
- </symbol>`,AN=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
99
+ </symbol>`,ON=`<symbol id="file-tree-builtin-image" viewBox="0 0 16 16">
100
100
  <path fill="currentColor" d="M12.5 2A2.5 2.5 0 0 1 15 4.5v4.67l-4.05-3.54-4.08 4.08-3-2L1 10.6V4.5A2.5 2.5 0 0 1 3.5 2z" opacity=".3"/>
101
101
  <path fill="currentColor" d="M15 10.5v1a2.5 2.5 0 0 1-2.5 2.5h-9a2.5 2.5 0 0 1-2.46-2.04L4 9l3 2 4-4zm-7-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0"/>
102
- </symbol>`,jN=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
102
+ </symbol>`,kN=`<symbol id="file-tree-builtin-javascript" viewBox="0 0 16 16">
103
103
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
104
104
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66M3.5 9.5h.98c0 .76.15.92.85.92.77 0 .94-.18.94-1.02V5.1h1v4.34c0 1.54-.35 1.87-1.92 1.87-1.55 0-1.89-.32-1.86-1.8"/>
105
- </symbol>`,MN=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
105
+ </symbol>`,AN=`<symbol id="file-tree-builtin-json" viewBox="0 0 16 16">
106
106
  <path fill="currentColor" d="M13.25 11.5V9.75a.5.5 0 0 1 .36-.48l.55-.15a1.16 1.16 0 0 0 0-2.24l-.55-.15a.5.5 0 0 1-.36-.48V4.5a2.5 2.5 0 0 0-2.5-2.5h-.25a.5.5 0 0 0 0 1h.25a1.5 1.5 0 0 1 1.5 1.5v1.75a1.5 1.5 0 0 0 1.09 1.44l.54.15a.16.16 0 0 1 0 .32l-.54.15a1.5 1.5 0 0 0-1.09 1.44v1.75a1.5 1.5 0 0 1-1.5 1.5h-.25a.5.5 0 0 0 0 1h.25a2.5 2.5 0 0 0 2.5-2.5m-10.5 0V9.75a.5.5 0 0 0-.36-.48l-.55-.15a1.16 1.16 0 0 1 0-2.24l.55-.15a.5.5 0 0 0 .36-.48V4.5A2.5 2.5 0 0 1 5.25 2h.25a.5.5 0 0 1 0 1h-.25a1.5 1.5 0 0 0-1.5 1.5v1.75a1.5 1.5 0 0 1-1.09 1.44l-.54.15a.16.16 0 0 0 0 .32l.54.15a1.5 1.5 0 0 1 1.09 1.45v1.74a1.5 1.5 0 0 0 1.5 1.5h.25a.5.5 0 0 1 0 1h-.25a2.5 2.5 0 0 1-2.5-2.5"/>
107
- </symbol>`,NN=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
107
+ </symbol>`,jN=`<symbol id="file-tree-builtin-markdown" viewBox="0 0 16 16">
108
108
  <path fill="currentColor" d="M1 12V4h2l2 2.5L7 4h2v8H7V7.5l-2 2-2-2V12zm9-3 3 3.5L16 9h-2V4h-2v5z"/>
109
- </symbol>`,PN=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
109
+ </symbol>`,MN=`<symbol id="file-tree-builtin-mcp" viewBox="0 0 16 16">
110
110
  <path fill="currentColor" d="M9.26-.04a3 3 0 0 1 2 .82 2.8 2.8 0 0 1 .8 2.35 2.9 2.9 0 0 1 2.41.8l.03.02a2.74 2.74 0 0 1 0 3.94l-5.8 5.69-.04.06-.02.07q0 .04.02.07.01.04.04.06l1.2 1.17a.55.55 0 0 1 0 .79.6.6 0 0 1-.81 0l-1.2-1.17a1.3 1.3 0 0 1 0-1.84L13.7 7.1a1.65 1.65 0 0 0 .37-1.82 2 2 0 0 0-.37-.54l-.03-.03a1.73 1.73 0 0 0-2.4 0L6.47 9.4l-.07.06a.58.58 0 0 1-.92-.18.6.6 0 0 1 .12-.6l4.85-4.76a1.65 1.65 0 0 0 0-2.36 1.73 1.73 0 0 0-2.4 0l-6.43 6.3a.6.6 0 0 1-.8 0 .55.55 0 0 1 0-.8L7.25.79a3 3 0 0 1 2-.82"/>
111
111
  <path fill="currentColor" d="M9.26 2.19a.6.6 0 0 1 .52.34.6.6 0 0 1 0 .43l-.12.18L4.9 7.79a1.65 1.65 0 0 0 0 2.36 1.73 1.73 0 0 0 2.4 0l4.75-4.66a.58.58 0 0 1 .93.18.6.6 0 0 1-.12.61l-4.75 4.66a2.9 2.9 0 0 1-4.01 0 2.75 2.75 0 0 1-.62-3.04A3 3 0 0 1 4.1 7l4.74-4.65a.6.6 0 0 1 .4-.16"/>
112
- </symbol>`,FN=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
112
+ </symbol>`,NN=`<symbol id="file-tree-builtin-nextjs" viewBox="0 0 16 16">
113
113
  <defs>
114
114
  <linearGradient id="a" x1="4.522" x2="14" y1="3.943" y2="16" gradientUnits="userSpaceOnUse">
115
115
  <stop stop-color="currentColor"/>
@@ -119,82 +119,82 @@ This template lives in your user home (~/.ok/templates/) — deleting affects ev
119
119
  <path fill="currentColor" d="M3 2h1.522v9.09H3z"/>
120
120
  <path fill="url(#a)" d="M4.903 2 15 15.075q-.565.5-1.195.925L4.522 3.943z"/>
121
121
  <path fill="currentColor" d="M12.172 2h-1.508v9.094h1.508z"/>
122
- </symbol>`,IN=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
122
+ </symbol>`,PN=`<symbol id="file-tree-builtin-npm" viewBox="0 0 16 16">
123
123
  <path fill="currentColor" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1z" class="vector" opacity=".2"/>
124
124
  <path fill="currentColor" d="M10.5 13H13V3H3v10h5V5.5h2.5z"/>
125
- </symbol>`,LN=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
125
+ </symbol>`,FN=`<symbol id="file-tree-builtin-oxc" viewBox="0 0 16 16">
126
126
  <path fill="currentColor" d="M9.5 1a.5.5 0 0 1 .5.5V3h3.5a.5.5 0 0 1 .38.83L10.5 7.69v1.44q.41.04.95-.16a4 4 0 0 0 .72-.35l.04-.03h.01a.5.5 0 0 1 .67.1l2 2.5a.5.5 0 0 1 0 .62c-.76.96-3.14 2.69-6.89 2.69s-6.13-1.73-6.89-2.69a.5.5 0 0 1 0-.62l2-2.5a.5.5 0 0 1 .67-.1l.05.03.16.09q.22.13.56.26.54.2.95.16V7.69L2.12 3.83A.5.5 0 0 1 2.5 3H6V1.5a.5.5 0 0 1 .5-.5zM7 3.5a.5.5 0 0 1-.5.5H3.6l2.78 3.17a.5.5 0 0 1 .12.33v2a.5.5 0 0 1-.28.45c-.7.35-1.5.15-2.02-.05a5 5 0 0 1-.58-.26l-1.46 1.84c.82.78 2.8 2.02 5.84 2.02s5.02-1.24 5.84-2.02l-1.46-1.83a5 5 0 0 1-.58.26c-.52.2-1.33.39-2.02.04a.5.5 0 0 1-.28-.45v-2a.5.5 0 0 1 .12-.33L12.4 4H9.5a.5.5 0 0 1-.5-.5V2H7z"/>
127
- </symbol>`,RN=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
127
+ </symbol>`,IN=`<symbol id="file-tree-builtin-postcss" viewBox="0 0 16 16">
128
128
  <path fill="currentColor" d="M14.5 8a6.5 6.5 0 0 0-5.9-6.47l5.42 8.93A7 7 0 0 0 14.5 8M2.88 12A6.5 6.5 0 0 0 8 14.5c2.08 0 3.93-.98 5.12-2.5zm8.62-1h1.68L11.5 8.24zm-1-.55a4 4 0 0 1-.7.55h.7zM8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M5.5 11h.7a4 4 0 0 1-.7-.55zm-2.68 0H4.5V8.24zm3.76-6.2A4 4 0 0 1 8 4.5q.76 0 1.42.3L8 2.46zM1.5 8q0 1.31.48 2.46L7.4 1.53A6.5 6.5 0 0 0 1.5 8m14 0a7.5 7.5 0 0 1-.99 3.72l-.01.03-.02.03A7.5 7.5 0 0 1 8 15.5a7.5 7.5 0 0 1-6.5-3.75l-.01-.03A7.5 7.5 0 1 1 15.5 8"/>
129
- </symbol>`,zN=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
129
+ </symbol>`,LN=`<symbol id="file-tree-builtin-prettier" viewBox="0 0 16 16">
130
130
  <path fill="currentColor" d="M6 12v1H4.93v-1zm1-2v1H2v-1zm6-4v1h-3V6zm-1-4v1H9V2z"/>
131
131
  <path fill="currentColor" d="M11.5 10v1H8v-1zM5 6v1H2V6zm5-2v1H9V4z" opacity=".8"/>
132
132
  <path fill="currentColor" d="M6 14v1H2v-1zm-.5-6v1H2V8zM13 4v1h-3V4zM4.93 2v1H2V2z" opacity=".6"/>
133
133
  <path fill="currentColor" d="M4.93 12v1H2v-1zM13 8v1H9V8zM5.5 4v1H2V4zM9 2v1H4.93V2z" opacity=".4"/>
134
- </symbol>`,BN=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
134
+ </symbol>`,RN=`<symbol id="file-tree-builtin-python" viewBox="0 0 16 16">
135
135
  <path fill="currentColor" d="M8.33 8.4H10c1.16 0 1.9-.73 1.9-1.86V5.08q0-.24.25-.24h.74c.75 0 1.33.32 1.66.97q.4.73.41 1.46c.09.9.09 1.78-.24 2.67-.25.73-.75 1.3-1.58 1.46h-4.8c-.08 0-.25 0-.25.08v.4s.17.09.25.09h2.82q.34-.02.33.32v1.06c0 .56-.25.97-.75 1.13-.41.16-.83.33-1.24.4a7 7 0 0 1-2.98-.07 3 3 0 0 1-1.16-.49c-.33-.32-.58-.65-.5-1.14v-2.91c0-1.13.67-1.78 1.82-1.78q.89-.1 1.66-.08m2.32 4.86a.65.65 0 0 0-.66-.65c-.34 0-.67.33-.67.65s.33.57.67.65a.65.65 0 0 0 .66-.65" class="bg" opacity=".8"/>
136
136
  <path fill="currentColor" d="M7.67 7.6H6c-1.16 0-1.9.73-1.9 1.86v1.46q0 .24-.25.24h-.74c-.75 0-1.33-.32-1.66-.97a3 3 0 0 1-.41-1.46 6 6 0 0 1 .24-2.67c.25-.73.75-1.3 1.58-1.46h4.8c.08 0 .25 0 .25-.08v-.4s-.17-.09-.25-.09H4.85c-.24 0-.33-.08-.33-.32V2.65c0-.56.25-.97.75-1.13.41-.16.83-.33 1.24-.4a7 7 0 0 1 2.98.07c.41.09.83.25 1.16.49.33.32.58.65.5 1.13v2.92c0 1.14-.67 1.78-1.82 1.78-.58.08-1.16.08-1.66.08M5.35 2.73c0 .33.25.65.66.65.33 0 .66-.32.66-.65 0-.32-.33-.56-.66-.64a.65.65 0 0 0-.66.64" class="fg"/>
137
- </symbol>`,VN=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
137
+ </symbol>`,zN=`<symbol id="file-tree-builtin-react" viewBox="0 0 16 16">
138
138
  <path fill="currentColor" d="M8 6.65c.73 0 1.31.6 1.31 1.35S8.73 9.35 8 9.35 6.69 8.75 6.69 8 7.27 6.65 8 6.65"/>
139
139
  <path fill="currentColor" fill-rule="evenodd" d="M8 2.55c1.3-.99 2.59-1.34 3.5-.8.92.55 1.27 1.87 1.08 3.53C14.06 5.94 15 6.9 15 8s-.94 2.06-2.42 2.72c.19 1.65-.16 2.98-1.08 3.52-.91.55-2.2.2-3.5-.8-1.3 1-2.58 1.35-3.5.8-.91-.54-1.27-1.87-1.08-3.52C1.94 10.06 1 9.1 1 8s.94-2.06 2.42-2.72c-.19-1.66.17-2.98 1.08-3.52s2.2-.2 3.5.8M4.26 11.2c-.08 1.34.28 2.03.68 2.26s1.15.22 2.25-.52l.11-.09a12 12 0 0 1-1.24-1.39 11 11 0 0 1-1.8-.41zm7.47-.15q-.83.27-1.79.41-.6.8-1.24 1.4l.11.08c1.1.74 1.86.76 2.25.52.4-.23.76-.92.68-2.26zm-3.04.54a14 14 0 0 1-1.38 0q.34.38.69.7.35-.32.7-.7M8 5.29q-.76 0-1.47.1A13 13 0 0 0 5.07 8a14 14 0 0 0 1.46 2.62 13 13 0 0 0 2.94 0A13 13 0 0 0 10.93 8a14 14 0 0 0-1.46-2.62A13 13 0 0 0 8 5.3M4.64 9.18q-.15.5-.25.96.44.16.94.27a15 15 0 0 1-.7-1.23m6.73 0a15 15 0 0 1-.7 1.23q.5-.11.95-.27a10 10 0 0 0-.25-.96M3.44 6.26C2.27 6.86 1.87 7.53 1.87 8s.4 1.14 1.57 1.74l.13.07q.18-.88.55-1.81a12 12 0 0 1-.55-1.8q-.07.02-.13.06m8.99-.07A12 12 0 0 1 11.88 8q.36.94.55 1.8l.13-.06c1.17-.6 1.56-1.27 1.56-1.74s-.39-1.14-1.56-1.74zm-7.1-.6q-.5.11-.94.27.1.46.25.96a15 15 0 0 1 .69-1.23m5.34 0a15 15 0 0 1 .7 1.23q.14-.5.24-.96-.44-.15-.94-.27M7.18 3.06c-1.09-.74-1.85-.76-2.24-.52s-.76.92-.69 2.26l.01.15a11 11 0 0 1 1.8-.41q.6-.8 1.24-1.4zm3.88-.52c-.4-.24-1.15-.22-2.25.52l-.12.08q.65.6 1.25 1.4.96.15 1.8.41v-.14c.08-1.35-.28-2.04-.68-2.27M8 3.7a10 10 0 0 0-.7.7 14 14 0 0 1 1.4 0 10 10 0 0 0-.7-.7" clip-rule="evenodd"/>
140
- </symbol>`,HN=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
140
+ </symbol>`,BN=`<symbol id="file-tree-builtin-ruby" viewBox="0 0 16 16">
141
141
  <path fill="currentColor" fill-rule="evenodd" d="M11.04 2c.48 0 .92.23 1.18.6l2.54 3.65c.37.52.3 1.23-.15 1.69l-5.58 5.64a1.47 1.47 0 0 1-2.06 0L1.39 7.94a1.3 1.3 0 0 1-.15-1.7l2.54-3.63q.2-.3.5-.45.33-.16.68-.16zm.84 2.17a.5.5 0 0 0-.7-.05L8 6.84 4.83 4.12a.5.5 0 0 0-.65.76L6.65 7H3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1H9.35l2.48-2.12a.5.5 0 0 0 .05-.7" clip-rule="evenodd"/>
142
- </symbol>`,UN=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
142
+ </symbol>`,VN=`<symbol id="file-tree-builtin-rust" viewBox="0 0 16 16">
143
143
  <path fill="currentColor" fill-rule="evenodd" d="M8 .8a.2.2 0 0 1 .18.1l.38.6.16.02.5-.53.01-.01a.2.2 0 0 1 .33.08l.25.68.16.05.59-.43h.02a.2.2 0 0 1 .3.14l.12.71.15.08.65-.3a.2.2 0 0 1 .2.02.2.2 0 0 1 .1.18l-.03.72.12.1.71-.16a.2.2 0 0 1 .25.25l-.17.7q.06.06.1.13l.73-.03A.2.2 0 0 1 14 4a.2.2 0 0 1 .02.2l-.3.66.08.14.71.12a.2.2 0 0 1 .14.32l-.43.59.05.16.68.25a.2.2 0 0 1 .07.35l-.53.49.01.16.62.38a.2.2 0 0 1 0 .36l-.62.38-.01.16.53.5a.2.2 0 0 1-.07.34l-.68.25-.05.16.43.59a.2.2 0 0 1-.14.32l-.72.12-.07.15.3.65a.2.2 0 0 1-.02.2.2.2 0 0 1-.18.1l-.72-.03-.1.13.16.7a.2.2 0 0 1-.25.25l-.7-.17-.13.1.03.73a.2.2 0 0 1-.1.18.2.2 0 0 1-.2.02l-.66-.3-.14.08-.12.71a.2.2 0 0 1-.32.14l-.59-.43-.16.05-.25.68a.2.2 0 0 1-.34.07l-.5-.53-.16.01-.38.62a.2.2 0 0 1-.36 0l-.38-.62-.16-.01-.5.53a.2.2 0 0 1-.34-.07l-.25-.68-.16-.05-.59.43a.2.2 0 0 1-.32-.14L5 13.78l-.15-.07-.65.3a.2.2 0 0 1-.2-.02.2.2 0 0 1-.1-.18l.03-.72-.13-.1-.7.16a.2.2 0 0 1-.25-.25l.17-.7-.1-.13-.73.03a.2.2 0 0 1-.2-.3l.3-.66-.08-.14-.71-.12a.2.2 0 0 1-.14-.32l.43-.59-.05-.16-.68-.25A.2.2 0 0 1 1 9.22l.53-.5-.02-.16-.6-.38A.2.2 0 0 1 .8 8a.2.2 0 0 1 .1-.18l.6-.38.02-.16-.53-.5a.2.2 0 0 1 .07-.34l.68-.25.05-.16-.43-.59a.2.2 0 0 1 .14-.32L2.2 5l.08-.15L2 4.2a.2.2 0 0 1 .2-.3l.72.03.1-.13-.16-.7a.2.2 0 0 1 .25-.25l.7.16.13-.1-.03-.72A.2.2 0 0 1 4 2a.2.2 0 0 1 .2-.02l.65.3L5 2.2l.12-.71v-.03a.2.2 0 0 1 .32-.1l.59.41.16-.04.25-.68.01-.02A.2.2 0 0 1 6.8.99l.49.53.16-.02.38-.61.02-.02A.2.2 0 0 1 8 .79M6.8 9.45h1.26l.06.01q.03.01.03.05v1.52q0 .07-.09.06h-4.5A5.4 5.4 0 0 0 8 13.42a5.4 5.4 0 0 0 4.45-2.33h-2.42c-.36 0-.68-.5-.77-.75-.08-.22-.2-.91-.25-1.12-.15-.61-.59-.71-.78-.73H6.8zM8 2.58a5.4 5.4 0 0 0-4.07 1.85h5.74l.17.02c.23.03.6.12.96.35.34.23.83.68.83 1.4 0 .66-.55 1.16-1.08 1.5.42.33.7.53.86 1.44.04.17.34.32.62.29.29-.03.62-.16.62-.75v-.24q0-.1.07-.1h.68A5.43 5.43 0 0 0 8 2.59M2.96 6.03a5.4 5.4 0 0 0-.19 3.37h1.66V6.03zM6.8 7.06h1.66c.35 0 .77-.12.77-.47 0-.42-.55-.53-.65-.53H6.8z" clip-rule="evenodd"/>
144
- </symbol>`,WN=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
144
+ </symbol>`,HN=`<symbol id="file-tree-builtin-sass" viewBox="0 0 16 16">
145
145
  <path fill="currentColor" fill-rule="evenodd" d="M8.08 1.44c2.41-.91 4.96-.37 5.35 1.27.39 1.62-.92 3.56-2.6 4.25a5 5 0 0 1-3.26.35c-.58-.2-.92-.62-1-.85-.03-.09-.09-.24 0-.3.05-.03.08-.02.22.15s.7.6 1.75.48c2.78-.34 4.45-2.64 3.92-3.88-.37-.87-2.5-1.26-5.18.16C4.03 4.81 3.85 6.24 3.82 6.8c-.08 1.5 1.73 2.28 2.7 3.4q.04.03.07.08c.3-.12.7-.19 1.35-.2 1.58-.03 2.47 1.08 2.43 2.08-.03.78-.7 1.1-.82 1.13-.1.01-.14.02-.15-.06q-.03-.06.13-.15c.16-.09.42-.3.48-.72.05-.43-.24-1.44-1.76-1.63a3 3 0 0 0-1.33.08c.27.62.32 1.87-.29 2.83-.63 1-1.8 1.61-2.93 1.27-.37-.1-.93-.92-.45-2.05.46-1.07 2.4-2.12 2.66-2.26-.9-.83-3.08-1.95-3.4-3.65-.08-.49.13-1.65 1.46-2.98a12 12 0 0 1 4.11-2.52m-1.88 9.7c-.01.01-.9.47-1.52 1.17-.59.66-.75 1.48-.43 1.69.3.18 1-.04 1.51-.62a3 3 0 0 0 .5-.9q.2-.64.02-1.39z" clip-rule="evenodd"/>
146
- </symbol>`,GN=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
146
+ </symbol>`,UN=`<symbol id="file-tree-builtin-stylelint" viewBox="0 0 16 16">
147
147
  <path fill="currentColor" d="M4 3v3.5l1.5-1L7 15 .5 6l1-1.5L0 3l2.5-2h1zm12 0-1.5 1.5 1 1.5L9 15l1.5-9.5 1.5 1V3l.5-2h1zm-8 8.5a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1m0-3a.5.5 0 1 1 0 1 .5.5 0 0 1 0-1"/>
148
148
  <path fill="currentColor" d="M6.5 2.5V4l-2 1.5v-4zm5 3L9.5 4V2.5l2-1zM9 4H7V2.5h2z"/>
149
- </symbol>`,KN=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
149
+ </symbol>`,WN=`<symbol id="file-tree-builtin-svelte" viewBox="0 0 16 16">
150
150
  <path fill="currentColor" d="m3.98 3.7 3.36-2.08a4.5 4.5 0 0 1 5.9 1.23 4 4 0 0 1 .7 3.02q-.16.75-.58 1.4c.42.77.56 1.66.4 2.52a3.7 3.7 0 0 1-1.57 2.4l-.17.1-3.36 2.09a4.5 4.5 0 0 1-5.9-1.23 4 4 0 0 1-.66-1.44 4 4 0 0 1-.04-1.58 4 4 0 0 1 .58-1.4 4 4 0 0 1-.4-2.52 3.7 3.7 0 0 1 1.57-2.4zl3.36-2.08zm7.87 0a2.7 2.7 0 0 0-1.26-.95 2.7 2.7 0 0 0-1.6-.07 3 3 0 0 0-.52.2l-.16.09-3.36 2.08a2 2 0 0 0-.69.64 2 2 0 0 0-.36.86 2.3 2.3 0 0 0 .42 1.81A2.7 2.7 0 0 0 7.18 9.4q.28-.06.53-.2l.16-.09 1.28-.79.2-.09a.8.8 0 0 1 .87.31.7.7 0 0 1 .13.55.7.7 0 0 1-.24.4l-.08.05-3.36 2.08-.2.09a1 1 0 0 1-.49-.02 1 1 0 0 1-.38-.3 1 1 0 0 1-.13-.37v-.1l.01-.13-.13-.03a4 4 0 0 1-1.1-.5l-.2-.14-.18-.12-.07.18-.08.3a2.3 2.3 0 0 0 .43 1.82q.45.64 1.19.93.73.28 1.51.14l.16-.04q.27-.07.52-.2l.16-.09 3.36-2.08q.4-.25.69-.64.27-.4.36-.86a2.3 2.3 0 0 0-.42-1.82 2.7 2.7 0 0 0-1.27-.95 2.7 2.7 0 0 0-1.6-.08q-.27.07-.52.2l-.16.1-1.28.79-.2.09a1 1 0 0 1-.49-.03 1 1 0 0 1-.38-.29.7.7 0 0 1-.13-.54.7.7 0 0 1 .24-.4l.08-.06L9.33 4.4l.2-.1a.8.8 0 0 1 .87.32 1 1 0 0 1 .13.38v.22l.11.04q.6.18 1.12.5l.2.14.17.12.06-.19.08-.3a2.3 2.3 0 0 0-.42-1.81z"/>
151
- </symbol>`,qN=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
151
+ </symbol>`,GN=`<symbol id="file-tree-builtin-svg" viewBox="0 0 16 16">
152
152
  <path fill="currentColor" d="M5 7a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/>
153
153
  <path fill="currentColor" d="M6 1a5 5 0 0 1 4.58 3H7a3 3 0 0 0-3 3v3.58A5 5 0 0 1 6 1" opacity=".5"/>
154
- </symbol>`,JN=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
154
+ </symbol>`,KN=`<symbol id="file-tree-builtin-svgo" viewBox="0 0 16 16">
155
155
  <path fill="currentColor" d="M9.43 4.8A.6.6 0 1 1 9.19 6l-.56.96a1.2 1.2 0 0 1 .32 1.58l.7.53a.89.89 0 1 1-.17.22l-.7-.52a1.2 1.2 0 0 1-1.4.25l-.56.87a.75.75 0 1 1-.57-.2 1 1 0 0 1 .32.05l.56-.87a1.2 1.2 0 0 1-.4-1.24l-1.2-.47a.56.56 0 1 1 .1-.28v.02l1.2.47a1.2 1.2 0 0 1 1.56-.55l.56-.97a.6.6 0 0 1-.15-.64.6.6 0 0 1 .63-.4"/>
156
156
  <path fill="currentColor" fill-rule="evenodd" d="M9.17 1q.16.63.27 1.26a6 6 0 0 1 1.61.67q.52-.38 1.08-.71l1.65 1.64q-.32.56-.68 1.05.48.78.72 1.67.6.09 1.18.25v2.32q-.55.15-1.11.24a6 6 0 0 1-.7 1.82q.31.44.59.91l-1.65 1.65-.85-.55a6 6 0 0 1-1.9.83q-.08.47-.2.95H6.84q-.12-.46-.2-.93a6 6 0 0 1-1.96-.81q-.39.27-.8.51l-1.65-1.65q.25-.43.53-.84a6 6 0 0 1-.75-1.9L1 9.16V6.83q.54-.14 1.09-.24a6 6 0 0 1 .77-1.74q-.33-.47-.63-.98l1.65-1.65q.54.32 1.03.68a6 6 0 0 1 1.66-.66q.1-.61.26-1.24zM7.96 3.73a4 4 0 0 0-1.74.36 4.5 4.5 0 0 0-2.3 2.3 4.4 4.4 0 0 0-.1 3.29l.03.06a4.4 4.4 0 0 0 2.4 2.47 4.4 4.4 0 0 0 3.48-.02l.03-.02a4.4 4.4 0 0 0 2.3-2.42l.06-.14a4.4 4.4 0 0 0-.2-3.4 4.4 4.4 0 0 0-2.13-2.07L9.47 4a4 4 0 0 0-1.51-.27" clip-rule="evenodd"/>
157
- </symbol>`,YN=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
157
+ </symbol>`,qN=`<symbol id="file-tree-builtin-swift" viewBox="0 0 16 16">
158
158
  <path fill="currentColor" d="M9.63 1c6.15 4.35 4.16 9.15 4.16 9.15s1.75 2.05 1.04 3.85c0 0-.72-1.26-1.93-1.26-1.17 0-1.85 1.26-4.2 1.26C3.47 14 1 9.46 1 9.46c4.71 3.22 7.93.94 7.93.94C6.8 9.12 2.29 3 2.29 3c3.93 3.47 5.63 4.39 5.63 4.39-1.01-.87-3.86-5.13-3.86-5.13C6.34 4.66 10.86 8 10.86 8c1.28-3.7-1.23-7-1.23-7"/>
159
- </symbol>`,XN=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
159
+ </symbol>`,JN=`<symbol id="file-tree-builtin-table" viewBox="0 0 16 16">
160
160
  <path fill="currentColor" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" opacity=".4"/>
161
161
  <path fill="currentColor" d="M11.5 8a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5h-7a.5.5 0 0 1-.5-.5v-4a.5.5 0 0 1 .5-.5zM5 12h2.5v-1H5zm3.5 0H11v-1H8.5zM5 10h2.5V9H5zm3.5 0H11V9H8.5zm1-9a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z" class="fg"/>
162
- </symbol>`,ZN=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
162
+ </symbol>`,YN=`<symbol id="file-tree-builtin-tailwind" viewBox="0 0 16 16">
163
163
  <path fill="currentColor" fill-rule="evenodd" d="M8 4Q5.2 4 4.5 6.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C8.98 7.23 9.77 8 11.5 8q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C10.52 4.77 9.73 4 8 4M4.5 8Q1.7 8 1 10.67q1.05-1.34 2.45-1c.53.12.91.5 1.33.9C5.48 11.23 6.26 12 8 12q2.8 0 3.5-2.67-1.05 1.34-2.45 1c-.53-.12-.91-.5-1.33-.9C7.02 8.77 6.24 8 4.5 8" clip-rule="evenodd"/>
164
- </symbol>`,QN=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
164
+ </symbol>`,XN=`<symbol id="file-tree-builtin-terraform" viewBox="0 0 16 16">
165
165
  <path fill="currentColor" d="M1 0v5.05l4.35 2.53V2.53zm9.18 5.34L5.83 2.82v5.05l4.35 2.53zm.47 5.06V5.34L15 2.82v5.05zm-.48 5.6-4.35-2.53V8.42l4.35 2.53z"/>
166
- </symbol>`,$N=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
166
+ </symbol>`,ZN=`<symbol id="file-tree-builtin-text" viewBox="0 0 16 16">
167
167
  <path fill="currentColor" fill-rule="evenodd" d="M8 4a3 3 0 0 0 3 3h3v5.5a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 2 12.5v-9A2.5 2.5 0 0 1 4.5 1H8z" class="bg" clip-rule="evenodd" opacity=".4"/>
168
168
  <path fill="currentColor" d="M8.5 11a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1zm2-2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1zm-1-8a.5.5 0 0 1 .354.146l4 4A.5.5 0 0 1 14 5.5V6h-3a2 2 0 0 1-2-2V1z"/>
169
- </symbol>`,eP=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
169
+ </symbol>`,QN=`<symbol id="file-tree-builtin-typescript" viewBox="0 0 16 16">
170
170
  <path fill="currentColor" d="M8 1C2.24 1 1 2.24 1 8s1.24 7 7 7 7-1.24 7-7-1.24-7-7-7" class="bg" opacity=".2"/>
171
171
  <path fill="currentColor" d="M8.1 9.64h.95c.04.62.28.76 1.28.76s1.2-.14 1.2-.85c0-.66-.2-.85-1.2-1.07-1.79-.38-2.18-.7-2.18-1.86C8.15 5.3 8.54 5 10.31 5c1.67 0 2.04.26 2.07 1.42h-.95c-.02-.43-.23-.53-1.1-.53-1 0-1.22.14-1.22.74 0 .52.22.7 1.24.92 1.76.38 2.15.73 2.15 2 0 1.44-.4 1.75-2.24 1.75-1.8 0-2.18-.3-2.15-1.66m-3 1.57V5.99H3.5v-.9h4.21v.9H6.1v5.22z"/>
172
- </symbol>`,tP=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
172
+ </symbol>`,$N=`<symbol id="file-tree-builtin-vite" viewBox="0 0 16 16">
173
173
  <path fill="currentColor" d="M8.57 14.87c-.18.26-.55.11-.55-.22v-3.18l-.05-.27-.13-.22-.2-.15-.24-.06H4.29c-.26 0-.4-.32-.26-.55L6.08 7c.3-.46 0-1.1-.5-1.1H1.8c-.25 0-.4-.32-.25-.56l2.65-4.2A.3.3 0 0 1 4.46 1h7.9c.26 0 .4.32.26.55l-2.05 3.23c-.29.46 0 1.1.5 1.1h3.12c.26 0 .4.34.24.57z"/>
174
- </symbol>`,nP=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
174
+ </symbol>`,eP=`<symbol id="file-tree-builtin-vscode" viewBox="0 0 16 16">
175
175
  <path fill="currentColor" d="m5.11 9.68-2.4 1.84a.6.6 0 0 1-.75-.04l-.77-.7a.6.6 0 0 1 0-.87L3.28 8zm5.52-8.42a.51.51 0 0 1 .87.36V4.8L7.32 8 5.1 6.32z" opacity=".75"/>
176
176
  <path fill="currentColor" d="M11.1 14.99h.03zM1.96 4.52a.6.6 0 0 1 .75-.04l8.8 6.71v3.19a.51.51 0 0 1-.88.36L1.19 6.1a.6.6 0 0 1 0-.87z" opacity=".65"/>
177
177
  <path fill="currentColor" d="M11.62 14.91a.9.9 0 0 1-1-.17.51.51 0 0 0 .88-.36V1.62a.51.51 0 0 0-.87-.36.9.9 0 0 1 1-.17l2.87 1.39a.9.9 0 0 1 .5.8v9.44a.9.9 0 0 1-.5.8z"/>
178
- </symbol>`,rP=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
178
+ </symbol>`,tP=`<symbol id="file-tree-builtin-vue" viewBox="0 0 16 16">
179
179
  <path fill="currentColor" d="M9.62 2.25 8 5.02 6.38 2.25H1l7 12 7-12z" opacity=".5"/>
180
180
  <path fill="currentColor" d="M9.54 2.25 8 4.95l-1.54-2.7H4l4 7 4-7z"/>
181
- </symbol>`,iP=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
181
+ </symbol>`,nP=`<symbol id="file-tree-builtin-wasm" viewBox="0 0 16 16">
182
182
  <path fill="currentColor" d="M13 1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h3a2 2 0 1 0 4 0z" class="subtract" opacity=".2"/>
183
183
  <path fill="currentColor" d="M4.64 11.4h.02l.8-3.4h.91l.73 3.45L7.88 8h.96l-1.25 5h-.97L5.9 9.6 5.1 13h-1L3 8h.98z"/>
184
184
  <path fill="currentColor" fill-rule="evenodd" d="M13 13h-1.02l-.33-1.11H9.9L9.64 13h-.97l1.26-5h1.54zm-2.49-3.77-.42 1.84h1.32l-.49-1.84z" clip-rule="evenodd"/>
185
- </symbol>`,aP=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
185
+ </symbol>`,rP=`<symbol id="file-tree-builtin-webpack" viewBox="0 0 16 16">
186
186
  <path fill="currentColor" d="M14.1 11.79 8.26 15v-2.5l3.64-1.94zm.4-.35V4.73l-2.14 1.2v4.3zm-12.6.35L7.74 15v-2.5L4.1 10.56zm-.4-.35V4.73l2.14 1.2v4.3zm.25-7.15 6-3.29v2.42L3.9 5.47l-.03.01zm12.5 0L8.25 1v2.42l3.85 2.05.03.01z" class="bg" opacity=".4"/>
187
187
  <path fill="currentColor" d="m7.74 11.93-3.59-1.92v-3.8l3.6 2.02zm.52 0 3.59-1.92v-3.8l-3.6 2.02zM4.4 5.77 8 3.85l3.6 1.93L8 7.8z" class="fg"/>
188
- </symbol>`,oP=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
188
+ </symbol>`,iP=`<symbol id="file-tree-builtin-yml" viewBox="0 0 16 16">
189
189
  <path fill="currentColor" d="M7.5 2A1.5 1.5 0 0 1 9 3.5v3A1.5 1.5 0 0 1 7.5 8h-2v2A1.5 1.5 0 0 0 7 11.5v-1A1.5 1.5 0 0 1 8.5 9h5a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-5A1.5 1.5 0 0 1 7 13.5v-1A2.5 2.5 0 0 1 4.5 10V8h-2A1.5 1.5 0 0 1 1 6.5v-3A1.5 1.5 0 0 1 2.5 2zm1 8a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5zm-6-7a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h5a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5z"/>
190
- </symbol>`,sP=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
190
+ </symbol>`,aP=`<symbol id="file-tree-builtin-zig" viewBox="0 0 16 16">
191
191
  <path fill="currentColor" d="m14.73 1.5-7.29 8.82h4.17l-1.73 2.04H5.76L1.27 14.5l7.3-8.91H4.39l1.73-2.05h4.12z"/>
192
192
  <path fill="currentColor" d="M5.21 3.54 3.56 5.6h-.55v4.73h.83L2.1 12.36H1V3.54zm9.79 0v8.82h-4.3l1.74-2.04h.55V5.68h-.83l1.74-2.14z"/>
193
- </symbol>`,cP=[mN,bN,xN,SN,TN,EN,DN,kN,AN,jN,MN,NN,PN,BN,HN,UN,YN,XN,$N,eP,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
193
+ </symbol>`,oP=[fN,vN,yN,bN,CN,wN,TN,DN,ON,kN,AN,jN,MN,RN,BN,VN,qN,JN,ZN,QN,`<symbol id="file-tree-builtin-zip" viewBox="0 0 16 16">
194
194
  <path fill="currentColor" d="M4.585 2a2 2 0 0 1 1.028.285l1.788 1.072a1 1 0 0 0 .514.143H12A2 2 0 0 1 13.935 5H0V4a2 2 0 0 1 2-2z" class="bg" opacity=".5"/>
195
195
  <path fill="currentColor" fill-rule="evenodd" d="M14 12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-1.25h1v-1H0V6h14zM9.9 8.25c-.883 0-1.9.5-1.9.5H7v1h1v1s1.017.5 1.9.5c.884 0 1.6-.672 1.6-1.5s-.716-1.5-1.6-1.5M2 9.75v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1zm-5-1v1h1v-1zm2 0v1h1v-1zm2 0v1h1v-1z" class="fg" clip-rule="evenodd"/>
196
- </symbol>`],lP=[fN,pN,hN,gN,_N,vN,yN,CN,wN,ON,FN,IN,LN,RN,zN,VN,WN,GN,KN,qN,JN,ZN,QN,tP,nP,rP,iP,aP,oP,sP];function uP(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
197
- `)}\n</svg>`)}var dP=uP(dN,cP),fP={minimal:dN,standard:dP,complete:uP(dP,lP)},pP={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},mP={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,htm:`html`,html:`html`,icns:`image`,ico:`image`,ini:`text`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},hP={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},gP=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),_P=new Set([`complete`]);function vP(e){return fP[e===`none`?`minimal`:e]}function yP(e){return`file-tree-builtin-${e}`}function bP(e){return e!==`none`&&_P.has(e)}function xP(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=pP[t.toLowerCase()];if(i!=null&&(r||gP.has(i)))return i;for(let e of n){if(r){let t=hP[e];if(t!=null)return t}let t=mP[e];if(t!=null&&(r||gP.has(t)))return t}return`default`}var SP=`file-tree-container`,CP=`data-file-tree-style`,wP=`data-file-tree-unsafe-css`,TP=`data-file-tree-scrollbar-measure`,EP=`data-file-tree-scrollbar-gutter-measured`,DP=`--trees-scrollbar-gutter-measured`,OP=`header`,kP=`context-menu`,AP=`context-menu-trigger`;function jP(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function MP(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(jP(e)?`none`:`complete`),colored:e.colored??!0}}var NP=e=>e.trim().toLowerCase(),PP=e=>e.split(`/`).at(-1)??e,FP=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function IP(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function LP(e){let t=MP(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(NP(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=PP(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return IP(c,e);for(let[t,n]of a)if(s.includes(t))return IP(n,e);let l=FP(n);for(let t of l){let n=i.get(t);if(n!=null)return IP(n,e)}let u=xP(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:yP(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:IP(s,e)}}}var RP=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,zP=/^0(?:\.0+)?%?$/;function BP(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function VP(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||RP.test(t))return!0;let n=BP(t);return n!=null&&zP.test(n)}function HP(e){return VP(e)?void 0:e}function UP(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=HP(t[`list.focusOutline`])??HP(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var WP=5,GP=1<<WP,KP=GP*4;function qP(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function JP(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function YP(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function XP(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function ZP(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function QP(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function $P(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,rF(e,t)}function eF(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=XP(e).get(t);if(i===void 0)return;let a=i>>WP;e.childVisibleChunkSums[a]+=r}function tF(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=iF(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=GP}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function nF(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>WP;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<WP}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function rF(e,t){if(t.childIds.length<KP){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/GP),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>WP]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function iF(e,t,n,r){let i=Math.min(t.childIds.length,n+GP),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var aF=7,oF=3,sF=1<<oF,cF=4;function lF(e,t,n=0){return e<<cF|n<<oF|t}function uF(e){return e.depthAndFlags>>>cF}function dF(e){return(e.depthAndFlags&sF)>>oF}function fF(e){return(e.depthAndFlags&sF)!==0}function pF(e){return e.depthAndFlags&aF}function mF(e,t){return(pF(e)&t)!==0}function hF(e,t){e.depthAndFlags|=t}function gF(e,t){e.depthAndFlags=lF(t,pF(e),dF(e))}var _F=Symbol(`benchmarkInstrumentation`);function vF(e,t){return t==null||Object.defineProperty(e,_F,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function yF(e){return e==null?null:e[_F]??null}function bF(e,t,n){return e==null?n():e.measurePhase(t,n)}function xF(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function SF(e){return e>=48&&e<=57}function CF(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!SF(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&SF(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function wF(e){let t=e.toLowerCase();return{lowerValue:t,tokens:CF(t)}}function TF(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function EF(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=TF(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function DF(e,t,n){let r=EF(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function OF(e,t){return DF(e,t,wF)}function kF(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function AF(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=kF(e,r);return a===kF(t,r)?OF(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function jF(e,t){return AF(e,t)}function MF(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=wF(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=kF(e,n);return o===kF(t,n)?DF(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function NF(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=wF(r);return e.sortKeyById[t]=i,i}function PF(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function FF(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function IF(e){let{hasTrailingSlash:t,segments:n}=FF(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function LF(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=FF(e);return{requiresDirectory:t,segments:n}}var RF=``;function zF(){let e=new Map;return e.set(RF,0),{idByValue:e,valueById:[RF],sortKeyById:[wF(RF)]}}function BF(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function VF(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var HF=Symbol(`pathStorePreparedInputKind`);function UF(e,t){return e[HF]=t,e}function WF(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function GF(e,t,n){return n===`default`?jF(e,t):n(WF(e),WF(t))}function KF(){return{depthAndFlags:lF(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function qF(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function JF(e){return e.isDirectory?e.segments.length:e.segments.length-1}function YF(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function XF(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function ZF(e,t={}){return rI(e,t).map(e=>e.path)}function QF(e,t={}){let n=rI(e,t);return UF({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function $F(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return UF({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function eI(e){let t=e,n=t.preparedPaths;if(t[HF]===`prepared`&&n!=null)return n;if(!YF(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function tI(e){let t=e;return t[HF]===`presorted`&&t.presortedPaths!=null||XF(t.presortedPaths)?t.presortedPaths:null}function nI(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function rI(e,t={}){let n=PF(t),r=yF(t);xF(r,`workload.inputFiles`,e.length);let i=bF(r,`store.preparePathEntries.parse`,()=>e.map(e=>IF(e)));return bF(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>GF(e,t,n.sort))),i}var iI=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[KF()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=zF();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=yF(e),this.options=PF(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,qP())}appendPaths(e){return bF(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>IF(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,bF(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return bF(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:lF(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:lF(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:lF(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=IF(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:lF(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:lF(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=IF(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(bF(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||bF(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?MF(this.lastPreparedPath,e,this.segmentSortKeyCache):GF(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=JF(e),i=n==null?0:JF(n),a=n==null?0:qF(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=BF(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:lF(uF(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),ZP(i,s),s}createFileChildUnchecked(e,t){let n=BF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:lF(uF(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ZP(r,a),a}getOrCreateDirectoryChild(e,t){let n=BF(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!fF(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:lF(uF(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ZP(r,a),this.directories.set(a,qP()),a}createDirectoryChild(e,t){let n=BF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:lF(uF(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),ZP(r,a),this.directories.set(a,qP()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!fF(n))throw Error(`Path is not a directory: "${t}"`);if(mF(n,1))throw Error(`Duplicate path: "${t}"`);hF(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,JP());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(fF(a)){let t=JP();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;fF(n)&&this.directories.set(t,qP());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),ZP(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!fF(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return $P(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function aI(e,t=`closed`,n=null){let r=sI(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function oI(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function sI(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function cI(e,t){return mF(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:uF(t)<=e.defaultExpansion}function lI(e,t,n=e.snapshot.nodes[t]){return n==null||!fF(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:cI(e,n)}function uI(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!fF(r))return;let i=cI(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function dI(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function fI(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function pI(e,t){let n=dI(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function mI(e,t){let n=dI(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function hI(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function gI(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function _I(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function vI(e,t){e.directoryLoadInfoById.delete(t)}function yI(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function bI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function xI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function SI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function CI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function wI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function TI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function EI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function DI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function OI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function kI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function AI(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function jI(e,t,n){return{...n,visibleCountDelta:HI(e)-t}}function MI(e,t){let n=HI(e),r=oI();e.transactionStack.push(r);try{t()}catch(t){throw FI(e,r,!1),t}FI(e,r,!0,HI(e)-n)}function NI(e,t){let n=e.instrumentation;if(n==null){PI(e,t);return}bF(n,`store.events.record`,()=>PI(e,t))}function PI(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){BI(e,t);return}n.events.push(t),zI(n,t)}function FI(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?RI(i,t):bF(n,`store.events.batch.merge`,()=>RI(i,t));return}let a=II(t,r),o=e.instrumentation;if(o==null){BI(e,a);return}bF(o,`store.events.batch.commit`,()=>BI(e,a))}function II(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function LI(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function RI(e,t){for(let n of t.events)e.events.push(n);LI(e,t)}function zI(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function BI(e,t){let n=e.instrumentation;if(n==null){VI(e,t);return}bF(n,`store.events.emit`,()=>VI(e,t))}function VI(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function HI(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function UI(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!fF(n)||mF(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!fF(a)?null:i}function WI(e,t){let n=t;for(;;){let t=UI(e,n);if(t==null)return n;n=t}}function GI(e,t){let n=[t],r=t;for(;;){let t=UI(e,r);if(t==null)return n;n.push(t),r=t}}function KI(e,t){let n=t==null?e.snapshot.rootId:nL(e,t);return n==null?[]:oL(e,n)}function qI(e,t){let n=IF(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=xL(e,bL(e,r)),{createdNodeIds:a,directoryId:o}=sL(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=aL(e,o);if(mF(n,1))throw Error(`Path already exists: "${t}"`);hF(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=lL(e,o,n.basename),s.add(c);$I(e,o);let l=xL(e,o);return bI({affectedAncestorIds:tL(e,c),affectedNodeIds:[...s],path:t,projectionChanged:SL(i,l)})}function JI(e,t,n){let r=nL(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=aL(e,r);if(mF(i,2))throw Error(`The root node cannot be removed`);if(fF(i)&&iL(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=xL(e,a),s=vL(e,r);fL(e,a,r,i.nameId),yL(e,a),$I(e,a);let c=xL(e,a);return xI({affectedAncestorIds:tL(e,a),affectedNodeIds:s,path:t,projectionChanged:SL(o,c),recursive:n.recursive===!0})}function YI(e,t,n,r){let i=nL(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=aL(e,i);if(mF(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=gL(e,i,n),c=xL(e,a.parentId),l=xL(e,s.parentId),u=VF(e.snapshot.segmentTable,a.nameId),d=BF(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(fF(a)&&EL(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=YP(e.snapshot.nodes,iL(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&_L(e,p,o,dF(a))===`skip`)return null;let m=a.parentId;fL(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),TL(e,i),dL(e,s.parentId,i),yL(e,m),e.pathCacheVersion++,$I(e,m),s.parentId!==m&&$I(e,s.parentId);let h=xL(e,m),g=xL(e,s.parentId);return SI({affectedAncestorIds:[...new Set([...tL(e,m),...tL(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:CL([c,l],[h,g]),to:QI(e,i)})}function XI(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function ZI(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function QI(e,t){let n=aL(e,t),r=XI(e,t);if(r!=null)return r;if(mF(n,2))return ZI(e,t,``);let i=QI(e,n.parentId),a=VF(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return ZI(e,t,fF(n)?`${o}/`:o)}function $I(e,t){let n=e.instrumentation;if(n==null){OL(e,t);return}bF(n,`store.recomputeCountsUpwardFrom`,()=>OL(e,t))}function eL(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!fF(o)){DL(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){DL(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function tL(e,t){let n=[],r=t;for(;r!=null;){let t=aL(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function nL(e,t){if(t.length===0)return e.snapshot.rootId;let n=LF(t);return rL(e,n.segments,n.requiresDirectory)}function rL(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=iL(e,r),a=YP(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=aL(e,r);return n&&!fF(i)?null:r}function iL(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function aL(e,t){let n=e.snapshot.nodes[t];if(n===void 0||mF(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function oL(e,t){let n=e.snapshot.nodes[t];if(n===void 0||mF(n,4))return[];if(!fF(n))return[QI(e,t)];if(iL(e,t).childIds.length===0)return mF(n,1)&&!mF(n,2)?[QI(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||mF(n,4)){i.pop();continue}if(!fF(n)){r.push(QI(e,t.nodeId)),i.pop();continue}let a=iL(e,t.nodeId);if(a.childIds.length===0){mF(n,1)&&!mF(n,2)&&r.push(QI(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function sL(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=BF(e.snapshot.segmentTable,i),a=iL(e,r),o=YP(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!fF(aL(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=cL(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function cL(e,t,n){let r=aL(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:lF(uF(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,qP()),dL(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function lL(e,t,n){let r=BF(e.snapshot.segmentTable,n),i=iL(e,t);if(YP(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${AL(e,t,n)}"`);let a=aL(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:lF(uF(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),dL(e,t,o),e.activeNodeCount++,o}function uL(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}pL(e,n,o)<0?i=a:r=a+1}return r}function dL(e,t,n){let r=iL(e,t),i=aL(e,n);YP(e.snapshot.nodes,r).set(i.nameId,n),eF(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=uL(e,r,n);r.childIds.splice(a,0,n),QP(r,a),rF(e.snapshot.nodes,r)}function fL(e,t,n,r){let i=iL(e,t),a=XP(i),o=a.get(n)??-1;YP(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&eF(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),QP(i,o),rF(e.snapshot.nodes,i))}function pL(e,t,n){let r=e.snapshot.options.sort;return r===`default`?mL(e,t,n):r(hL(e,t),hL(e,n))}function mL(e,t,n){let r=aL(e,t),i=aL(e,n),a=fF(r);if(a!==fF(i))return a?-1:1;let o=EF(NF(e.snapshot.segmentTable,r.nameId),NF(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=VF(e.snapshot.segmentTable,r.nameId),c=VF(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function hL(e,t){let n=aL(e,t),r=QI(e,t),i=fF(n),a=i?r.slice(0,-1):r;return{basename:VF(e.snapshot.segmentTable,n.nameId),depth:uF(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function gL(e,t,n){let r=aL(e,t),i=nL(e,n);if(i!=null){let t=aL(e,i);if(fF(t))return{basename:VF(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=LF(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=LF(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:rL(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function _L(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${QI(e,t)}"`);let i=aL(e,t);if(dF(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(fF(i)&&iL(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return vL(e,t),fL(e,a,t,o),yL(e,a),$I(e,a),`handled`}function vL(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=aL(e,t.nodeId);if(t.visitedChildren||!fF(i)){fF(i)&&e.snapshot.directories.delete(t.nodeId),hF(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),vI(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=iL(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function yL(e,t){let n=t;for(;n!=null;){let t=aL(e,n);if(!fF(t)||mF(t,2)||iL(e,n).childIds.length>0)return;hF(t,1),n=t.parentId===n?null:t.parentId}}function bL(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=YP(e.snapshot.nodes,iL(e,n)).get(t);if(i==null||!fF(aL(e,i)))break;n=i}return n}function xL(e,t){let n=wL(e,t);if(n==null)return null;let r=WI(e,n),i=aL(e,r),a=n===r?null:GI(e,n).map(t=>QI(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:iL(e,r).childIds.length>0,path:QI(e,r),terminalKind:dF(i)})}function SL(e,t){return CL([e],[t])}function CL(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function wL(e,t){let n=t;for(;n!=null;){let t=aL(e,n);if(!fF(t)||mF(t,2))return null;if(!lI(e,n,t))return n;n=t.parentId}return null}function TL(e,t){let n=aL(e,t);if(gF(n,(t===e.snapshot.rootId?-1:uF(aL(e,n.parentId)))+1),!fF(n))return;let r=iL(e,t);for(let t of r.childIds)TL(e,t)}function EL(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=aL(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function DL(e,t,n=aL(e,t),r=!1){let i=e.instrumentation;if(i==null){kL(e,t,n,r);return}bF(i,`store.recomputeNodeCounts`,()=>kL(e,t,n,r))}function OL(e,t){let n=t;for(;n!=null;){let t=aL(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(DL(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&eF(iL(e,s),n,a,o),n=s}}function kL(e,t,n,r){if(!fF(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=iL(e,t);if(r){let t=e.instrumentation;t==null?$P(e.snapshot.nodes,i):bF(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>$P(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,mF(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=UI(e,t)==null?lI(e,t,n)?1+o:1:o}function AL(e,t,n){let r=QI(e,t);return r.length===0?n:`${r}${n}`}function jL(e){return e!=null&&!mF(e,4)}function ML(e,t){let n=e.snapshot.nodes[t];return!jL(n)||!fF(n)||mF(n,2)?null:n}function NL(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&jL(e.snapshot.nodes[n])&&(t+=1);return t}function PL(e){return Math.max(0,e.valueById.length-1)}function FL(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:NL(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:PL(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function IL(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function LL(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)ML(e,n)!=null&&t.push(QI(e,n));for(let t of e.expandedDirectoryIds)ML(e,t)!=null&&n.push(QI(e,t));return{collapsedPaths:t,expandedPaths:n}}function RL(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)ML(e,n)==null||fI(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:QI(e,n)});return t}function zL(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=nL(e,n);t!=null&&uI(e,t,!0,aL(e,t))}for(let n of t.collapsedPaths){let t=nL(e,n);t!=null&&uI(e,t,!1,aL(e,t))}}function BL(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=nL(e,n.path);t!=null&&ML(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function VL(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function HL(e){let t=e.snapshot.segmentTable,n=zF();for(let r of e.snapshot.nodes)if(jL(r)){if(mF(r,2)){r.nameId=0;continue}r.nameId=BF(n,VF(t,r.nameId))}e.snapshot.segmentTable=n}function UL(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!jL(r)||!fF(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return jL(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[aL(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),$P(e.snapshot.nodes,n)}}function WL(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(jL(n))break;--t}e.snapshot.nodes.length=t+1}function GL(e){let t=LL(e),n=RL(e);bF(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>VL(e)),bF(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>HL(e)),bF(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>UL(e)),bF(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>WL(e)),bF(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>zL(e,t)),bF(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>BL(e,n)),bF(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>eL(e,e.snapshot.rootId))}function KL(e){let t=LL(e),n=RL(e),r=bF(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>KI(e)),i=vF({...e.snapshot.options},e.instrumentation),a=bF(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new iI(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,bF(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>zL(e,t)),bF(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>BL(e,n)),bF(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>eL(e,e.snapshot.rootId))}function qL(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function JL(e,t){let n=FL(e);t===`stable`?bF(e.instrumentation,`store.cleanup.stable`,()=>GL(e)):bF(e.instrumentation,`store.cleanup.aggressive`,()=>KL(e));let r=FL(e);return IL(t,t===`stable`,n,r)}var YL=64;function XL(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function ZL(e){return aL(e,e.snapshot.rootId).visibleSubtreeCount}function QL(e,t,n,r){let i=aL(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function $L(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:vR(e,t.cursor),setSize:t.setSize,subtreeEndIndex:QL(e,t.cursor,t.index,n)}}function eR(e,t,n,r,i,a){let o=iL(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=tF(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return tR(e,u,l,r+c,i+1,s,o.childIds.length,a)}function tR(e,t,n,r,i,a,o,s){if(!fF(aL(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=fR(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=aL(e,c.terminalNodeId);if(!fF(l)||!lI(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return eR(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function nR(e,t){let n=ZL(e);if(t<0||t>=n)return null;let r=eR(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>QI(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=$L(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:vR(e,r.cursor),setSize:r.setSize,subtreeEndIndex:QL(e,r.cursor,r.index,n)}}function rR(e,t,n){let r=e.instrumentation,i=ZL(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return _R(e,o+1);let t=[],n=lR(e,a);for(let r=a;r<=o&&n!=null;r++){let r=vR(e,n);t.push(r),n=mR(e,n)}return t}let s=[],c=0,l=0,u=bF(r,`store.getVisibleSlice.selectFirstRow`,()=>lR(e,a));for(let t=a;t<=o&&u!=null;t++){let t=bF(r,`store.getVisibleSlice.materializeRow`,()=>vR(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=bF(r,`store.getVisibleSlice.advanceCursor`,()=>mR(e,u))}return xF(r,`workload.visibleRowsRead`,s.length),xF(r,`workload.flattenedRowsRead`,c),xF(r,`workload.flattenedSegmentsRead`,l),s}function iR(e,t=ZL(e)){let n=e.instrumentation;return n==null?gR(e,t):bF(n,`store.getVisibleTreeProjection`,()=>gR(e,t))}function aR(e){return hR(iR(e))}function oR(e,t){let n=nL(e,t);if(n==null||n===e.snapshot.rootId||fF(aL(e,n))&&WI(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=aL(e,i).parentId,n=iL(e,t),s=XP(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=nF(a,n,s),t!==o){let n=aL(e,t),a=UI(e,t);if(!lI(e,t,n)&&a!==i)return null;WI(e,t)===t&&(r+=1)}i=t}return r}function sR(e,t){let n=nL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=aL(e,n);if(!fF(r))throw Error(`Path is not a directory: "${t}"`);return lI(e,n,r)?null:(uI(e,n,!0,r),$I(e,n),CI({affectedAncestorIds:tL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function cR(e,t){let n=nL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=aL(e,n);if(!fF(r))throw Error(`Path is not a directory: "${t}"`);return lI(e,n,r)?(uI(e,n,!1,r),$I(e,n),wI({affectedAncestorIds:tL(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function lR(e,t){return t<0||t>=ZL(e)?null:uR(e,e.snapshot.rootId,t,-1)}function uR(e,t,n,r){let i=iL(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?tF(e.snapshot.nodes,i,n):bF(a,`store.getVisibleSlice.selectChildIndex`,()=>tF(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return dR(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function dR(e,t,n,r){if(!fF(aL(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=fR(e,t,r);if(n===0)return i;let a=aL(e,i.terminalNodeId);if(!fF(a)||!lI(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return uR(e,i.terminalNodeId,n-1,i.visibleDepth)}function fR(e,t,n){return fF(aL(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:WI(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:bF(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>WI(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function pR(e,t){let n=aL(e,t);if(!fF(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:UI(e,r)!==t}function mR(e,t){let n=aL(e,t.terminalNodeId);if(fF(n)){let r=iL(e,t.terminalNodeId);if(lI(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:dR(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=aL(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=iL(e,n),o=XP(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return dR(e,s,0,i);pR(e,r)&&i--,r=n}}function hR(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function gR(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(YL);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=XL(o,y);let x,S=_;if(fF(v))S=f?WI(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:QI(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&fF(C)&&lI(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function _R(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!fF(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:QI(e,f)};continue}let h=l?WI(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=vR(e,g);let _=i[h];_!=null&&fF(_)&&lI(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function vR(e,t){let n=aL(e,t.terminalNodeId),r=fF(n)?yR(e,t):null,i=QI(e,t.terminalNodeId),a=VF(e.snapshot.segmentTable,n.nameId),o=fF(n)&&iL(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?GI(e,t.headNodeId).map(n=>{let r=aL(e,n);return{isTerminal:n===t.terminalNodeId,name:VF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:QI(e,n)}}):bF(c,`store.getVisibleSlice.flatten.collectSegments`,()=>GI(e,t.headNodeId).map(n=>{let r=aL(e,n);return{isTerminal:n===t.terminalNodeId,name:VF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:QI(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:fF(n)&&lI(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:fF(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function yR(e,t){if(t.headNodeId===t.terminalNodeId)return fI(e,t.terminalNodeId);let n=GI(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=fI(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function bR(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!fF(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&rF(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&fF(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,rF(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function xR(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var SR=class e{#e;constructor(e={}){let t=yF(e),n=bF(t,`store.builder.create`,()=>new iI(e));if(e.preparedInput!=null){let t=tI(e.preparedInput);t==null?n.appendPreparedPaths(eI(e.preparedInput),!1):n.appendPresortedPaths(t,nI(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(bF(t,`store.preparePathEntries`,()=>rI(r,e)))}let r=bF(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=bF(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=bF(t,`store.state.create`,()=>aI(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:bF(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||xR(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&bF(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?bF(t,`store.state.initializeOpenVisibleCounts`,()=>bR(this.#e)):bF(t,`store.state.recomputeCounts`,()=>eL(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return ZF(e,t)}static prepareInput(e,t={}){return QF(e,t)}static preparePresortedInput(e){return $F(e)}list(e){return bF(this.#e.instrumentation,`store.list`,()=>KI(this.#e,e))}add(e){bF(this.#e.instrumentation,`store.add`,()=>{let t=ZL(this.#e);NI(this.#e,jI(this.#e,t,qI(this.#e,e)))})}remove(e,t={}){bF(this.#e.instrumentation,`store.remove`,()=>{let n=ZL(this.#e);NI(this.#e,jI(this.#e,n,JI(this.#e,e,t)))})}move(e,t,n={}){bF(this.#e.instrumentation,`store.move`,()=>{let r=ZL(this.#e),i=YI(this.#e,e,t,n);i!=null&&NI(this.#e,jI(this.#e,r,i))})}batch(e){MI(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return bF(this.#e.instrumentation,`store.getVisibleCount`,()=>ZL(this.#e))}getVisibleSlice(e,t){return bF(this.#e.instrumentation,`store.getVisibleSlice`,()=>rR(this.#e,e,t))}getVisibleRowContext(e){return bF(this.#e.instrumentation,`store.getVisibleRowContext`,()=>nR(this.#e,e))}getVisibleTreeProjection(){return aR(this.#e)}getVisibleTreeProjectionData(e){return iR(this.#e,e)}getVisibleIndex(e){return bF(this.#e.instrumentation,`store.getVisibleIndex`,()=>oR(this.#e,e))}getPathInfo(e){return bF(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=nL(this.#e,e);if(t==null)return null;let n=aL(this.#e,t);return{depth:uF(n),kind:fF(n)?`directory`:`file`,path:QI(this.#e,t)}})}isExpanded(e){return bF(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=aL(this.#e,t);return lI(this.#e,t,n)})}expand(e){bF(this.#e.instrumentation,`store.expand`,()=>{let t=ZL(this.#e),n=sR(this.#e,e);n!=null&&NI(this.#e,jI(this.#e,t,n))})}collapse(e){bF(this.#e.instrumentation,`store.collapse`,()=>{let t=ZL(this.#e),n=cR(this.#e,e);n!=null&&NI(this.#e,jI(this.#e,t,n))})}on(e,t){return yI(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return fI(this.#e,t)}markDirectoryUnloaded(e){bF(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(iL(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=ZL(this.#e);mI(this.#e,t),NI(this.#e,jI(this.#e,n,TI({affectedAncestorIds:tL(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return bF(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=ZL(this.#e),r=pI(this.#e,t);return NI(this.#e,jI(this.#e,n,EI({affectedAncestorIds:tL(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return bF(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||fI(this.#e,n)!==`loading`||!gI(this.#e,n,e.attemptId))return!1;let r=QI(this.#e,n);this.validateChildPatch(r,t);let i=ZL(this.#e),a=[];for(let e of t.operations){CR(r,e);let t=ZL(this.#e);switch(e.type){case`add`:a.push(jI(this.#e,t,qI(this.#e,e.path)));break;case`remove`:a.push(jI(this.#e,t,JI(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=YI(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(jI(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return NI(this.#e,jI(this.#e,i,DI({affectedAncestorIds:tL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:QI(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return bF(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=ZL(this.#e),r=hI(this.#e,t,e.attemptId);return NI(this.#e,jI(this.#e,n,OI({affectedAncestorIds:tL(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:QI(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return bF(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=ZL(this.#e),i=_I(this.#e,n,e.attemptId,t);return NI(this.#e,jI(this.#e,r,kI({affectedAncestorIds:tL(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:QI(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return bF(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(qL(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=ZL(this.#e),n=JL(this.#e,e.mode??`stable`);return NI(this.#e,jI(this.#e,t,AI({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=iL(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??wF(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=EF(NF(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!fF(aL(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=aL(this.#e,n);lI(this.#e,n,i)||(uI(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=aL(this.#e,e);if(!lI(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=nL(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!fF(aL(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!fF(aL(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=aL(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=aL(this.#e,e),r=UI(this.#e,e);if(!lI(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function CR(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var wR={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function TR(e,t){if(typeof e==`number`)return{itemHeight:t??wR.default.itemHeight,factor:e};let n=wR[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var ER=wR.default.itemHeight,DR=`@layer base, theme, unsafe;
196
+ </symbol>`],sP=[uN,dN,pN,mN,hN,gN,_N,xN,SN,EN,NN,PN,FN,IN,LN,zN,HN,UN,WN,GN,KN,YN,XN,$N,eP,tP,nP,rP,iP,aP];function cP(e,t){return t.length===0?e:e.replace(`</svg>`,`\n ${t.join(`
197
+ `)}\n</svg>`)}var lP=cP(lN,oP),uP={minimal:lN,standard:lP,complete:cP(lP,sP)},dP={".babelrc":`babel`,".babelrc.json":`babel`,".bash_profile":`bash`,".bashrc":`bash`,".browserslistrc":`browserslist`,".dockerignore":`docker`,".eslintignore":`eslint`,".eslintrc":`eslint`,".eslintrc.cjs":`eslint`,".eslintrc.js":`eslint`,".eslintrc.json":`eslint`,".eslintrc.yaml":`eslint`,".eslintrc.yml":`eslint`,".gitattributes":`git`,".gitignore":`git`,".gitkeep":`git`,".gitmodules":`git`,".oxlintrc.json":`oxc`,".postcssrc":`postcss`,".postcssrc.json":`postcss`,".postcssrc.yaml":`postcss`,".postcssrc.yml":`postcss`,".prettierignore":`prettier`,".prettierrc":`prettier`,".prettierrc.cjs":`prettier`,".prettierrc.js":`prettier`,".prettierrc.json":`prettier`,".prettierrc.mjs":`prettier`,".prettierrc.toml":`prettier`,".prettierrc.yaml":`prettier`,".prettierrc.yml":`prettier`,".stylelintignore":`stylelint`,".stylelintrc":`stylelint`,".stylelintrc.cjs":`stylelint`,".stylelintrc.js":`stylelint`,".stylelintrc.json":`stylelint`,".stylelintrc.mjs":`stylelint`,".stylelintrc.yaml":`stylelint`,".stylelintrc.yml":`stylelint`,".terraform.lock.hcl":`terraform`,".zprofile":`bash`,".zshenv":`bash`,".zshrc":`bash`,"babel.config.cjs":`babel`,"babel.config.js":`babel`,"babel.config.json":`babel`,"babel.config.mjs":`babel`,"biome.json":`biome`,"biome.jsonc":`biome`,"bootstrap.bundle.js":`bootstrap`,"bootstrap.bundle.min.js":`bootstrap`,"bootstrap.css":`bootstrap`,"bootstrap.js":`bootstrap`,"bootstrap.min.css":`bootstrap`,"bootstrap.min.js":`bootstrap`,"bun.lock":`bun`,"bun.lockb":`bun`,"bunfig.toml":`bun`,"claude.md":`claude`,"compose.yaml":`docker`,"compose.yml":`docker`,"docker-compose.override.yml":`docker`,"docker-compose.yaml":`docker`,"docker-compose.yml":`docker`,dockerfile:`docker`,"eslint.config.cjs":`eslint`,"eslint.config.js":`eslint`,"eslint.config.mjs":`eslint`,"eslint.config.mts":`eslint`,"eslint.config.ts":`eslint`,gemfile:`ruby`,"next.config.js":`nextjs`,"next.config.mjs":`nextjs`,"next.config.mts":`nextjs`,"next.config.ts":`nextjs`,"postcss.config.cjs":`postcss`,"postcss.config.js":`postcss`,"postcss.config.mjs":`postcss`,"postcss.config.ts":`postcss`,"prettier.config.cjs":`prettier`,"prettier.config.js":`prettier`,"prettier.config.mjs":`prettier`,rakefile:`ruby`,"readme.md":`markdown`,"stylelint.config.cjs":`stylelint`,"stylelint.config.js":`stylelint`,"stylelint.config.mjs":`stylelint`,"svgo.config.cjs":`svgo`,"svgo.config.js":`svgo`,"svgo.config.mjs":`svgo`,"svgo.config.ts":`svgo`,"tailwind.config.cjs":`tailwind`,"tailwind.config.js":`tailwind`,"tailwind.config.mjs":`tailwind`,"tailwind.config.ts":`tailwind`,"vite.config.js":`vite`,"vite.config.mjs":`vite`,"vite.config.mts":`vite`,"vite.config.ts":`vite`,"webpack.config.babel.js":`webpack`,"webpack.config.cjs":`webpack`,"webpack.config.js":`webpack`,"webpack.config.mjs":`webpack`,"webpack.config.ts":`webpack`},fP={"7z":`zip`,astro:`astro`,AUTHORS:`text`,avif:`image`,bash:`bash`,bmp:`image`,bz2:`zip`,cfg:`text`,CHANGELOG:`text`,cjs:`javascript`,"code-workspace":`vscode`,conf:`text`,CONTRIBUTORS:`text`,csh:`bash`,css:`css`,csv:`table`,cts:`typescript`,db:`database`,editorconfig:`text`,env:`text`,"env.development":`text`,"env.local":`text`,"env.production":`text`,eot:`font`,erb:`ruby`,fish:`bash`,gemspec:`ruby`,gif:`image`,go:`go`,gql:`graphql`,graphql:`graphql`,gz:`zip`,htm:`html`,html:`html`,icns:`image`,ico:`image`,ini:`text`,jar:`zip`,jpeg:`image`,jpg:`image`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsonl:`json`,jsx:`javascript`,ksh:`bash`,less:`css`,LICENSE:`text`,log:`text`,markdown:`markdown`,mcp:`mcp`,md:`markdown`,mdx:`markdown`,"mdx.tsx":`markdown`,mjs:`javascript`,mts:`typescript`,ods:`table`,otf:`font`,png:`image`,postcss:`css`,py:`python`,pyi:`python`,pyw:`python`,pyx:`python`,rake:`ruby`,rar:`zip`,rb:`ruby`,rs:`rust`,rst:`text`,rtf:`text`,sass:`css`,scss:`css`,sh:`bash`,sql:`database`,sqlite:`database`,sqlite3:`database`,styl:`css`,svelte:`svelte`,svg:`svg`,swift:`swift`,tar:`zip`,tf:`terraform`,tfstate:`terraform`,tfvars:`terraform`,tgz:`zip`,tif:`image`,tiff:`image`,ts:`typescript`,tsv:`table`,tsx:`typescript`,ttf:`font`,txt:`text`,vue:`vue`,war:`zip`,wasm:`wasm`,wast:`wasm`,wat:`wasm`,webp:`image`,woff:`font`,woff2:`font`,xhtml:`html`,xls:`table`,xlsx:`table`,xz:`zip`,yaml:`yml`,yml:`yml`,zig:`zig`,zip:`zip`,zsh:`bash`},pP={jsx:`react`,sass:`sass`,scss:`sass`,tsx:`react`},mP=new Set([`bash`,`css`,`database`,`default`,`font`,`git`,`go`,`html`,`image`,`javascript`,`json`,`markdown`,`mcp`,`python`,`ruby`,`rust`,`swift`,`table`,`text`,`typescript`,`zip`]),hP=new Set([`complete`]);function gP(e){return uP[e===`none`?`minimal`:e]}function _P(e){return`file-tree-builtin-${e}`}function vP(e){return e!==`none`&&hP.has(e)}function yP(e,t,n){if(e===`minimal`||e===`none`)return;let r=e===`complete`,i=dP[t.toLowerCase()];if(i!=null&&(r||mP.has(i)))return i;for(let e of n){if(r){let t=pP[e];if(t!=null)return t}let t=fP[e];if(t!=null&&(r||mP.has(t)))return t}return`default`}var bP=`file-tree-container`,xP=`data-file-tree-style`,SP=`data-file-tree-unsafe-css`,CP=`data-file-tree-scrollbar-measure`,wP=`data-file-tree-scrollbar-gutter-measured`,TP=`--trees-scrollbar-gutter-measured`,EP=`header`,DP=`context-menu`,OP=`context-menu-trigger`;function kP(e){return e.spriteSheet!=null||e.remap!=null||e.byFileName!=null||e.byFileExtension!=null||e.byFileNameContains!=null}function AP(e){return e==null?{set:`complete`,colored:!0}:typeof e==`string`?{set:e,colored:!0}:{...e,set:e.set??(kP(e)?`none`:`complete`),colored:e.colored??!0}}var jP=e=>e.trim().toLowerCase(),MP=e=>e.split(`/`).at(-1)??e,NP=e=>{let t=e.toLowerCase().split(`.`),n=[];for(let e=1;e<t.length;e+=1)n.push(t.slice(e).join(`.`));return n};function PP(e,t){return typeof e==`string`?{name:e,remappedFrom:t}:{...e,remappedFrom:t}}function FP(e){let t=AP(e),n=t.remap,r=new Map;for(let[e,n]of Object.entries(t.byFileName??{}))r.set(e.toLowerCase(),n);let i=new Map;for(let[e,n]of Object.entries(t.byFileExtension??{}))i.set(jP(e),n);let a=Object.entries(t.byFileNameContains??{}).map(([e,t])=>[e.toLowerCase(),t]);return{resolveIcon:(e,o)=>{if(e===`file-tree-icon-file`&&o!=null){let n=MP(o),s=n.toLowerCase(),c=r.get(s);if(c!=null)return PP(c,e);for(let[t,n]of a)if(s.includes(t))return PP(n,e);let l=NP(n);for(let t of l){let n=i.get(t);if(n!=null)return PP(n,e)}let u=yP(t.set,n,l);if(u!=null&&t.set!==`none`)return{name:_P(u),remappedFrom:e,token:u}}let s=n?.[e];return s==null?{name:e}:PP(s,e)}}}var IP=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,LP=/^0(?:\.0+)?%?$/;function RP(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function zP(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||IP.test(t))return!0;let n=RP(t);return n!=null&&LP.test(n)}function BP(e){return zP(e)?void 0:e}function VP(e){let t=e.colors??{},n=t[`sideBar.background`]??t[`editor.background`]??e.bg,r=t[`sideBar.foreground`]??t[`editor.foreground`]??e.fg,i=t[`sideBar.border`],a=t[`list.activeSelectionForeground`]??t[`sideBar.foreground`],o=n?.toLowerCase(),s=t[`list.hoverBackground`],c=s?.toLowerCase()===o?void 0:s,l=t[`list.activeSelectionBackground`],u=l?.toLowerCase()===o?t[`list.focusBackground`]??t[`editor.selectionBackground`]:l??t[`editor.selectionBackground`],d=BP(t[`list.focusOutline`])??BP(t.focusBorder),f=t[`input.background`]??n,p=t[`input.border`],m=t[`scrollbarSlider.background`],h=t[`sideBarSectionHeader.foreground`]??r,g=t[`gitDecoration.addedResourceForeground`]??t[`terminal.ansiGreen`]??t[`editorGutter.addedBackground`],_=t[`gitDecoration.modifiedResourceForeground`]??t[`terminal.ansiBlue`]??t[`editorGutter.modifiedBackground`],v=t[`gitDecoration.deletedResourceForeground`]??t[`terminal.ansiRed`]??t[`editorGutter.deletedBackground`],y=e.type===`dark`,b={colorScheme:y?`dark`:`light`,backgroundColor:n??``,color:r??``,borderColor:`var(--trees-theme-sidebar-border, light-dark(oklch(0% 0 0 / 0.15), oklch(100% 0 0 / 0.15)))`,"--trees-theme-sidebar-bg":n??``,"--trees-theme-sidebar-fg":r??``,"--trees-theme-sidebar-header-fg":h??``,"--trees-theme-list-active-selection-fg":a??r??``,"--trees-theme-list-hover-bg":c??(y?`rgba(255,255,255,0.08)`:`rgba(0,0,0,0.06)`),"--trees-theme-list-active-selection-bg":u??`transparent`,"--trees-theme-focus-ring":d??r??``,"--trees-theme-input-bg":f??``};return i!=null&&i!==``&&(b[`--trees-theme-sidebar-border`]=i),p!=null&&p!==``&&(b[`--trees-theme-input-border`]=p),m!=null&&m!==``&&(b[`--trees-theme-scrollbar-thumb`]=m),g!=null&&g!==``&&(b[`--trees-theme-git-added-fg`]=g),_!=null&&_!==``&&(b[`--trees-theme-git-modified-fg`]=_),v!=null&&v!==``&&(b[`--trees-theme-git-deleted-fg`]=v),b}var HP=5,UP=1<<HP,WP=UP*4;function GP(){return{childIdByNameId:new Map,childIds:[],childPositionById:new Map,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function KP(){return{childIdByNameId:null,childIds:[],childPositionById:null,childVisibleChunkSums:null,totalChildSubtreeNodeCount:0,totalChildVisibleSubtreeCount:0}}function qP(e,t){if(t.childIdByNameId!=null)return t.childIdByNameId;let n=new Map;for(let r of t.childIds){let t=e[r];t!=null&&n.set(t.nameId,r)}return t.childIdByNameId=n,n}function JP(e){if(e.childPositionById!=null)return e.childPositionById;let t=new Map;for(let n=0;n<e.childIds.length;n++){let r=e.childIds[n];r!=null&&t.set(r,n)}return e.childPositionById=t,t}function YP(e,t){e.childPositionById!=null&&e.childPositionById.set(t,e.childIds.length),e.childIds.push(t)}function XP(e,t){if(e.childPositionById!=null)for(let n=t;n<e.childIds.length;n++){let t=e.childIds[n];t!=null&&e.childPositionById.set(t,n)}}function ZP(e,t){let n=0,r=0;for(let i of t.childIds){let t=e[i];t!=null&&(n+=t.subtreeNodeCount,r+=t.visibleSubtreeCount)}t.totalChildSubtreeNodeCount=n,t.totalChildVisibleSubtreeCount=r,tF(e,t)}function QP(e,t,n,r){if(e.totalChildSubtreeNodeCount+=n,e.totalChildVisibleSubtreeCount+=r,e.childVisibleChunkSums==null||r===0)return;let i=JP(e).get(t);if(i===void 0)return;let a=i>>HP;e.childVisibleChunkSums[a]+=r}function $P(e,t,n){let r=t.childVisibleChunkSums;if(r!=null){let i=n,a=0;for(let o of r){if(i<o){let r=nF(e,t,a,i);return{...r,childVisibleIndex:n-r.localVisibleIndex}}i-=o,a+=UP}throw Error(`Visible child index ${String(n)} is out of range`)}let i=n;for(let r=0;r<t.childIds.length;r++){let a=t.childIds[r];if(a==null)continue;let o=e[a];if(o!=null){if(i<o.visibleSubtreeCount)return{childIndex:r,childVisibleIndex:n-i,localVisibleIndex:i};i-=o.visibleSubtreeCount}}throw Error(`Visible child index ${String(n)} is out of range`)}function eF(e,t,n){let r=0,i=t.childVisibleChunkSums,a=0;if(i!=null){let e=n>>HP;for(let t=0;t<e;t+=1)r+=i[t]??0;a=e<<HP}for(let i=a;i<n;i+=1){let n=t.childIds[i];if(n==null)continue;let a=e[n];a!=null&&(r+=a.visibleSubtreeCount)}return r}function tF(e,t){if(t.childIds.length<WP){t.childVisibleChunkSums=null;return}let n=Math.ceil(t.childIds.length/UP),r=new Int32Array(n);for(let n=0;n<t.childIds.length;n++){let i=t.childIds[n];if(i==null)continue;let a=e[i];a!=null&&(r[n>>HP]+=a.visibleSubtreeCount)}t.childVisibleChunkSums=r}function nF(e,t,n,r){let i=Math.min(t.childIds.length,n+UP),a=r;for(let r=n;r<i;r++){let n=t.childIds[r];if(n==null)continue;let i=e[n];if(i!=null){if(a<i.visibleSubtreeCount)return{childIndex:r,localVisibleIndex:a};a-=i.visibleSubtreeCount}}throw Error(`Visible child index ${String(r)} is out of range`)}var rF=7,iF=3,aF=1<<iF,oF=4;function sF(e,t,n=0){return e<<oF|n<<iF|t}function cF(e){return e.depthAndFlags>>>oF}function lF(e){return(e.depthAndFlags&aF)>>iF}function uF(e){return(e.depthAndFlags&aF)!==0}function dF(e){return e.depthAndFlags&rF}function fF(e,t){return(dF(e)&t)!==0}function pF(e,t){e.depthAndFlags|=t}function mF(e,t){e.depthAndFlags=sF(t,dF(e),lF(e))}var hF=Symbol(`benchmarkInstrumentation`);function gF(e,t){return t==null||Object.defineProperty(e,hF,{configurable:!0,enumerable:!1,value:t,writable:!1}),e}function _F(e){return e==null?null:e[hF]??null}function vF(e,t,n){return e==null?n():e.measurePhase(t,n)}function yF(e,t,n){!Number.isFinite(n)||e==null||e.setCounter(t,n)}function bF(e){return e>=48&&e<=57}function xF(e){let t=[],n=0,r=0;for(;r<e.length;){for(;r<e.length&&!bF(e.charCodeAt(r));)r+=1;if(r>=e.length)break;r>n&&t.push(e.slice(n,r));let i=0;for(;r<e.length&&bF(e.charCodeAt(r));)i=i*10+(e.charCodeAt(r)-48),r+=1;t.push(i),n=r}return(n<e.length||t.length===0)&&t.push(e.slice(n)),t}function SF(e){let t=e.toLowerCase();return{lowerValue:t,tokens:xF(t)}}function CF(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e[r],i=t[r];if(n===i)continue;if(typeof n==`number`&&typeof i==`number`)return n<i?-1:1;let a=String(n),o=String(i);if(a!==o)return a<o?-1:1}return e.length===t.length?0:e.length<t.length?-1:1}function wF(e,t){if(e.tokens.length===1&&t.tokens.length===1&&typeof e.tokens[0]==`string`&&typeof t.tokens[0]==`string`)return e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1;let n=CF(e.tokens,t.tokens);return n===0?e.lowerValue===t.lowerValue?0:e.lowerValue<t.lowerValue?-1:1:n}function TF(e,t,n){let r=wF(n(e),n(t));return r===0?e===t?0:e<t?-1:1:r}function EF(e,t){return TF(e,t,SF)}function DF(e,t){return t===e.segments.length-1?+!!e.isDirectory:1}function OF(e,t){let n=Math.min(e.segments.length,t.segments.length);for(let r=0;r<n;r++){let n=e.segments[r],i=t.segments[r];if(n===i)continue;let a=DF(e,r);return a===DF(t,r)?EF(n,i):a===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function kF(e,t){return OF(e,t)}function AF(e,t,n){let r=e=>{let t=n.get(e);if(t!=null)return t;let r=SF(e);return n.set(e,r),r},i=Math.min(e.segments.length,t.segments.length);for(let n=0;n<i;n++){let i=e.segments[n],a=t.segments[n];if(i===a)continue;let o=DF(e,n);return o===DF(t,n)?TF(i,a,r):o===1?-1:1}return e.segments.length===t.segments.length?e.isDirectory===t.isDirectory?0:e.isDirectory?-1:1:e.segments.length<t.segments.length?-1:1}function jF(e,t){let n=e.sortKeyById[t];if(n!==void 0)return n;let r=e.valueById[t],i=SF(r);return e.sortKeyById[t]=i,i}function MF(e={}){return{flattenEmptyDirectories:e.flattenEmptyDirectories!==!1,sort:e.sort??`default`}}function NF(e){let t=e.length>0&&e.charCodeAt(e.length-1)===47,n=t?e.length-1:e.length,r=[],i=0;for(let t=0;t<n;t++)e.charCodeAt(t)===47&&(r.push(e.slice(i,t)),i=t+1);return r.push(e.slice(i,n)),{hasTrailingSlash:t,segments:r}}function PF(e){let{hasTrailingSlash:t,segments:n}=NF(e);return{basename:n[n.length-1]??``,isDirectory:t,path:e,segments:n}}function FF(e){if(e.length===0)return{requiresDirectory:!1,segments:[]};let{hasTrailingSlash:t,segments:n}=NF(e);return{requiresDirectory:t,segments:n}}var IF=``;function LF(){let e=new Map;return e.set(IF,0),{idByValue:e,valueById:[IF],sortKeyById:[SF(IF)]}}function RF(e,t){let n=e.idByValue.get(t);if(n!==void 0)return n;let r=e.valueById.length;return e.idByValue.set(t,r),e.valueById.push(t),r}function zF(e,t){let n=e.valueById[t];if(n===void 0)throw Error(`Unknown segment ID: ${String(t)}`);return n}var BF=Symbol(`pathStorePreparedInputKind`);function VF(e,t){return e[BF]=t,e}function HF(e){return{basename:e.basename,depth:e.segments.length,isDirectory:e.isDirectory,path:e.path,segments:e.segments}}function UF(e,t,n){return n===`default`?kF(e,t):n(HF(e),HF(t))}function WF(){return{depthAndFlags:sF(0,3,1),nameId:0,parentId:0,subtreeNodeCount:1,visibleSubtreeCount:1}}function GF(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return r;return n}function KF(e){return e.isDirectory?e.segments.length:e.segments.length-1}function qF(e){return Array.isArray(e)&&e.every(e=>typeof e==`object`&&!!e&&typeof e.path==`string`&&Array.isArray(e.segments)&&typeof e.basename==`string`&&typeof e.isDirectory==`boolean`)}function JF(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function YF(e,t={}){return tI(e,t).map(e=>e.path)}function XF(e,t={}){let n=tI(e,t);return VF({paths:n.map(e=>e.path),preparedPaths:n},`prepared`)}function ZF(e){let t=e.length,n=!1;for(let r=0;r<t;r+=1){let t=e[r];if(t.length>0&&t.charCodeAt(t.length-1)===47){n=!0;break}}return VF({paths:e,presortedPaths:e,presortedPathsContainDirectories:n},`presorted`)}function QF(e){let t=e,n=t.preparedPaths;if(t[BF]===`prepared`&&n!=null)return n;if(!qF(n))throw Error(`preparedInput must come from PathStore.prepareInput()`);return n}function $F(e){let t=e;return t[BF]===`presorted`&&t.presortedPaths!=null||JF(t.presortedPaths)?t.presortedPaths:null}function eI(e){let t=e;return typeof t.presortedPathsContainDirectories==`boolean`?t.presortedPathsContainDirectories:null}function tI(e,t={}){let n=MF(t),r=_F(t);yF(r,`workload.inputFiles`,e.length);let i=vF(r,`store.preparePathEntries.parse`,()=>e.map(e=>PF(e)));return vF(r,`store.preparePathEntries.sort`,()=>i.sort((e,t)=>UF(e,t,n.sort))),i}var nI=class{directories=new Map;directoryStack=[0];presortedDirectoryNodeIds=[];initialExpandedPathSet;createdDirectoriesAllExpanded=!1;createdDirectoryCount=0;lastPreparedPath=null;nodes=[WF()];options;instrumentation;segmentSortKeyCache=new Map;segmentTable=LF();hasDeferredDirectoryIndexes=!1;constructor(e={}){this.instrumentation=_F(e),this.options=MF(e);let t=e.initialExpandedPaths??null;if(t==null||t.length===0)this.initialExpandedPathSet=null;else{let e=new Set,n=t.length;for(let r=0;r<n;r+=1){let n=t[r],i=n.length;e.add(i>0&&n.charCodeAt(i-1)===47?n.slice(0,i-1):n)}this.initialExpandedPathSet=e,this.createdDirectoriesAllExpanded=!0}this.directories.set(0,GP())}appendPaths(e){return vF(this.instrumentation,`store.builder.appendPaths.parse`,()=>this.appendPreparedPaths(e.map(e=>PF(e))))}appendPreparedPaths(e,t=!0){return this.createdDirectoriesAllExpanded=!1,vF(this.instrumentation,`store.builder.appendPreparedPaths`,()=>{for(let n of e)this.appendPreparedPath(n,t)}),this}appendPresortedPaths(e,t=null){return vF(this.instrumentation,`store.builder.appendPresortedPaths`,()=>{if(t===!1){this.appendPresortedFilePaths(e);return}this.createdDirectoriesAllExpanded=!1;let n=null,r=0,i=this.nodes,a=this.segmentTable,o=a.idByValue,s=a.valueById,c=this.directoryStack,l=0,u=``,d=0;for(let t of e){if(n===t)throw Error(`Duplicate path: "${t}"`);let e=t.length>0&&t.charCodeAt(t.length-1)===47,a=e?t.length-1:t.length,f=0,p=0;if(n!=null)if(u.length>0&&t.length>u.length&&t.startsWith(u))f=d,p=u.length;else{let r=Math.min(a,n.length),i=!0;for(let e=0;e<r;e++){let r=t.charCodeAt(e);if(r!==n.charCodeAt(e)){i=!1;break}r===47&&(f++,p=e+1)}i&&e&&r===a&&n.length>a&&n.charCodeAt(a)===47&&(f++,p=a+1)}l=f,r=f;let m=p,h=t.indexOf(`/`,m);for(;h>=0&&h<a;){let e=c[l];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);r++;let n=t.slice(m,h),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n));let u=i.length;i.push({depthAndFlags:sF(r,0,1),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(t.slice(0,h)),l++,c[l]=u,m=h+1,h=t.indexOf(`/`,m)}if(e){if(m<a){let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory parent for "${t}"`);r++;let n=t.slice(m,a),u=o.get(n);u===void 0&&(u=s.length,o.set(n,u),s.push(n));let d=i.length;i.push({depthAndFlags:sF(r,0,1),nameId:u,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),l++,c[l]=d}let e=c[l];if(e===void 0)throw Error(`Unable to resolve directory node for "${t}"`);this.promoteDirectoryToExplicit(e,t)}else{let e=c[l];if(e===void 0)throw Error(`Unable to resolve file parent for "${t}"`);let n=t.slice(m),a=o.get(n);a===void 0&&(a=s.length,o.set(n,a),s.push(n)),i.push({depthAndFlags:sF(r+1,0),nameId:a,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1})}m!==u.length&&(u=t.substring(0,m),d=r),n=t}c.length=l+1,n!=null&&(this.lastPreparedPath=PF(n)),this.hasDeferredDirectoryIndexes=!0}),this}appendPresortedFilePaths(e){let t=null,n=0,r=this.nodes,i=this.segmentTable,a=i.idByValue,o=i.valueById,s=this.directoryStack,c=0,l=``,u=0;for(let i of e){if(t===i)throw Error(`Duplicate path: "${i}"`);let e=i.length,d=0,f=0;if(t!=null)if(l.length>0&&i.length>l.length&&i.startsWith(l))d=u,f=l.length;else{let n=Math.min(e,t.length);for(let e=0;e<n;e++){let n=i.charCodeAt(e);if(n!==t.charCodeAt(e))break;n===47&&(d++,f=e+1)}}c=d,n=d;let p=f,m=i.indexOf(`/`,p);for(;m>=0;){let e=s[c];if(e===void 0)throw Error(`Directory stack underflow while building the path store`);n++;let t=i.slice(p,m),l=a.get(t);l===void 0&&(l=o.length,a.set(t,l),o.push(t));let u=r.length;r.push({depthAndFlags:sF(n,0,1),nameId:l,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),this.recordCreatedDirectoryPath(i.slice(0,m)),this.presortedDirectoryNodeIds.push(u),c++,s[c]=u,p=m+1,m=i.indexOf(`/`,p)}let h=s[c];if(h===void 0)throw Error(`Unable to resolve file parent for "${i}"`);let g=i.slice(p),_=a.get(g);_===void 0&&(_=o.length,a.set(g,_),o.push(g)),r.push({depthAndFlags:sF(n+1,0),nameId:_,parentId:h,subtreeNodeCount:1,visibleSubtreeCount:1}),p!==l.length&&(l=i.substring(0,p),u=n),t=i}s.length=c+1,t!=null&&(this.lastPreparedPath=PF(t)),this.hasDeferredDirectoryIndexes=!0}finish(e={}){let t=e.skipSubtreeCountPass===!0;return this.hasDeferredDirectoryIndexes?(vF(this.instrumentation,`store.builder.buildDirectoryIndexes`,()=>this.buildPresortedFinish(t)),this.hasDeferredDirectoryIndexes=!1):t||vF(this.instrumentation,`store.builder.computeSubtreeCounts`,()=>this.computeSubtreeCounts(0)),{directories:this.directories,nodes:this.nodes,options:this.options,rootId:0,segmentTable:this.segmentTable,presortedDirectoryNodeIds:this.presortedDirectoryNodeIds.length>0?this.presortedDirectoryNodeIds:null}}didMatchAllInitialExpandedPaths(){return this.createdDirectoriesAllExpanded&&this.initialExpandedPathSet!=null&&this.createdDirectoryCount===this.initialExpandedPathSet.size}appendPreparedPath(e,t){if(this.hasDeferredDirectoryIndexes&&=(this.buildDirectoryIndexes(),!1),this.lastPreparedPath!=null){if(e.path===this.lastPreparedPath.path)throw Error(`Duplicate path: "${e.path}"`);if(t&&(this.options.sort===`default`?AF(this.lastPreparedPath,e,this.segmentSortKeyCache):UF(this.lastPreparedPath,e,this.options.sort))>0)throw Error(`Builder input must be sorted before appendPaths(): "${e.path}"`)}let n=this.lastPreparedPath,r=KF(e),i=n==null?0:KF(n),a=n==null?0:GF(n.segments,e.segments),o=Math.min(a,r,i);this.directoryStack.length=o+1;for(let n=o;n<r;n++){let r=this.directoryStack[this.directoryStack.length-1];if(r===void 0)throw Error(`Directory stack underflow while building the path store`);let i=t?this.getOrCreateDirectoryChild(r,e.segments[n]):this.createDirectoryChild(r,e.segments[n]);this.directoryStack.push(i)}if(e.isDirectory){let t=this.directoryStack[this.directoryStack.length-1];if(t===void 0)throw Error(`Unable to resolve directory node for "${e.path}"`);this.promoteDirectoryToExplicit(t,e.path),this.lastPreparedPath=e;return}let s=this.directoryStack[this.directoryStack.length-1];if(s===void 0)throw Error(`Unable to resolve file parent for "${e.path}"`);t?this.createFileChild(s,e.basename,e.path):this.createFileChildUnchecked(s,e.basename),this.lastPreparedPath=e}recordCreatedDirectoryPath(e){!this.createdDirectoriesAllExpanded||this.initialExpandedPathSet==null||(this.createdDirectoryCount+=1,this.initialExpandedPathSet.has(e)||(this.createdDirectoriesAllExpanded=!1))}createFileChild(e,t,n){let r=RF(this.segmentTable,t),i=this.getDirectoryIndex(e),a=i.childIdByNameId;if(a!=null&&a.get(r)!==void 0)throw Error(`Path collides with an existing entry: "${n}"`);let o=this.nodes[e];if(o===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let s=this.nodes.length;return this.nodes.push({depthAndFlags:sF(cF(o)+1,0),nameId:r,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),a?.set(r,s),YP(i,s),s}createFileChildUnchecked(e,t){let n=RF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:sF(cF(i)+1,0),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),YP(r,a),a}getOrCreateDirectoryChild(e,t){let n=RF(this.segmentTable,t),r=this.getDirectoryIndex(e);if(r.childIdByNameId!=null){let e=r.childIdByNameId.get(n);if(e!==void 0){let n=this.nodes[e];if(n!=null&&!uF(n))throw Error(`Path collides with an existing file while creating directory "${t}"`);return e}}let i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:sF(cF(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),YP(r,a),this.directories.set(a,GP()),a}createDirectoryChild(e,t){let n=RF(this.segmentTable,t),r=this.getDirectoryIndex(e),i=this.nodes[e];if(i===void 0)throw Error(`Unknown parent node ID: ${String(e)}`);let a=this.nodes.length;return this.nodes.push({depthAndFlags:sF(cF(i)+1,0,1),nameId:n,parentId:e,subtreeNodeCount:1,visibleSubtreeCount:1}),r.childIdByNameId!=null&&r.childIdByNameId.set(n,a),YP(r,a),this.directories.set(a,GP()),a}promoteDirectoryToExplicit(e,t){let n=this.nodes[e];if(n===void 0)throw Error(`Unknown directory node ID: ${String(e)}`);if(!uF(n))throw Error(`Path is not a directory: "${t}"`);if(fF(n,1))throw Error(`Duplicate path: "${t}"`);pF(n,1)}getDirectoryIndex(e){let t=this.directories.get(e);if(t!==void 0)return t;throw Error(`Unknown directory child index for node ${String(e)}`)}buildPresortedFinish(e){let t=this.nodes,n=this.directories;n.set(0,KP());let r=-1,i=null;for(let e=1;e<t.length;e++){let a=t[e];if(a==null)continue;if(uF(a)){let t=KP();n.set(e,t),r=e,i=t}let o;a.parentId===r?o=i:(o=n.get(a.parentId),r=a.parentId,i=o??null),o?.childIds.push(e)}if(!e)for(let e=t.length-1;e>=1;e--){let n=t[e];if(n==null)continue;let r=t[n.parentId];r!=null&&(r.subtreeNodeCount+=n.subtreeNodeCount,r.visibleSubtreeCount+=n.visibleSubtreeCount)}}buildDirectoryIndexes(){let e=this.nodes;for(let t=1;t<e.length;t++){let n=e[t];if(n==null)continue;uF(n)&&this.directories.set(t,GP());let r=this.directories.get(n.parentId);r!=null&&(r.childIdByNameId!=null&&r.childIdByNameId.set(n.nameId,t),YP(r,t))}}computeSubtreeCounts(e){let t=this.nodes[e];if(t===void 0)throw Error(`Unknown node ID: ${String(e)}`);if(!uF(t))return t.subtreeNodeCount=1,t.visibleSubtreeCount=1,1;let n=this.getDirectoryIndex(e),r=1;for(let e of n.childIds)r+=this.computeSubtreeCounts(e);return ZP(this.nodes,n),t.subtreeNodeCount=r,t.visibleSubtreeCount=r,r}};function rI(e,t=`closed`,n=null){let r=aI(t);return{activeNodeCount:e.nodes.length-1,collapsedDirectoryIds:new Set,collapseNewDirectoriesByDefault:!1,defaultExpansion:r,directoriesOpenByDefault:r===`open`,hasCollapsedDirectoryOverrides:!1,directoryLoadInfoById:new Map,expandedDirectoryIds:new Set,instrumentation:n,listeners:new Map,pathCacheByNodeId:new Map([[e.rootId,{path:``,version:0}]]),pathCacheVersion:0,snapshot:e,transactionStack:[]}}function iI(){return{affectedAncestorIds:new Set,affectedNodeIds:new Set,events:[]}}function aI(e){if(typeof e!=`number`)return e;if(!Number.isInteger(e)||e<0)throw Error(`initialExpansion must be "open", "closed", or a non-negative integer depth. Received: ${String(e)}`);return e}function oI(e,t){return fF(t,2)||e.defaultExpansion===`open`?!0:e.defaultExpansion===`closed`?!1:cF(t)<=e.defaultExpansion}function sI(e,t,n=e.snapshot.nodes[t]){return n==null||!uF(n)?!1:e.directoriesOpenByDefault&&!e.hasCollapsedDirectoryOverrides?!0:e.collapsedDirectoryIds.has(t)?!1:e.expandedDirectoryIds.has(t)?!0:oI(e,n)}function cI(e,t,n,r=e.snapshot.nodes[t]){if(r==null||!uF(r))return;let i=oI(e,r);if(n){if(i){e.collapsedDirectoryIds.delete(t),e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0;return}e.expandedDirectoryIds.add(t);return}if(i){e.collapsedDirectoryIds.add(t),e.hasCollapsedDirectoryOverrides=!0;return}e.expandedDirectoryIds.delete(t)}function lI(e,t){let n=e.directoryLoadInfoById.get(t);if(n!=null)return n;let r={activeAttemptId:null,errorMessage:null,nextAttemptId:1,state:`loaded`};return e.directoryLoadInfoById.set(t,r),r}function uI(e,t){return e.directoryLoadInfoById.get(t)?.state??`loaded`}function dI(e,t){let n=lI(e,t);if(n.state===`loading`&&n.activeAttemptId!=null)return{attemptId:n.activeAttemptId,nodeId:t,reused:!0};let r=n.nextAttemptId;return n.activeAttemptId=r,n.errorMessage=null,n.nextAttemptId+=1,n.state=`loading`,{attemptId:r,nodeId:t,reused:!1}}function fI(e,t){let n=lI(e,t);n.activeAttemptId=null,n.errorMessage=null,n.state=`unloaded`}function pI(e,t,n){let r=e.directoryLoadInfoById.get(t);return r==null||r.activeAttemptId!==n?!1:(r.activeAttemptId=null,r.errorMessage=null,r.state=`loaded`,!0)}function mI(e,t,n){return e.directoryLoadInfoById.get(t)?.activeAttemptId===n}function hI(e,t,n,r){let i=e.directoryLoadInfoById.get(t);return i==null||i.activeAttemptId!==n?!1:(i.activeAttemptId=null,i.errorMessage=r??null,i.state=`error`,!0)}function gI(e,t){e.directoryLoadInfoById.delete(t)}function _I(e,t,n){let r=n,i=e.listeners.get(t);return i==null?e.listeners.set(t,new Set([r])):i.add(r),()=>{let n=e.listeners.get(t);n!=null&&(n.delete(r),n.size===0&&e.listeners.delete(t))}}function vI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`add`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function yI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,operation:`remove`,path:e.path,projectionChanged:e.projectionChanged,recursive:e.recursive,visibleCountDelta:null}}function bI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!0,from:e.from,operation:`move`,projectionChanged:e.projectionChanged,to:e.to,visibleCountDelta:null}}function xI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`expand`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function SI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`collapse`,path:e.path,projectionChanged:!0,visibleCountDelta:null}}function CI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],canonicalChanged:!1,operation:`mark-directory-unloaded`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function wI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`begin-child-load`,path:e.path,projectionChanged:e.projectionChanged,reused:e.reused,visibleCountDelta:null}}function TI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:e.childEvents.some(e=>e.canonicalChanged),childEvents:e.childEvents,operation:`apply-child-patch`,path:e.path,projectionChanged:e.projectionChanged,visibleCountDelta:null}}function EI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,operation:`complete-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function DI(e){return{affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],attemptId:e.attemptId,canonicalChanged:!1,errorMessage:e.errorMessage,operation:`fail-child-load`,path:e.path,projectionChanged:e.projectionChanged,stale:e.stale,visibleCountDelta:null}}function OI(e){return{activeNodeCountAfter:e.activeNodeCountAfter,activeNodeCountBefore:e.activeNodeCountBefore,affectedAncestorIds:e.affectedAncestorIds??[],affectedNodeIds:e.affectedNodeIds??[],cachedPathEntryCountAfter:e.cachedPathEntryCountAfter,cachedPathEntryCountBefore:e.cachedPathEntryCountBefore,canonicalChanged:!1,idsPreserved:e.idsPreserved,loadInfoEntryCountAfter:e.loadInfoEntryCountAfter,loadInfoEntryCountBefore:e.loadInfoEntryCountBefore,mode:e.mode,operation:`cleanup`,projectionChanged:e.projectionChanged,reclaimedCachedPathEntryCount:e.reclaimedCachedPathEntryCount,reclaimedLoadInfoEntryCount:e.reclaimedLoadInfoEntryCount,reclaimedNodeSlotCount:e.reclaimedNodeSlotCount,reclaimedSegmentCount:e.reclaimedSegmentCount,segmentCountAfter:e.segmentCountAfter,segmentCountBefore:e.segmentCountBefore,totalNodeSlotCountAfter:e.totalNodeSlotCountAfter,totalNodeSlotCountBefore:e.totalNodeSlotCountBefore,visibleCountDelta:null}}function kI(e,t,n){return{...n,visibleCountDelta:BI(e)-t}}function AI(e,t){let n=BI(e),r=iI();e.transactionStack.push(r);try{t()}catch(t){throw NI(e,r,!1),t}NI(e,r,!0,BI(e)-n)}function jI(e,t){let n=e.instrumentation;if(n==null){MI(e,t);return}vF(n,`store.events.record`,()=>MI(e,t))}function MI(e,t){let n=e.transactionStack[e.transactionStack.length-1]??null;if(n==null){RI(e,t);return}n.events.push(t),LI(n,t)}function NI(e,t,n,r=null){if(e.transactionStack.pop()!==t)throw Error(`Transaction stack underflow`);if(!n)return;let i=e.transactionStack[e.transactionStack.length-1]??null;if(i!=null){let n=e.instrumentation;n==null?II(i,t):vF(n,`store.events.batch.merge`,()=>II(i,t));return}let a=PI(t,r),o=e.instrumentation;if(o==null){RI(e,a);return}vF(o,`store.events.batch.commit`,()=>RI(e,a))}function PI(e,t){return{affectedAncestorIds:[...e.affectedAncestorIds],affectedNodeIds:[...e.affectedNodeIds],canonicalChanged:e.events.some(e=>e.canonicalChanged),events:[...e.events],operation:`batch`,projectionChanged:e.events.some(e=>e.projectionChanged),visibleCountDelta:t}}function FI(e,t){for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n);for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n)}function II(e,t){for(let n of t.events)e.events.push(n);FI(e,t)}function LI(e,t){for(let n of t.affectedNodeIds)e.affectedNodeIds.add(n);for(let n of t.affectedAncestorIds)e.affectedAncestorIds.add(n)}function RI(e,t){let n=e.instrumentation;if(n==null){zI(e,t);return}vF(n,`store.events.emit`,()=>zI(e,t))}function zI(e,t){e.listeners.get(t.operation)?.forEach(e=>e(t)),e.listeners.get(`*`)?.forEach(e=>e(t))}function BI(e){return e.snapshot.nodes[e.snapshot.rootId]?.visibleSubtreeCount??0}function VI(e,t){if(e.snapshot.options.flattenEmptyDirectories!==!0)return null;let n=e.snapshot.nodes[t];if(n==null||!uF(n)||fF(n,2))return null;let r=e.snapshot.directories.get(t);if(r==null||r.childIds.length!==1)return null;let i=r.childIds[0];if(i==null)return null;let a=e.snapshot.nodes[i];return a==null||!uF(a)?null:i}function HI(e,t){let n=t;for(;;){let t=VI(e,n);if(t==null)return n;n=t}}function UI(e,t){let n=[t],r=t;for(;;){let t=VI(e,r);if(t==null)return n;n.push(t),r=t}}function WI(e,t){let n=t==null?e.snapshot.rootId:eL(e,t);return n==null?[]:iL(e,n)}function GI(e,t){let n=PF(t),r=n.isDirectory?n.segments:n.segments.slice(0,-1),i=yL(e,vL(e,r)),{createdNodeIds:a,directoryId:o}=aL(e,r),s=new Set(a),c=o;if(n.isDirectory){let n=rL(e,o);if(fF(n,1))throw Error(`Path already exists: "${t}"`);pF(n,1),e.pathCacheByNodeId.set(o,{path:t,version:e.pathCacheVersion}),s.add(o)}else c=sL(e,o,n.basename),s.add(c);ZI(e,o);let l=yL(e,o);return vI({affectedAncestorIds:$I(e,c),affectedNodeIds:[...s],path:t,projectionChanged:bL(i,l)})}function KI(e,t,n){let r=eL(e,t);if(r==null)throw Error(`Path does not exist: "${t}"`);let i=rL(e,r);if(fF(i,2))throw Error(`The root node cannot be removed`);if(uF(i)&&nL(e,r).childIds.length>0&&n.recursive!==!0)throw Error(`Cannot remove a non-empty directory without recursive: "${t}"`);let a=i.parentId,o=yL(e,a),s=gL(e,r);uL(e,a,r,i.nameId),_L(e,a),ZI(e,a);let c=yL(e,a);return yI({affectedAncestorIds:$I(e,a),affectedNodeIds:s,path:t,projectionChanged:bL(o,c),recursive:n.recursive===!0})}function qI(e,t,n,r){let i=eL(e,t);if(i==null)throw Error(`Source path does not exist: "${t}"`);let a=rL(e,i);if(fF(a,2))throw Error(`The root node cannot be moved`);let o=r.collision??`error`,s=mL(e,i,n),c=yL(e,a.parentId),l=yL(e,s.parentId),u=zF(e.snapshot.segmentTable,a.nameId),d=RF(e.snapshot.segmentTable,s.basename);if(s.parentId===a.parentId&&u===s.basename)return null;if(uF(a)&&wL(e,i,s.parentId))throw Error(`Cannot move a directory into one of its descendants`);let f=qP(e.snapshot.nodes,nL(e,s.parentId)).get(d),p=s.existingNodeId??f??null;if(p!=null&&p!==i&&hL(e,p,o,lF(a))===`skip`)return null;let m=a.parentId;uL(e,m,i,a.nameId),a.parentId=s.parentId,a.nameId=d,e.pathCacheByNodeId.delete(i),CL(e,i),lL(e,s.parentId,i),_L(e,m),e.pathCacheVersion++,ZI(e,m),s.parentId!==m&&ZI(e,s.parentId);let h=yL(e,m),g=yL(e,s.parentId);return bI({affectedAncestorIds:[...new Set([...$I(e,m),...$I(e,s.parentId)])],affectedNodeIds:[i],from:t,projectionChanged:xL([c,l],[h,g]),to:XI(e,i)})}function JI(e,t){let n=e.pathCacheByNodeId.get(t);return n!=null&&n.version===e.pathCacheVersion?n.path:null}function YI(e,t,n){return e.pathCacheByNodeId.set(t,{path:n,version:e.pathCacheVersion}),n}function XI(e,t){let n=rL(e,t),r=JI(e,t);if(r!=null)return r;if(fF(n,2))return YI(e,t,``);let i=XI(e,n.parentId),a=zF(e.snapshot.segmentTable,n.nameId),o=i.length===0?a:`${i}${a}`;return YI(e,t,uF(n)?`${o}/`:o)}function ZI(e,t){let n=e.instrumentation;if(n==null){EL(e,t);return}vF(n,`store.recomputeCountsUpwardFrom`,()=>EL(e,t))}function QI(e,t){let n=[[t,0]],{nodes:r,directories:i}=e.snapshot;for(;n.length>0;){let t=n[n.length-1],a=t[0],o=r[a];if(o==null||!uF(o)){TL(e,a,o,!0),n.pop();continue}let s=i.get(a);if(s==null||t[1]>=s.childIds.length){TL(e,a,o,!0),n.pop();continue}let c=s.childIds[t[1]++];n.push([c,0])}}function $I(e,t){let n=[],r=t;for(;r!=null;){let t=rL(e,r);if(n.push(r),r===e.snapshot.rootId)break;r=t.parentId}return n}function eL(e,t){if(t.length===0)return e.snapshot.rootId;let n=FF(t);return tL(e,n.segments,n.requiresDirectory)}function tL(e,t,n){let r=e.snapshot.rootId;for(let n of t){let t=e.snapshot.segmentTable.idByValue.get(n);if(t===void 0)return null;let i=nL(e,r),a=qP(e.snapshot.nodes,i).get(t);if(a===void 0)return null;r=a}let i=rL(e,r);return n&&!uF(i)?null:r}function nL(e,t){let n=e.snapshot.directories.get(t);if(n===void 0)throw Error(`Unknown directory child index for node ${String(t)}`);return n}function rL(e,t){let n=e.snapshot.nodes[t];if(n===void 0||fF(n,4))throw Error(`Unknown node ID: ${String(t)}`);return n}function iL(e,t){let n=e.snapshot.nodes[t];if(n===void 0||fF(n,4))return[];if(!uF(n))return[XI(e,t)];if(nL(e,t).childIds.length===0)return fF(n,1)&&!fF(n,2)?[XI(e,t)]:[];let r=[],i=[{childIndex:0,nodeId:t}];for(;i.length>0;){let t=i[i.length-1];if(t==null)break;let n=e.snapshot.nodes[t.nodeId];if(n===void 0||fF(n,4)){i.pop();continue}if(!uF(n)){r.push(XI(e,t.nodeId)),i.pop();continue}let a=nL(e,t.nodeId);if(a.childIds.length===0){fF(n,1)&&!fF(n,2)&&r.push(XI(e,t.nodeId)),i.pop();continue}let o=a.childIds[t.childIndex];if(o==null){i.pop();continue}t.childIndex++,i.push({childIndex:0,nodeId:o})}return r}function aL(e,t){let n=[],r=e.snapshot.rootId;for(let i of t){let t=RF(e.snapshot.segmentTable,i),a=nL(e,r),o=qP(e.snapshot.nodes,a).get(t);if(o!==void 0){if(!uF(rL(e,o)))throw Error(`Cannot create a directory that collides with an existing file: "${i}"`);r=o;continue}r=oL(e,r,t),n.push(r)}return{createdNodeIds:n,directoryId:r}}function oL(e,t,n){let r=rL(e,t),i=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:sF(cF(r)+1,0,1),nameId:n,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),e.snapshot.directories.set(i,GP()),lL(e,t,i),e.collapseNewDirectoriesByDefault&&(e.collapsedDirectoryIds.add(i),e.hasCollapsedDirectoryOverrides=!0),e.activeNodeCount++,i}function sL(e,t,n){let r=RF(e.snapshot.segmentTable,n),i=nL(e,t);if(qP(e.snapshot.nodes,i).has(r))throw Error(`Path already exists: "${OL(e,t,n)}"`);let a=rL(e,t),o=e.snapshot.nodes.length;return e.snapshot.nodes.push({depthAndFlags:sF(cF(a)+1,0),nameId:r,parentId:t,subtreeNodeCount:1,visibleSubtreeCount:1}),lL(e,t,o),e.activeNodeCount++,o}function cL(e,t,n){let r=0,i=t.childIds.length;for(;r<i;){let a=r+i>>>1,o=t.childIds[a];if(o==null){i=a;continue}dL(e,n,o)<0?i=a:r=a+1}return r}function lL(e,t,n){let r=nL(e,t),i=rL(e,n);qP(e.snapshot.nodes,r).set(i.nameId,n),QP(r,n,i.subtreeNodeCount,i.visibleSubtreeCount);let a=cL(e,r,n);r.childIds.splice(a,0,n),XP(r,a),tF(e.snapshot.nodes,r)}function uL(e,t,n,r){let i=nL(e,t),a=JP(i),o=a.get(n)??-1;qP(e.snapshot.nodes,i).delete(r),a.delete(n);let s=e.snapshot.nodes[n];s!=null&&QP(i,n,-s.subtreeNodeCount,-s.visibleSubtreeCount),o>=0&&(i.childIds.splice(o,1),XP(i,o),tF(e.snapshot.nodes,i))}function dL(e,t,n){let r=e.snapshot.options.sort;return r===`default`?fL(e,t,n):r(pL(e,t),pL(e,n))}function fL(e,t,n){let r=rL(e,t),i=rL(e,n),a=uF(r);if(a!==uF(i))return a?-1:1;let o=wF(jF(e.snapshot.segmentTable,r.nameId),jF(e.snapshot.segmentTable,i.nameId));if(o!==0)return o;let s=zF(e.snapshot.segmentTable,r.nameId),c=zF(e.snapshot.segmentTable,i.nameId);return s===c?t<n?-1:1:s<c?-1:1}function pL(e,t){let n=rL(e,t),r=XI(e,t),i=uF(n),a=i?r.slice(0,-1):r;return{basename:zF(e.snapshot.segmentTable,n.nameId),depth:cF(n),isDirectory:i,path:r,segments:a.length===0?[]:a.split(`/`)}}function mL(e,t,n){let r=rL(e,t),i=eL(e,n);if(i!=null){let t=rL(e,i);if(uF(t))return{basename:zF(e.snapshot.segmentTable,r.nameId),existingNodeId:null,parentId:i};let a=FF(n).segments;return{basename:a[a.length-1]??``,existingNodeId:i,parentId:t.parentId}}let a=FF(n),o=a.segments[a.segments.length-1]??``,s=a.segments.slice(0,-1),c=s.length===0?e.snapshot.rootId:tL(e,s,!0);if(c==null)throw Error(`Destination parent does not exist: "${n}"`);return{basename:o,existingNodeId:null,parentId:c}}function hL(e,t,n,r){if(n===`skip`)return`skip`;if(n===`error`)throw Error(`Destination already exists: "${XI(e,t)}"`);let i=rL(e,t);if(lF(i)!==r)throw Error(`replace collision requires the same source and destination kinds`);if(uF(i)&&nL(e,t).childIds.length>0)throw Error(`replace collision does not support non-empty directories`);let a=i.parentId,o=i.nameId;return gL(e,t),uL(e,a,t,o),_L(e,a),ZI(e,a),`handled`}function gL(e,t){let n=[],r=[{nodeId:t,visitedChildren:!1}];for(;r.length>0;){let t=r.pop();if(t==null)break;let i=rL(e,t.nodeId);if(t.visitedChildren||!uF(i)){uF(i)&&e.snapshot.directories.delete(t.nodeId),pF(i,4),e.pathCacheByNodeId.delete(t.nodeId),e.collapsedDirectoryIds.delete(t.nodeId)&&(e.hasCollapsedDirectoryOverrides=e.collapsedDirectoryIds.size>0),e.expandedDirectoryIds.delete(t.nodeId),gI(e,t.nodeId),e.activeNodeCount--,n.push(t.nodeId);continue}r.push({nodeId:t.nodeId,visitedChildren:!0});let a=nL(e,t.nodeId);for(let e=a.childIds.length-1;e>=0;e--){let t=a.childIds[e];t!=null&&r.push({nodeId:t,visitedChildren:!1})}}return n}function _L(e,t){let n=t;for(;n!=null;){let t=rL(e,n);if(!uF(t)||fF(t,2)||nL(e,n).childIds.length>0)return;pF(t,1),n=t.parentId===n?null:t.parentId}}function vL(e,t){let n=e.snapshot.rootId;for(let r of t){let t=e.snapshot.segmentTable.idByValue.get(r);if(t==null)break;let i=qP(e.snapshot.nodes,nL(e,n)).get(t);if(i==null||!uF(rL(e,i)))break;n=i}return n}function yL(e,t){let n=SL(e,t);if(n==null)return null;let r=HI(e,n),i=rL(e,r),a=n===r?null:UI(e,n).map(t=>XI(e,t));return JSON.stringify({flattenedSegmentPaths:a,hasChildren:nL(e,r).childIds.length>0,path:XI(e,r),terminalKind:lF(i)})}function bL(e,t){return xL([e],[t])}function xL(e,t){for(let n=0;n<e.length;n+=1){let r=e[n],i=t[n];if(r==null||i==null||r!==i)return!0}return!1}function SL(e,t){let n=t;for(;n!=null;){let t=rL(e,n);if(!uF(t)||fF(t,2))return null;if(!sI(e,n,t))return n;n=t.parentId}return null}function CL(e,t){let n=rL(e,t);if(mF(n,(t===e.snapshot.rootId?-1:cF(rL(e,n.parentId)))+1),!uF(n))return;let r=nL(e,t);for(let t of r.childIds)CL(e,t)}function wL(e,t,n){let r=n;for(;r!=null;){if(r===t)return!0;let n=rL(e,r);if(r===e.snapshot.rootId)return!1;r=n.parentId}return!1}function TL(e,t,n=rL(e,t),r=!1){let i=e.instrumentation;if(i==null){DL(e,t,n,r);return}vF(i,`store.recomputeNodeCounts`,()=>DL(e,t,n,r))}function EL(e,t){let n=t;for(;n!=null;){let t=rL(e,n),r=t.subtreeNodeCount,i=t.visibleSubtreeCount;if(TL(e,n,t),n===e.snapshot.rootId)return;let a=t.subtreeNodeCount-r,o=t.visibleSubtreeCount-i,s=t.parentId;(a!==0||o!==0)&&QP(nL(e,s),n,a,o),n=s}}function DL(e,t,n,r){if(!uF(n)){n.subtreeNodeCount=1,n.visibleSubtreeCount=1;return}let i=nL(e,t);if(r){let t=e.instrumentation;t==null?ZP(e.snapshot.nodes,i):vF(t,`store.recomputeNodeCounts.rebuildChildAggregates`,()=>ZP(e.snapshot.nodes,i))}let a=1+i.totalChildSubtreeNodeCount,o=i.totalChildVisibleSubtreeCount;if(n.subtreeNodeCount=a,fF(n,2)){n.visibleSubtreeCount=o;return}n.visibleSubtreeCount=VI(e,t)==null?sI(e,t,n)?1+o:1:o}function OL(e,t,n){let r=XI(e,t);return r.length===0?n:`${r}${n}`}function kL(e){return e!=null&&!fF(e,4)}function AL(e,t){let n=e.snapshot.nodes[t];return!kL(n)||!uF(n)||fF(n,2)?null:n}function jL(e){let t=0;for(let[n,r]of e.pathCacheByNodeId)r.version===e.pathCacheVersion&&kL(e.snapshot.nodes[n])&&(t+=1);return t}function ML(e){return Math.max(0,e.valueById.length-1)}function NL(e){return{activeNodeCount:e.activeNodeCount,cachedPathEntryCount:jL(e),loadInfoEntryCount:e.directoryLoadInfoById.size,segmentCount:ML(e.snapshot.segmentTable),totalNodeSlotCount:Math.max(0,e.snapshot.nodes.length-1)}}function PL(e,t,n,r){return{activeNodeCountAfter:r.activeNodeCount,activeNodeCountBefore:n.activeNodeCount,cachedPathEntryCountAfter:r.cachedPathEntryCount,cachedPathEntryCountBefore:n.cachedPathEntryCount,idsPreserved:t,loadInfoEntryCountAfter:r.loadInfoEntryCount,loadInfoEntryCountBefore:n.loadInfoEntryCount,mode:e,reclaimedCachedPathEntryCount:n.cachedPathEntryCount-r.cachedPathEntryCount,reclaimedLoadInfoEntryCount:n.loadInfoEntryCount-r.loadInfoEntryCount,reclaimedNodeSlotCount:n.totalNodeSlotCount-r.totalNodeSlotCount,reclaimedSegmentCount:n.segmentCount-r.segmentCount,segmentCountAfter:r.segmentCount,segmentCountBefore:n.segmentCount,totalNodeSlotCountAfter:r.totalNodeSlotCount,totalNodeSlotCountBefore:n.totalNodeSlotCount}}function FL(e){let t=[],n=[];for(let n of e.collapsedDirectoryIds)AL(e,n)!=null&&t.push(XI(e,n));for(let t of e.expandedDirectoryIds)AL(e,t)!=null&&n.push(XI(e,t));return{collapsedPaths:t,expandedPaths:n}}function IL(e){let t=[];for(let[n,r]of e.directoryLoadInfoById)AL(e,n)==null||uI(e,n)===`loaded`||t.push({info:{activeAttemptId:null,errorMessage:r.errorMessage,nextAttemptId:r.nextAttemptId,state:r.state},path:XI(e,n)});return t}function LL(e,t){e.collapsedDirectoryIds.clear(),e.hasCollapsedDirectoryOverrides=!1,e.expandedDirectoryIds.clear();for(let n of t.expandedPaths){let t=eL(e,n);t!=null&&cI(e,t,!0,rL(e,t))}for(let n of t.collapsedPaths){let t=eL(e,n);t!=null&&cI(e,t,!1,rL(e,t))}}function RL(e,t){e.directoryLoadInfoById.clear();for(let n of t){let t=eL(e,n.path);t!=null&&AL(e,t)!=null&&e.directoryLoadInfoById.set(t,{activeAttemptId:null,errorMessage:n.info.errorMessage,nextAttemptId:n.info.nextAttemptId,state:n.info.state})}}function zL(e){e.pathCacheVersion+=1,e.pathCacheByNodeId.clear(),e.pathCacheByNodeId.set(e.snapshot.rootId,{path:``,version:e.pathCacheVersion})}function BL(e){let t=e.snapshot.segmentTable,n=LF();for(let r of e.snapshot.nodes)if(kL(r)){if(fF(r,2)){r.nameId=0;continue}r.nameId=RF(n,zF(t,r.nameId))}e.snapshot.segmentTable=n}function VL(e){for(let[t,n]of e.snapshot.directories){let r=e.snapshot.nodes[t];if(!kL(r)||!uF(r)){e.snapshot.directories.delete(t);continue}let i=n.childIds.filter(n=>{let r=e.snapshot.nodes[n];return kL(r)&&r.parentId===t});n.childIds=i,n.childIdByNameId=new Map(i.map(t=>[rL(e,t).nameId,t])),n.childPositionById=new Map(i.map((e,t)=>[e,t])),ZP(e.snapshot.nodes,n)}}function HL(e){let t=e.snapshot.nodes.length-1;for(;t>e.snapshot.rootId;){let n=e.snapshot.nodes[t];if(kL(n))break;--t}e.snapshot.nodes.length=t+1}function UL(e){let t=FL(e),n=IL(e);vF(e.instrumentation,`store.cleanup.stable.clearPathCaches`,()=>zL(e)),vF(e.instrumentation,`store.cleanup.stable.rebuildSegmentTable`,()=>BL(e)),vF(e.instrumentation,`store.cleanup.stable.rebuildDirectoryIndexes`,()=>VL(e)),vF(e.instrumentation,`store.cleanup.stable.trimTrailingRemovedNodeSlots`,()=>HL(e)),vF(e.instrumentation,`store.cleanup.stable.restoreExpansionOverrides`,()=>LL(e,t)),vF(e.instrumentation,`store.cleanup.stable.restoreDirectoryLoadInfos`,()=>RL(e,n)),vF(e.instrumentation,`store.cleanup.stable.recomputeCounts`,()=>QI(e,e.snapshot.rootId))}function WL(e){let t=FL(e),n=IL(e),r=vF(e.instrumentation,`store.cleanup.aggressive.listPaths`,()=>WI(e)),i=gF({...e.snapshot.options},e.instrumentation),a=vF(e.instrumentation,`store.cleanup.aggressive.rebuildSnapshot`,()=>{let e=new nI(i);return e.appendPaths(r),e.finish()});e.snapshot=a,e.activeNodeCount=a.nodes.length-1,e.pathCacheByNodeId=new Map([[a.rootId,{path:``,version:0}]]),e.pathCacheVersion=0,vF(e.instrumentation,`store.cleanup.aggressive.restoreExpansionOverrides`,()=>LL(e,t)),vF(e.instrumentation,`store.cleanup.aggressive.restoreDirectoryLoadInfos`,()=>RL(e,n)),vF(e.instrumentation,`store.cleanup.aggressive.recomputeCounts`,()=>QI(e,e.snapshot.rootId))}function GL(e){for(let t of e.directoryLoadInfoById.values())if(t.state===`loading`&&t.activeAttemptId!=null)return!0;return!1}function KL(e,t){let n=NL(e);t===`stable`?vF(e.instrumentation,`store.cleanup.stable`,()=>UL(e)):vF(e.instrumentation,`store.cleanup.aggressive`,()=>WL(e));let r=NL(e);return PL(t,t===`stable`,n,r)}var qL=64;function JL(e,t){let n=t+2;if(n<=e.length)return e;let r=e.length;for(;r<n;)r*=2;let i=new Int32Array(r);return i.fill(-1),i.set(e),i}function YL(e){return rL(e,e.snapshot.rootId).visibleSubtreeCount}function XL(e,t,n,r){let i=rL(e,t.terminalNodeId),a=Math.max(1,i.visibleSubtreeCount);return Math.min(r-1,n+a-1)}function ZL(e,t,n,r){return{ancestorPaths:r,index:t.index,posInSet:t.posInSet,row:gR(e,t.cursor),setSize:t.setSize,subtreeEndIndex:XL(e,t.cursor,t.index,n)}}function QL(e,t,n,r,i,a){let o=nL(e,t),{childIndex:s,childVisibleIndex:c,localVisibleIndex:l}=$P(e.snapshot.nodes,o,n),u=o.childIds[s];if(u==null)throw Error(`Visible index ${String(n)} is out of range`);return $L(e,u,l,r+c,i+1,s,o.childIds.length,a)}function $L(e,t,n,r,i,a,o,s){if(!uF(rL(e,t))){if(n===0)return{ancestors:s,cursor:{headNodeId:t,terminalNodeId:t,visibleDepth:i},index:r,posInSet:a,setSize:o};throw Error(`Visible index ${String(n)} is out of range for file`)}let c=uR(e,t,i);if(n===0)return{ancestors:s,cursor:c,index:r,posInSet:a,setSize:o};let l=rL(e,c.terminalNodeId);if(!uF(l)||!sI(e,c.terminalNodeId,l))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return QL(e,c.terminalNodeId,n-1,r+1,c.visibleDepth,[...s,{cursor:c,index:r,posInSet:a,setSize:o}])}function eR(e,t){let n=YL(e);if(t<0||t>=n)return null;let r=QL(e,e.snapshot.rootId,t,0,-1,[]),i=r.ancestors.map(t=>XI(e,t.cursor.terminalNodeId)),a=null;return{ancestorPaths:i,get ancestorRows(){if(a!=null)return a;let t=[],i=[];for(let a of r.ancestors){let r=ZL(e,a,n,[...i]);t.push(r),i.push(r.row.path)}return a=t,a},index:r.index,posInSet:r.posInSet,row:gR(e,r.cursor),setSize:r.setSize,subtreeEndIndex:XL(e,r.cursor,r.index,n)}}function tR(e,t,n){let r=e.instrumentation,i=YL(e);if(i<=0||n<t)return[];let a=Math.max(0,Math.min(t,i-1)),o=Math.max(a,Math.min(n,i-1));if(r==null){if(a===0)return hR(e,o+1);let t=[],n=sR(e,a);for(let r=a;r<=o&&n!=null;r++){let r=gR(e,n);t.push(r),n=fR(e,n)}return t}let s=[],c=0,l=0,u=vF(r,`store.getVisibleSlice.selectFirstRow`,()=>sR(e,a));for(let t=a;t<=o&&u!=null;t++){let t=vF(r,`store.getVisibleSlice.materializeRow`,()=>gR(e,u));s.push(t),t.isFlattened&&(c++,l+=t.flattenedSegments?.length??0),u=vF(r,`store.getVisibleSlice.advanceCursor`,()=>fR(e,u))}return yF(r,`workload.visibleRowsRead`,s.length),yF(r,`workload.flattenedRowsRead`,c),yF(r,`workload.flattenedSegmentsRead`,l),s}function nR(e,t=YL(e)){let n=e.instrumentation;return n==null?mR(e,t):vF(n,`store.getVisibleTreeProjection`,()=>mR(e,t))}function rR(e){return pR(nR(e))}function iR(e,t){let n=eL(e,t);if(n==null||n===e.snapshot.rootId||uF(rL(e,n))&&HI(e,n)!==n)return null;let r=0,i=n,{nodes:a,rootId:o}=e.snapshot;for(;i!==o;){let t=rL(e,i).parentId,n=nL(e,t),s=JP(n).get(i);if(s==null)throw Error(`Child ${String(i)} was not found in its parent index`);if(r+=eF(a,n,s),t!==o){let n=rL(e,t),a=VI(e,t);if(!sI(e,t,n)&&a!==i)return null;HI(e,t)===t&&(r+=1)}i=t}return r}function aR(e,t){let n=eL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=rL(e,n);if(!uF(r))throw Error(`Path is not a directory: "${t}"`);return sI(e,n,r)?null:(cI(e,n,!0,r),ZI(e,n),xI({affectedAncestorIds:$I(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0}))}function oR(e,t){let n=eL(e,t);if(n==null)throw Error(`Path does not exist: "${t}"`);let r=rL(e,n);if(!uF(r))throw Error(`Path is not a directory: "${t}"`);return sI(e,n,r)?(cI(e,n,!1,r),ZI(e,n),SI({affectedAncestorIds:$I(e,n),affectedNodeIds:[n],path:t,projectionChanged:!0})):null}function sR(e,t){return t<0||t>=YL(e)?null:cR(e,e.snapshot.rootId,t,-1)}function cR(e,t,n,r){let i=nL(e,t),a=e.instrumentation,{childIndex:o,localVisibleIndex:s}=a==null?$P(e.snapshot.nodes,i,n):vF(a,`store.getVisibleSlice.selectChildIndex`,()=>$P(e.snapshot.nodes,i,n)),c=i.childIds[o];if(c!=null)return lR(e,c,s,r+1);throw Error(`Visible index ${String(n)} is out of range`)}function lR(e,t,n,r){if(!uF(rL(e,t))){if(n===0)return{headNodeId:t,terminalNodeId:t,visibleDepth:r};throw Error(`Visible index ${String(n)} is out of range for file`)}let i=uR(e,t,r);if(n===0)return i;let a=rL(e,i.terminalNodeId);if(!uF(a)||!sI(e,i.terminalNodeId,a))throw Error(`Visible index ${String(n)} is out of range for collapsed directory`);return cR(e,i.terminalNodeId,n-1,i.visibleDepth)}function uR(e,t,n){return uF(rL(e,t))?e.instrumentation==null?{headNodeId:t,terminalNodeId:HI(e,t),visibleDepth:n}:{headNodeId:t,terminalNodeId:vF(e.instrumentation,`store.getVisibleSlice.flatten.resolveTerminalDirectory`,()=>HI(e,t)),visibleDepth:n}:{headNodeId:t,terminalNodeId:t,visibleDepth:n}}function dR(e,t){let n=rL(e,t);if(!uF(n))return!0;let r=n.parentId;return r===e.snapshot.rootId?!0:VI(e,r)!==t}function fR(e,t){let n=rL(e,t.terminalNodeId);if(uF(n)){let r=nL(e,t.terminalNodeId);if(sI(e,t.terminalNodeId,n)&&r.childIds.length>0){let n=r.childIds[0];return n==null?null:lR(e,n,0,t.visibleDepth+1)}}let r=t.terminalNodeId,i=t.visibleDepth;for(;;){let t=rL(e,r);if(r===e.snapshot.rootId)return null;let n=t.parentId,a=nL(e,n),o=JP(a).get(r)??-1;if(o<0)throw Error(`Child ${String(r)} was not found in its parent index`);let s=a.childIds[o+1]??null;if(s!=null)return lR(e,s,0,i);dR(e,r)&&i--,r=n}}function pR(e){let t=e.paths.length,n=Array(t);for(let r=0;r<t;r+=1){let t=e.getParentIndex(r);n[r]={index:r,parentPath:t>=0?e.paths[t]??null:null,path:e.paths[r]??``,posInSet:e.posInSetByIndex[r]??0,setSize:e.setSizeByIndex[r]??0}}return{getParentIndex:e.getParentIndex,rows:n,get visibleIndexByPath(){return e.visibleIndexByPath}}}function mR(e,t){let n=Array(t),r=new Int32Array(t),i=new Int32Array(t),a=new Int32Array(t),o=new Int32Array(qL);o.fill(-1);let s=0,{nodes:c,directories:l,segmentTable:u}=e.snapshot,d=[[l.get(e.snapshot.rootId),0,-1,``]],f=e.snapshot.options.flattenEmptyDirectories,p=e.pathCacheByNodeId,m=e.pathCacheVersion,h=u.valueById;for(;d.length>0&&s<t;){let t=d[d.length-1],u=t[0];if(t[1]>=u.childIds.length){d.pop();continue}let g=t[1],_=u.childIds[t[1]++],v=c[_],y=t[2]+1,b=t[3];o=JL(o,y);let x,S=_;if(uF(v))S=f?HI(e,_):_,x=S===_?`${b}${h[v.nameId]}/`:XI(e,S);else{let e=p.get(_);x=e!=null&&e.version===m?e.path:`${b}${h[v.nameId]}`}r[s]=o[y],n[s]=x,i[s]=g,a[s]=u.childIds.length,o[y+1]=s,s+=1;let C=c[S];C!=null&&uF(C)&&sI(e,S,C)&&d.push([l.get(S),0,y,x])}s<t&&(n.length=s);let g=r.subarray(0,s),_=i.subarray(0,s),v=a.subarray(0,s),y=null;return{getParentIndex(e){return e<0||e>=s?-1:g[e]??-1},paths:n,posInSetByIndex:_,setSizeByIndex:v,get visibleIndexByPath(){if(y==null){y=new Map;for(let e=0;e<s;e+=1)y.set(n[e]??``,e)}return y}}}function hR(e,t){let n=Array(t),r=0,{nodes:i,directories:a,segmentTable:o}=e.snapshot,s=[[a.get(e.snapshot.rootId),0,-1]],c=o.valueById,l=e.snapshot.options.flattenEmptyDirectories,u=e.pathCacheByNodeId,d=e.pathCacheVersion;for(;s.length>0&&r<t;){let t=s[s.length-1],o=t[0];if(t[1]>=o.childIds.length){s.pop();continue}let f=o.childIds[t[1]++],p=i[f],m=t[2]+1;if(!uF(p)){let t=u.get(f);n[r++]={depth:m,flattenedSegments:void 0,hasChildren:!1,id:f,isExpanded:!1,isFlattened:!1,isLoading:!1,kind:`file`,loadState:void 0,name:c[p.nameId],path:t!=null&&t.version===d?t.path:XI(e,f)};continue}let h=l?HI(e,f):f,g={headNodeId:f,terminalNodeId:h,visibleDepth:m};n[r++]=gR(e,g);let _=i[h];_!=null&&uF(_)&&sI(e,h,_)&&s.push([a.get(h),0,m])}return r<t&&(n.length=r),n}function gR(e,t){let n=rL(e,t.terminalNodeId),r=uF(n)?_R(e,t):null,i=XI(e,t.terminalNodeId),a=zF(e.snapshot.segmentTable,n.nameId),o=uF(n)&&nL(e,t.terminalNodeId).childIds.length>0,s=t.headNodeId!==t.terminalNodeId,c=e.instrumentation,l=s?c==null?UI(e,t.headNodeId).map(n=>{let r=rL(e,n);return{isTerminal:n===t.terminalNodeId,name:zF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:XI(e,n)}}):vF(c,`store.getVisibleSlice.flatten.collectSegments`,()=>UI(e,t.headNodeId).map(n=>{let r=rL(e,n);return{isTerminal:n===t.terminalNodeId,name:zF(e.snapshot.segmentTable,r.nameId),nodeId:n,path:XI(e,n)}})):void 0;return{depth:t.visibleDepth,flattenedSegments:l,hasChildren:o,id:t.terminalNodeId,isExpanded:uF(n)&&sI(e,t.terminalNodeId,n),isFlattened:s,isLoading:r===`loading`,kind:uF(n)?`directory`:`file`,loadState:r==null||r===`loaded`?void 0:r,name:a,path:i}}function _R(e,t){if(t.headNodeId===t.terminalNodeId)return uI(e,t.terminalNodeId);let n=UI(e,t.headNodeId),r=!1,i=!1;for(let t of n){let n=uI(e,t);if(n===`loading`)return`loading`;if(n===`error`){i=!0;continue}n===`unloaded`&&(r=!0)}return i?`error`:r?`unloaded`:`loaded`}function vR(e){let{directories:t,nodes:n,options:r,rootId:i,presortedDirectoryNodeIds:a}=e.snapshot,o=r.flattenEmptyDirectories===!0,s=e=>{let r=n[e];if(r==null||!uF(r))return;let i=t.get(e);if(i==null)throw Error(`Unknown directory child index for node ${String(e)}`);let a=i.childIds,s=a.length,c=0,l=0;for(let e=0;e<s;e++){let t=a[e];if(t==null)continue;let r=n[t];c+=r.subtreeNodeCount,l+=r.visibleSubtreeCount}i.totalChildSubtreeNodeCount=c,i.totalChildVisibleSubtreeCount=l,s>=128&&tF(n,i),r.subtreeNodeCount=1+c;let u;if(o&&s===1){let e=n[a[0]];u=e!=null&&uF(e)?l:1+l}else u=1+l;r.visibleSubtreeCount=u};if(a!=null)for(let e=a.length-1;e>=0;e--)s(a[e]);else for(let e=n.length-1;e>=1;e--)s(e);let c=n[i],l=t.get(i);if(c==null||l==null)return;let u=l.childIds,d=0,f=0;for(let e=0;e<u.length;e++){let t=u[e];if(t==null)continue;let r=n[t];d+=r.subtreeNodeCount,f+=r.visibleSubtreeCount}l.totalChildSubtreeNodeCount=d,l.totalChildVisibleSubtreeCount=f,tF(n,l),c.subtreeNodeCount=1+d,c.visibleSubtreeCount=f}function yR(e){return e.initialExpansion===`open`&&(e.initialExpandedPaths==null||e.initialExpandedPaths.length===0)}var bR=class e{#e;constructor(e={}){let t=_F(e),n=vF(t,`store.builder.create`,()=>new nI(e));if(e.preparedInput!=null){let t=$F(e.preparedInput);t==null?n.appendPreparedPaths(QF(e.preparedInput),!1):n.appendPresortedPaths(t,eI(e.preparedInput))}else{let r=e.paths??[];e.presorted===!0?n.appendPaths(r):n.appendPreparedPaths(vF(t,`store.preparePathEntries`,()=>tI(r,e)))}let r=vF(t,`store.builder.finish`,()=>n.finish({skipSubtreeCountPass:!0})),i=vF(t,`store.state.detectAllDirectoriesExpanded`,()=>(e.initialExpansion??`closed`)===`closed`&&n.didMatchAllInitialExpandedPaths());this.#e=vF(t,`store.state.create`,()=>rI(r,i?`open`:e.initialExpansion??`closed`,t)),i&&(this.#e.collapseNewDirectoriesByDefault=!0);let a=i?this.#e.snapshot.directories.size-1:vF(t,`store.state.initializeExpandedPaths`,()=>this.initializeExpandedPaths(e.initialExpandedPaths));i||yR(e)||(e.initialExpansion??`closed`)===`closed`&&a===this.#e.snapshot.directories.size-1||(e.initialExpandedPaths?.length??0)>0&&vF(t,`store.state.checkAllDirectoriesExpanded`,()=>this.hasAllDirectoriesExpanded())?vF(t,`store.state.initializeOpenVisibleCounts`,()=>vR(this.#e)):vF(t,`store.state.recomputeCounts`,()=>QI(this.#e,this.#e.snapshot.rootId))}static preparePaths(e,t={}){return YF(e,t)}static prepareInput(e,t={}){return XF(e,t)}static preparePresortedInput(e){return ZF(e)}list(e){return vF(this.#e.instrumentation,`store.list`,()=>WI(this.#e,e))}add(e){vF(this.#e.instrumentation,`store.add`,()=>{let t=YL(this.#e);jI(this.#e,kI(this.#e,t,GI(this.#e,e)))})}remove(e,t={}){vF(this.#e.instrumentation,`store.remove`,()=>{let n=YL(this.#e);jI(this.#e,kI(this.#e,n,KI(this.#e,e,t)))})}move(e,t,n={}){vF(this.#e.instrumentation,`store.move`,()=>{let r=YL(this.#e),i=qI(this.#e,e,t,n);i!=null&&jI(this.#e,kI(this.#e,r,i))})}batch(e){AI(this.#e,()=>{if(typeof e==`function`){e(this);return}for(let t of e)switch(t.type){case`add`:this.add(t.path);break;case`remove`:this.remove(t.path,{recursive:t.recursive});break;case`move`:this.move(t.from,t.to,{collision:t.collision});break}})}getVisibleCount(){return vF(this.#e.instrumentation,`store.getVisibleCount`,()=>YL(this.#e))}getVisibleSlice(e,t){return vF(this.#e.instrumentation,`store.getVisibleSlice`,()=>tR(this.#e,e,t))}getVisibleRowContext(e){return vF(this.#e.instrumentation,`store.getVisibleRowContext`,()=>eR(this.#e,e))}getVisibleTreeProjection(){return rR(this.#e)}getVisibleTreeProjectionData(e){return nR(this.#e,e)}getVisibleIndex(e){return vF(this.#e.instrumentation,`store.getVisibleIndex`,()=>iR(this.#e,e))}getPathInfo(e){return vF(this.#e.instrumentation,`store.getPathInfo`,()=>{let t=eL(this.#e,e);if(t==null)return null;let n=rL(this.#e,t);return{depth:cF(n),kind:uF(n)?`directory`:`file`,path:XI(this.#e,t)}})}isExpanded(e){return vF(this.#e.instrumentation,`store.isExpanded`,()=>{let t=this.requireDirectoryNodeId(e),n=rL(this.#e,t);return sI(this.#e,t,n)})}expand(e){vF(this.#e.instrumentation,`store.expand`,()=>{let t=YL(this.#e),n=aR(this.#e,e);n!=null&&jI(this.#e,kI(this.#e,t,n))})}collapse(e){vF(this.#e.instrumentation,`store.collapse`,()=>{let t=YL(this.#e),n=oR(this.#e,e);n!=null&&jI(this.#e,kI(this.#e,t,n))})}on(e,t){return _I(this.#e,e,t)}getDirectoryLoadState(e){let t=this.requireDirectoryNodeId(e);return uI(this.#e,t)}markDirectoryUnloaded(e){vF(this.#e.instrumentation,`store.markDirectoryUnloaded`,()=>{let t=this.requireDirectoryNodeId(e);if(nL(this.#e,t).childIds.length>0)throw Error(`Cannot mark a directory with known children as unloaded: "${e}"`);let n=YL(this.#e);fI(this.#e,t),jI(this.#e,kI(this.#e,n,CI({affectedAncestorIds:$I(this.#e,t),affectedNodeIds:[t],path:e,projectionChanged:this.isDirectoryProjectionVisible(t)})))})}beginChildLoad(e){return vF(this.#e.instrumentation,`store.beginChildLoad`,()=>{let t=this.requireDirectoryNodeId(e),n=YL(this.#e),r=dI(this.#e,t);return jI(this.#e,kI(this.#e,n,wI({affectedAncestorIds:$I(this.#e,t),affectedNodeIds:[t],attemptId:r.attemptId,path:e,projectionChanged:this.isDirectoryProjectionVisible(t),reused:r.reused}))),r})}applyChildPatch(e,t){return vF(this.#e.instrumentation,`store.applyChildPatch`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null||uI(this.#e,n)!==`loading`||!mI(this.#e,n,e.attemptId))return!1;let r=XI(this.#e,n);this.validateChildPatch(r,t);let i=YL(this.#e),a=[];for(let e of t.operations){xR(r,e);let t=YL(this.#e);switch(e.type){case`add`:a.push(kI(this.#e,t,GI(this.#e,e.path)));break;case`remove`:a.push(kI(this.#e,t,KI(this.#e,e.path,{recursive:e.recursive})));break;case`move`:{let n=qI(this.#e,e.from,e.to,{collision:e.collision});n!=null&&a.push(kI(this.#e,t,n));break}}}let o=a.some(e=>e.projectionChanged)||this.isDirectoryProjectionVisible(n);return jI(this.#e,kI(this.#e,i,TI({affectedAncestorIds:$I(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,childEvents:a,path:XI(this.#e,n),projectionChanged:o}))),!0})}completeChildLoad(e){return vF(this.#e.instrumentation,`store.completeChildLoad`,()=>{let t=this.resolveActiveDirectoryNodeId(e.nodeId);if(t==null)return!1;let n=YL(this.#e),r=pI(this.#e,t,e.attemptId);return jI(this.#e,kI(this.#e,n,EI({affectedAncestorIds:$I(this.#e,t),affectedNodeIds:[t],attemptId:e.attemptId,path:XI(this.#e,t),projectionChanged:this.isDirectoryProjectionVisible(t),stale:!r}))),r})}failChildLoad(e,t){return vF(this.#e.instrumentation,`store.failChildLoad`,()=>{let n=this.resolveActiveDirectoryNodeId(e.nodeId);if(n==null)return!1;let r=YL(this.#e),i=hI(this.#e,n,e.attemptId,t);return jI(this.#e,kI(this.#e,r,DI({affectedAncestorIds:$I(this.#e,n),affectedNodeIds:[n],attemptId:e.attemptId,errorMessage:t,path:XI(this.#e,n),projectionChanged:this.isDirectoryProjectionVisible(n),stale:!i}))),i})}cleanup(e={}){return vF(this.#e.instrumentation,`store.cleanup`,()=>{if(this.#e.transactionStack.length>0)throw Error(`Cleanup cannot run during an open batch or transaction.`);if(GL(this.#e))throw Error(`Cleanup cannot run while directory loads are active.`);let t=YL(this.#e),n=KL(this.#e,e.mode??`stable`);return jI(this.#e,kI(this.#e,t,OI({...n,affectedAncestorIds:[],affectedNodeIds:[],projectionChanged:n.idsPreserved===!1}))),n})}getNodeCount(){return this.#e.activeNodeCount}initializeExpandedPaths(e){if(e==null||e.length===0)return 0;let t=0,n=[],r=[],i=0,a=null,o=this.#e.snapshot.segmentTable,s=o.valueById,c=this.#e.snapshot.nodes,l=new Map;for(let u of e){a!=null&&u<a&&(a=null,i=0,n.length=0,r.length=0);let e=u.length>0&&u.charCodeAt(u.length-1)===47?u.length-1:u.length;if(e===0){a=u,i=e,n.length=0,r.length=0;continue}let d=0,f=0;if(a!=null){let t=Math.min(e,i),n=!0;for(let e=0;e<t;e+=1){let t=u.charCodeAt(e);if(t!==a.charCodeAt(e)){n=!1;break}t===47&&(d+=1,f=e+1)}n&&(t===i&&e>t&&u.charCodeAt(t)===47?(d+=1,f=t+1):t===e&&i>t&&a.charCodeAt(t)===47&&(d+=1,f=e+1)),d=Math.min(d,r.length)}let p=d===0?this.#e.snapshot.rootId:r[d-1]??this.#e.snapshot.rootId,m=d,h=!0,g=f;for(;g<=e;){let t=u.indexOf(`/`,g),i=t===-1||t>e?e:t,a=u.slice(g,i),f=nL(this.#e,p).childIds,_=m===d?n[m]??0:0,v=_,y,b=l.get(a)??SF(a);l.set(a,b);let x=(e,t)=>{for(v=e;v<t;v+=1){let e=f[v],t=c[e],n=s[t.nameId];if(n===a)return y=e,!0;let r=wF(jF(o,t.nameId),b);if(r>0||r===0&&n>a)return!1}return!1};if(!x(_,f.length)&&_>0&&x(0,_),y===void 0){h=!1;break}if(!uF(rL(this.#e,y))){h=!1;break}if(n[m]=v,r[m]=y,p=y,m+=1,i===e)break;g=i+1}if(a=u,i=e,n.length=m,r.length=m,!h){a=null,i=0,n.length=0,r.length=0;continue}for(let e=d;e<m;e+=1){let n=r[e];if(n==null)continue;let i=rL(this.#e,n);sI(this.#e,n,i)||(cI(this.#e,n,!0,i),t+=1)}}return t}hasAllDirectoriesExpanded(){for(let e of this.#e.snapshot.directories.keys()){if(e===this.#e.snapshot.rootId)continue;let t=rL(this.#e,e);if(!sI(this.#e,e,t))return!1}return!0}requireDirectoryNodeId(e){let t=eL(this.#e,e);if(t==null)throw Error(`Path does not exist: "${e}"`);if(!uF(rL(this.#e,t)))throw Error(`Path is not a directory: "${e}"`);return t}resolveActiveDirectoryNodeId(e){try{if(!uF(rL(this.#e,e)))throw Error(`Node is not a directory: ${String(e)}`);return e}catch{return null}}isDirectoryProjectionVisible(e){let t=e;for(;t!==this.#e.snapshot.rootId;){let e=rL(this.#e,t).parentId;if(e!==this.#e.snapshot.rootId){let n=rL(this.#e,e),r=VI(this.#e,e);if(!sI(this.#e,e,n)&&r!==t)return!1}t=e}return!0}validateChildPatch(t,n){new e({paths:this.list(t),presorted:!0,sort:this.#e.snapshot.options.sort}).batch(n.operations)}};function xR(e,t){switch(t.type){case`add`:case`remove`:if(!t.path.startsWith(e)||t.path===e)throw Error(`Child patch operation must stay within ${e}: "${t.path}"`);break;case`move`:if(!t.from.startsWith(e)||!t.to.startsWith(e)||t.from===e||t.to===e)throw Error(`Child patch move must stay within ${e}: "${t.from}" -> "${t.to}"`);break}}var SR={compact:{itemHeight:24,factor:.8},default:{itemHeight:30,factor:1},relaxed:{itemHeight:36,factor:1.2}};function CR(e,t){if(typeof e==`number`)return{itemHeight:t??SR.default.itemHeight,factor:e};let n=SR[e??`default`];return{itemHeight:t??n.itemHeight,factor:n.factor}}var wR=SR.default.itemHeight,TR=`@layer base, theme, unsafe;
198
198
 
199
199
  @layer base {
200
200
  :host {
@@ -1837,17 +1837,17 @@ This template lives in your user home (~/.ok/templates/) — deleting affects ev
1837
1837
  }
1838
1838
  }
1839
1839
  }
1840
- `,OR=`@layer base, unsafe;`;function kR(e){return`${OR}
1840
+ `,ER=`@layer base, unsafe;`;function DR(e){return`${ER}
1841
1841
  @layer base {
1842
1842
  ${e}
1843
- }`}function AR(e){return`${OR}
1843
+ }`}function OR(e){return`${ER}
1844
1844
  @layer unsafe {
1845
1845
  ${e}
1846
- }`}var jR=new WeakMap;function MR(e){let t=jR.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(TP,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),jR.set(e,i),i}function NR(e,t){if(!e.isConnected)return;let n=MR(t);if(n==null)return;let r=t.querySelector(`style[${EP}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(EP,``),t.appendChild(i)),i.textContent=`:host { ${DP}: ${n}px; }`}var PR;function FR(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){PR??(PR=new CSSStyleSheet,PR.replaceSync(kR(DR)));let t=!1;try{e.adoptedStyleSheets=[PR],t=!0}catch{}if(t){e.querySelector(`style[${CP}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(CP,``),t.textContent=kR(DR),e.prepend(t)}}function IR(e,t){LR(e,t),FR(t),NR(e,t)}function LR(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});IR(this,e)}}if(customElements.define(SP,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(SP)))e instanceof HTMLElement&&IR(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var RR=e=>e.startsWith(`f::`)?e.slice(3):e;function zR(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function BR(e,t){return e===``?t:`${e}/${t}`}function VR({files:e,path:t,isFolder:n,nextBasename:r}){let i=RR(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=zR(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=BR(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function HR(e){return e.endsWith(`/`)}function UR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function WR(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function GR(e,t){return t.includes(e)?WR(t):[e]}function KR(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function qR(e,t){return{draggedPaths:e,target:t}}function JR(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(HR(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function YR(e,t){return t.kind===`root`||t.directoryPath==null?UR(e):t.directoryPath}function XR(e,t){let n=e.map(e=>{let n=YR(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}var ZR=Symbol(`FILE_TREE_RENAME_VIEW`);function QR(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var $R=512,ez=512;function tz(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function nz(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function rz(e){return nz(e).at(-1)??null}function iz(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var az=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},oz=e=>e.toLowerCase();function sz(e){return e.endsWith(`/`)}function cz(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function lz(e){return e.endsWith(`/`)?e.slice(0,-1):e}function uz(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function dz(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function fz(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function pz(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return fz(e,t.path)?n?e:null:e;case`move`:return dz(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=pz(r,e,n),r==null)return null;return r}}}function mz(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function hz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function gz(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!hz(SR.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function _z(e){switch(e.operation){case`add`:return{...mz(e),operation:`add`,path:e.path};case`remove`:return{...mz(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...mz(e),from:e.from,operation:`move`,to:e.to}}}function vz(e){return{...mz(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>_z(e)),operation:`batch`}}function yz(e){switch(e.operation){case`add`:case`remove`:case`move`:return _z(e);case`batch`:return vz(e);default:return null}}function bz(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=nz(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function xz(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:bz(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var Sz=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=gz({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=rz(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=ez){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#B.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#ye(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=GR(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=qR(t.draggedPaths,n);(JR(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}KR(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#we(),!1;let n=qR(e.draggedPaths,t);if(JR(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=XR(e.draggedPaths,t);if(r==null)return this.#we(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=sz(r),a=lz(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of nz(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=cz(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[ZR](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,sz(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,sz(e)?{recursive:!0}:void 0);return}let t=sz(e),n=VR({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:lz(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(uz(n.sourcePath,t),uz(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=gz({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!tz(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=rz(e),n=iz(e,t),r=null,i=null;for(let e of this.#ve()){if(rz(e)!==t)continue;let a=iz(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=nz(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#R.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!tz(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new SR({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of nz(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(oz),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(oz),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of nz(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Se(e,t){let n=e==null?null:az(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#de(),s=this.#fe();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of nz(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of nz(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=xz(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,$R)),e,t?e=>this.#B.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=pz(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=pz(this.#c,e,!0),r=[...this.#R].map(t=>pz(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=pz(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return tz(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&QR(e)&&(this.#i=null);let t=QR(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=yz(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},Cz=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function wz(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Tz(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function Ez(e,t){return t?`${e}/`:e}function Dz(e,t=null){let n=Cz(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=wz(t.path);if(e==null)continue;let n=Ez(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Tz(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var Oz,kz,Az,jz,Mz,Nz,Pz,Fz,Iz,Lz,Rz={},zz=[],Bz=Array.isArray,Vz=zz.slice,Hz=Object.assign;function Uz(e){e&&e.parentNode&&e.remove()}function Wz(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?Vz.call(arguments,2):n),Gz(e,o,r,i,null)}function Gz(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++kz,__i:-1,__u:0};return i==null&&Oz.vnode!=null&&Oz.vnode(a),a}function Kz(e){return e.children}function qz(e,t){this.props=e,this.context=t,this.__g=0}function Jz(e,t){if(t==null)return e.__?Jz(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Jz(e):null}function Yz(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return Yz(e)}}function Xz(e){(8&e.__g||!(e.__g|=8)||!Az.push(e)||Mz++)&&jz==Oz.debounceRendering||((jz=Oz.debounceRendering)||queueMicrotask)(Zz)}function Zz(){for(var e,t,n,r,i,a,o,s,c=1;Az.length;)Az.length>c&&Az.sort(Nz),e=Az.shift(),c=Az.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Hz({},r)).__v=r.__v+1,Oz.vnode&&Oz.vnode(n),aB(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Jz(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,sB(a,n,o),n.__e!=i&&Yz(n)));Mz=0}function Qz(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||zz,b=t.length;for(c=$z(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Rz:y[m.__i]||Rz,m.__i=f,_=aB(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&uB(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=eB(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function $z(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Gz(null,o,null,null,null):Bz(o)?Gz(Kz,{children:o},null,null,null):o.constructor==null&&o.__b>0?Gz(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=tB(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Jz(s)),dB(s,s));return r}function eB(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=eB(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Jz(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function tB(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function nB(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function rB(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||nB(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||nB(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Pz,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=Fz,e.addEventListener(t,a?Lz:Iz,a)):e.removeEventListener(t,a?Lz:Iz,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function iB(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Fz++;else if(t.u<n.l)return;return n(Oz.event?Oz.event(t):t)}}}function aB(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Oz.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new qz(v,x),f.constructor=M,f.render=fB),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Hz({},f.__s)),Hz(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Oz.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=Hz({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===Kz&&d.key==null&&(E=cB(d.props.children)),s=Qz(e,Bz(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)Uz(a[j]);oB(t)}else t.__e=n.__e,t.__k=n.__k,e.then||oB(t);Oz.__e(e,t,n)}else s=t.__e=lB(n.__e,t,n,r,i,a,o,c,l,u);return(d=Oz.diffed)&&d(t),128&t.__u?void 0:s}function oB(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(oB)}function sB(e,t,n){for(var r=0;r<n.length;r++)uB(n[r],n[++r],n[++r]);Oz.__c&&Oz.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Oz.__e(e,t.__v)}})}function cB(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Bz(e)?e.map(cB):Hz({},e)}function lB(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Oz.__m&&Oz.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=Vz.call(e.childNodes),v=n.props||Rz,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;rB(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||rB(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Qz(b==`template`?e.content:e,Bz(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Jz(n,0),s,c,l),a!=null)for(u=a.length;u--;)Uz(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||rB(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&rB(e,u,g,v[u],i))}return e}function uB(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Oz.__e(e,n)}}function dB(e,t,n){var r,i;if(Oz.unmount&&Oz.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||uB(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Oz.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&dB(r[i],t,n||typeof e.type!=`function`);n||Uz(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function fB(e,t,n){return this.constructor(e,n)}function pB(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Oz.__&&Oz.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Wz(Kz,null,[e]),i=[],a=[],aB(t,e,r||Rz,Rz,t.namespaceURI,r?null:t.firstChild?Vz.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),sB(i,e,a)}function mB(e,t){e.__u|=32,pB(e,t)}Oz={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw Mz=0,e}},kz=0,qz.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Hz({},this.state);typeof e==`function`&&(e=e(Hz({},n),this.props)),e&&Hz(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Xz(this))},qz.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Xz(this))},qz.prototype.render=Kz,Az=[],Mz=0,Nz=function(e,t){return e.__v.__b-t.__v.__b},Pz=/(PointerCapture)$|Capture$/i,Fz=0,Iz=iB(!1),Lz=iB(!0);var hB=0;Array.isArray;function gB(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--hB,__i:-1,__u:0,__source:i,__self:a};return Oz.vnode&&Oz.vnode(l),l}var _B=16,vB=16,yB={};function bB({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=yB[e]??{width:_B,height:vB},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return gB(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:gB(`use`,{href:c})})}var xB=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},SB=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},CB=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},wB=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},TB=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},EB=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function DB({children:e,marker:t,variant:n=`default`}){"use no memo";return gB(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:gB(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?gB(`span`,{"data-truncate-fade":!0}):t})})}function OB(e){"use no memo";let{mode:t,children:n}=e;return gB(`div`,{children:[gB(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?gB(`span`,{children:n}):n}),gB(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?gB(`span`,{children:n}):n})]})}function kB({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=gB(OB,{mode:t,children:e},`content`),o=gB(DB,{marker:n,mode:t,variant:r},`marker`),s=gB(`div`,{"data-truncate-fill":!0},`fill`);return gB(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:gB(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function AB({children:e,...t}){"use no memo";return gB(kB,{mode:`truncate`,...t,children:e})}function jB({children:e,...t}){"use no memo";return gB(kB,{mode:`fruncate`,...t,children:e})}function MB({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=gB(AB,{...s,children:t[0]}),l=gB(jB,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return gB(`div`,{className:a,style:o});if(e.length<i)return gB(n===`end`?jB:AB,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=xB:r===`extension`?t=SB:r===`leaf-path`&&(t=CB);else if(typeof r==`number`)t=wB,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=TB:e===`first`&&(t=EB)}else typeof r==`function`&&(t=r);t??=xB;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=gB(AB,{...s,..._,children:f}),l=gB(jB,{...s,...v,children:p})}return gB(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[gB(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),gB(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var NB={endIndex:-1,startIndex:-1};function PB(e,t,n){return Math.min(Math.max(e,t),n)}function FB(e,t){return e<0||t<e?NB:{endIndex:t,startIndex:e}}function IB(e){return e.startIndex<0||e.endIndex<e.startIndex}function LB(e,t){return IB(e)?0:(e.endIndex-e.startIndex+1)*t}function RB(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function zB(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function BB(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function VB(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function HB(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function UB(e,t,n){if(e.length===0||t<=0)return[];let r=HB(e),i=BB(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=VB(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function WB(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=PB(t.scrollTop,0,o),c=t.stickyRows??UB(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=RB(s,n,t.itemHeight),m=RB(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?NB:FB(m,zB(u+d,n,t.itemHeight)),y=g+1,b=IB(v)?NB:FB(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=LB(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:IB(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var GB={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},KB={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},qB=`Contains git status items`;function JB(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function YB(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function XB(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}function ZB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function QB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}var $B,eV,tV,nV,rV=Object.is,iV=0,aV=[],oV=Oz,sV=oV.__b,cV=oV.__r,lV=oV.diffed,uV=oV.__c,dV=oV.unmount,fV=oV.__;function pV(e,t){oV.__h&&oV.__h(eV,e,iV||t),iV=0;var n=eV.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function mV(e){return iV=1,hV(DV,e)}function hV(e,t,n){var r=pV($B++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):DV(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);rV(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=eV,!eV.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,rV(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};eV.__f=!0;var a=eV.shouldComponentUpdate,o=eV.componentWillUpdate;eV.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},eV.shouldComponentUpdate=i}return r.__N||r.__}function gV(e,t){var n=pV($B++,3);!oV.__s&&EV(n.__H,t)&&(n.__=e,n.u=t,eV.__H.__h.push(n))}function _V(e,t){var n=pV($B++,4);!oV.__s&&EV(n.__H,t)&&(n.__=e,n.u=t,eV.__h.push(n))}function vV(e){return iV=5,yV(function(){return{current:e}},[])}function yV(e,t){var n=pV($B++,7);return EV(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function bV(e,t){return iV=8,yV(function(){return e},t)}function xV(){for(var e;e=aV.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wV),e.__H.__h.forEach(TV),e.__H.__h=[]}catch(t){e.__H.__h=[],oV.__e(t,e.__v)}}oV.__b=function(e){eV=null,sV&&sV(e)},oV.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),fV&&fV(e,t)},oV.__r=function(e){cV&&cV(e),$B=0;var t=(eV=e.__c).__H;t&&(tV===eV?(t.__h=[],eV.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(wV),t.__h.forEach(TV),t.__h=[],$B=0)),tV=eV},oV.diffed=function(e){lV&&lV(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(aV.push(t)!==1&&nV===oV.requestAnimationFrame||((nV=oV.requestAnimationFrame)||CV)(xV)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),tV=eV=null},oV.__c=function(e,t){t.some(function(e){try{e.__h.forEach(wV),e.__h=e.__h.filter(function(e){return!e.__||TV(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],oV.__e(n,e.__v)}}),uV&&uV(e,t)},oV.unmount=function(e){dV&&dV(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{wV(e)}catch(e){t=e}}),n.__H=void 0,t&&oV.__e(t,n.__v))};var SV=typeof requestAnimationFrame==`function`;function CV(e){var t,n=function(){clearTimeout(r),SV&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);SV&&(t=requestAnimationFrame(n))}function wV(e){var t=eV,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),eV=t}function TV(e){var t=eV;e.__c=e.__(),eV=t}function EV(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!rV(t,e[n])})}function DV(e,t){return typeof t==`function`?t(e):t}function OV(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function kV(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function AV({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return gB(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function jV(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:gB(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return gB(Kz,{children:[gB(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:gB(AB,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function MV(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function NV(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function PV(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function FV({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=WB(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:PV(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?PV(u,1,t,o):i&&r<=0&&c.length>0?UB(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var IV=400,LV=10,RV=40,zV=18;function BV(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?VV(e,t,n):a instanceof HTMLElement?a:null}function VV(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function HV(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function UV(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function WV(){return navigator.vendor!==`Apple Computer, Inc.`}function GV(e,t){let n=e-t.top;if(n<RV)return-Math.ceil((RV-Math.max(0,n))/RV*zV);let r=t.bottom-e;return r<RV?Math.ceil((RV-Math.max(0,r))/RV*zV):0}function KV(e,t){if(e!=null){let t=GB[e];return t==null?null:{text:t,title:KB[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:qB}:null}function qV(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function JV(e){return e!=null&&`toggle`in e}function YV(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function XV(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function ZV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function QV(e,t){return e!=null&&e>0?e:t}function $V(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function eH(e,t,n,r,i=0){let a=ZB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function tH(e,t,n,r,i,a){let o=QB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function nH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function rH(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function iH(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function aH(e,t){return t&&iH(e)||(e.ctrlKey||e.metaKey)&&YV(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var oH=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function sH(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function cH(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function lH(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function uH(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function dH(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function fH(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function pH(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function mH(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function hH(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=mH(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function gH(e,t){return{kind:e.kind,name:NV(e),path:t}}function _H(e){return e==null?void 0:`${e}__tree`}function vH(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function yH(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function bH(e,t){if(e==null)return null;if(`text`in e)return gB(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?yH(e.icon)?t(e.icon):{name:e.icon}:yH(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return gB(`span`,{title:e.title,children:gB(bB,{...n})})}function xH(e){e!=null&&OV(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function SH(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=MV(e);return gB(Kz,{children:[e.depth>0?gB(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>gB(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,gB(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?gB(bB,{...t(`file-tree-icon-chevron`)}):gB(bB,{...t(`file-tree-icon-file`,u)})}),gB(`div`,{"data-item-section":`content`,children:e.isFlattened?jV(e,c,a):c??gB(MB,{minimumLength:5,split:`extension`,children:e.name})}),i?gB(`div`,{"data-item-section":`decoration`,children:r==null?null:bH(r,t)}):null,s?gB(`div`,{"data-item-section":`git`,children:bH(o,t)}):null,n?gB(`div`,{"data-item-section":`action`,children:l?gB(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:gB(bB,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function CH(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=MV(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??qV(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=KV(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,ee=R||!K?null:gB(AV,{ref:D,ariaLabel:`Rename ${NV(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=SH(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:ee,showDecorativeActionAffordance:G}),ne={...YB({ariaLabel:NV(t),domId:t.isFocused?vH(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusPath(P),j(t,P,{anchorRect:lH(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusPath(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?gB(`div`,{...ne,children:te}):gB(`button`,{...ne,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:te})}function wH(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(MV(e))).map((n,r)=>CH(e,n,t.start+r))}function TH({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=ER,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=vV(null),v=vV(null),y=vV(!1),b=vV(null),x=vV(null),S=vV(null),C=vV(null),w=vV(null),T=vV(new Map),E=vV(new Map),D=vV(()=>{}),O=vV(null),k=vV(!1),A=vV(null),j=vV(null),M=vV(!1),N=vV(null),P=vV(null),F=vV(null),I=vV(null),L=vV(null),R=vV(null),z=vV(null),B=vV(null),V=vV(!1),H=vV(null),U=vV(null),W=vV(null),G=vV(null),K=yV(()=>new Map,[]),[,q]=mV(0),[ee,te]=mV(null),[ne,re]=mV(null),[ie,ae]=mV(null),[oe,se]=mV(null),[ce,le]=mV(0),[ue,de]=mV(null),fe=vV(ue);fe.current=ue;let pe=vV(null),me=vV(null),he=vV(null),ge=vV(null),_e=vV(null),ve=vV(!1),ye=()=>{me.current=null,he.current=null,ge.current=null},be=(e,t)=>{me.current=e,he.current=null,ge.current=t==null?null:{path:e,scrollTop:t}},xe=(e,t)=>{me.current=null,he.current={path:e,viewportOffset:t},ge.current=null},Se=vV(d===`retain`&&t.isSearchOpen()),[Ce,we]=mV(p);gV(()=>{p||we(!1)},[p]);let J=vV(!1),Te=bV(()=>{J.current=!0,we(e=>e&&!1)},[]),[Ee,De]=mV(()=>FV({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Oe,ke]=mV(!1);gV(()=>{ke(!0)},[]);let Ae=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,je=e?.contextMenu?.triggerMode??(Ae?`right-click`:`both`),Me=je===`both`||je===`button`,Ne=e?.contextMenu?.buttonVisibility??`when-needed`,Pe=je===`both`||je===`right-click`;_V(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;_e.current=t,re(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ve.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Fe=bV((e,t)=>{dH(T.current,e,t)},[]),Ie=bV((e,t)=>{dH(E.current,e,t)},[]),Le=bV(e=>{x.current=e},[]),Re=bV(e=>fH(e,E.current,T.current),[]),ze=n!=null||r!=null||i!=null,{resolveIcon:Be}=yV(()=>LP(a),[a]),Ve=t[ZR](),He=Ve.getPath(),Ue=He!=null,We=t.isSearchOpen(),Ge=t.getSearchValue(),Ke=t.getFocusedPath(),qe=t.getFocusedIndex(),Je=t.isDragAndDropEnabled(),Ye=t.getDragSession(),Xe=yV(()=>Ye==null?null:new Set(Ye.draggedPaths),[Ye]),Ze=Ye?.target??null,Qe=Ye?.primaryPath??null,$e=_H(o),{overlayHeight:et,overlayRows:tt,snapshot:nt,visibleRows:rt}=Ee,it=nt.physical.viewportHeight,at=yV(()=>({end:nt.window.endIndex,start:nt.window.startIndex}),[nt.window.endIndex,nt.window.startIndex]),ot=tt,st=nt.sticky.rows,ct=nt.physical.totalHeight,lt=nt.sticky.height,ut=yV(()=>new Set(st.map(e=>MV(e.row))),[st]),dt=qe>=0&&qe>=at.start&&qe<=at.end,ft=bV((e,t)=>u?.({item:gH(e,t),row:e})??null,[u]),pt=bV(e=>OV(e==null?null:T.current.get(e)??null)?!0:OV(S.current),[]),mt=bV(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=vV(mt);ht.current=mt;let gt=vV(!0),_t=vV(()=>{}),vt=bV((t=!0)=>{let n=fe.current;n!=null&&(gt.current=gt.current&&t,de(null),e?.contextMenu?.onClose?.(),gt.current&&mt(n.path))},[e?.contextMenu,mt]);_t.current=vt;let yt=bV(e=>{let t=e==null?null:uH(S.current,e);ae(e=>e===t?e:t)},[]),bt=bV((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Re(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),k.current=!0,te(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,de({anchorRect:r?.anchorRect??null,item:gH(e,n),path:n,source:r?.source??`keyboard`})},[t,Re,yt]),xt=bV(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=ZV(e,it);N.current=qe<0||e==null?null:Math.max(0,Math.min(qe*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),q(e=>e+1))}},[t,qe,s,l,it]),St=bV((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=ZV(i,it),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:FV({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,tH(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,it,h]),Ct=()=>y.current===!0||G.current!=null||V.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Tt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Et=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},Dt=()=>{R.current?.remove(),R.current=null},Ot=()=>{Tt(P.current),P.current=null,L.current=null},kt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},At=()=>{B.current?.(),B.current=null,G.current!=null&&(clearTimeout(G.current),G.current=null),V.current=!1,H.current=null,W.current=null,U.current!=null&&(U.current.setAttribute(`draggable`,`true`),U.current.style.removeProperty(`touch-action`),U.current=null),Dt(),Et(),Ot(),z.current=null},jt=(e,n)=>{let r=S.current?.getRootNode(),i=HV(BV(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Mt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Et();return}let r=t.getItem(e.directoryPath),i=JV(r)?r:null;if(i==null||i.isExpanded()){Et();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Et(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Nt=()=>{P.current=null;let e=L.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=GV(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Mt(jt(e.clientX,e.clientY)),P.current=wt(Nt)},Pt=(e,t)=>{L.current={clientX:e,clientY:t},P.current??=wt(Nt)},Ft=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(At(),Dt(),Et(),Ot(),t.startDrag(r)===!1){e.preventDefault();return}if(z.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),WV())){let t=UV(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),kt(t),R.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},It=()=>{Dt(),Et(),Ot(),z.current=null,t.cancelDrag()},Lt=(e,n,r)=>{if(G.current!=null||V.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;W.current={clientX:i.clientX,clientY:i.clientY},U.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!V.current;G.current!=null&&(clearTimeout(G.current),G.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),B.current===o&&(B.current=null),t&&(a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null)},s=e=>{let t=e.touches[0],n=W.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=LV*LV||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,G.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null;return}V.current=!0,U.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),z.current=n;let e=a.getBoundingClientRect(),s=UV(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),kt(s),R.current=s,H.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=H.current;n!=null&&R.current!=null&&(R.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Mt(jt(t.clientX,t.clientY)),Pt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&jt(n.clientX,n.clientY),t.completeDrag(),At()},u=()=>{t.cancelDrag(),At()};B.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},IV)},Rt=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}oH.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ve.isActive()){if(e.key===`Escape`)Ve.cancel();else if(e.key===`Enter`)Ve.commit();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(Ke??void 0),e.preventDefault(),e.stopPropagation();return}if(We){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=ZV(n,it);N.current=qe<0||n==null?null:Math.max(0,Math.min(qe*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&XV(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ae&&iH(e),r=aH(e,Ae),i=r&&S.current!=null?kV(S.current):null,a=r?new Set(pH(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ke&&a.has(o)){let e=C.current;be(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=JV(p)?p:null,h=u!=null&&(ut.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=fH(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&YV(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ut.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))be(b,v?.scrollTop??null),k.current=!0,te(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,hH(S.current,v,i,u,s,lt,it)),k.current=!0,te(e=>e===b?e:b)):ye()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};_V(()=>{if(!(!f||!We)){if(Se.current){Se.current=!1;return}OV(w.current)}},[We,f]),_V(()=>{let e=x.current;switch(JB({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:He})){case`reset`:j.current=null;return;case`reveal-canonical`:He!=null&&St(He,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=He,OV(e),e.select());return}},[at.end,at.start,He,St,ut]),_V(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=kV(e)?.dataset.itemPath??null;te(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,kV(e)!=null){r();return}k.current=!1,te(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,te(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;te(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),_V(()=>{let e=S.current;e!=null&&(nt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[nt.physical.scrollTop]),_V(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=ZV(n,g);let a=()=>{let e=t.getVisibleCount(),r=QV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),De(FV({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?q(e=>e+1):o=!0,a()}),u=()=>{ve.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,le(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ve.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),fe.current!=null&&y.current&&_t.current(),ve.current===!0){y.current=!1;return}re(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:$V(e[0]))??ZV(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),_V(()=>{Ae||ue==null||vt(!1)},[vt,Ae,ue]);let zt=yV(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);_V(()=>{if(zt==null){m?.clearSlotContent(kP);return}let t=fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??cH(n.getBoundingClientRect()),close:e=>{_t.current(e?.restoreFocus??!0)},restoreFocus:()=>{gt.current&&ht.current(fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(kP,i),e?.contextMenu?.onOpen?.(t.item,r),xH(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&xH(i)}),()=>{m?.clearSlotContent(kP)}},[zt,e?.contextMenu,m]),_V(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),_V(()=>{if(ue==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(sH(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&vt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),vt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[vt,ue]),_V(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=Ke;return}let n=Ke==null?null:T.current.get(Ke)??null,r=kV(t),i=r?.dataset.itemPath??null,a=Ue&&x.current===r,o=f&&w.current===r,c=M.current&&!We,l=N.current??0,u=pe.current,d=me.current,p=he.current,m=ge.current,h=r!=null,g=k.current||h,_=A.current!==Ke,v=d!=null&&d===Ke&&Ke!=null,y=c&&tH(e,qe,s,it,ct,l),b=u!=null&&u===Ke&&tH(e,qe,s,it,ct,lt),E=p!=null&&p.path===Ke&&tH(e,qe,s,it,ct,p.viewportOffset),O=m!=null&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==Ke&&!v&&eH(e,qe,s,it,lt))&&D.current(),!g){A.current=Ke;return}if(a){A.current=Ke;return}if(o&&!c){A.current=Ke;return}if(n==null){c&&qe>=0&&(tH(e,qe,s,it,ct,l),D.current()),A.current=Ke;return}(_||c||u===Ke||d===Ke||p?.path===Ke||m?.path===Ke||i==null||i!==Ke)&&(OV(n),u===Ke&&(pe.current=null),d===Ke&&(me.current=null),p?.path===Ke&&(he.current=null),m?.path===Ke&&(ge.current=null),M.current=!1,N.current=null),A.current=Ke},[t,qe,Ke,dt,s,Ue,We,at,it,f,lt,ct,rt]);let Bt=qe>=0&&qe>=nt.visible.startIndex&&qe<=nt.visible.endIndex,Vt=Ke!=null&&ot.some(e=>MV(e.row)===Ke),Ht=Bt||Vt,Ut=Me&&k.current===!0&&Ht?Ke:null,Wt=oe===`pointer`?ne:null,Gt=ue?.path??_e.current??Wt??Ut??ne,Kt=ue?.source===`right-click`;_V(()=>{y.current&&ue==null||yt(Re(Gt))},[ue,Re,at,it,ce,ot,Gt,yt,rt]);let qt=bV(e=>{if(y.current||sH(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&se(e=>e===`pointer`?e:`pointer`),re(e=>e===i?e:i)},[]),Jt=bV(()=>{re(null)},[]);_V(()=>{if(!Je)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Je]);let Yt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=HV(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Mt(t.getDragSession()?.target??null),Pt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Xt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Et(),Ot(),t.setDragTarget(null))},Zt=e=>{!Je||t.getDragSession()==null||V.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),z.current=null)},Qt=nt.window.height,$t=nt.window.offsetTop,en=Math.min(0,it-Qt-lt),tn=ee===Ke||M.current,nn=Ke!=null&&tn&&!dt&&qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null,rn=nn==null?null:nH(qe,s,at,Qt),an=z.current,on=Qe!=null&&an!=null&&an.path===Qe&&an.index>=at.start&&an.index<=at.end,sn=Qe!=null&&an!=null&&an.path===Qe&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:nH(sn.index,s,at,Qt),ln=rH((qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null)?.ancestorPaths.at(-1)??null),un=We&&Ke!=null?vH(o,Ke,!dt):void 0,dn=ue?.path??(We?Ke:ee),fn=ue?.path??ne,pn=Re(Gt),mn=Ae&&Me&&!Kt&&!Ue&&pn!=null&&ie!=null&&Gt!=null,hn=Ae&&(mn||ue!=null),gn=ue?.anchorRect,_n=gn==null&&pn!=null&&ie!=null&&(ue!=null||mn)?ie:null,vn=gn==null?_n==null?void 0:{top:`${_n}px`}:{left:`${gn.left}px`,position:`fixed`,right:`auto`,top:`${gn.top}px`},yn=Kt?{opacity:`0`}:void 0,bn=bV((e,n,r,i)=>{let a=t.getItem(r),o=XB({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=nt.visible.startIndex&&n.index<=nt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,te(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&JV(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,nt.visible.endIndex,nt.visible.startIndex,St]),xn=()=>{if(y.current||!Me||Gt==null||pn==null)return;let e=t.getItem(Gt);e!=null&&(yt(pn),gt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:pn.getAttribute(`aria-label`)??Gt,path:e.getPath()},path:e.getPath(),source:`button`}))},Sn={contextHoverPath:fn,contextMenuButtonTriggerEnabled:Me,contextMenuButtonVisibility:Ne,contextMenuEnabled:Ae,contextMenuRightClickEnabled:Pe,contextMenuTriggerMode:je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Je,draggedPathSet:Xe,dragTarget:Ze,gitLaneActive:ze,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Fe,registerRenameInput:Le,renameView:Ve,renderDecorationForRow:ft,resolveIcon:Be,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Ie};return gB(`div`,{ref:S,id:$e,"data-file-tree-context-menu-button-visibility":Ae&&Me?Ne:void 0,"data-file-tree-context-menu-trigger-mode":Ae?je:void 0,"data-file-tree-has-context-menu-action-lane":Ae&&Me?`true`:void 0,"data-file-tree-has-git-lane":ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Je?Xt:void 0,onDragOver:Je?Yt:void 0,onDrop:Je?Zt:void 0,onKeyDown:Rt,onPointerLeave:Ae?Jt:void 0,onPointerOver:Ae?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[gB(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),gB(`slot`,{name:OP,"data-type":`header-slot`}),f?gB(`div`,{"data-file-tree-search-container":!0,"data-open":We?`true`:`false`,children:gB(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":$e,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ge,onBlur:()=>{d===`retain`&&!J.current||t.closeSearch()},onFocus:Te,onPointerDown:Te,onInput:e=>{Te();let n=e.currentTarget;t.setSearch(n.value)}})}):null,gB(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Oe&&ot.length>0?gB(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:gB(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${et}px`},children:ot.map((e,t)=>CH(Cn,e.row,`sticky:${MV(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,gB(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[gB(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),gB(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[wH(Sn,at,ut),nn!=null&&rn!=null?CH(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:Qe===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?CH(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),Ae?gB(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[gB(`button`,{ref:v,type:`button`,"data-type":AP,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":mn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){vt();return}xn()},tabIndex:-1,style:yn,children:gB(bB,{...Be(`file-tree-icon-ellipsis`)})}),ue==null?null:gB(`slot`,{name:kP})]}):null,ue==null?null:gB(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),vt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),vt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var EH={hydrateRoot:(e,t)=>{mB(Wz(TH,t),e)},renderRoot:(e,t)=>{pB(Wz(TH,t),e)},unmountRoot:e=>{pB(null,e)}};function DH(e,t){EH.renderRoot(e,t)}function OH(e,t){EH.hydrateRoot(e,t)}function kH(e){EH.unmountRoot(e)}var AH=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},jH=`__c`,MH=`__k`,NH=`__d`,PH=`__s`,FH=/[\s\n\\/='"\0<>]/,IH=/^(xlink|xmlns|xml)([A-Z])/,LH=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,RH=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,zH=new Set([`draggable`,`spellcheck`]);function BH(e){e.__g===void 0?e[NH]=!0:e.__g|=8}function VH(e){e.__g===void 0?e[NH]=!1:e.__g&=-9}function HH(e){return e.__g===void 0?!0===e[NH]:!!(8&e.__g)}var UH=/["&<]/;function WH(e){if(e.length===0||!1===UH.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var GH={},KH=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),qH=/[A-Z]/g;function JH(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:GH[n]||(GH[n]=n.replace(qH,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||KH.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function YH(){this.__d=!0}function XH(e,t){return{__v:e,context:t,props:e.props,setState:YH,forceUpdate:YH,__d:!0,__h:[]}}function ZH(e,t,n){if(!e.s){if(n instanceof QH){if(!n.s)return void(n.o=ZH.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ZH.bind(null,e,t),ZH.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var QH=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{ZH(r,1,a(this.v))}catch(e){ZH(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?ZH(r,1,t?t(i):i):n?ZH(r,1,n(i)):ZH(r,2,i)}catch(e){ZH(r,2,e)}},r},e}(),$H,eU,tU,nU,rU={},iU=Array.isArray,aU=Object.assign,oU=``,sU=`<!--$s-->`,cU=`<!--/$s-->`;function lU(e,t){var n,r=e.type,i=!0;return e[jH]?(i=!1,(n=e[jH]).state=n[PH]):n=new r(e.props,t),e[jH]=n,n.__v=e,n.props=e.props,n.context=t,BH(n),n.state??=rU,n[PH]??(n[PH]=n.state),r.getDerivedStateFromProps?n.state=aU({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[PH]===n.state?n.state:n[PH]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),tU&&tU(e),n.render(n.props,n.state,t)}function uU(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===oU)return oU;var s=typeof e;if(s!=`object`)return s==`function`?oU:s==`string`?WH(e):e+oU;if(iU(e)){var c,l=oU;i[MH]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=uU(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=oU,iU(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return oU;e.__=i,$H&&$H(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===Kz){if(`tpl`in g){for(var x=oU,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!iU(C)?x+=C:x+=uU(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+WH(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=lU(e,b),y=e[jH];else{e[jH]=y=XH(e,b);for(var E=0;HH(y)&&E++<25;){VH(y),tU&&tU(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}BH(y)}if(y.getChildContext!=null&&(t=aU({},t,y.getChildContext())),T&&Oz.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===Kz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return uU(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[PH]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,rU),HH(y)?(v=lU(e,t),(y=e[jH]).getChildContext!=null&&(t=aU({},t,y.getChildContext())),uU(v=v!=null&&v.type===Kz&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):oU}finally{eU&&eU(e),nU&&nU(e)}}}v=v!=null&&v.type===Kz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=uU(v,t,n,r,e,a,o);return eU&&eU(e),Oz.unmount&&Oz.unmount(e),e._suspended?typeof D==`string`?sU+D+cU:iU(D)?(D.unshift(sU),D.push(cU),D):D.then(function(e){return sU+e+cU}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return uU(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=Oz.__e;return k&&k(i,e),oU}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=uU(v,t,n,r,e,a,o);return e._suspended?sU+s+cU:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=oU;for(var N in g){var P=g[N];if(typeof(P=fU(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=JH(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(IH.test(N))N=N.replace(IH,`$1:$2`).toLowerCase();else{if(FH.test(N))continue;N[4]!==`-`&&!zH.has(N)||P==null?n?RH.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):LH.test(N)&&(N=N.toLowerCase()):P+=oU}}P!=null&&!1!==P&&(j=!0===P||P===oU?j+` `+N:j+` `+N+`="`+(typeof P==`string`?WH(P):P+oU)+`"`)}}if(FH.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=WH(A):A!=null&&!1!==A&&!0!==A&&(M=uU(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),eU&&eU(e),nU&&nU(e),!M&&dU.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return iU(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var dU=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function fU(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var pU=0;function mU(e){return e!=null&&e.length>0?e:(pU+=1,`pst_ft_${pU}`)}function hU({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??ER)}function gU(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function _U(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function vU(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var yU=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new AH;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=mU(a),this.#p=Dz(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=TR(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new Sz({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(kH(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),DH(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Dz(e,this.#p);let t=this.#T();t!=null&&DH(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),DH(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),OH(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),DH(r,this.#w())}#C(){return{initialViewportHeight:hU({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(OP,e());return}this.#l.setSlotHtml(OP,this.#e?.header?.html??null)}#k(e){let t=vU(e).find(e=>_U(e)),n=gU(vP(MP(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=vU(e),n=t.find(e=>_U(e)),r=t.filter(e=>e!==n),i=MP(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=gU(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=MP(this.#m);t.colored&&bP(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${wP}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(wP,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=AR(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return IR(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},bU=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function xU(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:OP,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:kP,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function SU(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function CU(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function wU(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function TU({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>wU(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),bU(()=>{n.setComposition(g)},[g,n]),bU(()=>{if(c!=null)return r!=null&&CU(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=SU(xU(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(SP,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function EU(e){let t=(0,Q.useRef)(null);return t.current??=new yU(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}var DU=`.md`,OU=/\.(md|mdx)$/i;function kU(e,t=DU){return`${e}${t}`}function AU(e){return JU(e).replace(OU,``)}function jU(e){return Pr(e)?PU(e.path):Fn(e)?e.path:kU(e.docName,e.docExt)}function MU(e){let t=JU(e).match(OU);return t?`.${t[1].toLowerCase()}`:void 0}function NU(e){return JU(e)}function PU(e){let t=JU(e.trim());return t?`${t}/`:``}function FU(e){return e.endsWith(`/`)?NU(e):AU(e)}function IU(e){return e.map(jU)}function LU(e){return[...e].sort().join(`\0`)}function RU(e){return LU(IU(e))}function zU(e){let t=new Set;for(let n of e){if(Pr(n)){let e=PU(n.path);e&&t.add(e)}let e=(Pr(n)||Fn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Pr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function BU(e){if(!e)return[];let t=JU(e.replace(OU,``)).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 VU(e){let t=e.kind===`directory`,n=t?NU(e.path):AU(e.path),r=t?void 0:MU(e.path);return{kind:t?`folder`:`file`,name:JU(qU(e.path)).replace(OU,``),path:n,treePath:UU(e.path,t),docExt:r}}function HU(e){return e.kind===`directory`?NU(e.path):e.path}function UU(e,t){return t?PU(e):OU.test(e)?e:`${e}${DU}`}function WU(e,t,n){let r=PU(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}${DU}`;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 GU(e,t){return e===`file`?UU(t,!1):`${NU(t)}/index${DU}`}function KU(e,t){return t.kind===`root`||t.directoryPath==null?qU(e):`${t.directoryPath}${qU(e)}`}function qU(e){let t=JU(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function JU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function YU(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function XU(e){let t=YU(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function ZU(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function QU(e,t,n={}){if(!e)return ZU(t);let r=Hn(e);if(t&&r!==t)return ZU(t);switch(e.kind){case`doc`:return ZU(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?ZU(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function $U(e,t){if(!e)return{kind:`none`};let n=t.find(t=>jU(t)===e);if(n&&Fn(n))return{kind:`asset`,path:n.path,hash:xr(n.path),mediaKind:n.mediaKind};let r=FU(e);return e.endsWith(`/`)?t.some(e=>Pr(e)?e.path===r||e.path.startsWith(`${r}/`):(Fn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Ar(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}function eW(e){return e?.isDirectory()?e:null}function tW(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function nW(e,t,n,r){let i=(0,$.c)(6),a,o;i[0]!==n||i[1]!==t||i[2]!==e||i[3]!==r?(a=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=eW(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}tW(e,o),o.focus(),i()},o=[n,t,e,r],i[0]=n,i[1]=t,i[2]=e,i[3]=r,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}function rW(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function iW(e){return e?`No workspace`:null}function aW(e){let t=(0,$.c)(48),{input:n,installStates:r,dispatch:i}=e,{skillInstalled:a,refresh:o}=la(),[s,c]=(0,Q.useState)(!1),l=n===null,u;t[0]===l?u=t[1]:(u=iW(l),t[0]=l,t[1]=u);let d=u,f,p,m,h,g,_;if(t[2]!==i||t[3]!==d||t[4]!==n||t[5]!==l||t[6]!==r||t[7]!==a){let e;t[14]===r?e=t[15]:(e=e=>r[e.id]?.installed===!0,t[14]=r,t[15]=e);let o=zf.filter(e);m=r[`claude-cowork`]?.installed===!0;let s;t[16]===n?s=t[17]:(s=n!==null&&n.docContext!==null?tr(n.docContext):``,t[16]=n,t[17]=s);let u=s,v;t[18]!==n||t[19]!==u?(v=()=>{n!==null&&tb(u)},t[18]=n,t[19]=u,t[20]=v):v=t[20],h=v,p=yi,t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(ha,{children:[(0,Z.jsx)(ii,{"aria-hidden":`true`}),`Open in`]}),t[21]=_):_=t[21],f=Ci;let y;t[22]!==i||t[23]!==d||t[24]!==n||t[25]!==l||t[26]!==a?(y=e=>{let t=!l,r=e.id===`claude-cowork`&&t&&!a?()=>c(!0):void 0,o=nb({target:e,onInstallSkillRequest:r}),s=o?`Install Open Knowledge skill in ${e.displayName}`:d?`Open in ${e.displayName}, ${d}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(di,{disabled:!t,onSelect:()=>{n&&(o&&r?r():i(e.id,n))},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(Yy,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:Y(`flex-1`,o&&`whitespace-nowrap`),children:e.displayName}),o?(0,Z.jsx)(Ne,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null]},e.id)},t[22]=i,t[23]=d,t[24]=n,t[25]=l,t[26]=a,t[27]=y):y=t[27],g=o.map(y),t[2]=i,t[3]=d,t[4]=n,t[5]=l,t[6]=r,t[7]=a,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_}else f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13];let y;t[28]!==m||t[29]!==h||t[30]!==l?(y=m?null:(0,Z.jsxs)(di,{onSelect:h,disabled:l,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(v,{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[28]=m,t[29]=h,t[30]=l,t[31]=y):y=t[31];let b;t[32]!==f||t[33]!==g||t[34]!==y?(b=(0,Z.jsxs)(f,{children:[g,y]}),t[32]=f,t[33]=g,t[34]=y,t[35]=b):b=t[35];let x;t[36]!==p||t[37]!==_||t[38]!==b?(x=(0,Z.jsxs)(p,{children:[_,b]}),t[36]=p,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S;t[40]===o?S=t[41]:(S=e=>{c(e),e||o()},t[40]=o,t[41]=S);let C;t[42]!==s||t[43]!==S?(C=(0,Z.jsx)(ta,{open:s,onOpenChange:S}),t[42]=s,t[43]=S,t[44]=C):C=t[44];let w;return t[45]!==x||t[46]!==C?(w=(0,Z.jsxs)(Z.Fragment,{children:[x,C]}),t[45]=x,t[46]=C,t[47]=w):w=t[47],w}var oW=tt(`HOVER_INTENT_MS`,80),sW=3,cW=20,lW=new Map,uW=new Set,dW=[],fW=new Map;function pW(e){for(fW.delete(e),fW.set(e,!0);fW.size>cW;){let e=fW.keys().next().value;if(e===void 0)break;fW.delete(e)}}function mW(e){uW.delete(e),gW()}function hW(e,t){let n=Date.now();Ge(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),m(e,t,n)}function gW(){for(;uW.size<sW&&dW.length>0;){let e=dW.shift();if(!e)break;if(!fW.has(e.docName)){uW.add(e.docName),pW(e.docName);try{let t=e.prewarm(e.docName);t&&hW(e.docName,t)}catch(t){Ge(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{mW(e.docName)}}}}function _W(e,t){if(we(e)||fW.has(e))return;let n=lW.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(lW.delete(e),uW.size>=sW){dW.push({docName:e,prewarm:t});return}pW(e),uW.add(e);try{let n=t(e);n&&hW(e,n)}catch(t){Ge(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{mW(e)}},oW);lW.set(e,{timer:r,prewarm:t})}function vW(e){let t=lW.get(e);t&&(clearTimeout(t.timer),lW.delete(e))}var yW=/\.(md|mdx)$/i;function bW(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function xW(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function SW(e){let t=e.match(yW);return t?t[0]:null}async function CW(e,t){try{await navigator.clipboard.writeText(e),Xa.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Xa.error(`Could not copy ${t}`)}}var wW=new Set([`agents`,`agent`,`claude`,`skill`]),TW=`ok-file-tree-link-decoration`,EW=`ok-file-tree-agent-decoration`;function DW(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function OW(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${DW(t)}</symbol>`}var kW=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1847
- ${OW(TW,Ls)}
1848
- ${OW(EW,os)}
1849
- </svg>`,AW=`
1846
+ }`}var kR=new WeakMap;function AR(e){let t=kR.get(e);if(t!=null)return t;let n=document.createElement(`div`);n.setAttribute(CP,`true`);let r=document.createElement(`div`);r.style.position=`relative`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n);let i=Math.max(n.offsetWidth-n.clientWidth,0);return n.remove(),kR.set(e,i),i}function jR(e,t){if(!e.isConnected)return;let n=AR(t);if(n==null)return;let r=t.querySelector(`style[${wP}]`),i=r instanceof HTMLStyleElement?r:document.createElement(`style`);r instanceof HTMLStyleElement||(i.setAttribute(wP,``),t.appendChild(i)),i.textContent=`:host { ${TP}: ${n}px; }`}var MR;function NR(e){if(typeof CSSStyleSheet<`u`&&typeof CSSStyleSheet.prototype.replaceSync==`function`&&`adoptedStyleSheets`in e){MR??(MR=new CSSStyleSheet,MR.replaceSync(DR(TR)));let t=!1;try{e.adoptedStyleSheets=[MR],t=!0}catch{}if(t){e.querySelector(`style[${xP}]`)?.remove();return}}if(e.querySelector(`style[data-file-tree-style]`)==null){let t=document.createElement(`style`);t.setAttribute(xP,``),t.textContent=DR(TR),e.prepend(t)}}function PR(e,t){FR(e,t),NR(t),jR(e,t)}function FR(e,t){let n=e.querySelector(`template[shadowrootmode="open"], template[data-file-tree-shadowrootmode="open"]`);n instanceof HTMLTemplateElement&&(t.childNodes.length>0||(t.appendChild(n.content.cloneNode(!0)),n.hasAttribute(`shadowrootmode`)&&n.remove()))}if(typeof HTMLElement<`u`&&customElements.get(`file-tree-container`)==null){class e extends HTMLElement{constructor(){super()}connectedCallback(){let e=this.shadowRoot??this.attachShadow({mode:`open`});PR(this,e)}}if(customElements.define(bP,e),typeof document<`u`)for(let e of Array.from(document.querySelectorAll(bP)))e instanceof HTMLElement&&PR(e,e.shadowRoot??e.attachShadow({mode:`open`}))}var IR=e=>e.startsWith(`f::`)?e.slice(3):e;function LR(e){let t=e.lastIndexOf(`/`);return t<0?{parentPath:``,baseName:e}:{parentPath:e.slice(0,t),baseName:e.slice(t+1)}}function RR(e,t){return e===``?t:`${e}/${t}`}function zR({files:e,path:t,isFolder:n,nextBasename:r}){let i=IR(t),a=r.trim();if(a.length===0)return{error:`Name cannot be empty.`};if(a.includes(`/`))return{error:`Name cannot include "/".`};let{parentPath:o,baseName:s}=LR(i);if(a===s)return{nextFiles:e,sourcePath:i,destinationPath:i,isFolder:n};let c=RR(o,a),l=Array(e.length),u=new Set;if(!n){let t=`${c}/`,r=!1;for(let n=0;n<e.length;n++){let a=e[n];if(a!==i&&a.startsWith(t))return{error:`"${c}" already exists.`};let o=a===i?c:a;if(u.has(o))return{error:`"${c}" already exists.`};u.add(o),l[n]=o,a===i&&(r=!0)}return r?{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}:{error:`Could not find the selected file to rename.`}}let d=`${i}/`,f=`${c}/`,p=0;for(let t=0;t<e.length;t++){let n=e[t],r=n===i||n.startsWith(d);if(!r&&(n===c||n.startsWith(f)))return{error:`"${c}" already exists.`};let a=r?`${c}${n.slice(i.length)}`:n;if(u.has(a))return{error:`"${c}" already exists.`};u.add(a),l[t]=a,r&&p++}return p===0?{error:`Could not find the selected folder to rename.`}:{nextFiles:l,sourcePath:i,destinationPath:c,isFolder:n}}function BR(e){return e.endsWith(`/`)}function VR(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`),r=n<0?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function HR(e){let t=[],n=new Set;for(let r of e)n.has(r)||(n.add(r),t.push(r));let r=new Set;for(let e of t.toSorted((e,t)=>e.length===t.length?e.localeCompare(t):e.length-t.length)){let t=(e.endsWith(`/`)?e.slice(0,-1):e).split(`/`),n=!1;for(let e=0;e<t.length-1;e+=1){let i=`${t.slice(0,e+1).join(`/`)}/`;if(r.has(i)){n=!0;break}}n||r.add(e)}return t.filter(e=>r.has(e))}function UR(e,t){return t.includes(e)?HR(t):[e]}function WR(e,t){return e===t?!0:e==null||t==null?!1:e.kind===t.kind&&e.directoryPath===t.directoryPath&&e.flattenedSegmentPath===t.flattenedSegmentPath&&e.hoveredPath===t.hoveredPath}function GR(e,t){return{draggedPaths:e,target:t}}function KR(e,t){if(t.kind!==`directory`||t.directoryPath==null)return!1;for(let n of e)if(BR(n)&&(t.directoryPath===n||t.directoryPath.startsWith(n)))return!0;return!1}function qR(e,t){return t.kind===`root`||t.directoryPath==null?VR(e):t.directoryPath}function JR(e,t){let n=e.map(e=>{let n=qR(e,t);return n===e?null:{from:e,to:n,type:`move`}}).filter(e=>e!=null);return n.length===0?null:{operations:n,result:{draggedPaths:e,operation:n.length===1?`move`:`batch`,target:t}}}var YR=Symbol(`FILE_TREE_RENAME_VIEW`);function XR(e){return e.operation===`add`||e.operation===`remove`||e.operation===`move`||e.operation===`batch`}var ZR=512,QR=512;function $R(e,t){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}function ez(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function tz(e){return ez(e).at(-1)??null}function nz(e,t){return t==null?e:e.startsWith(t)?e.slice(t.length):e}var rz=e=>{let t=e.trim();return t.length===0?``:(t.includes(`\\`)?t.replaceAll(`\\`,`/`):t).toLowerCase()},iz=e=>e.toLowerCase();function az(e){return e.endsWith(`/`)}function oz(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.lastIndexOf(`/`);return n<0?t:t.slice(n+1)}function sz(e){return e.endsWith(`/`)?e.slice(0,-1):e}function cz(e,t){return t&&!e.endsWith(`/`)?`${e}/`:e}function lz(e,t,n){if(e===t)return n;let r=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(r)?`${n.endsWith(`/`)?n:`${n}/`}${e.slice(r.length)}`:e}function uz(e,t){if(e===t)return!0;let n=t.endsWith(`/`)?t:`${t}/`;return e.startsWith(n)}function dz(e,t,n=!1){if(e==null)return null;switch(t.operation){case`add`:case`expand`:case`collapse`:case`mark-directory-unloaded`:case`begin-child-load`:case`apply-child-patch`:case`complete-child-load`:case`fail-child-load`:case`cleanup`:return e;case`remove`:return uz(e,t.path)?n?e:null:e;case`move`:return lz(e,t.from,t.to);case`batch`:{let r=e;for(let e of t.events)if(r=dz(r,e,n),r==null)return null;return r}}}function fz(e){return{canonicalChanged:e.canonicalChanged,projectionChanged:e.projectionChanged,visibleCountDelta:e.visibleCountDelta}}function pz(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function mz(e,t,n){let{paths:r,preparedInput:i}=e;if(i==null){if(r==null)throw Error(`FileTree requires paths or preparedInput`);return{paths:r,preparedInput:void 0}}let a=i.paths;if(r==null)return{paths:a,preparedInput:i};if(!pz(bR.preparePaths(r,n==null?{}:{sort:n}),a))throw Error(`FileTree ${t} received paths and preparedInput for different path lists`);return{paths:a,preparedInput:i}}function hz(e){switch(e.operation){case`add`:return{...fz(e),operation:`add`,path:e.path};case`remove`:return{...fz(e),operation:`remove`,path:e.path,recursive:e.recursive};case`move`:return{...fz(e),from:e.from,operation:`move`,to:e.to}}}function gz(e){return{...fz(e),events:e.events.filter(e=>e.operation===`add`||e.operation===`remove`||e.operation===`move`).map(e=>hz(e)),operation:`batch`}}function _z(e){switch(e.operation){case`add`:case`remove`:case`move`:return hz(e);case`batch`:return gz(e);default:return null}}function vz(e,t,n){if(e===0)return-1;if(n!=null){let e=t(n);if(e!=null)return e;let r=ez(n);for(let e=r.length-1;e>=0;--e){let n=r[e];if(n==null)continue;let i=t(n);if(i!=null)return i}}return 0}function yz(e,t,n){if(e.paths.length===0)return{focusedIndex:-1,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};if(t==null)return{focusedIndex:0,getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex};let r=n??(t=>e.visibleIndexByPath.get(t)??null);return{focusedIndex:vz(e.paths.length,r,t),getParentIndex:e.getParentIndex,paths:e.paths,posInSetByIndex:e.posInSetByIndex,setSizeByIndex:e.setSizeByIndex}}var bz=class{#e;#t=new Set;#n=new Map;#r=null;#i=null;#a=new Map;#o=new Map;#s=-1;#c=null;#l=!1;#u=e=>-1;#d=new Map;#f=null;#p=null;#m=null;#h=null;#g=null;#_;#v;#y;#b=[];#x=new Int32Array;#S=new Int32Array;#C=void 0;#w=!1;#T=null;#E=``;#D=!1;#O=new Set;#k=[];#A;#j=null;#M=null;#N=null;#P=null;#F=null;#I=null;#L=null;#R=new Set;#z=0;#B;#V=0;#H=!1;#U=0;#W;constructor(e){let{dragAndDrop:t,fileTreeSearchMode:n,initialSearchQuery:r,initialSelectedPaths:i,renaming:a,onSearchChange:o,paths:s,preparedInput:c,...l}=e,u=mz({paths:s,preparedInput:c},`constructor`,l.sort);this.#e=l,t!=null&&t!==!1&&(this.#r=t===!0?{}:t),this.#w=a!=null&&a!==!1,a!=null&&a!==!1&&a!==!0&&(this.#C=a.canRename,this.#v=a.onError,this.#_=a.onRename),this.#y=o,this.#A=n??`hide-non-matches`,this.#B=this.#se(u.paths,u.preparedInput);let d=i?.map(e=>this.#Ae(e)).filter(e=>e!=null)??[],f=d.at(-1)??null;d.length>0&&(this.#R=new Set(d),this.#L=f,this.#z=1),this.#Oe(f,!1),r!=null&&this.#Se(r,!1),this.#W=this.#Fe()}destroy(){this.#W?.(),this.#W=null,this.#n.clear(),this.#t.clear(),this.#d.clear(),this.#i=null,this.#pe()}focusFirstItem(){this.#ve().length>0&&this.#Me(0)}focusLastItem(){this.#U<=0||(this.#Ne(),this.#Me(this.#U-1))}focusNextItem(){this.#De(1)}focusParentItem(){if(this.#c==null)return;let e=tz(this.#c);if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t)}focusPath(e){let t=this.#B.getPathInfo(e)?.path??null;if(t==null)return;this.#Ne();let n=this.#Y(t);n>=0&&this.#Me(n)}focusNearestPath(e){let t=this.resolveNearestVisiblePath(e);if(t==null)return null;let n=this.#Y(t);return n>=0?(this.#Me(n),this.#ve()[n]??t):null}focusPreviousItem(){this.#De(-1)}getFocusedIndex(){return this.#s}getFocusedItem(){return this.#c==null?null:this.#X(this.#c)}getFocusedPath(){return this.#c}resolveNearestVisiblePath(e){let t=this.#ve();if(this.#U===0)return null;if(e==null)return this.#c??t[0]??null;let n=this.#B.getPathInfo(e)?.path??e,r=this.#Y(n);return r>=0?t[r]??n:this.#J(n)??this.#c??t[0]??null}getSelectedPaths(){return[...this.#R]}getSelectionVersion(){return this.#z}getVisibleCount(){return this.#U}getVisibleRows(e,t){if(t<e||this.#U===0)return[];let n=Math.max(0,e),r=Math.min(this.#U-1,t);if(r<n)return[];let i=r-n+1;if(this.#F==null&&!this.#l&&r>=this.#b.length&&i<=QR){let e=[];for(let t=n;t<=r;t+=1){let n=this.#B.getVisibleRowContext(t);if(n==null)break;e.push(this.#Q(n))}return e}if(!this.#l&&r>=this.#b.length&&this.#Ne(),this.#F!=null){let e=Array.from({length:r-n+1},(e,t)=>this.#ye(n+t)),t=new Map,i=e[0]??-1,a=i;for(let n=1;n<=e.length;n+=1){let r=e[n];if(r!=null&&r===a+1){a=r;continue}if(i>=0&&this.#B.getVisibleSlice(i,a).forEach((e,n)=>{t.set(i+n,e)}),r==null){i=-1,a=-1;continue}i=r,a=r}return Array.from({length:r-n+1},(e,r)=>{let i=n+r,a=this.#ye(i),o=t.get(a),s=this.#b[a];if(o==null||s==null)throw Error(`Missing projection row for filtered visible index ${String(i)}`);return this.#Z(o,i,a,{ancestorPaths:this.#te(a),path:s})})}return this.#B.getVisibleSlice(n,r).map((e,t)=>{let r=n+t,i=this.#b[r];if(i==null)throw Error(`Missing projection path for visible index ${String(r)}`);return this.#Z(e,r,r,{ancestorPaths:this.#te(r),path:i})})}getStickyRowCandidates(e,t){if(this.#F!=null)return null;if(this.#U===0||e<=0||t<=0)return[];let n=[];for(let r=0;r<this.#U;r+=1){let i=e+r*t,a=Math.min(this.#U-1,Math.floor(i/t)),o=this.#$(a,r)??(a>0?this.#$(a-1,r):void 0);if(o==null)break;n.push({row:this.#Q(o),subtreeEndIndex:o.subtreeEndIndex})}return n}getItem(e){let t=this.#B.getPathInfo(e);return t==null?null:this.#X(t.path,t)}selectAllVisiblePaths(){this.#Ne();let e=[...this.#ve()];this.#re(e,this.#c??this.#L)}selectOnlyPath(e){let t=this.#Ae(e);t!=null&&this.#re([t],t)}selectPath(e){let t=this.#Ae(e);t==null||this.#R.has(t)||this.#re([...this.#R,t])}deselectPath(e){let t=this.#Ae(e);t==null||!this.#R.has(t)||this.#re([...this.#R].filter(e=>e!==t))}toggleFocusedSelection(){this.#c!=null&&this.togglePathSelectionFromInput(this.#c)}togglePathSelection(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.deselectPath(t);return}this.selectPath(t)}}togglePathSelectionFromInput(e){let t=this.#Ae(e);if(t!=null){if(this.#R.has(t)){this.#re([...this.#R].filter(e=>e!==t),t);return}this.#re([...this.#R,t],t)}}selectPathRange(e,t){let n=this.#Ae(e);if(n==null)return;this.#Ne();let r=this.#L,i=r==null?-1:this.#be(r),a=this.#be(n);if(i===-1||a===-1){let e=t?[...this.#R,n]:[n];this.#re(e,n);return}let[o,s]=i<=a?[i,a]:[a,i],c=this.#ve().slice(o,s+1),l=t?[...this.#R,...c]:c;this.#re(l,r)}extendSelectionFromFocused(e){if(this.#c==null)return;let t=this.#s;if(t===-1)return;let n=Math.min(this.#U-1,Math.max(0,t+e));if(n===t)return;!this.#l&&n>=this.#b.length&&this.#Ne();let r=this.#ve(),i=r[t]??null,a=r[n]??null;if(i==null||a==null)return;let o=new Set(this.#R);o.has(i)&&o.has(a)?o.delete(i):o.add(a),this.#re([...o],this.#L??i,!1),this.#Me(n)}getDragAndDropConfig(){return this.#r}isDragAndDropEnabled(){return this.#r!=null}getDragSession(){return this.#i==null?null:{draggedPaths:[...this.#i.draggedPaths],primaryPath:this.#i.primaryPath,target:this.#i.target==null?null:{...this.#i.target}}}startDrag(e){if(this.#r==null)return!1;let t=this.#Ae(e);if(t==null||this.#M!=null&&this.#M.length>0)return!1;let n=this.getSelectedPaths(),r=UR(t,n);return this.#r.canDrag?.(r)===!1?!1:(n.includes(t)||this.#re([t],t,!1),this.#je(t),this.#i={draggedPaths:r,primaryPath:t,target:null},this.#we(),!0)}setDragTarget(e){let t=this.#i;if(t==null)return;let n=e;if(n!=null){let e=GR(t.draggedPaths,n);(KR(t.draggedPaths,n)||this.#r?.canDrop?.(e)===!1)&&(n=null)}WR(t.target,n)||(this.#i={...t,target:n},this.#we())}cancelDrag(){this.#i!=null&&(this.#i=null,this.#we())}completeDrag(){let e=this.#i;if(e==null)return!1;this.#i=null;let t=e.target==null?null:{...e.target};if(t==null)return this.#we(),!1;let n=GR(e.draggedPaths,t);if(KR(e.draggedPaths,t)||this.#r?.canDrop?.(n)===!1)return this.#we(),!1;let r=JR(e.draggedPaths,t);if(r==null)return this.#we(),!1;try{if(r.operations.length===1){let e=r.operations[0];if(e==null||e.type!==`move`)throw Error(`Expected a single move operation for one-item drops`);this.#B.move(e.from,e.to,{collision:e.collision})}else this.#oe(r.operations),this.#B.batch(r.operations)}catch(e){return this.#we(),this.#r?.onDropError?.(e instanceof Error?e.message:String(e),n),!1}return this.#r?.onDropComplete?.(r.result),!0}subscribe(e){return this.#t.add(e),e(),()=>{this.#t.delete(e)}}add(e){this.#B.add(e)}remove(e,t={}){this.#B.remove(e,t)}move(e,t,n={}){this.#B.move(e,t,n)}batch(e){this.#B.batch(e)}onMutation(e,t){let n=e,r=t,i=this.#n.get(n);return i??(i=new Set,this.#n.set(n,i)),i.add(r),()=>{let e=this.#n.get(n);e?.delete(r),e?.size===0&&this.#n.delete(n)}}setSearch(e){this.#Se(e,!0)}openSearch(e=``){this.#Se(e,!0)}closeSearch(){this.#Se(null,!0)}isSearchOpen(){return this.#M!==null}getSearchValue(){return this.#M??``}getSearchMatchingPaths(){return this.#k}focusNextSearchMatch(){this.#xe(1)}focusPreviousSearchMatch(){this.#xe(-1)}startRenaming(e=this.#c??``,t={}){if(!this.#w)return!1;let n=this.#B.getPathInfo(e);if(n==null)return!1;let r=n.path,i=az(r),a=sz(r);if(this.#C?.({isFolder:i,path:a})===!1)return!1;for(let e of ez(r))this.#B.isExpanded(e)||this.#B.expand(e);return this.#re([r],r,!1),this.#M!=null&&(this.#Se(null,!1),this.#y?.(this.#M)),this.#je(r),this.#T=r,this.#E=oz(r),this.#D=t.removeIfCanceled??!1,this.#we(),!0}[YR](){return{cancel:()=>{this.#G()},commit:()=>{this.#K()},getPath:()=>this.#T,getValue:()=>this.#E,isActive:()=>this.#T!=null,setValue:e=>{this.#q(e)}}}#G(){if(this.#T==null)return;let e=this.#T,t=this.#D;if(this.#T=null,this.#E=``,this.#D=!1,t){this.remove(e,az(e)?{recursive:!0}:void 0);return}this.#je(e),this.#we()}#K(){let e=this.#T;if(e==null)return;if(this.#D&&this.#E.trim().length===0){this.#T=null,this.#E=``,this.#D=!1,this.remove(e,az(e)?{recursive:!0}:void 0);return}let t=az(e),n=zR({files:this.#B.list(),isFolder:t,nextBasename:this.#E,path:sz(e)});if(this.#T=null,this.#E=``,this.#D=!1,`error`in n){this.#je(e),this.#v?.(n.error),this.#we();return}if(n.sourcePath===n.destinationPath){this.#je(e),this.#we();return}this.#_?.({destinationPath:n.destinationPath,isFolder:n.isFolder,sourcePath:n.sourcePath}),this.move(cz(n.sourcePath,t),cz(n.destinationPath,t))}#q(e){this.#T==null||this.#E===e||(this.#E=e,this.#we())}resetPaths(e,t={}){let n=this.#B.list().length,r=this.#U,i=mz({paths:e,preparedInput:t.preparedInput},`resetPaths`,this.#e.sort),a=this.#se(i.paths,i.preparedInput,t.initialExpandedPaths),o=this.#c,s=this.#T,c=this.getSelectedPaths(),l=this.#L;this.#W?.(),this.#B=a,this.#d.clear(),this.#pe();let u=c.map(e=>a.getPathInfo(e)?.path??null).filter(e=>e!=null),d=!$R(this.#R,u);this.#R=new Set(u),d&&(this.#z+=1),this.#L=l==null?null:a.getPathInfo(l)?.path??null,this.#T=s==null?null:a.getPathInfo(s)?.path??null,this.#T??(this.#E=``,this.#D=!1),this.#Oe(o,o!=null||u.length>0||this.#L!=null),this.#W=this.#Fe(),this.#we(),this.#Te({canonicalChanged:!0,operation:`reset`,pathCountAfter:i.paths.length,pathCountBefore:n,projectionChanged:!0,usedPreparedInput:t.preparedInput!=null,visibleCountDelta:this.#U-r})}#J(e){this.#Ne();let t=tz(e),n=nz(e,t),r=null,i=null;for(let e of this.#ve()){if(tz(e)!==t)continue;let a=nz(e,t);if(a<n){r=e;continue}if(a>n){i=e;break}}return r??i}#Y(e){let t=this.#be(e);if(t!==-1)return t;let n=ez(e);for(let e=n.length-1;e>=0;--e){let t=n[e];if(t==null)continue;let r=this.#be(t);if(r!==-1)return r}return this.#ve().length>0?0:-1}#X(e,t){let n=this.#d.get(e);if(n!=null)return n;let r=t??this.#B.getPathInfo(e);if(r==null)return null;let i=r.kind===`directory`?this.#ie(r.path):this.#ae(r.path);return this.#d.set(r.path,i),i}#Z(e,t,n,r){return{ancestorPaths:r.ancestorPaths,depth:e.depth,flattenedSegments:e.flattenedSegments?.map(e=>({isTerminal:e.isTerminal,name:e.name,path:e.path})),hasChildren:e.hasChildren,index:t,isExpanded:e.isExpanded,isFlattened:e.isFlattened,isFocused:r.path===this.#c,isSelected:this.#R.has(r.path),kind:e.kind,level:e.depth,name:e.name,path:r.path,posInSet:r.posInSet??this.#x[n]??0,setSize:r.setSize??this.#S[n]??0}}#Q(e){return this.#Z(e.row,e.index,e.index,{ancestorPaths:e.ancestorPaths,path:e.row.path,posInSet:e.posInSet,setSize:e.setSize})}#$(e,t){let n=this.#B.getVisibleRowContext(e);return n==null?void 0:n.ancestorRows[t]??(t===n.ancestorRows.length&&n.row.kind===`directory`&&n.row.isExpanded?n:void 0)}#ee(e){let t=this.#a.get(e);if(t!=null)return t;let n=this.#u(e),r=n<0?[]:[...this.#ee(n),n];return this.#a.set(e,r),r}#te(e){let t=this.#o.get(e);if(t!=null)return t;let n=this.#ee(e).map(e=>this.#b[e]??``).filter(e=>e!==``);return this.#o.set(e,n),n}#ne(e){this.#B.collapse(e)}#re(e,t=this.#L,n=!0){let r=[...new Set(e)],i=!$R(this.#R,r),a=this.#L!==t;!i&&!a||(this.#R=new Set(r),this.#L=t,i&&(this.#z+=1),n&&this.#we())}#ie(e){return{collapse:()=>{this.#ne(e)},deselect:()=>{this.deselectPath(e)},expand:()=>{this.#Ee(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!0,isExpanded:()=>this.#B.isExpanded(e),isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)},toggle:()=>{this.#Ie(e)}}}#ae(e){return{deselect:()=>{this.deselectPath(e)},focus:()=>{this.focusPath(e)},getPath:()=>e,isDirectory:()=>!1,isFocused:()=>this.#c===e,isSelected:()=>this.#R.has(e),select:()=>{this.selectPath(e)},toggleSelect:()=>{this.togglePathSelection(e)}}}#oe(e){let t=this.#B.list();this.#se(t).batch(e)}#se(e,t,n){return new bR({...this.#e,paths:e,preparedInput:t??void 0,...n===void 0?{}:{initialExpandedPaths:n}})}#ce(){return this.#h??=this.#B.list(),this.#h}#le(){if(this.#m!=null)return this.#m;let e=new Set;for(let t of this.#ce()){e.add(t);for(let n of ez(t))e.add(n)}return this.#m=[...e].sort(),this.#m}#ue(){return this.#g??=this.#ce().map(iz),this.#g}#de(){return this.#f??=this.#le().filter(e=>e.endsWith(`/`)),this.#f}#fe(){return this.#p??=this.#de().map(iz),this.#p}#pe(){this.#f=null,this.#p=null,this.#m=null,this.#h=null,this.#g=null}#me(){return this.#de().filter(e=>this.#B.isExpanded(e))}#he(e){let t=new Set(this.#j??[]);if(e)for(let e of this.#R)for(let n of ez(e))t.add(n);this.#ge(t)}#ge(e){this.#H=!0;try{for(let t of this.#de()){let n=e.has(t),r=this.#B.isExpanded(t);n&&!r?this.#B.expand(t):!n&&r&&this.#B.collapse(t)}}finally{this.#H=!1}}#_e(){let e=this.#b;if(this.#k=e.filter(e=>this.#O.has(e)),this.#M==null||this.#M.length===0||this.#A!==`hide-non-matches`||this.#O.size===0){this.#F=null,this.#I=null,this.#P=null,this.#U=this.#V;return}let t=[],n=[],r=new Map;for(let[i,a]of e.entries())this.#N?.has(a)===!0&&(r.set(a,n.length),t.push(i),n.push(a));this.#F=t,this.#I=n,this.#P=r,this.#U=n.length}#ve(){return this.#I??this.#b}#ye(e){return this.#F?.[e]??e}#be(e){return this.#P?.get(e)??this.#B.getVisibleIndex(e)??-1}#xe(e){let t=this.#k;if(t.length===0)return;let n=this.#c,r=n==null?-1:t.indexOf(n),i=t[r<0?e>0?0:t.length-1:Math.min(t.length-1,Math.max(0,r+e))];i!=null&&this.focusPath(i)}#Se(e,t){let n=e==null?null:rz(e),r=this.#M;if(r!==n){if(r==null&&n!=null&&(this.#j=this.#me()),this.#M=n,n==null)this.#he(!0),this.#j=null,this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else if(n.length===0)this.#he(!1),this.#O.clear(),this.#N=null,this.#Oe(this.#c,!0);else{let e=this.#Ce();this.#Oe(e,!0)}t&&(this.#y?.(this.#M),this.#we())}}#Ce(){if(this.#M==null||this.#M.length===0)return this.#O.clear(),this.#c;let e=this.#M,t=this.#ce(),n=this.#ue(),r=[],i=new Set,a=null;for(let o=0;o<t.length;o+=1){if(!n[o].includes(e))continue;let s=t[o];r.push(s),i.add(s),a??=s}let o=this.#de(),s=this.#fe();for(let t=0;t<o.length;t+=1){if(!s[t].includes(e))continue;let n=o[t];i.has(n)||(r.push(n),i.add(n),a??=n)}this.#O=i;let c=this.#A===`hide-non-matches`&&r.length>0?new Set:null;this.#N=c;let l=this.#A===`expand-matches`?new Set(this.#j??[]):new Set;for(let e of r){c?.add(e),e.endsWith(`/`)&&l.add(e);for(let t of ez(e))l.add(t),c?.add(t)}return this.#ge(l),a??this.#c}#we(){for(let e of this.#t)e()}#Te(e){this.#n.get(e.operation)?.forEach(t=>{t(e)}),this.#n.get(`*`)?.forEach(t=>{t(e)})}#Ee(e){for(let t of ez(e))this.#B.isExpanded(t)||this.#B.expand(t);this.#B.isExpanded(e)||this.#B.expand(e)}#De(e){let t=this.#U;if(t===0)return;let n=this.#s===-1?0:this.#s,r=Math.min(t-1,Math.max(0,n+e));(r!==n||this.#s===-1)&&(!this.#l&&this.#F==null&&r>=this.#b.length&&this.#Ne(),this.#Me(r))}#Oe(e,t=!0){let n=this.#B.getVisibleCount();this.#V=n;let r=yz(this.#B.getVisibleTreeProjectionData(t?void 0:Math.min(n,ZR)),e,t?e=>this.#B.getVisibleIndex(e):void 0);this.#a.clear(),this.#o.clear(),this.#l=r.paths.length>=n,this.#u=r.getParentIndex,this.#b=r.paths,this.#x=r.posInSetByIndex,this.#S=r.setSizeByIndex,this.#_e(),this.#s=e==null?this.#ve().length>0?0:-1:this.#Y(e),this.#c=this.#s<0?null:this.#ke(this.#s)}#ke(e){return this.#ve()[e]??(this.#F==null?this.#B.getVisibleRowContext(e)?.row.path??null:null)}#Ae(e){return this.#B.getPathInfo(e)?.path??null}#je(e){if(e==null)return;let t=this.#Y(e);t>=0&&this.#Me(t,!1)}#Me(e,t=!0){let n=this.#ke(e);n!=null&&(this.#s===e&&this.#c===n||(this.#s=e,this.#c=n,t&&this.#we()))}#Ne(){this.#l||this.#Oe(this.#c,!0)}#Pe(e){let t=dz(this.#T,e);t==null&&this.#T!=null&&(this.#E=``),this.#T=t;let n=dz(this.#c,e,!0),r=[...this.#R].map(t=>dz(t,e)).filter(e=>e!=null).map(e=>this.#B.getPathInfo(e)?.path??null).filter(e=>e!=null),i=dz(this.#L,e),a=i==null?null:this.#B.getPathInfo(i)?.path??null,o=[...new Set(r)];return $R(this.#R,o)||(this.#R=new Set(o),this.#z+=1),this.#L=a,n}#Fe(){return this.#B.on(`*`,e=>{if(this.#H)return;e.canonicalChanged&&(this.#d.clear(),this.#pe()),this.#i!=null&&XR(e)&&(this.#i=null);let t=XR(e)?this.#Pe(e):this.#c,n=this.#M!=null&&this.#M.length>0?this.#Ce():this.#M===``?this.#c:t,r=this.#M!=null||e.operation!==`expand`&&e.operation!==`collapse`;this.#Oe(n,r),this.#we();let i=_z(e);i!=null&&this.#Te(i)})}#Ie(e){if(this.#B.isExpanded(e)){this.#ne(e);return}this.#Ee(e)}},xz=e=>{if(e==null||e.length===0)return`0`;let t=`${e.length}`;for(let n of e)t+=`\0${n.path}\0${n.status}`;return t};function Sz(e){let t=e.endsWith(`/`),n=``,r=-1;for(let t=0;t<=e.length;t+=1){if(!(e[t]===`/`||t===e.length)){r===-1&&(r=t);continue}r!==-1&&(n!==``&&(n+=`/`),n+=e.slice(r,t),r=-1)}return n===``?null:{isDirectory:t,path:n}}function Cz(e){let t=e.endsWith(`/`)?e.slice(0,-1):e;if(t.length===0)return[];let n=t.split(`/`);return n.slice(0,-1).map((e,t)=>`${n.slice(0,t+1).join(`/`)}/`)}function wz(e,t){return t?`${e}/`:e}function Tz(e,t=null){let n=xz(e==null?void 0:[...e]);if(n===`0`)return null;if(t?.signature===n)return t;let r=new Map,i=new Set,a=new Set;for(let t of e??[]){let e=Sz(t.path);if(e==null)continue;let n=wz(e.path,e.isDirectory);r.set(n,t.status),t.status===`ignored`&&e.isDirectory?a.add(n):e.isDirectory&&a.delete(n);for(let t of Cz(e.path))i.add(t)}return{directoriesWithChanges:i,ignoredDirectoryPaths:a,signature:n,statusByPath:r}}var Ez,Dz,Oz,kz,Az,jz,Mz,Nz,Pz,Fz,Iz={},Lz=[],Rz=Array.isArray,zz=Lz.slice,Bz=Object.assign;function Vz(e){e&&e.parentNode&&e.remove()}function Hz(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return arguments.length>2&&(o.children=arguments.length>3?zz.call(arguments,2):n),Uz(e,o,r,i,null)}function Uz(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Dz,__i:-1,__u:0};return i==null&&Ez.vnode!=null&&Ez.vnode(a),a}function Wz(e){return e.children}function Gz(e,t){this.props=e,this.context=t,this.__g=0}function Kz(e,t){if(t==null)return e.__?Kz(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?Kz(e):null}function qz(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=n.__e;break}return qz(e)}}function Jz(e){(8&e.__g||!(e.__g|=8)||!Oz.push(e)||Az++)&&kz==Ez.debounceRendering||((kz=Ez.debounceRendering)||queueMicrotask)(Yz)}function Yz(){for(var e,t,n,r,i,a,o,s,c=1;Oz.length;)Oz.length>c&&Oz.sort(jz),e=Oz.shift(),c=Oz.length,8&e.__g&&(n=void 0,i=(r=(t=e).__v).__e,a=[],o=[],(s=t.__P)&&((n=Bz({},r)).__v=r.__v+1,Ez.vnode&&Ez.vnode(n),rB(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i??Kz(r),!!(32&r.__u),o,s.ownerDocument),n.__v=r.__v,n.__.__k[n.__i]=n,aB(a,n,o),n.__e!=i&&qz(n)));Az=0}function Xz(e,t,n,r,i,a,o,s,c,l,u,d){var f,p,m,h,g,_,v,y=r&&r.__k||Lz,b=t.length;for(c=Zz(n,t,y,c,b),f=0;f<b;f++)(m=n.__k[f])!=null&&(p=m.__i==-1?Iz:y[m.__i]||Iz,m.__i=f,_=rB(e,m,p,i,a,o,s,c,l,u,d),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&cB(p.ref,null,m),u.push(m.ref,m.__c||h,m)),g==null&&h!=null&&(g=h),(v=!!(4&m.__u))||p.__k===m.__k?c=Qz(m,c,e,v):typeof m.type==`function`&&_!==void 0?c=_:h&&(c=h.nextSibling),m.__u&=-7);return n.__e=g,c}function Zz(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(c=a+f,(o=e.__k[a]=typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?Uz(null,o,null,null,null):Rz(o)?Uz(Wz,{children:o},null,null,null):o.constructor==null&&o.__b>0?Uz(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=e,o.__b=e.__b+1,s=null,(l=o.__i=$z(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Kz(s)),lB(s,s));return r}function Qz(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=Qz(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Kz(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function $z(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&e.key==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function eB(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n??``}function tB(e,t,n,r,i){var a;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||eB(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||eB(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(Mz,`$1`)),(t=t.slice(2))[0].toLowerCase()!=t[0]&&(t=t.toLowerCase()),e.__l||={},e.__l[t+a]=n,n?r?n.l=r.l:(n.l=Nz,e.addEventListener(t,a?Fz:Pz,a)):e.removeEventListener(t,a?Fz:Pz,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function nB(e){return function(t){if(this.__l){var n=this.__l[t.type+e];if(t.u==null)t.u=Nz++;else if(t.u<n.l)return;return n(Ez.event?Ez.event(t):t)}}}function rB(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,M=t.type;if(t.constructor!=null)return null;128&n.__u&&(c=!!(32&n.__u),n.__c.__z&&(s=t.__e=n.__e=(a=n.__c.__z)[0],n.__c.__z=null)),(d=Ez.__b)&&d(t);n:if(typeof M==`function`)try{if(v=t.props,y=`prototype`in M&&M.prototype.render,b=(d=M.contextType)&&r[d.__c],x=d?b?b.props.value:d.__:r,n.__c?2&(f=t.__c=n.__c).__g&&(f.__g|=1,_=!0):(y?t.__c=f=new M(v,x):(t.__c=f=new Gz(v,x),f.constructor=M,f.render=uB),b&&b.sub(f),f.props=v,f.state||={},f.context=x,f.__n=r,p=!0,f.__g|=8,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Bz({},f.__s)),Bz(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),!(4&f.__g)&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)||t.__v==n.__v){for(t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__g&=-5,C=Ez.__r,w=0,y){for(f.state=f.__s,f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__g&=-9,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++w<25);f.state=f.__s,f.getChildContext!=null&&(r=Bz({},r,f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),E=d,d!=null&&d.type===Wz&&d.key==null&&(E=oB(d.props.children)),s=Xz(e,Rz(E)?E:[E],t,n,r,i,a,o,s,c,l,u),t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__g&=-4)}catch(e){if(t.__v=null,c||a!=null)if(e.then){for(D=0,O=!1,t.__u|=c?160:128,t.__c.__z=[],k=0;k<a.length;k++)(A=a[k])==null||O||(A.nodeType==8&&A.data==`$s`?(D>0&&t.__c.__z.push(A),D++,a[k]=null):A.nodeType==8&&A.data==`/$s`?(--D>0&&t.__c.__z.push(A),O=D===0,s=a[k],a[k]=null):D>0&&(t.__c.__z.push(A),a[k]=null));if(!O){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__c.__z=[s]}t.__e=s}else{for(j=a.length;j--;)Vz(a[j]);iB(t)}else t.__e=n.__e,t.__k=n.__k,e.then||iB(t);Ez.__e(e,t,n)}else s=t.__e=sB(n.__e,t,n,r,i,a,o,c,l,u);return(d=Ez.diffed)&&d(t),128&t.__u?void 0:s}function iB(e){e&&e.__c&&(e.__c.__g|=4),e&&e.__k&&e.__k.forEach(iB)}function aB(e,t,n){for(var r=0;r<n.length;r++)cB(n[r],n[++r],n[++r]);Ez.__c&&Ez.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Ez.__e(e,t.__v)}})}function oB(e){return typeof e!=`object`||!e||e.__b&&e.__b>0?e:Rz(e)?e.map(oB):Bz({},e)}function sB(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v=n.props,y=t.props,b=t.type;if(b==`svg`?i=`http://www.w3.org/2000/svg`:b==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(u=0;u<a.length;u++)if((m=a[u])&&`setAttribute`in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,a[u]=null;break}}if(e==null){if(b==null)return l.createTextNode(y);e=l.createElementNS(i,b,y.is&&y),s&&=(Ez.__m&&Ez.__m(t,a),!1),a=null}if(b==null)v===y||s&&e.data==y||(e.data=y);else{if(a&&=zz.call(e.childNodes),v=n.props||Iz,!s&&a!=null)for(v={},u=0;u<e.attributes.length;u++)v[(m=e.attributes[u]).name]=m.value;for(u in v)if(m=v[u],u!=`children`){if(u==`dangerouslySetInnerHTML`)f=m;else if(!(u in y)){if(u==`value`&&`defaultValue`in y||u==`checked`&&`defaultChecked`in y)continue;tB(e,u,null,m,i)}}for(u in _=1&n.__u,y)m=y[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||v[u]===m&&!_||tB(e,u,m,v[u],i);if(d)s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=``),Xz(b==`template`?e.content:e,Rz(p)?p:[p],t,n,r,b==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&Kz(n,0),s,c,l),a!=null)for(u=a.length;u--;)Vz(a[u]);s||(u=`value`,b==`progress`&&h==null?e.removeAttribute(`value`):h==null||h===e[u]&&(b!==`progress`||h)||tB(e,u,h,v[u],i),u=`checked`,g!=null&&g!=e[u]&&tB(e,u,g,v[u],i))}return e}function cB(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){Ez.__e(e,n)}}function lB(e,t,n){var r,i;if(Ez.unmount&&Ez.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||cB(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Ez.__e(e,t)}r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&lB(r[i],t,n||typeof e.type!=`function`);n||Vz(e.__e),e.__e&&e.__e.__l&&(e.__e.__l=null),e.__e=e.__c=e.__=null}function uB(e,t,n){return this.constructor(e,n)}function dB(e,t){var n,r,i,a;t==document&&(t=document.documentElement),Ez.__&&Ez.__(e,t),r=(n=!!(e&&32&e.__u))?null:t.__k,e=t.__k=Hz(Wz,null,[e]),i=[],a=[],rB(t,e,r||Iz,Iz,t.namespaceURI,r?null:t.firstChild?zz.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a,t.ownerDocument),aB(i,e,a)}function fB(e,t){e.__u|=32,dB(e,t)}Ez={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t}}throw Az=0,e}},Dz=0,Gz.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Bz({},this.state);typeof e==`function`&&(e=e(Bz({},n),this.props)),e&&Bz(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Jz(this))},Gz.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Jz(this))},Gz.prototype.render=Wz,Oz=[],Az=0,jz=function(e,t){return e.__v.__b-t.__v.__b},Mz=/(PointerCapture)$|Capture$/i,Nz=0,Pz=nB(!1),Fz=nB(!0);var pB=0;Array.isArray;function mB(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--pB,__i:-1,__u:0,__source:i,__self:a};return Ez.vnode&&Ez.vnode(l),l}var hB=16,gB=16,_B={};function vB({name:e,remappedFrom:t,token:n,width:r,height:i,viewBox:a,label:o,alignCapitals:s=!1}){"use no memo";let c=`#${e.replace(/^#/,``)}`,{width:l,height:u,viewBox:d}=_B[e]??{width:hB,height:gB},f=r??l,p=i??u,m=a??d??`0 0 ${l} ${u}`;return mB(`svg`,{"data-icon-name":t??e,"data-icon-token":n,"data-align-capitals":s,...o==null?{"aria-hidden":!0}:{"aria-label":o,role:`img`},viewBox:m,width:f,height:p,children:mB(`use`,{href:c})})}var yB=e=>{if(e.length<2)return[e,``];let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]},bB=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`.`)+1,n=e.length-t>10,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},xB=e=>{if(e.length<4)return[e,``];let t=e.lastIndexOf(`/`)+1,n=e.length-t>25,r=t>=1&&!n?t:Math.ceil(e.length/2);return[e.slice(0,r),e.slice(r)]},SB=(e,{splitIndex:t}={})=>{if(typeof t!=`number`){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}return[e.slice(0,t),e.slice(t)]},CB=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=e.length-t;return[e.slice(0,n),e.slice(n)]},wB=(e,{splitOffset:t}={})=>{if(typeof t!=`number`||t<=0||t>=e.length){let t=Math.ceil(e.length/2);return[e.slice(0,t),e.slice(t)]}let n=t;return[e.slice(0,n),e.slice(n)]};function TB({children:e,marker:t,variant:n=`default`}){"use no memo";return mB(`div`,{"aria-hidden":!0,"data-truncate-marker-cell":!0,children:mB(`div`,{"data-truncate-marker":!0,children:typeof t==`function`?t({children:e}):n===`fade`?mB(`span`,{"data-truncate-fade":!0}):t})})}function EB(e){"use no memo";let{mode:t,children:n}=e;return mB(`div`,{children:[mB(`div`,{"data-truncate-content":`visible`,children:t===`fruncate`?mB(`span`,{children:n}):n}),mB(`div`,{"data-truncate-content":`overflow`,"aria-hidden":!0,children:t===`fruncate`?mB(`span`,{children:n}):n})]})}function DB({children:e,mode:t=`truncate`,marker:n=`…`,variant:r=`default`,...i}){"use no memo";let a=mB(EB,{mode:t,children:e},`content`),o=mB(TB,{marker:n,mode:t,variant:r},`marker`),s=mB(`div`,{"data-truncate-fill":!0},`fill`);return mB(`div`,{"data-truncate-container":t,"data-truncate-variant":r,...i,children:mB(`div`,{"data-truncate-grid":!0,children:t===`truncate`?[a,o]:[o,a,s]})})}function OB({children:e,...t}){"use no memo";return mB(DB,{mode:`truncate`,...t,children:e})}function kB({children:e,...t}){"use no memo";return mB(DB,{mode:`fruncate`,...t,children:e})}function AB({children:e,contents:t,priority:n=`end`,split:r=`center`,minimumLength:i=12,className:a,style:o,...s}){"use no memo";let c=null,l=null;if(Array.isArray(t)){if(t.length!==2)return console.error(`MiddleTruncate: contents must be an array of two items`),null;c=mB(OB,{...s,children:t[0]}),l=mB(kB,{...s,children:t[1]})}else{if(typeof e!=`string`)return console.error(`MiddleTruncate: children must be a string`),null;if(e.length===0)return mB(`div`,{className:a,style:o});if(e.length<i)return mB(n===`end`?kB:OB,{...s,className:a,style:o,children:e});let t=null,u=null,d=null;if(typeof r==`string`)r===`center`?t=yB:r===`extension`?t=bB:r===`leaf-path`&&(t=xB);else if(typeof r==`number`)t=SB,u=r;else if(Array.isArray(r)){let[e,n]=r;d=n,e===`last`?t=CB:e===`first`&&(t=wB)}else typeof r==`function`&&(t=r);t??=yB;let[f,p]=t(e,{priority:n,variant:s.variant,splitIndex:typeof u==`number`?u:void 0,splitOffset:typeof d==`number`?d:void 0}),m=f.length>=p.length,h=n===`equal`&&!m,g=n===`equal`&&m,_={},v={};h&&(_.marker=``),g&&(v.marker=``),c=mB(OB,{...s,..._,children:f}),l=mB(kB,{...s,...v,children:p})}return mB(`div`,{"data-truncate-group-container":`middle`,className:a,style:o,children:[mB(`div`,{"data-truncate-segment-priority":n===`start`||n===`equal`?`1`:`2`,children:c}),mB(`div`,{"data-truncate-segment-priority":n===`end`||n===`equal`?`1`:`2`,children:l})]})}var jB={endIndex:-1,startIndex:-1};function MB(e,t,n){return Math.min(Math.max(e,t),n)}function NB(e,t){return e<0||t<e?jB:{endIndex:t,startIndex:e}}function PB(e){return e.startIndex<0||e.endIndex<e.startIndex}function FB(e,t){return PB(e)?0:(e.endIndex-e.startIndex+1)*t}function IB(e,t,n){if(t<=0)return-1;let r=t*n;return e<=0?0:e>=r?t:Math.floor(e/n)}function LB(e,t,n){return t<=0||e<=0?-1:e>=t*n?t-1:Math.ceil(e/n)-1}function RB(e){let t=new Map;return e.forEach((e,n)=>{if(e.kind!==`directory`||!e.isExpanded)return;let r=e.ancestorPaths.length,i=t.get(r);if(i==null){t.set(r,[n]);return}i.push(n)}),t}function zB(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a];if(o==null)break;if(o<=t){i=a,n=a+1;continue}r=a-1}return i}function BB(e){let t=new Map,n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=i.kind===`directory`&&i.isExpanded?[...i.ancestorPaths,i.path]:i.ancestorPaths,o=0;for(;o<n.length&&o<a.length&&n[o]===a[o];)o+=1;for(let e=n.length-1;e>=o;--e){let i=n[e];i!=null&&t.set(i,r-1)}n.length=o;for(let e=o;e<a.length;e+=1){let t=a[e];t!=null&&n.push(t)}}let r=e.length-1;for(let e of n)t.set(e,r);return t}function VB(e,t,n){if(e.length===0||t<=0)return[];let r=BB(e),i=RB(e),a=[];for(let r=0;r<e.length;r+=1){let o=i.get(r);if(o==null||o.length===0)break;let s=t+r*n,c=zB(o,Math.min(e.length-1,Math.floor(s/n))),l=null;for(;c>=0;){let t=o[c],n=t==null?null:e[t]??null;if(n!=null&&(r===0||n.ancestorPaths[r-1]===a[r-1]?.path)){l=n;break}--c}if(l==null)break;a.push(l)}return a.map((i,a)=>{let o=a*n,s=(r.get(i.path)??e.length-1)+1;if(s>=e.length)return{row:i,top:o};let c=s*n-t;return{row:i,top:Math.min(o,c-n)}}).filter(e=>e.top+n>0)}function HB(e,t){let n=t.totalRowCount??e.length,r=n*t.itemHeight,i=Math.max(0,t.viewportHeight),a=Math.max(0,Math.floor(t.overscan)),o=Math.max(0,r-i),s=MB(t.scrollTop,0,o),c=t.stickyRows??VB(e,s,t.itemHeight),l=c.reduce((e,n)=>Math.max(e,n.top+t.itemHeight),0),u=Math.min(r,s+l),d=Math.max(0,i-l),f=Math.max(0,r-u),p=IB(s,n,t.itemHeight),m=IB(u,n,t.itemHeight),h=l<=0||p<0||p>=n?-1:p,g=h===-1?-1:Math.min(n-1,m-1),_=h===-1||g<h?0:g-h+1,v=d<=0||m>=n?jB:NB(m,LB(u+d,n,t.itemHeight)),y=g+1,b=PB(v)?jB:NB(Math.max(y,v.startIndex-a),Math.min(n-1,v.endIndex+a)),x=FB(b,t.itemHeight);return{occlusion:{firstOccludedIndex:h,lastOccludedIndex:g,occludedCount:_},physical:{itemHeight:t.itemHeight,maxScrollTop:o,overscan:a,scrollTop:s,totalHeight:r,totalRowCount:n,viewportHeight:i},projected:{contentHeight:f,paneHeight:d,paneTop:u},sticky:{height:l,rows:c},visible:v,window:{endIndex:b.endIndex,height:x,offsetTop:PB(b)?0:b.startIndex*t.itemHeight,startIndex:b.startIndex}}}var UB={added:`A`,deleted:`D`,ignored:null,modified:`M`,renamed:`R`,untracked:`U`},WB={added:`Git status: added`,deleted:`Git status: deleted`,ignored:`Git status: ignored`,modified:`Git status: modified`,renamed:`Git status: renamed`,untracked:`Git status: untracked`},GB=`Contains git status items`;function KB(e){let{renamingPath:t,previousRenamingPath:n,hasRenderedInput:r}=e;return t==null?`reset`:r?n===t?`ignore`:`focus-input`:`reveal-canonical`}function qB(e){let{row:t,mode:n,targetPath:r,ariaLabel:i,domId:a,isParked:o,itemHeight:s,features:c,state:l,extraStyle:u}=e,d=n===`sticky`,f=t.ancestorPaths.at(-1)??``,p={};return l.isFocusRinged&&(p[`data-item-focused`]=!0),t.isSelected&&(p[`data-item-selected`]=!0),l.isContextHovered&&(p[`data-item-context-hover`]=`true`),l.isDragTarget&&(p[`data-item-drag-target`]=!0),l.isDragging&&(p[`data-item-dragging`]=!0),l.effectiveGitStatus!=null&&(p[`data-item-git-status`]=l.effectiveGitStatus),l.containsGitChange&&(p[`data-item-contains-git-change`]=`true`),{"aria-expanded":!d&&t.kind===`directory`?t.isExpanded:void 0,"aria-haspopup":c.contextMenuEnabled?`menu`:void 0,"aria-label":i,"aria-level":d?void 0:t.level+1,"aria-posinset":d?void 0:t.posInSet+1,"aria-selected":d?void 0:t.isSelected?`true`:`false`,"aria-setsize":d?void 0:t.setSize,"data-file-tree-sticky-path":d?r:void 0,"data-file-tree-sticky-row":d?`true`:void 0,"data-item-context-menu-button-visibility":c.actionLaneEnabled?c.contextMenuButtonVisibility:void 0,"data-item-context-menu-trigger-mode":c.contextMenuEnabled?c.contextMenuTriggerMode:void 0,"data-item-has-context-menu-action-lane":c.actionLaneEnabled?`true`:void 0,"data-item-has-git-lane":c.gitLaneActive?`true`:void 0,"data-item-parent-path":f.length>0?f:void 0,"data-item-parked":o?`true`:void 0,"data-item-path":r,"data-item-type":t.kind===`directory`?`folder`:`file`,"data-type":`item`,id:d?void 0:a,role:d?void 0:`treeitem`,style:{minHeight:`${s}px`,...u},tabIndex:!d&&t.isFocused?0:-1,...p}}function JB(e){let{event:t,mode:n,isSearchOpen:r,isDirectory:i}=e,a=t.ctrlKey||t.metaKey,o=t.shiftKey||a,s=t.shiftKey?{additive:a,kind:`range`}:a?{kind:`toggle`}:{kind:`single`};return{closeSearch:r,revealCanonical:n===`sticky`,selection:s,toggleDirectory:!o&&i}}function YB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,topInset:i=0,viewportHeight:a}=e;if(n<0)return null;let o=Math.max(0,i),s=n*r,c=s+r;if(s<t+o){let e=Math.max(0,s-o);return e===t?null:e}if(c>t+a){let e=c-a;return e===t?null:e}return null}function XB(e){let{currentScrollTop:t,focusedIndex:n,itemHeight:r,targetViewportOffset:i,totalHeight:a,viewportHeight:o}=e;if(n<0)return null;let s=Math.max(0,i),c=n*r,l=c+r,u=t+s,d=t+o;if(c>=u&&l<=d)return null;let f=Math.max(0,a-o),p=Math.max(0,Math.min(c-s,f));return p===t?null:p}var ZB,QB,$B,eV,tV=Object.is,nV=0,rV=[],iV=Ez,aV=iV.__b,oV=iV.__r,sV=iV.diffed,cV=iV.__c,lV=iV.unmount,uV=iV.__;function dV(e,t){iV.__h&&iV.__h(QB,e,nV||t),nV=0;var n=QB.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function fV(e){return nV=1,pV(TV,e)}function pV(e,t,n){var r=dV(ZB++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):TV(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);tV(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=QB,!QB.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,tV(t,e.__[0])||(o=!0)}}),a&&a.call(this,e,t,n)||o};QB.__f=!0;var a=QB.shouldComponentUpdate,o=QB.componentWillUpdate;QB.componentWillUpdate=function(e,t,n){if(4&this.__g){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},QB.shouldComponentUpdate=i}return r.__N||r.__}function mV(e,t){var n=dV(ZB++,3);!iV.__s&&wV(n.__H,t)&&(n.__=e,n.u=t,QB.__H.__h.push(n))}function hV(e,t){var n=dV(ZB++,4);!iV.__s&&wV(n.__H,t)&&(n.__=e,n.u=t,QB.__h.push(n))}function gV(e){return nV=5,_V(function(){return{current:e}},[])}function _V(e,t){var n=dV(ZB++,7);return wV(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function vV(e,t){return nV=8,_V(function(){return e},t)}function yV(){for(var e;e=rV.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(SV),e.__H.__h.forEach(CV),e.__H.__h=[]}catch(t){e.__H.__h=[],iV.__e(t,e.__v)}}iV.__b=function(e){QB=null,aV&&aV(e)},iV.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),uV&&uV(e,t)},iV.__r=function(e){oV&&oV(e),ZB=0;var t=(QB=e.__c).__H;t&&($B===QB?(t.__h=[],QB.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(SV),t.__h.forEach(CV),t.__h=[],ZB=0)),$B=QB},iV.diffed=function(e){sV&&sV(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(rV.push(t)!==1&&eV===iV.requestAnimationFrame||((eV=iV.requestAnimationFrame)||xV)(yV)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),$B=QB=null},iV.__c=function(e,t){t.some(function(e){try{e.__h.forEach(SV),e.__h=e.__h.filter(function(e){return!e.__||CV(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],iV.__e(n,e.__v)}}),cV&&cV(e,t)},iV.unmount=function(e){lV&&lV(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{SV(e)}catch(e){t=e}}),n.__H=void 0,t&&iV.__e(t,n.__v))};var bV=typeof requestAnimationFrame==`function`;function xV(e){var t,n=function(){clearTimeout(r),bV&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);bV&&(t=requestAnimationFrame(n))}function SV(e){var t=QB,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),QB=t}function CV(e){var t=QB;e.__c=e.__(),QB=t}function wV(e,t){return!e||e.length!==t.length||t.some(function(t,n){return!tV(t,e[n])})}function TV(e,t){return typeof t==`function`?t(e):t}function EV(e){if(e==null||!e.isConnected||e===document.body||e===document.documentElement)return!1;e.focus({preventScroll:!0});let t=e.getRootNode();return t instanceof ShadowRoot?t.activeElement===e:document.activeElement===e}function DV(e){let t=e.getRootNode();if(t instanceof ShadowRoot){let e=t.activeElement;return e instanceof HTMLElement?e:null}let n=document.activeElement;return n instanceof HTMLElement&&e.contains(n)?n:null}function OV({ariaLabel:e,isFlattened:t=!1,ref:n,value:r,onBlur:i,onInput:a}){return mB(`input`,{ref:n,"data-item-rename-input":!0,...t?{"data-item-flattened-rename-input":!0}:{},"aria-label":e,value:r,onBlur:i,onInput:a,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation()})}function kV(e,t=null,n=null){"use no memo";let r=e.flattenedSegments;return r==null||r.length===0?t??e.name:mB(`span`,{"data-item-flattened-subitems":!0,children:r.map((e,i)=>{let a=i===r.length-1;return mB(Wz,{children:[mB(`span`,{"data-item-flattened-subitem":e.path,"data-item-flattened-subitem-drag-target":n===e.path?`true`:void 0,children:a&&t!=null?t:mB(OB,{children:e.name})}),i<r.length-1?` / `:``]},e.path)})})}function AV(e){return e.isFlattened?e.flattenedSegments?.findLast(e=>e.isTerminal)?.path??e.path:e.path}function jV(e){let t=e.flattenedSegments;return t==null||t.length===0?e.name:t.map(e=>e.name).join(` / `)}function MV(e,t,n,r){return e.map((e,i)=>{let a=i*n,o=e.subtreeEndIndex+1;if(o>=r)return{row:e.row,top:a};let s=o*n-t;return{row:e.row,top:Math.min(a,s-n)}}).filter(e=>e.top+n>0)}function NV({controller:e,itemHeight:t,overscan:n,scrollTop:r,stickyFolders:i,viewportHeight:a}){let o=e.getVisibleCount(),s=i&&o>0?e.getStickyRowCandidates(r,t):[],c=s==null&&i&&o>0?e.getVisibleRows(0,o-1):[],l=HB(c,{itemHeight:t,overscan:n,scrollTop:r,stickyRows:s==null?void 0:MV(s,r,t,o),totalRowCount:o,viewportHeight:a}),u=i&&r<=0&&o>0?e.getStickyRowCandidates(1,t):[],d=u!=null&&r<=0?MV(u,1,t,o):i&&r<=0&&c.length>0?VB(c,1,t):l.sticky.rows;return{overlayHeight:d.reduce((e,n)=>Math.max(e,n.top+t),0),overlayRows:d,snapshot:l,visibleRows:c}}var PV=400,FV=10,IV=40,LV=18;function RV(e,t,n){let r=e,i=document.elementFromPoint?.bind(document)??null,a=r.elementFromPoint?.(t,n)??i?.(t,n)??null;return e instanceof ShadowRoot&&(a==null||!e.contains(a))?zV(e,t,n):a instanceof HTMLElement?a:null}function zV(e,t,n){let r=Array.from(e.querySelectorAll(`[data-type="item"], [data-item-flattened-subitem]`));for(let e=r.length-1;e>=0;e--){let i=r[e],a=i.getBoundingClientRect();if(t>=a.left&&t<=a.right&&n>=a.top&&n<=a.bottom)return i}return null}function BV(e){let t=e?.closest?.(`[data-type="item"]`);if(!(t instanceof HTMLElement))return null;let n=t.dataset.itemPath??null;if(n==null)return null;let r=e?.closest?.(`[data-item-flattened-subitem]`),i=r instanceof HTMLElement?r.getAttribute(`data-item-flattened-subitem`)??null:null;if(i!=null&&i.endsWith(`/`))return{directoryPath:i,flattenedSegmentPath:i,hoveredPath:n,kind:`directory`};if(t.dataset.itemType===`folder`)return{directoryPath:n,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`};let a=t.dataset.itemParentPath??null;return a==null||a.length===0?{directoryPath:null,flattenedSegmentPath:null,hoveredPath:n,kind:`root`}:{directoryPath:a,flattenedSegmentPath:null,hoveredPath:n,kind:`directory`}}function VV(e){let t=e.cloneNode(!0);return t.removeAttribute(`id`),t.dataset.fileTreeDragPreview=`true`,t.setAttribute(`aria-hidden`,`true`),t.tabIndex=-1,Object.assign(t.style,{boxShadow:`0 4px 12px rgba(0, 0, 0, 0.15)`,left:`0px`,margin:`0`,pointerEvents:`none`,position:`fixed`,top:`0px`,willChange:`transform`,zIndex:`10000`}),t}function HV(){return navigator.vendor!==`Apple Computer, Inc.`}function UV(e,t){let n=e-t.top;if(n<IV)return-Math.ceil((IV-Math.max(0,n))/IV*LV);let r=t.bottom-e;return r<IV?Math.ceil((IV-Math.max(0,r))/IV*LV):0}function WV(e,t){if(e!=null){let t=UB[e];return t==null?null:{text:t,title:WB[e]}}return t?{icon:{name:`file-tree-icon-dot`,width:6,height:6},title:GB}:null}function GV(e,t,n){if(t==null||t.size===0)return null;let r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=n.get(a);if(o!=null){for(let e of r)n.set(e,o);return o?`ignored`:null}if(t.has(a)){n.set(a,!0);for(let e of r)n.set(e,!0);return`ignored`}r.push(a)}for(let e of r)n.set(e,!1);return null}function KV(e){return e!=null&&`toggle`in e}function qV(e){return e.code===`Space`||e.key===` `||e.key===`Spacebar`}function JV(e){return e.key.length===1&&/^[\p{L}\p{N}]$/u.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey}function YV(e,t){if(e==null)return t;let n=e.getBoundingClientRect().height;return n>0?n:e.clientHeight>0?e.clientHeight:t}function XV(e,t){return e!=null&&e>0?e:t}function ZV(e){let t=e.borderBoxSize,n=Array.isArray(t)?t[0]:t;return n!=null&&Number.isFinite(n.blockSize)&&n.blockSize>0?n.blockSize:e.contentRect.height>0?e.contentRect.height:null}function QV(e,t,n,r,i=0){let a=YB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,topInset:i,viewportHeight:r});return a==null?!1:(e.scrollTop=a,!0)}function $V(e,t,n,r,i,a){let o=XB({currentScrollTop:e.scrollTop,focusedIndex:t,itemHeight:n,targetViewportOffset:a,totalHeight:i,viewportHeight:r});return o==null?!1:(e.scrollTop=o,!0)}function eH(e,t,n,r){return n.end<n.start?null:e<n.start?-t:e>n.end?r:null}function tH(e){return e==null?``:`[data-item-section="spacing-item"][data-ancestor-path="${e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}"] { opacity: 1; }`}function nH(e){return e.shiftKey&&e.key===`F10`||e.key===`ContextMenu`}function rH(e,t){return t&&nH(e)||(e.ctrlKey||e.metaKey)&&qV(e)?!0:e.key===`ArrowDown`||e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`}var iH=new Set([`ArrowDown`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`]);function aH(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&(t.dataset.fileTreeContextMenuRoot===`true`||t.dataset.type===`context-menu-anchor`||t.dataset.type===`context-menu-trigger`||t.getAttribute(`slot`)===`context-menu`))return!0;return!1}function oH(e){return{bottom:e.bottom,height:e.height,left:e.left,right:e.right,top:e.top,width:e.width,x:e.x,y:e.y}}function sH(e,t){return{bottom:t,height:0,left:e,right:e,top:t,width:0,x:e,y:t}}function cH(e,t){if(e==null)return t.offsetTop;let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return n.top-r.top}function lH(e,t,n){if(n==null){e.delete(t);return}e.set(t,n)}function uH(e,t,n){if(e==null)return null;let r=t.get(e)??null;if(r!=null)return r;let i=n.get(e)??null;return i?.dataset.itemParked===`true`?null:i}function dH(e){if(e==null)return[];let t=[];for(let n of e.querySelectorAll(`button[data-file-tree-sticky-row="true"]`)){if(!(n instanceof HTMLElement))continue;let e=n.dataset.fileTreeStickyPath;e!=null&&t.push(e)}return t}function fH(e,t){if(e==null||t==null)return null;for(let n of e.querySelectorAll(`button[data-item-focused="true"][data-item-parked="true"]`))if(n instanceof HTMLElement&&n.dataset.itemPath===t)return n;return null}function pH(e,t,n,r,i,a,o){let s=Math.max(0,a-i),c=t?.getBoundingClientRect()??null,l=c==null||n==null?null:n.getBoundingClientRect().top-c.top,u=fH(e,r),d=c==null||u==null?null:u.getBoundingClientRect().top-c.top;return Math.max(0,Math.min(d??Math.max(l??0,s),Math.max(0,o-i)))}function mH(e,t){return{kind:e.kind,name:jV(e),path:t}}function hH(e){return e==null?void 0:`${e}__tree`}function gH(e,t,n){if(e!=null)return`${e}__focused-item-${encodeURIComponent(t)}${n?`__parked`:``}`}function _H(e){return e===`file-tree-icon-chevron`||e===`file-tree-icon-dot`||e===`file-tree-icon-file`||e===`file-tree-icon-lock`}function vH(e,t){if(e==null)return null;if(`text`in e)return mB(`span`,{title:e.title,children:e.text});let n=typeof e.icon==`string`?_H(e.icon)?t(e.icon):{name:e.icon}:_H(e.icon.name)?(()=>{let n=t(e.icon.name),{name:r,...i}=e.icon;return{...n,...i}})():e.icon;return mB(`span`,{title:e.title,children:mB(vB,{...n})})}function yH(e){e!=null&&EV(e.querySelector([`button:not([disabled])`,`[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`, `))??e)}function bH(e,t,{actionLaneEnabled:n=!1,customDecoration:r=null,decorationLaneEnabled:i=!1,dragTargetFlattenedSegmentPath:a=null,gitDecoration:o=null,gitLaneActive:s=!1,renameInput:c=null,showDecorativeActionAffordance:l=!1}={}){let u=AV(e);return mB(Wz,{children:[e.depth>0?mB(`div`,{"data-item-section":`spacing`,children:Array.from({length:e.depth}).map((t,n)=>mB(`div`,{"data-item-section":`spacing-item`,"data-ancestor-path":e.ancestorPaths[n]},n))}):null,mB(`div`,{"data-item-section":`icon`,children:e.kind===`directory`?mB(vB,{...t(`file-tree-icon-chevron`)}):mB(vB,{...t(`file-tree-icon-file`,u)})}),mB(`div`,{"data-item-section":`content`,children:e.isFlattened?kV(e,c,a):c??mB(AB,{minimumLength:5,split:`extension`,children:e.name})}),i?mB(`div`,{"data-item-section":`decoration`,children:r==null?null:vH(r,t)}):null,s?mB(`div`,{"data-item-section":`git`,children:vH(o,t)}):null,n?mB(`div`,{"data-item-section":`action`,children:l?mB(`span`,{"aria-hidden":`true`,"data-item-action-affordance":`decorative`,children:mB(vB,{...t(`file-tree-icon-ellipsis`)})}):null}):null]})}function xH(e,t,n,r={}){let{controller:i,renameView:a,visualFocusPath:o,contextHoverPath:s,draggedPathSet:c,dragTarget:l,dragAndDropEnabled:u,shouldSuppressContextMenu:d,handleRowDragStart:f,handleRowDragEnd:p,handleRowTouchStart:m,instanceId:h,itemHeight:g,gitStatusByPath:_,ignoredGitDirectories:v,ignoredInheritanceCache:y,directoriesWithGitChanges:b,gitLaneActive:x,contextMenuEnabled:S,contextMenuTriggerMode:C,contextMenuButtonTriggerEnabled:w,contextMenuButtonVisibility:T,contextMenuRightClickEnabled:E,registerRenameInput:D,registerButton:O,resolveIcon:k,renderDecorationForRow:A,openContextMenuForRow:j,onRowClick:M,onKeyDown:N}=e,P=AV(t),{isParked:F=!1,mode:I=`flow`,style:L}=r,R=I===`sticky`,z=_?.get(P)??null??GV(t.ancestorPaths,v,y),B=t.kind===`directory`&&(b?.has(P)??!1),V=A(t,P),H=WV(z,B),U=S&&w,W=V!=null||x||U,G=U&&T===`always`,K=a.getPath()===P,q=K?a.getValue():``,ee=R||!K?null:mB(OV,{ref:D,ariaLabel:`Rename ${jV(t)}`,isFlattened:t.isFlattened,value:q,onBlur:()=>{a.commit()},onInput:e=>{a.setValue(e.currentTarget.value)}}),te=bH(t,k,{actionLaneEnabled:U,customDecoration:V,decorationLaneEnabled:W,dragTargetFlattenedSegmentPath:l?.flattenedSegmentPath??null,gitDecoration:H,gitLaneActive:x,renameInput:ee,showDecorativeActionAffordance:G}),ne={...qB({ariaLabel:jV(t),domId:t.isFocused?gH(h,P,F):void 0,extraStyle:L,features:{actionLaneEnabled:U,contextMenuButtonVisibility:U?T:null,contextMenuEnabled:S,contextMenuTriggerMode:S?C:null,gitLaneActive:x},isParked:F,itemHeight:g,mode:I,row:t,state:{containsGitChange:B,effectiveGitStatus:z,isContextHovered:s===P,isDragTarget:l?.kind===`directory`&&l.directoryPath===P,isDragging:c?.has(P)===!0,isFocusRinged:t.isFocused&&o===P},targetPath:P}),key:n,onContextMenu:S||u?e=>{if(d()){e.preventDefault();return}S&&(e.preventDefault(),E&&(i.focusPath(P),j(t,P,{anchorRect:sH(e.clientX,e.clientY),source:`right-click`})))}:void 0,onFocus:R?void 0:()=>{i.focusPath(P)},onKeyDown:R?void 0:N,ref:e=>{O(P,e)}};return!R&&K?mB(`div`,{...ne,children:te}):mB(`button`,{...ne,type:`button`,draggable:u&&!F,onDragEnd:u&&!F?p:void 0,onDragStart:u&&!F?e=>{f(e,t,P)}:void 0,onMouseDown:e=>{if(R){e.preventDefault();return}i.isSearchOpen()&&e.preventDefault()},onTouchStart:u&&!F?e=>{m(e,t,P)}:void 0,onClick:e=>{M(e,t,P,I)},children:te})}function SH(e,t,n){return t.end<t.start?[]:e.controller.getVisibleRows(t.start,t.end).filter(e=>!n.has(AV(e))).map((n,r)=>xH(e,n,t.start+r))}function CH({composition:e,controller:t,gitStatusByPath:n,ignoredGitDirectories:r,directoriesWithGitChanges:i,icons:a,instanceId:o,itemHeight:s=wR,overscan:c=10,renamingEnabled:l=!1,renderRowDecoration:u,searchBlurBehavior:d=`close`,searchEnabled:f=!1,searchFakeFocus:p=!1,slotHost:m,stickyFolders:h=!1,initialViewportHeight:g=420}){"use no memo";let _=gV(null),v=gV(null),y=gV(!1),b=gV(null),x=gV(null),S=gV(null),C=gV(null),w=gV(null),T=gV(new Map),E=gV(new Map),D=gV(()=>{}),O=gV(null),k=gV(!1),A=gV(null),j=gV(null),M=gV(!1),N=gV(null),P=gV(null),F=gV(null),I=gV(null),L=gV(null),R=gV(null),z=gV(null),B=gV(null),V=gV(!1),H=gV(null),U=gV(null),W=gV(null),G=gV(null),K=_V(()=>new Map,[]),[,q]=fV(0),[ee,te]=fV(null),[ne,re]=fV(null),[ie,ae]=fV(null),[oe,se]=fV(null),[ce,le]=fV(0),[ue,de]=fV(null),fe=gV(ue);fe.current=ue;let pe=gV(null),me=gV(null),he=gV(null),ge=gV(null),_e=gV(null),ve=gV(!1),ye=()=>{me.current=null,he.current=null,ge.current=null},be=(e,t)=>{me.current=e,he.current=null,ge.current=t==null?null:{path:e,scrollTop:t}},xe=(e,t)=>{me.current=null,he.current={path:e,viewportOffset:t},ge.current=null},Se=gV(d===`retain`&&t.isSearchOpen()),[Ce,we]=fV(p);mV(()=>{p||we(!1)},[p]);let J=gV(!1),Te=vV(()=>{J.current=!0,we(e=>e&&!1)},[]),[Ee,De]=fV(()=>NV({controller:t,itemHeight:s,overscan:c,scrollTop:0,stickyFolders:h,viewportHeight:g})),[Oe,ke]=fV(!1);mV(()=>{ke(!0)},[]);let Ae=e?.contextMenu?.enabled===!0||e?.contextMenu?.render!=null||e?.contextMenu?.onOpen!=null||e?.contextMenu?.onClose!=null,je=e?.contextMenu?.triggerMode??(Ae?`right-click`:`both`),Me=je===`both`||je===`button`,Ne=e?.contextMenu?.buttonVisibility??`when-needed`,Pe=je===`both`||je===`right-click`;hV(()=>{let e=S.current;if(e==null)return;let t=e=>{if(!(e instanceof CustomEvent))return;let t=e.detail?.path??null;_e.current=t,re(t),se(t==null?null:`pointer`)},n=e=>{e instanceof CustomEvent&&(ve.current=e.detail?.disabled===!0)};return e.addEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.addEventListener(`file-tree-debug-set-scroll-suppression`,n),()=>{e.removeEventListener(`file-tree-debug-set-context-menu-trigger`,t),e.removeEventListener(`file-tree-debug-set-scroll-suppression`,n)}},[]);let Fe=vV((e,t)=>{lH(T.current,e,t)},[]),Ie=vV((e,t)=>{lH(E.current,e,t)},[]),Le=vV(e=>{x.current=e},[]),Re=vV(e=>uH(e,E.current,T.current),[]),ze=n!=null||r!=null||i!=null,{resolveIcon:Be}=_V(()=>FP(a),[a]),Ve=t[YR](),He=Ve.getPath(),Ue=He!=null,We=t.isSearchOpen(),Ge=t.getSearchValue(),Ke=t.getFocusedPath(),qe=t.getFocusedIndex(),Je=t.isDragAndDropEnabled(),Ye=t.getDragSession(),Xe=_V(()=>Ye==null?null:new Set(Ye.draggedPaths),[Ye]),Ze=Ye?.target??null,Qe=Ye?.primaryPath??null,$e=hH(o),{overlayHeight:et,overlayRows:tt,snapshot:nt,visibleRows:rt}=Ee,it=nt.physical.viewportHeight,at=_V(()=>({end:nt.window.endIndex,start:nt.window.startIndex}),[nt.window.endIndex,nt.window.startIndex]),ot=tt,st=nt.sticky.rows,ct=nt.physical.totalHeight,lt=nt.sticky.height,ut=_V(()=>new Set(st.map(e=>AV(e.row))),[st]),dt=qe>=0&&qe>=at.start&&qe<=at.end,ft=vV((e,t)=>u?.({item:mH(e,t),row:e})??null,[u]),pt=vV(e=>EV(e==null?null:T.current.get(e)??null)?!0:EV(S.current),[]),mt=vV(e=>{pt(t.focusNearestPath(e))},[t,pt]),ht=gV(mt);ht.current=mt;let gt=gV(!0),_t=gV(()=>{}),vt=vV((t=!0)=>{let n=fe.current;n!=null&&(gt.current=gt.current&&t,de(null),e?.contextMenu?.onClose?.(),gt.current&&mt(n.path))},[e?.contextMenu,mt]);_t.current=vt;let yt=vV(e=>{let t=e==null?null:cH(S.current,e);ae(e=>e===t?e:t)},[]),bt=vV((e,n,r)=>{let i=t.getItem(n);if(i==null)return;let a=Re(n);if(a?.dataset.fileTreeStickyRow===`true`){let e=C.current;be(n,e?.scrollTop??null),k.current=!0,te(e=>e===n?e:n)}i.focus(),yt(a),gt.current=!0,de({anchorRect:r?.anchorRect??null,item:mH(e,n),path:n,source:r?.source??`keyboard`})},[t,Re,yt]),xt=vV(e=>{if(l){if(t.isSearchOpen()){let e=C.current,t=YV(e,it);N.current=qe<0||e==null?null:Math.max(0,Math.min(qe*s-e.scrollTop,Math.max(0,t-s))),M.current=!0}t.startRenaming(e)!==!1&&(se(`focus`),q(e=>e+1))}},[t,qe,s,l,it]),St=vV((e,{restoreTreeFocus:n=!0,targetOffset:r=`live-overlay`}={})=>{let i=C.current;if(i==null)return!1;t.focusPath(e);let a=t.getFocusedIndex();if(a<0)return!1;let o=t.getVisibleRows(a,a)[0]??null;if(o==null)return!1;let l=YV(i,it),u=t.getVisibleCount()*s,d=r===`sticky-parents`?o.ancestorPaths.length*s:NV({controller:t,itemHeight:s,overscan:c,scrollTop:i.scrollTop,stickyFolders:h,viewportHeight:l}).snapshot.sticky.height;return k.current=!0,$V(i,a,s,l,u,d),D.current(),pe.current=n?e:null,!0},[t,s,c,it,h]),Ct=()=>y.current===!0||G.current!=null||V.current===!0,wt=e=>typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame(()=>{e()}):window.setTimeout(e,16),Tt=e=>{if(e!=null){if(typeof window.cancelAnimationFrame==`function`){window.cancelAnimationFrame(e);return}window.clearTimeout(e)}},Et=()=>{I.current!=null&&(clearTimeout(I.current),I.current=null),F.current=null},Dt=()=>{R.current?.remove(),R.current=null},Ot=()=>{Tt(P.current),P.current=null,L.current=null},kt=e=>{let t=S.current?.getRootNode();if(t instanceof ShadowRoot){t.append(e);return}document.body.append(e)},At=()=>{B.current?.(),B.current=null,G.current!=null&&(clearTimeout(G.current),G.current=null),V.current=!1,H.current=null,W.current=null,U.current!=null&&(U.current.setAttribute(`draggable`,`true`),U.current.style.removeProperty(`touch-action`),U.current=null),Dt(),Et(),Ot(),z.current=null},jt=(e,n)=>{let r=S.current?.getRootNode(),i=BV(RV(r instanceof ShadowRoot?r:document,e,n));return t.setDragTarget(i),t.getDragSession()?.target??null},Mt=e=>{let n=t.getDragAndDropConfig()?.openOnDropDelay??800;if(e==null||e.kind!==`directory`||e.directoryPath==null||n<=0){Et();return}let r=t.getItem(e.directoryPath),i=KV(r)?r:null;if(i==null||i.isExpanded()){Et();return}let a=`${e.directoryPath}::${e.flattenedSegmentPath??``}`;F.current!==a&&(Et(),F.current=a,I.current=setTimeout(()=>{let n=t.getDragSession()?.target;n?.kind!==`directory`||n.directoryPath!==e.directoryPath||n.flattenedSegmentPath!==e.flattenedSegmentPath||i.expand()},n))},Nt=()=>{P.current=null;let e=L.current,n=C.current;if(e==null||n==null||t.getDragSession()==null)return;let r=n.getBoundingClientRect(),i=UV(e.clientY,r);if(i===0)return;let a=Math.max(0,n.scrollHeight-n.clientHeight),o=Math.max(0,Math.min(a,n.scrollTop+i));o!==n.scrollTop&&(n.scrollTop=o,D.current()),Mt(jt(e.clientX,e.clientY)),P.current=wt(Nt)},Pt=(e,t)=>{L.current={clientX:e,clientY:t},P.current??=wt(Nt)},Ft=(e,n,r)=>{let i=e.currentTarget;if(i!=null){if(At(),Dt(),Et(),Ot(),t.startDrag(r)===!1){e.preventDefault();return}if(z.current=n,e.dataTransfer!=null&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.dropEffect=`move`,e.dataTransfer.setData(`text/plain`,r),HV())){let t=VV(i),n=i.getBoundingClientRect();Object.assign(t.style,{height:`${n.height}px`,opacity:`0.85`,transform:`translate3d(-9999px, 0px, 0)`,width:`${n.width}px`}),kt(t),R.current=t,e.dataTransfer.setDragImage(t,Math.max(0,e.clientX-n.left),Math.max(0,e.clientY-n.top))}}},It=()=>{Dt(),Et(),Ot(),z.current=null,t.cancelDrag()},Lt=(e,n,r)=>{if(G.current!=null||V.current)return;let i=e.touches[0],a=e.currentTarget;if(i==null||a==null)return;W.current={clientX:i.clientX,clientY:i.clientY},U.current=a,a.setAttribute(`draggable`,`false`);let o=(e={})=>{let t=e.restoreNativeDraggable??!V.current;G.current!=null&&(clearTimeout(G.current),G.current=null),document.removeEventListener(`touchmove`,s),document.removeEventListener(`touchend`,c),document.removeEventListener(`touchcancel`,c),B.current===o&&(B.current=null),t&&(a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null)},s=e=>{let t=e.touches[0],n=W.current;if(t==null||n==null)return;let r=t.clientX-n.clientX,i=t.clientY-n.clientY;r*r+i*i<=FV*FV||o()},c=()=>{o()};document.addEventListener(`touchmove`,s,{passive:!0}),document.addEventListener(`touchend`,c),document.addEventListener(`touchcancel`,c),B.current=o,G.current=setTimeout(()=>{if(o({restoreNativeDraggable:!1}),t.startDrag(r)===!1){a.setAttribute(`draggable`,`true`),U.current===a&&(U.current=null),W.current=null;return}V.current=!0,U.current=a,a.setAttribute(`draggable`,`false`),a.style.setProperty(`touch-action`,`none`),z.current=n;let e=a.getBoundingClientRect(),s=VV(a);Object.assign(s.style,{height:`${e.height}px`,opacity:`0.85`,transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:`${e.width}px`}),kt(s),R.current=s,H.current={x:i.clientX-e.left,y:i.clientY-e.top};let c=e=>{let t=e.touches[0];if(t==null)return;e.preventDefault();let n=H.current;n!=null&&R.current!=null&&(R.current.style.transform=`translate3d(${t.clientX-n.x}px, ${t.clientY-n.y}px, 0)`),Mt(jt(t.clientX,t.clientY)),Pt(t.clientX,t.clientY)},l=e=>{let n=e.changedTouches[0];n!=null&&jt(n.clientX,n.clientY),t.completeDrag(),At()},u=()=>{t.cancelDrag(),At()};B.current=()=>{document.removeEventListener(`touchmove`,c),document.removeEventListener(`touchend`,l),document.removeEventListener(`touchcancel`,u)},document.addEventListener(`touchmove`,c,{passive:!1}),document.addEventListener(`touchend`,l),document.addEventListener(`touchcancel`,u)},PV)},Rt=e=>{if(ue!=null){if(e.key===`Escape`){vt(),e.preventDefault(),e.stopPropagation();return}iH.has(e.key)&&(e.preventDefault(),e.stopPropagation());return}if(Ve.isActive()){if(e.key===`Escape`)Ve.cancel();else if(e.key===`Enter`)Ve.commit();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(l&&e.key===`F2`){xt(Ke??void 0),e.preventDefault(),e.stopPropagation();return}if(We){if(e.key===`Escape`)M.current=!1,N.current=null,t.closeSearch();else if(e.key===`Enter`){let e=t.getFocusedPath();e!=null&&t.selectOnlyPath(e);let n=C.current,r=YV(n,it);N.current=qe<0||n==null?null:Math.max(0,Math.min(qe*s-n.scrollTop,Math.max(0,r-s))),M.current=!0,t.closeSearch()}else if(e.key===`ArrowDown`)t.focusNextSearchMatch();else if(e.key===`ArrowUp`)t.focusPreviousSearchMatch();else return;se(`focus`),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}if(f&&JV(e)){t.openSearch(e.key),q(e=>e+1),e.preventDefault(),e.stopPropagation();return}let n=Ae&&nH(e),r=rH(e,Ae),i=r&&S.current!=null?DV(S.current):null,a=r?new Set(dH(S.current)):new Set,o=i?.dataset.fileTreeStickyPath??null,c=i?.dataset.fileTreeStickyRow===`true`&&o!=null;if(c&&o!==Ke&&a.has(o)){let e=C.current;be(o,e?.scrollTop??null),t.focusPath(o)}let u=t.getFocusedPath(),d=t.getFocusedIndex(),p=t.getFocusedItem();if(p==null)return;let m=KV(p)?p:null,h=u!=null&&(ut.has(u)||c&&o===u&&a.has(u)),g=e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowRight`&&m!=null&&m.isExpanded(),_=e.key===`ArrowLeft`&&h&&m!=null&&m.isExpanded(),v=C.current,y=!0;if(e.shiftKey&&e.key===`ArrowDown`)t.extendSelectionFromFocused(1);else if(e.shiftKey&&e.key===`ArrowUp`)t.extendSelectionFromFocused(-1);else if(n&&u!=null&&d>=0){let e=t.getVisibleRows(d,d)[0]??null,n=uH(u,E.current,T.current);e==null||n==null?y=!1:bt(e,u)}else if((e.ctrlKey||e.metaKey)&&qV(e))t.toggleFocusedSelection();else if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`a`)t.selectAllVisiblePaths();else switch(e.key){case`ArrowDown`:t.focusNextItem();break;case`ArrowUp`:t.focusPreviousItem();break;case`ArrowRight`:m==null||m.isExpanded()?t.focusNextItem():m.expand();break;case`ArrowLeft`:m!=null&&m.isExpanded()?m.collapse():t.focusParentItem();break;case`Home`:t.focusFirstItem();break;case`End`:t.focusLastItem();break;default:y=!1}if(!y)return;se(`focus`);let b=t.getFocusedPath(),x=b!=null&&(ut.has(b)||a.has(b)),w=g&&b!==u,D=n&&c&&o===u&&b===u;if((h||D)&&b!=null&&(w&&x||D))be(b,v?.scrollTop??null),k.current=!0,te(e=>e===b?e:b);else{let t=e.key===`ArrowUp`&&h&&b!==u;b!=null&&(t||_&&b===u)?(xe(b,pH(S.current,v,i,u,s,lt,it)),k.current=!0,te(e=>e===b?e:b)):ye()}q(e=>e+1),e.preventDefault(),e.stopPropagation()};hV(()=>{if(!(!f||!We)){if(Se.current){Se.current=!1;return}EV(w.current)}},[We,f]),hV(()=>{let e=x.current;switch(KB({hasRenderedInput:e!=null,previousRenamingPath:j.current,renamingPath:He})){case`reset`:j.current=null;return;case`reveal-canonical`:He!=null&&St(He,{restoreTreeFocus:!1,targetOffset:`live-overlay`});return;case`ignore`:return;case`focus-input`:e!=null&&(pe.current=null,j.current=He,EV(e),e.select());return}},[at.end,at.start,He,St,ut]),hV(()=>{let e=S.current;if(e==null)return;let t=null,n=()=>{t!=null&&(clearTimeout(t),t=null)},r=()=>{let t=DV(e)?.dataset.itemPath??null;te(e=>e===t?e:t)},i=()=>{n(),k.current=!0,r()},a=i=>{let a=i.relatedTarget;if(a==null){n(),t=setTimeout(()=>{if(t=null,DV(e)!=null){r();return}k.current=!1,te(null)},0);return}if(!(a instanceof Node)||!e.contains(a)){n(),k.current=!1,te(null);return}let o=a instanceof HTMLElement?a.dataset.itemPath??null:null;te(e=>e===o?e:o)};return e.addEventListener(`focusin`,i),e.addEventListener(`focusout`,a),()=>{n(),e.removeEventListener(`focusin`,i),e.removeEventListener(`focusout`,a)}},[]),hV(()=>{let e=S.current;e!=null&&(nt.physical.scrollTop<=0?e.dataset.scrollAtTop=`true`:delete e.dataset.scrollAtTop)},[nt.physical.scrollTop]),hV(()=>{let e=null,n=C.current,r=b.current,i=S.current;if(n==null)return;O.current=YV(n,g);let a=()=>{let e=t.getVisibleCount(),r=XV(O.current,g),i=Math.max(0,e*s-r);n.scrollTop>i&&(n.scrollTop=i),De(NV({controller:t,itemHeight:s,overscan:c,scrollTop:Math.min(n.scrollTop,i),stickyFolders:h,viewportHeight:r}))};D.current=a;let o=!1,l=t.subscribe(()=>{o?q(e=>e+1):o=!0,a()}),u=()=>{ve.current!==!0&&(r!=null&&(r.dataset.isScrolling??=``),i!=null&&(i.dataset.isScrolling??=``),y.current=!0,e!=null&&clearTimeout(e),e=setTimeout(()=>{r!=null&&delete r.dataset.isScrolling,i!=null&&delete i.dataset.isScrolling,y.current=!1,le(e=>e+1),e=null},50))},d=null,f=()=>{i!=null&&delete i.dataset.overlayReveal,d!=null&&(clearTimeout(d),d=null)},p=()=>{i==null||ve.current===!0||n.scrollTop>0||(i.dataset.overlayReveal=`true`,d!=null&&clearTimeout(d),d=setTimeout(()=>{f()},200))},m=()=>{if(a(),n.scrollTop>0&&f(),fe.current!=null&&y.current&&_t.current(),ve.current===!0){y.current=!1;return}re(e=>e==null?e:null),u()},_=()=>{u(),p()},v=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`,` `,`Spacebar`]),x=e=>{v.has(e.key)&&_()};n.addEventListener(`scroll`,m,{passive:!0}),n.addEventListener(`wheel`,_,{passive:!0}),n.addEventListener(`touchmove`,_,{passive:!0}),n.addEventListener(`keydown`,x);let w=typeof ResizeObserver<`u`?new ResizeObserver(e=>{O.current=(e[0]==null?null:ZV(e[0]))??YV(n,g),a()}):null;return w?.observe(n),()=>{D.current=()=>{},l(),n.removeEventListener(`scroll`,m),n.removeEventListener(`wheel`,_),n.removeEventListener(`touchmove`,_),n.removeEventListener(`keydown`,x),e!=null&&clearTimeout(e),d!=null&&clearTimeout(d),r!=null&&delete r.dataset.isScrolling,i!=null&&(delete i.dataset.isScrolling,delete i.dataset.overlayReveal),y.current=!1,O.current=null,w?.disconnect()}},[t,g,s,c,h]),hV(()=>{Ae||ue==null||vt(!1)},[vt,Ae,ue]);let zt=_V(()=>ue==null?null:`${ue.path}::${ue.source}`,[ue]);hV(()=>{if(zt==null){m?.clearSlotContent(DP);return}let t=fe.current;if(t==null)return;let n=v.current??_.current;if(n==null)return;let r={anchorElement:n,anchorRect:t.anchorRect??oH(n.getBoundingClientRect()),close:e=>{_t.current(e?.restoreFocus??!0)},restoreFocus:()=>{gt.current&&ht.current(fe.current?.path??null)}},i=e?.contextMenu?.render?.(t.item,r)??null;return m?.setSlotContent(DP,i),e?.contextMenu?.onOpen?.(t.item,r),yH(i),queueMicrotask(()=>{i==null||!i.isConnected||document.activeElement===i&&yH(i)}),()=>{m?.clearSlotContent(DP)}},[zt,e?.contextMenu,m]),hV(()=>{ue!=null&&t.getItem(ue.path)==null&&vt()},[vt,ue,t]),hV(()=>{if(ue==null)return;let e=S.current?.getRootNode(),t=e instanceof ShadowRoot?e.host:S.current,n=e=>{let n=e.target;n instanceof Node&&(aH(e)||_.current?.contains(n)!==!0&&t?.contains(n)!==!0&&vt())},r=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),vt())};return document.addEventListener(`mousedown`,n,!0),document.addEventListener(`keydown`,r,!0),()=>{document.removeEventListener(`mousedown`,n,!0),document.removeEventListener(`keydown`,r,!0)}},[vt,ue]),hV(()=>{let e=C.current,t=S.current;if(e==null||t==null){A.current=Ke;return}let n=Ke==null?null:T.current.get(Ke)??null,r=DV(t),i=r?.dataset.itemPath??null,a=Ue&&x.current===r,o=f&&w.current===r,c=M.current&&!We,l=N.current??0,u=pe.current,d=me.current,p=he.current,m=ge.current,h=r!=null,g=k.current||h,_=A.current!==Ke,v=d!=null&&d===Ke&&Ke!=null,y=c&&$V(e,qe,s,it,ct,l),b=u!=null&&u===Ke&&$V(e,qe,s,it,ct,lt),E=p!=null&&p.path===Ke&&$V(e,qe,s,it,ct,p.viewportOffset),O=m!=null&&m.path===Ke&&e.scrollTop!==m.scrollTop;if(O&&(e.scrollTop=m.scrollTop),(O||b||E||y||g&&_&&u!==Ke&&!v&&QV(e,qe,s,it,lt))&&D.current(),!g){A.current=Ke;return}if(a){A.current=Ke;return}if(o&&!c){A.current=Ke;return}if(n==null){c&&qe>=0&&($V(e,qe,s,it,ct,l),D.current()),A.current=Ke;return}(_||c||u===Ke||d===Ke||p?.path===Ke||m?.path===Ke||i==null||i!==Ke)&&(EV(n),u===Ke&&(pe.current=null),d===Ke&&(me.current=null),p?.path===Ke&&(he.current=null),m?.path===Ke&&(ge.current=null),M.current=!1,N.current=null),A.current=Ke},[t,qe,Ke,dt,s,Ue,We,at,it,f,lt,ct,rt]);let Bt=qe>=0&&qe>=nt.visible.startIndex&&qe<=nt.visible.endIndex,Vt=Ke!=null&&ot.some(e=>AV(e.row)===Ke),Ht=Bt||Vt,Ut=Me&&k.current===!0&&Ht?Ke:null,Wt=oe===`pointer`?ne:null,Gt=ue?.path??_e.current??Wt??Ut??ne,Kt=ue?.source===`right-click`;hV(()=>{y.current&&ue==null||yt(Re(Gt))},[ue,Re,at,it,ce,ot,Gt,yt,rt]);let qt=vV(e=>{if(y.current||aH(e))return;let t=e.target;if(!(t instanceof HTMLElement)||t.closest?.(`[data-type="context-menu-trigger"]`)!=null)return;let n=t.closest?.(`[data-file-tree-sticky-row="true"]`),r=t.closest?.(`[data-type="item"]`),i=n instanceof HTMLElement?n.dataset.fileTreeStickyPath??null:r instanceof HTMLElement?r.dataset.itemPath??null:null;i!=null&&se(e=>e===`pointer`?e:`pointer`),re(e=>e===i?e:i)},[]),Jt=vV(()=>{re(null)},[]);hV(()=>{if(!Je)return;let e=()=>{At(),t.cancelDrag()};return window.addEventListener(`dragend`,e),()=>{window.removeEventListener(`dragend`,e),At(),t.cancelDrag()}},[t,Je]);let Yt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=BV(e.target instanceof HTMLElement?e.target:null);t.setDragTarget(n),Mt(t.getDragSession()?.target??null),Pt(e.clientX,e.clientY),e.dataTransfer!=null&&(e.dataTransfer.dropEffect=`move`),e.preventDefault()},Xt=e=>{if(!Je||t.getDragSession()==null||V.current)return;let n=e.relatedTarget;n instanceof Node&&S.current?.contains(n)===!0||(Et(),Ot(),t.setDragTarget(null))},Zt=e=>{!Je||t.getDragSession()==null||V.current||(e.preventDefault(),jt(e.clientX,e.clientY),t.completeDrag(),Dt(),Et(),Ot(),z.current=null)},Qt=nt.window.height,$t=nt.window.offsetTop,en=Math.min(0,it-Qt-lt),tn=ee===Ke||M.current,nn=Ke!=null&&tn&&!dt&&qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null,rn=nn==null?null:eH(qe,s,at,Qt),an=z.current,on=Qe!=null&&an!=null&&an.path===Qe&&an.index>=at.start&&an.index<=at.end,sn=Qe!=null&&an!=null&&an.path===Qe&&!on&&an.path!==nn?.path?an:null,cn=sn==null?null:eH(sn.index,s,at,Qt),ln=tH((qe>=0?rt[qe]??t.getVisibleRows(qe,qe)[0]??null:null)?.ancestorPaths.at(-1)??null),un=We&&Ke!=null?gH(o,Ke,!dt):void 0,dn=ue?.path??(We?Ke:ee),fn=ue?.path??ne,pn=Re(Gt),mn=Ae&&Me&&!Kt&&!Ue&&pn!=null&&ie!=null&&Gt!=null,hn=Ae&&(mn||ue!=null),gn=ue?.anchorRect,_n=gn==null&&pn!=null&&ie!=null&&(ue!=null||mn)?ie:null,vn=gn==null?_n==null?void 0:{top:`${_n}px`}:{left:`${gn.left}px`,position:`fixed`,right:`auto`,top:`${gn.top}px`},yn=Kt?{opacity:`0`}:void 0,bn=vV((e,n,r,i)=>{let a=t.getItem(r),o=JB({event:{ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey},isDirectory:n.kind===`directory`,isSearchOpen:t.isSearchOpen(),mode:i});switch(o.selection.kind){case`range`:t.selectPathRange(r,o.selection.additive);break;case`toggle`:t.togglePathSelectionFromInput(r);break;case`single`:t.selectOnlyPath(r);break}let s=e.currentTarget instanceof HTMLElement?e.currentTarget:null,c=n.index>=nt.visible.startIndex&&n.index<=nt.visible.endIndex,l=i===`flow`&&c&&s!=null&&s.dataset.itemParked!==`true`;a?.focus(),l&&(k.current=!0,te(e=>e===r?e:r),se(`focus`)),o.toggleDirectory&&KV(a)&&a.toggle(),o.closeSearch&&t.closeSearch(),o.revealCanonical&&St(r,{targetOffset:`sticky-parents`})},[t,nt.visible.endIndex,nt.visible.startIndex,St]),xn=()=>{if(y.current||!Me||Gt==null||pn==null)return;let e=t.getItem(Gt);e!=null&&(yt(pn),gt.current=!0,de({anchorRect:null,item:{kind:e.isDirectory()?`directory`:`file`,name:pn.getAttribute(`aria-label`)??Gt,path:e.getPath()},path:e.getPath(),source:`button`}))},Sn={contextHoverPath:fn,contextMenuButtonTriggerEnabled:Me,contextMenuButtonVisibility:Ne,contextMenuEnabled:Ae,contextMenuRightClickEnabled:Pe,contextMenuTriggerMode:je,controller:t,directoriesWithGitChanges:i,dragAndDropEnabled:Je,draggedPathSet:Xe,dragTarget:Ze,gitLaneActive:ze,gitStatusByPath:n,handleRowDragEnd:It,handleRowDragStart:Ft,handleRowTouchStart:Lt,ignoredGitDirectories:r,ignoredInheritanceCache:K,instanceId:o,itemHeight:s,onKeyDown:Rt,onRowClick:bn,openContextMenuForRow:bt,registerButton:Fe,registerRenameInput:Le,renameView:Ve,renderDecorationForRow:ft,resolveIcon:Be,shouldSuppressContextMenu:Ct,visualFocusPath:dn},Cn={...Sn,registerButton:Ie};return mB(`div`,{ref:S,id:$e,"data-file-tree-context-menu-button-visibility":Ae&&Me?Ne:void 0,"data-file-tree-context-menu-trigger-mode":Ae?je:void 0,"data-file-tree-has-context-menu-action-lane":Ae&&Me?`true`:void 0,"data-file-tree-has-git-lane":ze?`true`:void 0,"data-file-tree-virtualized-root":`true`,onDragLeave:Je?Xt:void 0,onDragOver:Je?Yt:void 0,onDrop:Je?Zt:void 0,onKeyDown:Rt,onPointerLeave:Ae?Jt:void 0,onPointerOver:Ae?qt:void 0,role:`tree`,tabIndex:-1,style:{outline:`none`,position:`relative`},children:[mB(`style`,{"data-file-tree-guide-style":`true`,dangerouslySetInnerHTML:{__html:ln}}),mB(`slot`,{name:EP,"data-type":`header-slot`}),f?mB(`div`,{"data-file-tree-search-container":!0,"data-open":We?`true`:`false`,children:mB(`input`,{ref:w,"aria-activedescendant":un,"aria-controls":$e,placeholder:`Search…`,"data-file-tree-search-input":!0,"data-file-tree-search-input-fake-focus":Ce?`true`:void 0,value:Ge,onBlur:()=>{d===`retain`&&!J.current||t.closeSearch()},onFocus:Te,onPointerDown:Te,onInput:e=>{Te();let n=e.currentTarget;t.setSearch(n.value)}})}):null,mB(`div`,{ref:C,"data-file-tree-virtualized-scroll":`true`,children:[h&&Oe&&ot.length>0?mB(`div`,{"aria-hidden":`true`,"data-file-tree-sticky-overlay":`true`,children:mB(`div`,{"data-file-tree-sticky-overlay-content":`true`,style:{height:`${et}px`},children:ot.map((e,t)=>xH(Cn,e.row,`sticky:${AV(e.row)}`,{mode:`sticky`,style:{left:`0`,position:`absolute`,right:`0`,top:`${e.top}px`,zIndex:`${ot.length-t}`}}))})}):null,mB(`div`,{ref:b,"data-file-tree-virtualized-list":`true`,style:{height:`${ct}px`},children:[mB(`div`,{"data-file-tree-virtualized-sticky-offset":`true`,"aria-hidden":`true`,style:{height:`${$t}px`}}),mB(`div`,{"data-file-tree-virtualized-sticky":`true`,style:{height:`${Qt}px`,top:`${en}px`,bottom:`${en}px`},children:[SH(Sn,at,ut),nn!=null&&rn!=null?xH(Sn,nn,`parked:${nn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:Qe===nn.path?`none`:void 0,position:`absolute`,right:`0`,top:`${rn}px`}}):null,sn!=null&&cn!=null?xH(Sn,sn,`parked-drag:${sn.path}`,{isParked:!0,style:{left:`0`,opacity:`0`,pointerEvents:`none`,position:`absolute`,right:`0`,top:`${cn}px`}}):null]})]})]}),Ae?mB(`div`,{ref:_,"data-type":`context-menu-anchor`,"data-visible":hn?`true`:`false`,style:vn,children:[mB(`button`,{ref:v,type:`button`,"data-type":OP,"aria-label":`Options`,"aria-haspopup":`menu`,"aria-expanded":ue==null?`false`:`true`,"data-visible":mn?`true`:`false`,onMouseDown:e=>{e.preventDefault()},onClick:e=>{if(e.preventDefault(),e.stopPropagation(),ue!=null){vt();return}xn()},tabIndex:-1,style:yn,children:mB(vB,{...Be(`file-tree-icon-ellipsis`)})}),ue==null?null:mB(`slot`,{name:DP})]}):null,ue==null?null:mB(`div`,{"data-type":`context-menu-wash`,"aria-hidden":`true`,onMouseDownCapture:e=>{e.preventDefault(),vt()},onTouchStartCapture:e=>{e.preventDefault(),e.stopPropagation(),vt()},onTouchMoveCapture:e=>{e.preventDefault(),e.stopPropagation()},onWheelCapture:e=>{e.preventDefault(),e.stopPropagation()}})]})}var wH={hydrateRoot:(e,t)=>{fB(Hz(CH,t),e)},renderRoot:(e,t)=>{dB(Hz(CH,t),e)},unmountRoot:e=>{dB(null,e)}};function TH(e,t){wH.renderRoot(e,t)}function EH(e,t){wH.hydrateRoot(e,t)}function DH(e){wH.unmountRoot(e)}var OH=class{#e=new Map;#t=null;clearAll(){for(let e of this.#e.values())e.remove();this.#e.clear()}clearSlotContent(e){let t=this.#n(e);t!=null&&(t.remove(),this.#e.delete(e))}setHost(e){if(this.#t=e,e!=null){this.#i(e);for(let[e,t]of this.#e)this.#r(e,t)}}setSlotContent(e,t){let n=this.#n(e);if(n===t){t!=null&&(this.#e.set(e,t),this.#r(e,t));return}if(n?.remove(),t==null){this.#e.delete(e);return}this.#e.set(e,t),this.#r(e,t)}setSlotHtml(e,t){let n=t?.trim()??``;if(n.length===0){this.setSlotContent(e,null);return}let r=this.#n(e);if(r!=null&&r.innerHTML===n){this.#e.set(e,r),this.#r(e,r);return}let i=document.createElement(`div`);i.innerHTML=n,this.setSlotContent(e,i)}#n(e){let t=this.#e.get(e)??null;if(t!=null)return t;let n=this.#t;if(n==null)return null;for(let t of Array.from(n.children))if(t instanceof HTMLElement&&t.dataset.fileTreeManagedSlot===e)return t;return null}#r(e,t){t.slot=e,t.dataset.fileTreeManagedSlot=e,this.#t!=null&&t.parentNode!==this.#t&&this.#t.appendChild(t)}#i(e){for(let t of Array.from(e.children)){if(!(t instanceof HTMLElement))continue;let e=t.dataset.fileTreeManagedSlot;e==null||this.#e.has(e)||this.#e.set(e,t)}}},kH=`__c`,AH=`__k`,jH=`__d`,MH=`__s`,NH=/[\s\n\\/='"\0<>]/,PH=/^(xlink|xmlns|xml)([A-Z])/,FH=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,IH=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,LH=new Set([`draggable`,`spellcheck`]);function RH(e){e.__g===void 0?e[jH]=!0:e.__g|=8}function zH(e){e.__g===void 0?e[jH]=!1:e.__g&=-9}function BH(e){return e.__g===void 0?!0===e[jH]:!!(8&e.__g)}var VH=/["&<]/;function HH(e){if(e.length===0||!1===VH.test(e))return e;for(var t=0,n=0,r=``,i=``;n<e.length;n++){switch(e.charCodeAt(n)){case 34:i=`&quot;`;break;case 38:i=`&amp;`;break;case 60:i=`&lt;`;break;default:continue}n!==t&&(r+=e.slice(t,n)),r+=i,t=n+1}return n!==t&&(r+=e.slice(t,n)),r}var UH={},WH=new Set(`animation-iteration-count.border-image-outset.border-image-slice.border-image-width.box-flex.box-flex-group.box-ordinal-group.column-count.fill-opacity.flex.flex-grow.flex-negative.flex-order.flex-positive.flex-shrink.flood-opacity.font-weight.grid-column.grid-row.line-clamp.line-height.opacity.order.orphans.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.widows.z-index.zoom`.split(`.`)),GH=/[A-Z]/g;function KH(e){var t=``;for(var n in e){var r=e[n];if(r!=null&&r!==``){var i=n[0]==`-`?n:UH[n]||(UH[n]=n.replace(GH,`-$&`).toLowerCase()),a=`;`;typeof r!=`number`||i.startsWith(`--`)||WH.has(i)||(a=`px;`),t=t+i+`:`+r+a}}return t||void 0}function qH(){this.__d=!0}function JH(e,t){return{__v:e,context:t,props:e.props,setState:qH,forceUpdate:qH,__d:!0,__h:[]}}function YH(e,t,n){if(!e.s){if(n instanceof XH){if(!n.s)return void(n.o=YH.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(YH.bind(null,e,t),YH.bind(null,e,2));e.s=t,e.v=n;let r=e.o;r&&r(e)}}var XH=function(){function e(){}return e.prototype.then=function(t,n){var r=new e,i=this.s;if(i){var a=1&i?t:n;if(a){try{YH(r,1,a(this.v))}catch(e){YH(r,2,e)}return r}return this}return this.o=function(e){try{var i=e.v;1&e.s?YH(r,1,t?t(i):i):n?YH(r,1,n(i)):YH(r,2,i)}catch(e){YH(r,2,e)}},r},e}(),ZH,QH,$H,eU,tU={},nU=Array.isArray,rU=Object.assign,iU=``,aU=`<!--$s-->`,oU=`<!--/$s-->`;function sU(e,t){var n,r=e.type,i=!0;return e[kH]?(i=!1,(n=e[kH]).state=n[MH]):n=new r(e.props,t),e[kH]=n,n.__v=e,n.props=e.props,n.context=t,RH(n),n.state??=tU,n[MH]??(n[MH]=n.state),r.getDerivedStateFromProps?n.state=rU({},n.state,r.getDerivedStateFromProps(n.props,n.state)):i&&n.componentWillMount?(n.componentWillMount(),n.state=n[MH]===n.state?n.state:n[MH]):!i&&n.componentWillUpdate&&n.componentWillUpdate(),$H&&$H(e),n.render(n.props,n.state,t)}function cU(e,t,n,r,i,a,o){if(e==null||!0===e||!1===e||e===iU)return iU;var s=typeof e;if(s!=`object`)return s==`function`?iU:s==`string`?HH(e):e+iU;if(nU(e)){var c,l=iU;i[AH]=e;for(var u=e.length,d=0;d<u;d++){var f=e[d];if(f!=null&&typeof f!=`boolean`){var p,m=cU(f,t,n,r,i,a,o);typeof m==`string`?l+=m:(c||=Array(u),l&&c.push(l),l=iU,nU(m)?(p=c).push.apply(p,m):c.push(m))}}return c?(l&&c.push(l),c):l}if(e.constructor!==void 0)return iU;e.__=i,ZH&&ZH(e);var h=e.type,g=e.props;if(typeof h==`function`){var _,v,y,b=t;if(h===Wz){if(`tpl`in g){for(var x=iU,S=0;S<g.tpl.length;S++)if(x+=g.tpl[S],g.exprs&&S<g.exprs.length){var C=g.exprs[S];if(C==null)continue;typeof C!=`object`||C.constructor!==void 0&&!nU(C)?x+=C:x+=cU(C,t,n,r,e,a,o)}return x}if(`UNSTABLE_comment`in g)return`<!--`+HH(g.UNSTABLE_comment)+`-->`;v=g.children}else{if((_=h.contextType)!=null){var w=t[_.__c];b=w?w.props.value:_.__}var T=h.prototype&&typeof h.prototype.render==`function`;if(T)v=sU(e,b),y=e[kH];else{e[kH]=y=JH(e,b);for(var E=0;BH(y)&&E++<25;){zH(y),$H&&$H(e);try{v=h.call(y,g,b)}catch(t){throw a&&t&&typeof t.then==`function`&&(e._suspended=!0),t}}RH(y)}if(y.getChildContext!=null&&(t=rU({},t,y.getChildContext())),T&&Ez.errorBoundaries&&(h.getDerivedStateFromError||y.componentDidCatch)){v=v!=null&&v.type===Wz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{return cU(v,t,n,r,e,a,!1)}catch(i){return h.getDerivedStateFromError&&(y[MH]=h.getDerivedStateFromError(i)),y.componentDidCatch&&y.componentDidCatch(i,tU),BH(y)?(v=sU(e,t),(y=e[kH]).getChildContext!=null&&(t=rU({},t,y.getChildContext())),cU(v=v!=null&&v.type===Wz&&v.key==null&&v.props.tpl==null?v.props.children:v,t,n,r,e,a,o)):iU}finally{QH&&QH(e),eU&&eU(e)}}}v=v!=null&&v.type===Wz&&v.key==null&&v.props.tpl==null?v.props.children:v;try{var D=cU(v,t,n,r,e,a,o);return QH&&QH(e),Ez.unmount&&Ez.unmount(e),e._suspended?typeof D==`string`?aU+D+oU:nU(D)?(D.unshift(aU),D.push(oU),D):D.then(function(e){return aU+e+oU}):D}catch(i){if(!a&&o&&o.onError){var O=function i(s){return o.onError(s,e,function(e,s){try{return cU(e,t,n,r,s,a,o)}catch(e){return i(e)}})}(i);if(O!==void 0)return O;var k=Ez.__e;return k&&k(i,e),iU}if(!a||!i||typeof i.then!=`function`)throw i;return i.then(function i(){try{var s=cU(v,t,n,r,e,a,o);return e._suspended?aU+s+oU:s}catch(e){if(!e||typeof e.then!=`function`)throw e;return e.then(i)}})}}var A,j=`<`+h,M=iU;for(var N in g){var P=g[N];if(typeof(P=uU(P)?P.value:P)!=`function`||N===`class`||N===`className`){switch(N){case`children`:A=P;continue;case`key`:case`ref`:case`__self`:case`__source`:continue;case`htmlFor`:if(`for`in g)continue;N=`for`;break;case`className`:if(`class`in g)continue;N=`class`;break;case`defaultChecked`:N=`checked`;break;case`defaultSelected`:N=`selected`;break;case`defaultValue`:case`value`:switch(N=`value`,h){case`textarea`:A=P;continue;case`select`:r=P;continue;case`option`:r!=P||`selected`in g||(j+=` selected`)}break;case`dangerouslySetInnerHTML`:M=P&&P.__html;continue;case`style`:typeof P==`object`&&(P=KH(P));break;case`acceptCharset`:N=`accept-charset`;break;case`httpEquiv`:N=`http-equiv`;break;default:if(PH.test(N))N=N.replace(PH,`$1:$2`).toLowerCase();else{if(NH.test(N))continue;N[4]!==`-`&&!LH.has(N)||P==null?n?IH.test(N)&&(N=N===`panose1`?`panose-1`:N.replace(/([A-Z])/g,`-$1`).toLowerCase()):FH.test(N)&&(N=N.toLowerCase()):P+=iU}}P!=null&&!1!==P&&(j=!0===P||P===iU?j+` `+N:j+` `+N+`="`+(typeof P==`string`?HH(P):P+iU)+`"`)}}if(NH.test(h))throw Error(h+` is not a valid HTML tag name in `+j+`>`);if(M||(typeof A==`string`?M=HH(A):A!=null&&!1!==A&&!0!==A&&(M=cU(A,t,h===`svg`||h!==`foreignObject`&&n,r,e,a,o))),QH&&QH(e),eU&&eU(e),!M&&lU.has(h))return j+`/>`;var F=`</`+h+`>`,I=j+`>`;return nU(M)?[I].concat(M,[F]):typeof M==`string`?I+M+F:[I,M,F]}var lU=new Set([`area`,`base`,`br`,`col`,`command`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function uU(e){return typeof e==`object`&&!!e&&typeof e.peek==`function`&&`value`in e}var dU=0;function fU(e){return e!=null&&e.length>0?e:(dU+=1,`pst_ft_${dU}`)}function pU({initialVisibleRowCount:e,itemHeight:t}){return e==null?420:Math.max(0,e)*(t??wR)}function mU(e){if(typeof document>`u`)return;let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelector(`svg`);return n instanceof SVGElement?n:void 0}function hU(e){return e.querySelector(`#file-tree-icon-chevron`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-file`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-dot`)instanceof SVGElement&&e.querySelector(`#file-tree-icon-lock`)instanceof SVGElement}function gU(e){return Array.from(e.children).filter(e=>e instanceof SVGElement)}var _U=class{static LoadedCustomComponent=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=new OH;#u;#d;#f;#p;#m;#h;#g;#_;#v;#y=null;#b;#x=!1;#S=!1;constructor(e){let{composition:t,density:n,fileTreeSearchMode:r,gitStatus:i,id:a,initialSearchQuery:o,icons:s,itemHeight:c,onSearchChange:l,onSelectionChange:u,overscan:d,renderRowDecoration:f,renaming:p,search:m,searchBlurBehavior:h,searchFakeFocus:g,stickyFolders:_,unsafeCSS:v,initialVisibleRowCount:y,...b}=e;this.#e=t,this.#n=fU(a),this.#p=Tz(i),this.#m=s,this.#h=v,this.#r=u,this.#i=f,this.#a=p!=null&&p!==!1,this.#o=h,this.#s=m===!0,this.#c=g===!0,this.#u=CR(n,c),this.#d={itemHeight:this.#u.itemHeight,overscan:d,stickyFolders:_,initialVisibleRowCount:y},this.#t=new bz({...b,fileTreeSearchMode:r,initialSearchQuery:o,onSearchChange:l,renaming:p}),this.#v=this.#t.getSelectionVersion(),this.#y=this.#r==null?null:this.subscribe(()=>{this.#D()})}unmount(){this.#b!=null&&(DH(this.#b),delete this.#b.dataset.fileTreeVirtualizedWrapper,this.#b=void 0),this.#l.clearAll(),this.#l.setHost(null),this.#f!=null&&(delete this.#f.dataset.fileTreeVirtualized,this.#I(this.#f),this.#f=void 0)}cleanUp(){this.unmount(),this.#y?.(),this.#y=null,this.#t.destroy()}getFileTreeContainer(){return this.#f}getItem(e){return this.#t.getItem(e)}getFocusedItem(){return this.#t.getFocusedItem()}getFocusedPath(){return this.#t.getFocusedPath()}getSelectedPaths(){return this.#t.getSelectedPaths()}getComposition(){return this.#e}getItemHeight(){return this.#u.itemHeight}getDensityFactor(){return this.#u.factor}subscribe(e){let t=!1;return this.#t.subscribe(()=>{if(!t){t=!0;return}e()})}focusPath(e){this.#t.focusPath(e)}focusNearestPath(e){return this.#t.focusNearestPath(e)}add(e){this.#t.add(e)}batch(e){this.#t.batch(e)}move(e,t,n){this.#t.move(e,t,n)}onMutation(e,t){return this.#t.onMutation(e,t)}setSearch(e){this.#t.setSearch(e)}openSearch(e){this.#t.openSearch(e)}closeSearch(){this.#t.closeSearch()}isSearchOpen(){return this.#t.isSearchOpen()}getSearchValue(){return this.#t.getSearchValue()}getSearchMatchingPaths(){return this.#t.getSearchMatchingPaths()}focusNextSearchMatch(){this.#t.focusNextSearchMatch()}focusPreviousSearchMatch(){this.#t.focusPreviousSearchMatch()}startRenaming(e,t){return this.#t.startRenaming(e,t)}remove(e,t){this.#t.remove(e,t)}resetPaths(e,t){this.#t.resetPaths(e,t)}setComposition(e){this.#e=e;let t=this.#T();t!=null&&(this.#O(),TH(t.wrapper,this.#w()))}setGitStatus(e){this.#p=Tz(e,this.#p);let t=this.#T();t!=null&&TH(t.wrapper,this.#w())}setIcons(e){this.#m=e;let t=this.#T();t!=null&&(this.#E(t.host,t.wrapper),TH(t.wrapper,this.#w()))}hydrate({fileTreeContainer:e}){let t=this.#P(e),n=this.#N(t);this.#O(),EH(n,this.#w())}render({containerWrapper:e,fileTreeContainer:t}){let n=this.#P(t??this.#f,e),r=this.#N(n);this.#O(),TH(r,this.#w())}#C(){return{initialViewportHeight:pU({initialVisibleRowCount:this.#d.initialVisibleRowCount,itemHeight:this.#d.itemHeight}),itemHeight:this.#d.itemHeight,overscan:this.#d.overscan,stickyFolders:this.#d.stickyFolders}}#w(){return{composition:this.#e,controller:this.#t,gitStatusByPath:this.#p?.statusByPath,ignoredGitDirectories:this.#p?.ignoredDirectoryPaths,directoriesWithGitChanges:this.#p?.directoriesWithChanges,icons:this.#m,instanceId:this.#n,renamingEnabled:this.#a,renderRowDecoration:this.#i,searchBlurBehavior:this.#o,searchEnabled:this.#s,searchFakeFocus:this.#c,slotHost:this.#l,...this.#C()}}#T(){let e=this.#f,t=this.#b;return e==null||t==null?null:{host:e,wrapper:t}}#E(e,t){let n=e.shadowRoot;n!=null&&(this.#k(n),this.#A(n)),this.#j(t)}#D(){let e=this.#r;if(e==null)return;let t=this.#t.getSelectionVersion();t!==this.#v&&(this.#v=t,e(this.#t.getSelectedPaths()))}#O(){let e=this.#e?.header?.render;if(e!=null){this.#l.setSlotContent(EP,e());return}this.#l.setSlotHtml(EP,this.#e?.header?.html??null)}#k(e){let t=gU(e).find(e=>hU(e)),n=mU(gP(AP(this.#m).set));n!=null&&(t!=null&&t.outerHTML===n.outerHTML||(t==null?e.prepend(n):t.replaceWith(n)))}#A(e){let t=gU(e),n=t.find(e=>hU(e)),r=t.filter(e=>e!==n),i=AP(this.#m).spriteSheet?.trim()??``;if(i.length===0){for(let e of r)e.remove();return}let a=mU(i);if(a==null){for(let e of r)e.remove();return}if(!(r.length===1&&r[0].outerHTML===a.outerHTML)){for(let e of r)e.remove();e.appendChild(a)}}#j(e){let t=AP(this.#m);t.colored&&vP(t.set)?e.dataset.fileTreeColoredIcons=`true`:delete e.dataset.fileTreeColoredIcons}#M(e){let t=e.querySelector(`style[${SP}]`);if(this.#g==null&&t instanceof HTMLStyleElement&&(this.#g=t),this.#h==null||this.#h===``){this.#g?.remove(),this.#g=void 0,this.#_=void 0;return}this.#g?.parentNode===e&&this.#_===this.#h||(this.#g??=document.createElement(`style`),this.#g.setAttribute(SP,``),this.#g.parentNode!==e&&e.appendChild(this.#g),this.#g.textContent=OR(this.#h),this.#_=this.#h)}#N(e){if(this.#b!=null)return this.#b;let t=e.shadowRoot;if(t==null)throw Error(`FileTree requires a shadow root`);let n=Array.from(t.children).filter(e=>e instanceof HTMLDivElement&&typeof e.dataset.fileTreeId==`string`&&e.dataset.fileTreeId.length>0),r=n.find(e=>e.dataset.fileTreeId===this.#n)??n[0];return r!=null&&(this.#n=r.dataset.fileTreeId??this.#n),this.#b=r??document.createElement(`div`),this.#b.dataset.fileTreeId=this.#n,this.#b.dataset.fileTreeVirtualizedWrapper=`true`,this.#E(e,this.#b),this.#b.parentNode!==t&&t.appendChild(this.#b),this.#b}#P(e,t){let n=e??this.#f??document.createElement(`file-tree-container`);t!=null&&n.parentNode!==t&&t.appendChild(n);let r=n.shadowRoot??n.attachShadow({mode:`open`});return PR(n,r),this.#M(r),n.dataset.fileTreeVirtualized=`true`,n.style.display=`flex`,this.#F(n),this.#l.setHost(n),this.#f=n,n}#F(e){e.style.getPropertyValue(`--trees-item-height`)===``&&(e.style.setProperty(`--trees-item-height`,`${String(this.#u.itemHeight)}px`),this.#x=!0),e.style.getPropertyValue(`--trees-density-override`)===``&&(e.style.setProperty(`--trees-density-override`,String(this.#u.factor)),this.#S=!0)}#I(e){this.#x&&=(e.style.removeProperty(`--trees-item-height`),!1),this.#S&&=(e.style.removeProperty(`--trees-density-override`),!1)}},vU=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function yU(e,t,n){let r=e==null?null:(0,Z.jsx)(`div`,{slot:EP,children:e}),i=t!=null&&n!=null?(0,Z.jsx)(`div`,{slot:DP,children:t(n.item,n.context)}):null;return r==null&&i==null?null:(0,Z.jsxs)(Z.Fragment,{children:[r,i]})}function bU(e,t){return typeof window>`u`&&t!=null?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t.shadowHtml}}),e]}):(0,Z.jsx)(Z.Fragment,{children:e})}function xU(e){let t=e.shadowRoot;return t?.querySelector(`[data-file-tree-id]`)instanceof HTMLElement||t?.querySelector(`[data-file-tree-id]`)instanceof SVGElement?!0:e.querySelector(`template[shadowrootmode="open"]`)instanceof HTMLTemplateElement}function SU(e,t,n,r,i){let a={...e??{}};if(t!=null&&delete a.header,n){let t=e?.contextMenu,n=t?.onClose,o=t?.onOpen;a.contextMenu={...t??{},enabled:!0,onClose:()=>{n?.(),r()},onOpen:(e,t)=>{i(e,t),o?.(e,t)}},delete a.contextMenu.render}return a.header!=null||a.contextMenu!=null?a:void 0}function CU({header:e,id:t,model:n,preloadedData:r,renderContextMenu:i,...a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(n.getComposition()),d=(0,Q.useRef)(n);d.current!==n&&(d.current=n,u.current=n.getComposition());let f=i!=null,p=(0,Q.useCallback)(()=>{s(null)},[]),m=(0,Q.useCallback)((e,t)=>{s({context:t,item:e})},[]),h=u.current,g=(0,Q.useMemo)(()=>SU(h,e,f,p,m),[h,p,m,f,e]),_=(0,Q.useCallback)(e=>{l(e)},[]);(0,Q.useEffect)(()=>{f||s(null)},[f]),vU(()=>{n.setComposition(g)},[g,n]),vU(()=>{if(c!=null)return r!=null&&xU(c)?n.hydrate({fileTreeContainer:c}):n.render({fileTreeContainer:c}),()=>{n.unmount(),n.setComposition(h)}},[h,c,n,r]);let v=bU(yU(e,i,o),r),y=t??r?.id,b={"--trees-item-height":`${String(n.getItemHeight())}px`,"--trees-density-override":n.getDensityFactor(),...a.style};return(0,Z.jsx)(bP,{...a,id:y,ref:_,style:b,suppressHydrationWarning:r!=null,children:v})}function wU(e){let t=(0,Q.useRef)(null);return t.current??=new _U(e),(0,Q.useEffect)(()=>{let e=t.current;return()=>{e?.cleanUp(),t.current=null}},[]),{model:t.current}}var TU=`.md`,EU=/\.(md|mdx)$/i;function DU(e,t=TU){return`${e}${t}`}function OU(e){return KU(e).replace(EU,``)}function kU(e){return Pr(e)?MU(e.path):Fn(e)?e.path:DU(e.docName,e.docExt)}function AU(e){let t=KU(e).match(EU);return t?`.${t[1].toLowerCase()}`:void 0}function jU(e){return KU(e)}function MU(e){let t=KU(e.trim());return t?`${t}/`:``}function NU(e){return e.endsWith(`/`)?jU(e):OU(e)}function PU(e){return e.map(kU)}function FU(e){return[...e].sort().join(`\0`)}function IU(e){return FU(PU(e))}function LU(e){let t=new Set;for(let n of e){if(Pr(n)){let e=MU(n.path);e&&t.add(e)}let e=(Pr(n)||Fn(n)?n.path:n.docName).split(`/`).filter(Boolean),r=Pr(n)?e.length:e.length-1;for(let n=1;n<=r;n++)t.add(`${e.slice(0,n).join(`/`)}/`)}return[...t].sort()}function RU(e){if(!e)return[];let t=KU(e.replace(EU,``)).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 zU(e){let t=e.kind===`directory`,n=t?jU(e.path):OU(e.path),r=t?void 0:AU(e.path);return{kind:t?`folder`:`file`,name:KU(GU(e.path)).replace(EU,``),path:n,treePath:VU(e.path,t),docExt:r}}function BU(e){return e.kind===`directory`?jU(e.path):e.path}function VU(e,t){return t?MU(e):EU.test(e)?e:`${e}${TU}`}function HU(e,t,n){let r=MU(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}${TU}`;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 UU(e,t){return e===`file`?VU(t,!1):`${jU(t)}/index${TU}`}function WU(e,t){return t.kind===`root`||t.directoryPath==null?GU(e):`${t.directoryPath}${GU(e)}`}function GU(e){let t=KU(e),n=t.lastIndexOf(`/`),r=n===-1?t:t.slice(n+1);return e.endsWith(`/`)?`${r}/`:r}function KU(e){return e.endsWith(`/`)?e.slice(0,-1):e}function qU(e){return e.replace(/\\/g,`\\\\`).replace(/\[/g,`\\[`).replace(/\]/g,`\\]`).replace(/\*/g,`\\*`)}function JU(e){let t=qU(e.path);return e.kind===`folder`?`/${t}/`:`/${t}${e.docExt??`.md`}`}function YU(e){return{selectedFilePath:e,selectedFolderPath:null,navigationPath:e}}function XU(e,t,n={}){if(!e)return YU(t);let r=Hn(e);if(t&&r!==t)return YU(t);switch(e.kind){case`doc`:return YU(t??e.docName);case`folder`:case`folder-index`:return{selectedFilePath:null,selectedFolderPath:e.folderPath,navigationPath:e.folderPath};case`missing`:return t&&n.isKnownDocument?.(t)?YU(t):{selectedFilePath:null,selectedFolderPath:null,navigationPath:null};case`asset`:return{selectedFilePath:null,selectedFolderPath:null,navigationPath:null}}}function ZU(e,t){if(!e)return{kind:`none`};let n=t.find(t=>kU(t)===e);if(n&&Fn(n))return{kind:`asset`,path:n.path,hash:xr(n.path),mediaKind:n.mediaKind};let r=NU(e);return e.endsWith(`/`)?t.some(e=>Pr(e)?e.path===r||e.path.startsWith(`${r}/`):(Fn(e)?e.path:e.docName).startsWith(`${r}/`))?{kind:`folder`,path:r}:{kind:`none`}:t.some(e=>Ar(e)&&e.docName===r)?{kind:`document`,path:r}:{kind:`none`}}function QU(e){return e?.isDirectory()?e:null}function $U(e,t){let n=t.getPath();for(let t of e.getSelectedPaths())t!==n&&e.getItem(t)?.deselect();t.isSelected()||t.select()}function eW(e,t,n,r){let i=(0,$.c)(6),a,o;i[0]!==n||i[1]!==t||i[2]!==e||i[3]!==r?(a=()=>{let i=()=>{queueMicrotask(()=>{r.current=!1})};if(r.current=!0,!t){for(let t of e.getSelectedPaths())e.getItem(t)?.deselect();i();return}let a=n?n.split(`\0`):[];for(let t of a){let n=QU(e.getItem(t));n&&!n.isExpanded()&&n.expand()}let o=e.getItem(t);if(!o){i();return}$U(e,o),o.focus(),i()},o=[n,t,e,r],i[0]=n,i[1]=t,i[2]=e,i[3]=r,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}function tW(e){let t=!1,n=!1,r=!1;async function i(){if(!r){t=!0;try{await e()}finally{t=!1,r?n=!1:n&&(n=!1,i())}}}return{request(){if(!r){if(t){n=!0;return}i()}},dispose(){r=!0,n=!1}}}function nW(e){return e?`No workspace`:null}function rW(e){let t=(0,$.c)(48),{input:n,installStates:r,dispatch:i}=e,{skillInstalled:a,refresh:o}=la(),[s,c]=(0,Q.useState)(!1),l=n===null,u;t[0]===l?u=t[1]:(u=nW(l),t[0]=l,t[1]=u);let d=u,f,p,m,h,g,_;if(t[2]!==i||t[3]!==d||t[4]!==n||t[5]!==l||t[6]!==r||t[7]!==a){let e;t[14]===r?e=t[15]:(e=e=>r[e.id]?.installed===!0,t[14]=r,t[15]=e);let o=op.filter(e);m=r[`claude-cowork`]?.installed===!0;let s;t[16]===n?s=t[17]:(s=n!==null&&n.docContext!==null?tr(n.docContext):``,t[16]=n,t[17]=s);let u=s,v;t[18]!==n||t[19]!==u?(v=()=>{n!==null&&Sb(u)},t[18]=n,t[19]=u,t[20]=v):v=t[20],h=v,p=di,t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsxs)(bi,{children:[(0,Z.jsx)(ii,{"aria-hidden":`true`}),`Open in`]}),t[21]=_):_=t[21],f=Li;let y;t[22]!==i||t[23]!==d||t[24]!==n||t[25]!==l||t[26]!==a?(y=e=>{let t=!l,r=e.id===`claude-cowork`&&t&&!a?()=>c(!0):void 0,o=Cb({target:e,onInstallSkillRequest:r}),s=o?`Install Open Knowledge skill in ${e.displayName}`:d?`Open in ${e.displayName}, ${d}`:`Open in ${e.displayName}`;return(0,Z.jsxs)(vi,{disabled:!t,onSelect:()=>{n&&(o&&r?r():i(e.id,n))},"data-testid":`file-tree-open-in-${e.id}`,"aria-label":s,children:[(0,Z.jsx)(gb,{id:e.id,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:Y(`flex-1`,o&&`whitespace-nowrap`),children:e.displayName}),o?(0,Z.jsx)(Ne,{variant:`outline`,"aria-hidden":`true`,className:`ml-2 h-[18px] px-1.5 py-0 text-[10px]`,"data-testid":`open-in-agent-skill-install-badge`,children:`Install`}):d?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:d}):null]},e.id)},t[22]=i,t[23]=d,t[24]=n,t[25]=l,t[26]=a,t[27]=y):y=t[27],g=o.map(y),t[2]=i,t[3]=d,t[4]=n,t[5]=l,t[6]=r,t[7]=a,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_}else f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13];let y;t[28]!==m||t[29]!==h||t[30]!==l?(y=m?null:(0,Z.jsxs)(vi,{onSelect:h,disabled:l,"data-testid":`file-tree-open-in-claude-web-fallback`,"aria-label":`Open in claude.ai, opens in browser with prompt pre-filled`,children:[(0,Z.jsx)(v,{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[28]=m,t[29]=h,t[30]=l,t[31]=y):y=t[31];let b;t[32]!==f||t[33]!==g||t[34]!==y?(b=(0,Z.jsxs)(f,{children:[g,y]}),t[32]=f,t[33]=g,t[34]=y,t[35]=b):b=t[35];let x;t[36]!==p||t[37]!==_||t[38]!==b?(x=(0,Z.jsxs)(p,{children:[_,b]}),t[36]=p,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S;t[40]===o?S=t[41]:(S=e=>{c(e),e||o()},t[40]=o,t[41]=S);let C;t[42]!==s||t[43]!==S?(C=(0,Z.jsx)(ta,{open:s,onOpenChange:S}),t[42]=s,t[43]=S,t[44]=C):C=t[44];let w;return t[45]!==x||t[46]!==C?(w=(0,Z.jsxs)(Z.Fragment,{children:[x,C]}),t[45]=x,t[46]=C,t[47]=w):w=t[47],w}var iW=tt(`HOVER_INTENT_MS`,80),aW=3,oW=20,sW=new Map,cW=new Set,lW=[],uW=new Map;function dW(e){for(uW.delete(e),uW.set(e,!0);uW.size>oW;){let e=uW.keys().next().value;if(e===void 0)break;uW.delete(e)}}function fW(e){cW.delete(e),mW()}function pW(e,t){let n=Date.now();Ge(`ok/sidebar/prewarm-success`,{docName:e,t:n,poolEventId:t}),m(e,t,n)}function mW(){for(;cW.size<aW&&lW.length>0;){let e=lW.shift();if(!e)break;if(!uW.has(e.docName)){cW.add(e.docName),dW(e.docName);try{let t=e.prewarm(e.docName);t&&pW(e.docName,t)}catch(t){Ge(`ok/sidebar/prewarm-failed`,{docName:e.docName,message:t instanceof Error?t.message:String(t)})}finally{fW(e.docName)}}}}function hW(e,t){if(we(e)||uW.has(e))return;let n=sW.get(e);n&&clearTimeout(n.timer);let r=setTimeout(()=>{if(sW.delete(e),cW.size>=aW){lW.push({docName:e,prewarm:t});return}dW(e),cW.add(e);try{let n=t(e);n&&pW(e,n)}catch(t){Ge(`ok/sidebar/prewarm-failed`,{docName:e,message:t instanceof Error?t.message:String(t)})}finally{fW(e)}},iW);sW.set(e,{timer:r,prewarm:t})}function gW(e){let t=sW.get(e);t&&(clearTimeout(t.timer),sW.delete(e))}var _W=/\.(md|mdx)$/i;function vW(e){if(window.location.hash===e)return;let{pathname:t,search:n}=window.location;window.history.replaceState(null,``,`${t}${n}${e}`)}function yW(e){let t=e.match(/^"(.+)" already exists\.$/);return t?t[1]:null}function bW(e){let t=e.match(_W);return t?t[0]:null}async function xW(e,t){try{await navigator.clipboard.writeText(e),Xa.success(`Copied ${t}`,{description:e})}catch(e){console.warn(`[FileTree] clipboard write failed:`,e),Xa.error(`Could not copy ${t}`)}}var SW=new Set([`agents`,`agent`,`claude`,`skill`]),CW=`ok-file-tree-link-decoration`,wW=`ok-file-tree-agent-decoration`;function TW(e){return e.map(([e,{key:t,...n}])=>`<${e} ${Object.entries(n).map(([e,t])=>`${e}="${t}"`).join(` `)} />`).join(``)}function EW(e,t){return`<symbol id="${e}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${TW(t)}</symbol>`}var DW=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
1847
+ ${EW(CW,Ls)}
1848
+ ${EW(wW,os)}
1849
+ </svg>`,OW=`
1850
1850
  [data-item-selected='true'] [data-icon-token='markdown'] {
1851
1851
  color: var(--trees-selected-fg);
1852
1852
  }
1853
- `;function jW(e){return{...UP({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function MW(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&wW.has(t)}function NW(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function PW(e){let t=(0,$.c)(14),{item:n,workspace:r,onClose:i}=e,a=typeof window<`u`?window.okDesktop:void 0;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=NW(a.platform),t[0]=o):o=t[0];let s=o,c=r?null:`No workspace`,l=!r,u;t[1]!==n||t[2]!==i||t[3]!==r?(u=()=>{if(!r)return;i();let e=bp(r.contentDir,HU(n),r.pathSeparator);a.shell.showItemInFolder(e)},t[1]=n,t[2]=i,t[3]=r,t[4]=u):u=t[4];let d=c?`${s}, ${c}`:s,f,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(G,{"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{className:`flex-1`,children:s}),t[5]=f,t[6]=p):(f=t[5],p=t[6]);let m;t[7]===c?m=t[8]:(m=c?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:c}):null,t[7]=c,t[8]=m);let h;return t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==m?(h=(0,Z.jsxs)(di,{disabled:l,onSelect:u,"aria-label":d,children:[f,p,m]}),t[9]=l,t[10]=u,t[11]=d,t[12]=m,t[13]=h):h=t[13],h}function FW(e){return VU({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function IW(e,t){return e!==t&&e.startsWith(t)}function LW(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>IW(e,t))).map(FW)}function RW(e,t){return e===t||e.startsWith(`${t}/`)}function zW(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function BW(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)Ar(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=NU(e);RW(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function VW(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:RW(t.createdPath,e.path)}function HW(e){let t=(0,$.c)(85),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onStartCreatingFromTemplate:u,onDelete:d,onExpandSubtree:f,onCollapseSubtree:p,isAsset:m,isAssetTreePath:g}=e,_,v,y,b,x;if(t[0]!==m||t[1]!==g||t[2]!==n||t[3]!==s||t[4]!==c){x=VU(n),y=n.kind===`directory`,_=!m&&c!==null,v=y?`Hide files in this folder`:`Hide this file`;let e=s.getSelectedPaths();b=e.includes(x.treePath)?LW(e,g):[],t[0]=m,t[1]=g,t[2]=n,t[3]=s,t[4]=c,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x}else _=t[5],v=t[6],y=t[7],b=t[8],x=t[9];let S=b,C;t[10]!==S||t[11]!==x?(C=S.length>1?S:[x],t[10]=S,t[11]=x,t[12]=C):C=t[12];let w=C,T=w.length>1?`Delete ${w.length} Items`:`Delete`,E;t[13]!==y||t[14]!==n.path||t[15]!==a?(E=y?null:Sp({docName:AU(n.path),workspace:a}),t[13]=y,t[14]=n.path,t[15]=a,t[16]=E):E=t[16];let D=E,O;t[17]===r?O=t[18]:(O=()=>r.close({restoreFocus:!1}),t[17]=r,t[18]=O);let k=O,A;t[19]===r?A=t[20]:(A=()=>r.close(),t[19]=r,t[20]=A);let j=A,M;t[21]===j?M=t[22]:(M=e=>{e||j()},t[21]=j,t[22]=M);let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Si,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[23]=N):N=t[23];let P;t[24]!==i||t[25]!==j||t[26]!==k||t[27]!==y||t[28]!==n.path||t[29]!==p||t[30]!==f||t[31]!==l||t[32]!==u?(P=y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(di,{disabled:i,onSelect:()=>{k(),l(`file`,NU(n.path))},children:[(0,Z.jsx)(cc,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(di,{disabled:i,onSelect:()=>{k(),u(NU(n.path))},children:[(0,Z.jsx)(Cs,{"aria-hidden":`true`}),`New from template`]}),(0,Z.jsxs)(di,{disabled:i,onSelect:()=>{k(),l(`folder`,NU(n.path))},children:[(0,Z.jsx)(Os,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(Ri,{}),(0,Z.jsxs)(di,{onSelect:()=>{j(),f(n.path)},children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Expand All`]}),(0,Z.jsxs)(di,{onSelect:()=>{j(),p(n.path)},children:[(0,Z.jsx)(Es,{"aria-hidden":`true`}),`Collapse All`]}),(0,Z.jsx)(Ri,{})]}):null,t[24]=i,t[25]=j,t[26]=k,t[27]=y,t[28]=n.path,t[29]=p,t[30]=f,t[31]=l,t[32]=u,t[33]=P):P=t[33];let F;t[34]!==i||t[35]!==k||t[36]!==m||t[37]!==n.path||t[38]!==s?(F=m?null:(0,Z.jsxs)(di,{disabled:i,onSelect:()=>{k(),s.startRenaming(n.path)},children:[(0,Z.jsx)(be,{"aria-hidden":`true`}),`Rename`]}),t[34]=i,t[35]=k,t[36]=m,t[37]=n.path,t[38]=s,t[39]=F):F=t[39];let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(ha,{children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),`Copy Path`]}),t[40]=I):I=t[40];let L=!a,R;t[41]!==j||t[42]!==n||t[43]!==a?(R=()=>{a&&(j(),CW(bp(a.contentDir,HU(n),a.pathSeparator),`full path`))},t[41]=j,t[42]=n,t[43]=a,t[44]=R):R=t[44];let z;t[45]!==L||t[46]!==R?(z=(0,Z.jsx)(di,{disabled:L,onSelect:R,children:`Full Path`}),t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==j||t[49]!==n?(B=(0,Z.jsx)(di,{onSelect:()=>{j(),CW(HU(n),`relative path`)},children:`Relative Path`}),t[48]=j,t[49]=n,t[50]=B):B=t[50];let V;t[51]!==z||t[52]!==B?(V=(0,Z.jsxs)(yi,{children:[I,(0,Z.jsxs)(Ci,{children:[z,B]})]}),t[51]=z,t[52]=B,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Ri,{}),t[54]=H):H=t[54];let U;t[55]!==j||t[56]!==n||t[57]!==a?(U=(0,Z.jsx)(PW,{item:n,workspace:a,onClose:j}),t[55]=j,t[56]=n,t[57]=a,t[58]=U):U=t[58];let W;t[59]!==o||t[60]!==D||t[61]!==m||t[62]!==y?(W=!y&&!m&&(0,Z.jsx)(aW,{input:D,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[59]=o,t[60]=D,t[61]=m,t[62]=y,t[63]=W):W=t[63];let G;t[64]!==i||t[65]!==_||t[66]!==j||t[67]!==T||t[68]!==w||t[69]!==v||t[70]!==m||t[71]!==c||t[72]!==d||t[73]!==x?(G=m?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ri,{}),(0,Z.jsxs)(di,{"data-testid":`file-tree-menu-hide`,disabled:!_,onSelect:()=>{if(!c)return;j();let e=XU(x),t=sa(c.current()),n=Wi(t,e);n!==t&&c.patch(Zi(n))},children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),v]}),(0,Z.jsx)(Ri,{}),(0,Z.jsxs)(di,{variant:`destructive`,disabled:i,onSelect:()=>{j(),d(w)},children:[(0,Z.jsx)(fe,{"aria-hidden":`true`}),T]})]}),t[64]=i,t[65]=_,t[66]=j,t[67]=T,t[68]=w,t[69]=v,t[70]=m,t[71]=c,t[72]=d,t[73]=x,t[74]=G):G=t[74];let K;t[75]!==V||t[76]!==U||t[77]!==W||t[78]!==G||t[79]!==P||t[80]!==F?(K=(0,Z.jsxs)(Aa,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[P,F,V,H,U,W,G]}),t[75]=V,t[76]=U,t[77]=W,t[78]=G,t[79]=P,t[80]=F,t[81]=K):K=t[81];let q;return t[82]!==K||t[83]!==M?(q=(0,Z.jsxs)(ji,{open:!0,modal:!1,onOpenChange:M,children:[N,K]}),t[82]=K,t[83]=M,t[84]=q):q=t[84],q}function UW(e){let t=(0,$.c)(172),{ref:n}=e,{activeDocName:r,activeTarget:i,closeTabs:a,closeDocument:o,closeAndClearForRename:s,isNewTabActive:c,openTarget:l,prewarm:u,remapTabsForRename:d}=We(),{notifySidebarFileSelected:f}=Tj(),{resolvedTheme:p}=yr(),{addPage:m}=wr(),h;t[0]!==f||t[1]!==l?(h=function(e){l({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),bW(er(e)),f()},t[0]=f,t[1]=l,t[2]=h):h=t[2];let g=h,_;t[3]!==f||t[4]!==l?(_=function(e){let t=Ln(e);l({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),bW(t),f()},t[3]=f,t[4]=l,t[5]=_):_=t[5];let v=_,y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],t[6]=y):y=t[6];let[b,x]=(0,Q.useState)(y),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),F=(0,Q.useRef)(b),I;t[7]!==b||t[8]!==v||t[9]!==g||t[10]!==f||t[11]!==l?(I=function(e,t){let n=$U(e,t===void 0?b:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,FU(e));return}if(n.kind===`asset`){l({kind:`asset`,target:n.path,assetPath:n.path,mediaKind:n.mediaKind},{tabBehavior:`replace-active`}),bW(n.hash),f();return}if(n.kind===`folder`){v(n.path);return}g(n.path)},t[7]=b,t[8]=v,t[9]=g,t[10]=f,t[11]=l,t[12]=I):I=t[12];let L=I,R=(0,Q.useRef)(r),z;t[13]===b?z=t[14]:(z=new Set(b.filter(Fn).map(iG)),t[13]=b,t[14]=z);let B=z,V=(0,Q.useRef)(B),H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let U=(0,Q.useRef)(H),W=(0,Q.useRef)(null),G=(0,Q.useRef)(rG),K=(0,Q.useRef)(null),q=(0,Q.useRef)(null),ee=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),ne=(0,Q.useRef)(null),re=(0,Q.useRef)(nG),ie=(0,Q.useRef)(tG),ae=(0,Q.useRef)(eG),oe=(0,Q.useRef)($W),se=(0,Q.useRef)(i),{selectedFilePath:ce,selectedFolderPath:le,navigationPath:ue}=QU(i,c?null:r),de=ce?kU(ce,b.find(e=>Ar(e)&&e.docName===ce)?.docExt):le?PU(le):i?.kind===`asset`?i.assetPath:null,fe=Wp().states,{dispatch:me}=Np(),he;t[16]!==me||t[17]!==fe?(he={installStates:fe,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:me},t[16]=me,t[17]=fe,t[18]=he):he=t[18];let ge=he,{okignoreBinding:_e}=ba(),ve;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>te.current===null,t[19]=ve):ve=t[19];let ye=ve,be;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[20]=be):be=t[20];let xe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(xe={set:`complete`,spriteSheet:kW},t[21]=xe):xe=t[21];let Se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Se={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[22]=Se):Se=t[22];let Ce;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ce={canDrag:ye,canDrop:ye,onDropComplete:e=>oe.current(e),onDropError:QW},t[23]=Ce):Ce=t[23];let we;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(we={paths:be,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:xe,unsafeCSS:AW,composition:Se,dragAndDrop:Ce,renaming:{canRename:ye,onRename:e=>ie.current(e),onError:e=>ae.current(e)},onSelectionChange:e=>re.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=F.current.find(e=>Ar(e)&&kU(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:TW,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:MW(t.path)?{icon:EW,title:`Agent configuration file`}:null}},t[24]=we):we=t[24];let{model:J}=EU(we),Te;t[25]===J?Te=t[26]:(Te=function(e){let t=J.getItem(e)??J.getItem(PU(e));return t?.isDirectory()?PU(NU(t.getPath())):e},t[25]=J,t[26]=Te);let Ee=Te,De,Oe;t[27]===b?(De=t[28],Oe=t[29]):(Oe=IU(b),De=LU(Oe),t[27]=b,t[28]=De,t[29]=Oe);let ke=De,Ae=(0,Q.useRef)(Oe),je;t[30]===b?je=t[31]:(je=zU(b),t[30]=b,t[31]=je);let Me=je,Ne=(0,Q.useRef)(Me),Pe=le?BU(PU(le)).slice(0,-1):BU(de??ue),Fe=Pe.join(`\0`),Ie;if(t[32]!==J){let e=()=>{let e=new Set;for(let t of Ne.current)eW(J.getItem(t))?.isExpanded()&&e.add(t);return e};Ie=t=>{let n=new Set(zU(t??F.current)),r=e();for(let e of U.current)r.add(e);return[...r].filter(e=>n.has(e))},t[32]=J,t[33]=Ie}else Ie=t[33];let Re=Ie,ze;t[34]!==Re||t[35]!==J?(ze=e=>{let t=IU(e??F.current);J.resetPaths(t,{initialExpandedPaths:Re(e)})},t[34]=Re,t[35]=J,t[36]=ze):ze=t[36];let Be=ze,Ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=e=>{K.current=RU(e)},t[37]=Ve):Ve=t[37];let He=Ve,Ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=e=>V.current.has(e),t[38]=Ue):Ue=t[38];let Ge=Ue,Ke=function(e){let t=xW(e);if(!t||SW(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Ge(n))return!1;let r=SW(n);if(!r)return!1;let i=PU(t);if(!Ne.current.includes(i))return!1;let a=`${t}${r}`;return Ae.current.includes(a)?!1:(ft({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},qe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(qe=e=>{let t=e??W.current;!t||W.current!==t||(t.disposeCommitListener(),W.current=null)},t[39]=qe):qe=t[39];let Je=qe,Ye;t[40]!==Je||t[41]!==o||t[42]!==a||t[43]!==Be?(Ye=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;Je(e),r&&D(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=await Le(t,`Failed to clean up pending ${e.kind}`);if(n.ok)return;let i=`${n.title} - ${e.kind} "${e.createdPath}" still exists on disk`;r?Xa.error(i):console.warn(`[FileTree] cleanup pending create failed: ${i}`),r&&(D(null),Be());return}}catch(t){console.warn(`[FileTree] cleanup pending create failed:`,t),r&&Xa.error(`Network error - ${e.kind} "${e.createdPath}" still exists on disk`),r&&(D(null),Be());return}r&&(e.kind===`file`?o(e.createdPath):a([pe(e.createdPath)],{force:!0})),r&&x(t=>{let n=dM(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return He(n),n}),Kn([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&D(null)},t[40]=Je,t[41]=o,t[42]=a,t[43]=Be,t[44]=Ye):Ye=t[44];let Xe=Ye,Ze,Qe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>()=>{let e=W.current;e&&G.current(e,{restoreLocation:!1,updateUi:!1}).catch(ZW)},Qe=[],t[45]=Ze,t[46]=Qe):(Ze=t[45],Qe=t[46]),(0,Q.useEffect)(Ze,Qe);let $e,et;t[47]===Symbol.for(`react.memo_cache_sentinel`)?($e=()=>{let e=!0,t=rW(async function(){try{let t=await Le(await fetch(`/api/documents`),`Failed to load documents`);if(!e)return;if(!t.ok)T(t.title);else{let e=Gn.safeParse(t.body);e.success?(x(e.data.documents),T(null)):T(`Documents response did not match expected shape.`)}}catch(t){let n=t;e&&T(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&C(!1)});t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=_r(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},et=[],t[47]=$e,t[48]=et):($e=t[47],et=t[48]),(0,Q.useEffect)($e,et);let tt,nt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=M(On,n,`workspace`,null);r&&P({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(XW),()=>{e=!1}},nt=[],t[49]=tt,t[50]=nt):(tt=t[49],nt=t[50]),(0,Q.useEffect)(tt,nt);let rt;t[51]!==Re||t[52]!==J||t[53]!==ke?(rt=()=>{if(K.current===ke){K.current=null;return}J.resetPaths(Ae.current,{initialExpandedPaths:Re()})},t[51]=Re,t[52]=J,t[53]=ke,t[54]=rt):rt=t[54];let it;t[55]!==J||t[56]!==ke?(it=[J,ke],t[55]=J,t[56]=ke,t[57]=it):it=t[57],(0,Q.useEffect)(rt,it),nW(J,de,Fe,ee);let ot,st;t[58]===J?(ot=t[59],st=t[60]):(ot=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of U.current){let t=eW(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),st=[J],t[58]=J,t[59]=ot,t[60]=st),(0,Q.useEffect)(ot,st);let ct,lt;t[61]===J?(ct=t[62],lt=t[63]):(ct=()=>J.onMutation(`remove`,e=>{let t=W.current;!t||e.path!==t.renamePath||G.current(t)}),lt=[J],t[61]=J,t[62]=ct,t[63]=lt),(0,Q.useEffect)(ct,lt);let ut;t[64]!==m||t[65]!==s||t[66]!==v||t[67]!==d?(ut=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??R.current,a=fM(i,e),o=n?.folderPath??(se.current?.kind===`folder`?se.current.folderPath:null),c=o?at(o,r):null;await Promise.all(e.flatMap(e=>[s(e.fromDocName),s(e.toDocName)]));for(let t of e)m(t.toDocName);d(e,r),x(t=>{let n=uM(t,e,r);return He(n),n}),o&&c&&c!==o?v(c):a&&a!==i&&(window.location.hash=er(a)),Kn([`files`,`backlinks`,`graph`])},t[64]=m,t[65]=s,t[66]=v,t[67]=d,t[68]=ut):ut=t[68];let dt=ut;async function ft(e){let t=UU(e.sourcePath,e.isFolder),n=UU(e.destinationPath,e.isFolder);D(t),T(null);try{if(!e.isFolder&&Ge(t)){Xa.error(`Assets cannot be renamed from the sidebar`),Be(),Je(),D(null);return}let r=e.isFolder?{kind:`folder`,fromPath:NU(t),toPath:NU(n)}:{kind:`file`,fromPath:AU(t),toPath:AU(n)},i={docName:R.current,folderPath:se.current?.kind===`folder`?se.current.folderPath:null},a=await Le(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),`Failed to rename path`);if(!a.ok){Xa.error(a.title),T(a.title),Be();let e=W.current;e&&e.renamePath===t?await Xe(e):Je(),D(null);return}await dt(M(vn,a.body,`rename-path`,{renamed:[]}).renamed,e.isFolder?[{fromPath:NU(t),toPath:NU(n)}]:[],i),Je(),D(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),Xa.error(`Network error — please try again`),T(`Network error — please try again`),Be();let n=W.current;n&&n.renamePath===t?await Xe(n):Je(),D(null)}}let pt;t[69]!==dt||t[70]!==Be?(pt=async function(e){let t=e.draggedPaths.map(t=>{let n=KU(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(YW);if(t.length!==0){if(t.some(e=>Ge(e.sourcePath))){Xa.error(`Assets cannot be moved from the sidebar`),Be();return}D(t[0]?.sourcePath??null),T(null);try{let e=[],n=[],r={docName:R.current,folderPath:se.current?.kind===`folder`?se.current.folderPath:null};for(let r of t){let t=r.sourcePath.endsWith(`/`),i=t?{kind:`folder`,fromPath:NU(r.sourcePath),toPath:NU(r.destinationTreePath)}:{kind:`file`,fromPath:AU(r.sourcePath),toPath:AU(r.destinationTreePath)},a=await Le(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to move`);if(!a.ok){Xa.error(a.title),T(a.title),Be(),D(null);return}let o=M(vn,a.body,`rename-path:drop`,{renamed:[]});e=e.concat(o.renamed),t&&n.push({fromPath:NU(r.sourcePath),toPath:NU(r.destinationTreePath)})}await dt(e,n,r),D(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Xa.error(`Network error — please try again`),Be(),D(null)}}},t[69]=dt,t[70]=Be,t[71]=pt):pt=t[71];let mt=pt,ht;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(e){j({parentDir:e})},t[72]=ht):ht=t[72];let gt=ht,_t;t[73]!==Xe||t[74]!==Je||t[75]!==J||t[76]!==v||t[77]!==g||t[78]!==Be||t[79]!==Oe?(_t=async function(e,t){if(te.current)return;let n=W.current;n&&Je(n);try{let n=WU(e,t,[...Oe,...Ne.current]);D(n.renamePath),te.current=n.renamePath;let r=window.location.hash,i;if(e===`file`){let e=GU(`file`,n.addPath),t=await Le(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create file`);if(!t.ok){Xa.error(t.title),T(t.title),D(null),te.current=null;return}let r=AU(e),a=M(Er,t.body,`create-page`,{docName:r}).docName;i=a;let o=e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`;x(e=>{if(e.some(e=>Ar(e)&&e.docName===a))return e;let t=[...e,{kind:`document`,docName:a,docExt:o,modified:new Date().toISOString(),size:0}];return He(t),t}),Kn([`files`,`backlinks`,`graph`]),g(a)}else{let e=NU(n.addPath),t=await Le(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create folder`);if(!t.ok){Xa.error(t.title),T(t.title),D(null),te.current=null;return}i=M(gr,t.body,`create-folder`,{path:e}).path,x(e=>{if(e.some(e=>Pr(e)&&e.path===i))return e;let t=[...e,{kind:`folder`,path:i,modified:new Date().toISOString(),size:0}];return He(t),t}),Kn([`files`]),v(i)}let a=!1,o=e=>{if(e.key!==`Enter`)return;let t=W.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>Je(t))};document.addEventListener(`keydown`,o,!0),W.current={kind:e,renamePath:n.renamePath,createdPath:i,previousHash:r,disposeCommitListener:()=>{a||(a=!0,document.removeEventListener(`keydown`,o,!0))}},D(null),te.current=null,J.add(n.addPath),J.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Xa.error(`Could not start creating a new item`);let t=W.current;t?await Xe(t):Je(),D(null),te.current=null,Be()}},t[73]=Xe,t[74]=Je,t[75]=J,t[76]=v,t[77]=g,t[78]=Be,t[79]=Oe,t[80]=_t):_t=t[80];let vt=_t,yt;t[81]===J?yt=t[82]:(yt=function(e){let t=PU(e);(0,Q.startTransition)(()=>{for(let e of Ne.current)if(e===t||e.startsWith(t)){let t=eW(J.getItem(e));t&&t.expand()}})},t[81]=J,t[82]=yt);let bt=yt,xt;t[83]===J?xt=t[84]:(xt=function(e){let t=PU(e),n=new Set(U.current);(0,Q.startTransition)(()=>{for(let e of[...Ne.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=eW(J.getItem(e));t&&t.collapse()}})},t[83]=J,t[84]=xt);let St=xt,Ct;t[85]!==L||t[86]!==Pe||t[87]!==r||t[88]!==i||t[89]!==B||t[90]!==E||t[91]!==Xe||t[92]!==b||t[93]!==Me||t[94]!==mt||t[95]!==ft||t[96]!==Ee||t[97]!==Ke||t[98]!==Oe?(Ct=()=>{F.current=b,R.current=r,se.current=i,V.current=B,te.current=E,Ae.current=Oe,Ne.current=Me,U.current=Pe,G.current=Xe,re.current=e=>{if(ee.current||e.length!==1)return;let t=e[0];t&&L(Ee(t),b)},ae.current=e=>{Ke(e)||Xa.error(e)},ie.current=ft,oe.current=mt},t[85]=L,t[86]=Pe,t[87]=r,t[88]=i,t[89]=B,t[90]=E,t[91]=Xe,t[92]=b,t[93]=Me,t[94]=mt,t[95]=ft,t[96]=Ee,t[97]=Ke,t[98]=Oe,t[99]=Ct):Ct=t[99],(0,Q.useLayoutEffect)(Ct);let wt,Tt;t[100]===J?(wt=t[101],Tt=t[102]):(wt=()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey||e.key.toLowerCase()!==`a`||zW(e.target))return;let t=ne.current,n=e.target,r=document.activeElement,i=n instanceof Node&&t?.contains(n),a=r instanceof Node&&t?.contains(r);if(!i&&!a)return;let o=new Set([...Ne.current,...Ae.current]);ee.current=!0;for(let e of o)!e||V.current.has(e)||J.getItem(e)?.select();queueMicrotask(()=>{ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Tt=[J],t[100]=J,t[101]=wt,t[102]=Tt),(0,Q.useEffect)(wt,Tt);let Et,Dt;t[103]!==b.length||t[104]!==S?(Et=()=>{if(S||b.length===0)return;let e=ne.current?.querySelector(SP)?.shadowRoot;if(!e)return;let t=JW,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Dt=[S,b.length],t[103]=b.length,t[104]=S,t[105]=Et,t[106]=Dt):(Et=t[105],Dt=t[106]),(0,Q.useEffect)(Et,Dt);let Ot;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ot={folderCount:0,expandedCount:0},t[107]=Ot):Ot=t[107];let kt=(0,Q.useRef)(Ot),At=(0,Q.useRef)(vt),jt=(0,Q.useRef)(gt),Mt;t[108]===vt?Mt=t[109]:(Mt=()=>{At.current=vt,jt.current=gt},t[108]=vt,t[109]=Mt),(0,Q.useEffect)(Mt);let Nt,Pt;t[110]===J?(Nt=t[111],Pt=t[112]):(Nt=()=>({startCreating(e,t){At.current(e,t)},startCreatingFromTemplate(e){jt.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of Ne.current){let t=eW(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(U.current);(0,Q.startTransition)(()=>{for(let t of[...Ne.current].reverse()){if(e.has(t))continue;let n=eW(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Ne.current,t=0;for(let n of e)eW(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=kt.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return kt.current=i,i},subscribe(e){return J.subscribe(e)}}),Pt=[J],t[110]=J,t[111]=Nt,t[112]=Pt),(0,Q.useImperativeHandle)(n,Nt,Pt);let Ft;t[113]!==Je||t[114]!==s||t[115]!==a||t[116]!==J||t[117]!==Be?(Ft=async function(e){let t=e[0];if(t){D(t.path),k(null);try{let t=BW(e,F.current,Ne.current),n=[],r=[],i=[];for(let t of e){D(t.path);let e=await Le(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:t.kind,path:t.path})}),`Failed to delete path`);if(!e.ok){let t=BW(i,F.current,Ne.current),o=new Set([...t.docNames,...n]),c=new Set([...t.folderPaths,...r]);a([...[...o].map(qW),...[...c].map(KW)],{force:!0}),await Promise.all([...o].map(e=>s(e))),Xa.error(e.title),D(null),Be(),Kn([`files`,`backlinks`,`graph`]);return}let o=M(kr,e.body,`delete-path`,{deletedDocNames:[]});n.push(...o.deletedDocNames),t.kind===`folder`&&r.push(t.path),i.push(t)}let o=W.current;o&&e.some(e=>VW(e,o))&&(o.kind===`file`?t.docNames.add(o.createdPath):t.folderPaths.add(o.createdPath),Je(o));let c=new Set([...t.docNames,...n]),l=new Set([...t.folderPaths,...r]);a([...[...c].map(GW),...[...l].map(WW)],{force:!0}),await Promise.all([...c].map(e=>s(e)));for(let t of e){let e=t.kind===`folder`?PU(t.path):kU(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}x(e=>{let t=dM(e,[...c]);for(let e of l)t=dM(t,[],e);return He(t),t}),Kn([`files`,`backlinks`,`graph`]),D(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),Xa.error(`Network error — please try again`),D(null),Be()}}},t[113]=Je,t[114]=s,t[115]=a,t[116]=J,t[117]=Be,t[118]=Ft):Ft=t[118];let It=Ft,Lt;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=function(){let e=q.current;e&&vW(e),q.current=null},t[119]=Lt):Lt=t[119];let Rt=Lt,zt;t[120]===u?zt=t[121]:(zt=function(e){let t=aG(e.nativeEvent);if(!t||t.endsWith(`/`)){Rt();return}let n=AU(t),r=F.current.find(e=>jU(e)===t);if(r&&Fn(r)){Rt();return}q.current!==n&&(Rt(),q.current=n,_W(n,e=>u(e)))},t[120]=u,t[121]=zt);let Bt=zt,Vt;t[122]!==L||t[123]!==J||t[124]!==v?(Vt=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=oG(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?PU(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=NU(r);if(window.location.hash===Ln(e))return;queueMicrotask(()=>v(e));return}let i=AU(r);window.location.hash!==er(i)&&queueMicrotask(()=>L(r))},t[122]=L,t[123]=J,t[124]=v,t[125]=Vt):Vt=t[125];let Ht=Vt;if(S){let e;return t[126]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(cG,{}),t[126]=e):e=t[126],e}if(b.length===0){if(w){let e;return t[127]===w?e=t[128]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:w})}),t[127]=w,t[128]=e),e}let e;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[129]=e):e=t[129];let n;return t[130]===vt?n=t[131]:(n=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>vt(`file`,``),children:`Create your first file`})]}),t[130]=vt,t[131]=n),n}let Ut=E!==null,Wt=O?.targets[0]??null,Gt;t[132]===w?Gt=t[133]:(Gt=w&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:w}),t[132]=w,t[133]=Gt);let Kt;t[134]===p?Kt=t[135]:(Kt=jW(p),t[134]=p,t[135]=Kt);let qt;t[136]!==Ut||t[137]!==B||t[138]!==St||t[139]!==bt||t[140]!==ge||t[141]!==J||t[142]!==_e||t[143]!==vt||t[144]!==N?(qt=(e,t)=>(0,Z.jsx)(HW,{item:e,context:t,anyActionBusy:Ut,workspace:N,handoff:ge,model:J,okignoreBinding:_e,onStartCreating:vt,onStartCreatingFromTemplate:gt,onDelete:e=>k({targets:e}),onExpandSubtree:bt,onCollapseSubtree:St,isAsset:B.has(e.path),isAssetTreePath:Ge}),t[136]=Ut,t[137]=B,t[138]=St,t[139]=bt,t[140]=ge,t[141]=J,t[142]=_e,t[143]=vt,t[144]=N,t[145]=qt):qt=t[145];let Jt;t[146]!==Ht||t[147]!==Bt||t[148]!==J||t[149]!==Gt||t[150]!==Kt||t[151]!==qt?(Jt=(0,Z.jsx)(`div`,{ref:ne,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(TU,{header:Gt,model:J,style:Kt,onClickCapture:Ht,onMouseMove:Bt,onMouseLeave:Rt,renderContextMenu:qt})}),t[146]=Ht,t[147]=Bt,t[148]=J,t[149]=Gt,t[150]=Kt,t[151]=qt,t[152]=Jt):Jt=t[152];let Yt=!!O,Xt;t[153]===E?Xt=t[154]:(Xt=e=>{!e&&!E&&k(null)},t[153]=E,t[154]=Xt);let Zt;t[155]!==E||t[156]!==O||t[157]!==It||t[158]!==Wt?(Zt=O&&Wt&&(0,Z.jsx)(Sa,{itemName:O.targets.length===1?`${Wt.name}${Wt.kind===`file`?Wt.docExt??`.md`:`/`}`:void 0,isSubmitting:E!==null,onDelete:()=>It(O.targets),customTitle:O.targets.length>1?`Delete selected items`:void 0,customDescription:O.targets.length>1?`Are you sure you want to delete ${O.targets.length} selected items? Folders and all files inside them will be deleted. This action cannot be undone.`:Wt.kind===`folder`?`Are you sure you want to delete ${Wt.name}/ and all files inside? This action cannot be undone.`:void 0}),t[155]=E,t[156]=O,t[157]=It,t[158]=Wt,t[159]=Zt):Zt=t[159];let Qt;t[160]!==Yt||t[161]!==Xt||t[162]!==Zt?(Qt=(0,Z.jsx)(Ja,{open:Yt,onOpenChange:Xt,children:Zt}),t[160]=Yt,t[161]=Xt,t[162]=Zt,t[163]=Qt):Qt=t[163];let $t=A!==null,en;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(en=e=>{e||j(null)},t[164]=en):en=t[164];let tn=A?.parentDir??``,nn;t[165]!==$t||t[166]!==tn?(nn=(0,Z.jsx)(Pf,{open:$t,onOpenChange:en,kind:`file`,initialDir:tn}),t[165]=$t,t[166]=tn,t[167]=nn):nn=t[167];let rn;return t[168]!==Jt||t[169]!==Qt||t[170]!==nn?(rn=(0,Z.jsxs)(Z.Fragment,{children:[Jt,Qt,nn]}),t[168]=Jt,t[169]=Qt,t[170]=nn,t[171]=rn):rn=t[171],rn}function WW(e){return pe(e)}function GW(e){return nt(e)}function KW(e){return pe(e)}function qW(e){return nt(e)}function JW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function YW(e){return!!e}function XW(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function ZW(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function QW(e){Xa.error(e)}function $W(){}function eG(e){return Xa.error(e)}function tG(){}function nG(){}async function rG(){}function iG(e){return jU(e)}function aG(e){return oG(e)?.dataset.itemPath??null}function oG(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var sG=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function cG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:sG.map(lG)}),e[0]=t):t=e[0],t}function lG(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Gi,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Gi,{className:`h-3 ${e}`})]},t)}var uG=(e,t,n)=>wc(e,t,n,`ProjectSwitcher`);function dG(e){let t=(0,$.c)(59),{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)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return uG(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,Q.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),uG(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),uG(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),uG(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=ji,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(us,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(Si,{asChild:!0,children:(0,Z.jsxs)(zj,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=Aa,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Li,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Z.jsx)(Li,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(di,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Ri,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(di,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Z.jsx)(di,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:`Switch Project`}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Z.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Z.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function fG(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),gn(`sidebarSearchPill`)}function pG(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Y(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Be,{"aria-hidden":`true`}),o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:`Search`}),t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-medium text-[10px] text-foreground/70`,children:Vr()?`⌘K`:`Ctrl\xA0K`}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(X,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function mG(e){let t=(0,$.c)(33),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Fa,{"aria-hidden":`true`,className:`size-3`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:a}),t[1]=r,t[2]=o);let s=o;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${i}`,a;t[3]===n.body?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[3]=n.body,t[4]=a);let o;t[5]!==s||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,s]}),t[5]=s,t[6]=a,t[7]=o):o=t[7];let c;t[8]===n.action?c=t[9]:(c=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[8]=n.action,t[9]=c);let l;t[10]===n.secondaryAction?l=t[11]:(l=()=>{n.secondaryAction?.onClick()},t[10]=n.secondaryAction,t[11]=l);let u;t[12]!==n.secondaryAction.label||t[13]!==l?(u=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:l,children:n.secondaryAction.label}),t[12]=n.secondaryAction.label,t[13]=l,t[14]=u):u=t[14];let d;t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==d||t[19]!==e||t[20]!==r||t[21]!==o?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,d]}),t[18]=d,t[19]=e,t[20]=r,t[21]=o,t[22]=f):f=t[22],f}let c=`update-notice-${n.id}`,l=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,u;t[23]===n.body?u=t[24]:(u=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[23]=n.body,t[24]=u);let d;t[25]===n.action?d=t[26]:(d=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[25]=n.action,t[26]=d);let f;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":c,className:l,children:[u,d,s]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f):f=t[32],f}function hG(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function gG(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Id,Fd,Fd),n;e[0]===t?n=e[1]:(n=hG(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Pd(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(mG,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}var _G={folderCount:0,expandedCount:0};function vG(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(st,{name:`file-sidebar`,children:(0,Z.jsx)(bG,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var yG=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(co,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(uo,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function bG(e){let t=(0,$.c)(55),{onOpenSearch:n}=e,[r,i]=(0,Q.useState)(null),{activeDocName:a,activeTarget:o}=We(),s;t[0]!==a||t[1]!==o?(s=o?.kind===`folder`||o?.kind===`folder-index`?o.folderPath:Jn(a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=typeof window<`u`&&window.okDesktop!=null,{state:u}=Tj(),d=u===`expanded`,f=l&&u===`collapsed`,[p,m]=(0,Q.useState)(_G),h,g;t[3]===r?(h=t[4],g=t[5]):(h=()=>{if(r!==null)return m(r.getFolderState()),r.subscribe(()=>{m(r.getFolderState())})},g=[r],t[3]=r,t[4]=h,t[5]=g),(0,Q.useEffect)(h,g);let _,v;t[6]===r?(_=t[7],v=t[8]):(_=()=>{if(r!==null)return fx(()=>{r.startCreating(`file`,``)})},v=[r],t[6]=r,t[7]=_,t[8]=v),(0,Q.useEffect)(_,v);let y=p.folderCount>0,x=y&&p.expandedCount===p.folderCount,S=p.expandedCount===0,C=f&&`opacity-0`,w;t[9]===C?w=t[10]:(w=Y(`flex-row h-12 items-center py-0 px-3`,l?`justify-end`:`justify-between`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,C,l&&`[-webkit-app-region:drag]`),t[9]=C,t[10]=w);let T;t[11]===d?T=t[12]:(T=d&&!l?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}):null,t[11]=d,t[12]=T);let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=Y(`flex items-center gap-1`,l&&`[&>*]:[-webkit-app-region:no-drag]`),t[13]=E):E=t[13];let D;t[14]!==x||t[15]!==y||t[16]!==S||t[17]!==r?(D=y?(0,Z.jsxs)(ji,{children:[(0,Z.jsx)(Si,{asChild:!0,children:(0,Z.jsx)(yG,{icon:Bs,label:`Tree View Options`})}),(0,Z.jsxs)(Aa,{align:`end`,children:[x?null:(0,Z.jsxs)(di,{onSelect:()=>r?.expandAll(),children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Expand All`]}),S?null:(0,Z.jsxs)(di,{onSelect:()=>r?.collapseAll(),children:[(0,Z.jsx)(Es,{"aria-hidden":`true`}),`Collapse All`]})]})]}):null,t[14]=x,t[15]=y,t[16]=S,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==c||t[20]!==r?(O=(0,Z.jsx)(yG,{icon:cc,label:`New File`,onClick:()=>r?.startCreating(`file`,c)}),t[19]=c,t[20]=r,t[21]=O):O=t[21];let k;t[22]!==c||t[23]!==r?(k=(0,Z.jsx)(yG,{icon:Cs,label:`New from template`,onClick:()=>r?.startCreatingFromTemplate(c)}),t[22]=c,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==c||t[26]!==r?(A=(0,Z.jsx)(yG,{icon:Os,label:`New Folder`,onClick:()=>r?.startCreating(`folder`,c)}),t[25]=c,t[26]=r,t[27]=A):A=t[27];let j;t[28]!==D||t[29]!==O||t[30]!==k||t[31]!==A?(j=(0,Z.jsxs)(`div`,{className:E,children:[D,O,k,A]}),t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,Z.jsxs)(Nj,{className:w,children:[T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N=f&&`opacity-0`,P;t[37]===N?P=t[38]:(P=Y(`px-2 pb-2`,l&&`[-webkit-app-region:no-drag]`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,N),t[37]=N,t[38]=P);let F;t[39]===u?F=t[40]:(F=[u],t[39]=u,t[40]=F);let I;t[41]===n?I=t[42]:(I=(0,Z.jsx)(pG,{onClick:n}),t[41]=n,t[42]=I);let L;t[43]!==F||t[44]!==I?(L=(0,Z.jsx)(b,{fallbackRender:xG,onError:fG,resetKeys:F,children:I}),t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==P||t[47]!==L?(R=(0,Z.jsx)(`div`,{className:P,children:L}),t[46]=P,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Fj,{children:(0,Z.jsx)(UW,{ref:i})}),t[49]=z):z=t[49];let B,V;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Pj,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Z.jsx)(Ij,{children:(0,Z.jsx)(Lj,{children:(0,Z.jsx)(dG,{bridge:window.okDesktop})})}):null,(0,Z.jsx)(gG,{})]}),V=(0,Z.jsx)(jj,{enableToggle:!1}),t[50]=B,t[51]=V):(B=t[50],V=t[51]);let H;return t[52]!==M||t[53]!==R?(H=(0,Z.jsxs)(kj,{variant:`inset`,children:[M,R,z,B,V]}),t[52]=M,t[53]=R,t[54]=H):H=t[54],H}function xG(){return null}function SG(){let e=(0,$.c)(17),t=qt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=We(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new St,i=new Ke({url:n,name:dn,document:e,onStateless:e=>{let{payload:t}=e;vt(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:OG,onConfigValidationRejected:DG,onConfigIgnoreNestedError:EG,onUnknown:TG})},onClose:wG,onDisconnect:CG}),a=_r(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=K(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Kn([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function CG(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function wG(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function TG(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function EG(e){ga(e)}function DG(e){ya(e)}function OG(e){Kn([e.ch])}var kG=`#install-claude-desktop`;function AG(e){return e===`#settings`||e===kG}function jG(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function MG(){let e=(0,$.c)(20),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=We(),{openTargetTransition:i}=et(),{assetPaths:a,folderPaths:o,loading:s,pages:c}=wr(),l=(0,Q.useRef)(null),u;e[0]!==a||e[1]!==o||e[2]!==c?(u=jG(c,o,a),e[0]=a,e[1]=o,e[2]=c,e[3]=u):u=e[3];let d=u,f,p;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==n||e[9]!==r||e[10]!==d?(f=()=>{s||!r||l.current===d||(l.current=d,n({pages:c,folderPaths:o,assetPaths:a}))},p=[a,o,s,c,n,r,d],e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=n,e[9]=r,e[10]=d,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p);let m,h;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(m=()=>{e();function e(){if(AG(window.location.hash))return;let e=Dr(window.location.hash);if(e){let t=ln(e.split(`.`).pop()??``);Ge(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=fr(window.location.hash);if(!n){Ge(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Ge(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=sr(n,{pages:c,folderPaths:o});if(r.kind===`missing`&&/\/+$/.test(n.trim())){Ge(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}Ge(`ok/nav/hash-change`,{docName:n,kind:r.kind}),i(r)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},h=[t,o,s,i,c],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=m,e[19]=h):(m=e[18],h=e[19]),(0,Q.useEffect)(m,h),null}function NG(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===kG),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===kG&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===kG){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(ta,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function PG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(FG,t),null}function FG(){let e=function(e){let t=e.target;Vf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=Bf))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function IG(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=We(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Jn(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Mf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Pf,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function LG(){let e=(0,$.c)(13),t=typeof window<`u`?window.okDesktop??null:null,[n,r]=(0,Q.useState)(!1),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(sm,{}),e[0]=i):i=e[0];let a,o,s,c,l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(SG,{}),o=(0,Z.jsx)(MG,{}),s=(0,Z.jsx)(IG,{}),c=(0,Z.jsx)(PG,{}),l=(0,Z.jsx)(NG,{}),u=(0,Z.jsx)(Au,{}),e[1]=a,e[2]=o,e[3]=s,e[4]=c,e[5]=l,e[6]=u):(a=e[1],o=e[2],s=e[3],c=e[4],l=e[5],u=e[6]);let d;e[7]===n?d=e[8]:(d=(0,Z.jsx)(em,{bridge:t,open:n,onOpenChange:r}),e[7]=n,e[8]=d);let f;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(vG,{onOpenSearch:()=>r(!0)}),e[9]=f):f=e[9];let p;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(Ej,{className:`h-screen overflow-hidden`,children:[f,(0,Z.jsx)(Mj,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(uN,{})})]}),e[10]=p):p=e[10];let m;return e[11]===d?m=e[12]:(m=(0,Z.jsx)(st,{name:`app`,children:(0,Z.jsx)(ot,{children:(0,Z.jsxs)(Xi,{children:[i,(0,Z.jsxs)(mr,{children:[a,o,s,c,l,u,d,p]})]})})}),e[11]=d,e[12]=m),m}Bo(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&zu({apiOrigin:window.okDesktop.config.apiOrigin}),id()&&ud(),Ld(),typeof window<`u`&&Hu({bridge:window.okDesktop}),typeof window<`u`&&eo({bridge:window.okDesktop}),typeof window<`u`&&po({bridge:window.okDesktop}),typeof window<`u`&&Gu({bridge:window.okDesktop});var RG=new Yo({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),zG=document.getElementById(`root`);if(!zG)throw Error(`Root element not found`);var BG=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,as.createRoot)(zG).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Bt,{client:RG,children:(0,Z.jsxs)(mn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(lo,{children:BG&&window.okDesktop?(0,Z.jsx)(Pu,{bridge:window.okDesktop}):(0,Z.jsx)(LG,{})}),(0,Z.jsx)(Ru,{richColors:!0,closeButton:!0})]})})}));
1853
+ `;function kW(e){return{...VP({type:e===`dark`?`dark`:`light`,colors:{"sideBar.background":`var(--sidebar)`,"sideBar.foreground":`var(--sidebar-foreground)`,"sideBar.border":`var(--sidebar-border)`,"list.activeSelectionBackground":`var(--sidebar-accent)`,"list.activeSelectionForeground":`var(--sidebar-accent-foreground)`,"list.hoverBackground":`var(--sidebar-hover)`,focusBorder:`var(--color-primary)`,"input.background":`var(--input)`,"input.border":`var(--border)`}}),"--trees-font-family-override":`var(--font-sans)`,"--trees-font-size-override":`0.875rem`,"--trees-item-padding-x-override":`0.5rem`,"--trees-padding-inline-override":`0.5rem`,"--trees-border-radius-override":`0.375rem`,"--trees-selected-fg":`var(--color-primary)`,"--truncate-marker-fade-in-duration":`0s`,"--trees-file-icon-color-markdown":`light-dark(var(--color-gray-400), var(--color-gray-500))`,"--trees-fg-muted":`light-dark(var(--color-gray-400), var(--color-gray-500))`}}function AW(e){let t=e.split(`/`).pop()?.replace(/\.md$/i,``).toLowerCase();return!!t&&SW.has(t)}function jW(e){return e===`darwin`?`Reveal in Finder`:e===`win32`?`Reveal in File Explorer`:`Open Containing Folder`}function MW(e){let t=(0,$.c)(14),{item:n,workspace:r,onClose:i}=e,a=typeof window<`u`?window.okDesktop:void 0;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=jW(a.platform),t[0]=o):o=t[0];let s=o,c=r?null:`No workspace`,l=!r,u;t[1]!==n||t[2]!==i||t[3]!==r?(u=()=>{if(!r)return;i();let e=Vp(r.contentDir,BU(n),r.pathSeparator);a.shell.showItemInFolder(e)},t[1]=n,t[2]=i,t[3]=r,t[4]=u):u=t[4];let d=c?`${s}, ${c}`:s,f,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(G,{"aria-hidden":`true`}),p=(0,Z.jsx)(`span`,{className:`flex-1`,children:s}),t[5]=f,t[6]=p):(f=t[5],p=t[6]);let m;t[7]===c?m=t[8]:(m=c?(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:c}):null,t[7]=c,t[8]=m);let h;return t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==m?(h=(0,Z.jsxs)(vi,{disabled:l,onSelect:u,"aria-label":d,children:[f,p,m]}),t[9]=l,t[10]=u,t[11]=d,t[12]=m,t[13]=h):h=t[13],h}function NW(e){return zU({kind:e.endsWith(`/`)?`directory`:`file`,name:e,path:e})}function PW(e,t){return e!==t&&e.startsWith(t)}function FW(e,t){let n=[...new Set(e)].filter(e=>!t(e)),r=n.filter(e=>e.endsWith(`/`));return n.filter(e=>!r.some(t=>PW(e,t))).map(NW)}function IW(e,t){return e===t||e.startsWith(`${t}/`)}function LW(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable||e.closest(`[contenteditable="true"]`)!==null}function RW(e,t,n){let r=new Set,i=new Set;for(let a of e){if(a.kind===`file`){r.add(a.path);continue}i.add(a.path);for(let e of t)Ar(e)&&e.docName.startsWith(`${a.path}/`)&&r.add(e.docName);for(let e of n){let t=jU(e);IW(t,a.path)&&i.add(t)}}return{docNames:r,folderPaths:i}}function zW(e,t){return e.kind===`file`?t.kind===`file`&&e.path===t.createdPath:IW(t.createdPath,e.path)}function BW(e){let t=(0,$.c)(85),{item:n,context:r,anyActionBusy:i,workspace:a,handoff:o,model:s,okignoreBinding:c,onStartCreating:l,onStartCreatingFromTemplate:u,onDelete:d,onExpandSubtree:f,onCollapseSubtree:p,isAsset:m,isAssetTreePath:g}=e,_,v,y,b,x;if(t[0]!==m||t[1]!==g||t[2]!==n||t[3]!==s||t[4]!==c){x=zU(n),y=n.kind===`directory`,_=!m&&c!==null,v=y?`Hide files in this folder`:`Hide this file`;let e=s.getSelectedPaths();b=e.includes(x.treePath)?FW(e,g):[],t[0]=m,t[1]=g,t[2]=n,t[3]=s,t[4]=c,t[5]=_,t[6]=v,t[7]=y,t[8]=b,t[9]=x}else _=t[5],v=t[6],y=t[7],b=t[8],x=t[9];let S=b,C;t[10]!==S||t[11]!==x?(C=S.length>1?S:[x],t[10]=S,t[11]=x,t[12]=C):C=t[12];let w=C,T=w.length>1?`Delete ${w.length} Items`:`Delete`,E;t[13]!==y||t[14]!==n.path||t[15]!==a?(E=y?null:Up({docName:OU(n.path),workspace:a}),t[13]=y,t[14]=n.path,t[15]=a,t[16]=E):E=t[16];let D=E,O;t[17]===r?O=t[18]:(O=()=>r.close({restoreFocus:!1}),t[17]=r,t[18]=O);let k=O,A;t[19]===r?A=t[20]:(A=()=>r.close(),t[19]=r,t[20]=A);let j=A,M;t[21]===j?M=t[22]:(M=e=>{e||j()},t[21]=j,t[22]=M);let N;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(Ii,{asChild:!0,children:(0,Z.jsx)(`span`,{"aria-hidden":`true`,"data-file-tree-context-menu-root":`true`,className:`block size-px`})}),t[23]=N):N=t[23];let P;t[24]!==i||t[25]!==j||t[26]!==k||t[27]!==y||t[28]!==n.path||t[29]!==p||t[30]!==f||t[31]!==l||t[32]!==u?(P=y?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(vi,{disabled:i,onSelect:()=>{k(),l(`file`,jU(n.path))},children:[(0,Z.jsx)(cc,{"aria-hidden":`true`}),`New File`]}),(0,Z.jsxs)(vi,{disabled:i,onSelect:()=>{k(),u(jU(n.path))},children:[(0,Z.jsx)(Cs,{"aria-hidden":`true`}),`New from template`]}),(0,Z.jsxs)(vi,{disabled:i,onSelect:()=>{k(),l(`folder`,jU(n.path))},children:[(0,Z.jsx)(Os,{"aria-hidden":`true`}),`New Folder`]}),(0,Z.jsx)(Aa,{}),(0,Z.jsxs)(vi,{onSelect:()=>{j(),f(n.path)},children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Expand All`]}),(0,Z.jsxs)(vi,{onSelect:()=>{j(),p(n.path)},children:[(0,Z.jsx)(Es,{"aria-hidden":`true`}),`Collapse All`]}),(0,Z.jsx)(Aa,{})]}):null,t[24]=i,t[25]=j,t[26]=k,t[27]=y,t[28]=n.path,t[29]=p,t[30]=f,t[31]=l,t[32]=u,t[33]=P):P=t[33];let F;t[34]!==i||t[35]!==k||t[36]!==m||t[37]!==n.path||t[38]!==s?(F=m?null:(0,Z.jsxs)(vi,{disabled:i,onSelect:()=>{k(),s.startRenaming(n.path)},children:[(0,Z.jsx)(be,{"aria-hidden":`true`}),`Rename`]}),t[34]=i,t[35]=k,t[36]=m,t[37]=n.path,t[38]=s,t[39]=F):F=t[39];let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsxs)(bi,{children:[(0,Z.jsx)(h,{"aria-hidden":`true`}),`Copy Path`]}),t[40]=I):I=t[40];let L=!a,R;t[41]!==j||t[42]!==n||t[43]!==a?(R=()=>{a&&(j(),xW(Vp(a.contentDir,BU(n),a.pathSeparator),`full path`))},t[41]=j,t[42]=n,t[43]=a,t[44]=R):R=t[44];let z;t[45]!==L||t[46]!==R?(z=(0,Z.jsx)(vi,{disabled:L,onSelect:R,children:`Full Path`}),t[45]=L,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==j||t[49]!==n?(B=(0,Z.jsx)(vi,{onSelect:()=>{j(),xW(BU(n),`relative path`)},children:`Relative Path`}),t[48]=j,t[49]=n,t[50]=B):B=t[50];let V;t[51]!==z||t[52]!==B?(V=(0,Z.jsxs)(di,{children:[I,(0,Z.jsxs)(Li,{children:[z,B]})]}),t[51]=z,t[52]=B,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(Aa,{}),t[54]=H):H=t[54];let U;t[55]!==j||t[56]!==n||t[57]!==a?(U=(0,Z.jsx)(MW,{item:n,workspace:a,onClose:j}),t[55]=j,t[56]=n,t[57]=a,t[58]=U):U=t[58];let W;t[59]!==o||t[60]!==D||t[61]!==m||t[62]!==y?(W=!y&&!m&&(0,Z.jsx)(rW,{input:D,installStates:o.installStates,isElectronHost:o.isElectronHost,dispatch:o.dispatch}),t[59]=o,t[60]=D,t[61]=m,t[62]=y,t[63]=W):W=t[63];let G;t[64]!==i||t[65]!==_||t[66]!==j||t[67]!==T||t[68]!==w||t[69]!==v||t[70]!==m||t[71]!==c||t[72]!==d||t[73]!==x?(G=m?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Aa,{}),(0,Z.jsxs)(vi,{"data-testid":`file-tree-menu-hide`,disabled:!_,onSelect:()=>{if(!c)return;j();let e=JU(x),t=sa(c.current()),n=Wi(t,e);n!==t&&c.patch(Zi(n))},children:[(0,Z.jsx)(ee,{"aria-hidden":`true`}),v]}),(0,Z.jsx)(Aa,{}),(0,Z.jsxs)(vi,{variant:`destructive`,disabled:i,onSelect:()=>{j(),d(w)},children:[(0,Z.jsx)(fe,{"aria-hidden":`true`}),T]})]}),t[64]=i,t[65]=_,t[66]=j,t[67]=T,t[68]=w,t[69]=v,t[70]=m,t[71]=c,t[72]=d,t[73]=x,t[74]=G):G=t[74];let K;t[75]!==V||t[76]!==U||t[77]!==W||t[78]!==G||t[79]!==P||t[80]!==F?(K=(0,Z.jsxs)(ki,{sideOffset:0,align:`start`,"data-file-tree-context-menu-root":`true`,className:`min-w-52`,children:[P,F,V,H,U,W,G]}),t[75]=V,t[76]=U,t[77]=W,t[78]=G,t[79]=P,t[80]=F,t[81]=K):K=t[81];let q;return t[82]!==K||t[83]!==M?(q=(0,Z.jsxs)(Ei,{open:!0,modal:!1,onOpenChange:M,children:[N,K]}),t[82]=K,t[83]=M,t[84]=q):q=t[84],q}function VW(e){let t=(0,$.c)(172),{ref:n}=e,{activeDocName:r,activeTarget:i,closeTabs:a,closeDocument:o,closeAndClearForRename:s,isNewTabActive:c,openTarget:l,prewarm:u,remapTabsForRename:d}=We(),{notifySidebarFileSelected:f}=Cj(),{resolvedTheme:p}=yr(),{addPage:m}=wr(),h;t[0]!==f||t[1]!==l?(h=function(e){l({kind:`doc`,target:e,docName:e},{tabBehavior:`replace-active`}),vW(er(e)),f()},t[0]=f,t[1]=l,t[2]=h):h=t[2];let g=h,_;t[3]!==f||t[4]!==l?(_=function(e){let t=Ln(e);l({kind:`folder`,target:e,folderPath:e},{tabBehavior:`replace-active`}),vW(t),f()},t[3]=f,t[4]=l,t[5]=_):_=t[5];let v=_,y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=[],t[6]=y):y=t[6];let[b,x]=(0,Q.useState)(y),[S,C]=(0,Q.useState)(!0),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(null),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[N,P]=(0,Q.useState)(null),F=(0,Q.useRef)(b),I;t[7]!==b||t[8]!==v||t[9]!==g||t[10]!==f||t[11]!==l?(I=function(e,t){let n=ZU(e,t===void 0?b:t);if(n.kind===`none`){console.debug(`[FileTree] Dropped selection for unknown docName:`,NU(e));return}if(n.kind===`asset`){l({kind:`asset`,target:n.path,assetPath:n.path,mediaKind:n.mediaKind},{tabBehavior:`replace-active`}),vW(n.hash),f();return}if(n.kind===`folder`){v(n.path);return}g(n.path)},t[7]=b,t[8]=v,t[9]=g,t[10]=f,t[11]=l,t[12]=I):I=t[12];let L=I,R=(0,Q.useRef)(r),z;t[13]===b?z=t[14]:(z=new Set(b.filter(Fn).map(nG)),t[13]=b,t[14]=z);let B=z,V=(0,Q.useRef)(B),H;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(H=[],t[15]=H):H=t[15];let U=(0,Q.useRef)(H),W=(0,Q.useRef)(null),G=(0,Q.useRef)(tG),K=(0,Q.useRef)(null),q=(0,Q.useRef)(null),ee=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),ne=(0,Q.useRef)(null),re=(0,Q.useRef)(eG),ie=(0,Q.useRef)($W),ae=(0,Q.useRef)(QW),oe=(0,Q.useRef)(ZW),se=(0,Q.useRef)(i),{selectedFilePath:ce,selectedFolderPath:le,navigationPath:ue}=XU(i,c?null:r),de=ce?DU(ce,b.find(e=>Ar(e)&&e.docName===ce)?.docExt):le?MU(le):i?.kind===`asset`?i.assetPath:null,fe=dm().states,{dispatch:me}=em(),he;t[16]!==me||t[17]!==fe?(he={installStates:fe,isElectronHost:typeof window<`u`&&window.okDesktop!=null,dispatch:me},t[16]=me,t[17]=fe,t[18]=he):he=t[18];let ge=he,{okignoreBinding:_e}=Bi(),ve;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(ve=()=>te.current===null,t[19]=ve):ve=t[19];let ye=ve,be;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(be=[],t[20]=be):be=t[20];let xe;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(xe={set:`complete`,spriteSheet:DW},t[21]=xe):xe=t[21];let Se;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(Se={contextMenu:{enabled:!0,triggerMode:`both`,buttonVisibility:`when-needed`}},t[22]=Se):Se=t[22];let Ce;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Ce={canDrag:ye,canDrop:ye,onDropComplete:e=>oe.current(e),onDropError:XW},t[23]=Ce):Ce=t[23];let we;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(we={paths:be,flattenEmptyDirectories:!1,initialExpansion:`closed`,fileTreeSearchMode:`hide-non-matches`,initialVisibleRowCount:18,stickyFolders:!0,icons:xe,unsafeCSS:OW,composition:Se,dragAndDrop:Ce,renaming:{canRename:ye,onRename:e=>ie.current(e),onError:e=>ae.current(e)},onSelectionChange:e=>re.current(e),renderRowDecoration:e=>{let{item:t}=e;if(t.kind!==`file`)return null;let n=F.current.find(e=>Ar(e)&&DU(e.docName,e.docExt)===t.path);return n?.isSymlink?{icon:CW,title:n.targetPath?`Symlink to ${n.targetPath}`:`Symlink`}:AW(t.path)?{icon:wW,title:`Agent configuration file`}:null}},t[24]=we):we=t[24];let{model:J}=wU(we),Te;t[25]===J?Te=t[26]:(Te=function(e){let t=J.getItem(e)??J.getItem(MU(e));return t?.isDirectory()?MU(jU(t.getPath())):e},t[25]=J,t[26]=Te);let Ee=Te,De,Oe;t[27]===b?(De=t[28],Oe=t[29]):(Oe=PU(b),De=FU(Oe),t[27]=b,t[28]=De,t[29]=Oe);let ke=De,Ae=(0,Q.useRef)(Oe),je;t[30]===b?je=t[31]:(je=LU(b),t[30]=b,t[31]=je);let Me=je,Ne=(0,Q.useRef)(Me),Pe=le?RU(MU(le)).slice(0,-1):RU(de??ue),Fe=Pe.join(`\0`),Ie;if(t[32]!==J){let e=()=>{let e=new Set;for(let t of Ne.current)QU(J.getItem(t))?.isExpanded()&&e.add(t);return e};Ie=t=>{let n=new Set(LU(t??F.current)),r=e();for(let e of U.current)r.add(e);return[...r].filter(e=>n.has(e))},t[32]=J,t[33]=Ie}else Ie=t[33];let Re=Ie,ze;t[34]!==Re||t[35]!==J?(ze=e=>{let t=PU(e??F.current);J.resetPaths(t,{initialExpandedPaths:Re(e)})},t[34]=Re,t[35]=J,t[36]=ze):ze=t[36];let Be=ze,Ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=e=>{K.current=IU(e)},t[37]=Ve):Ve=t[37];let He=Ve,Ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=e=>V.current.has(e),t[38]=Ue):Ue=t[38];let Ge=Ue,Ke=function(e){let t=yW(e);if(!t||bW(t))return!1;let n=J.getFocusedPath()??J.getSelectedPaths()[0]??null;if(!n||n.endsWith(`/`)||Ge(n))return!1;let r=bW(n);if(!r)return!1;let i=MU(t);if(!Ne.current.includes(i))return!1;let a=`${t}${r}`;return Ae.current.includes(a)?!1:(ft({sourcePath:n,destinationPath:a,isFolder:!1}),J.move(n,a),!0)},qe;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(qe=e=>{let t=e??W.current;!t||W.current!==t||(t.disposeCommitListener(),W.current=null)},t[39]=qe):qe=t[39];let Je=qe,Ye;t[40]!==Je||t[41]!==o||t[42]!==a||t[43]!==Be?(Ye=async function(e,t){let n=t===void 0?{}:t,r=n.updateUi??!0,i=n.restoreLocation??r;Je(e),r&&D(e.renamePath);try{let t=await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e.kind,path:e.createdPath})});if(!t.ok&&t.status!==404){let n=await Le(t,`Failed to clean up pending ${e.kind}`);if(n.ok)return;let i=`${n.title} - ${e.kind} "${e.createdPath}" still exists on disk`;r?Xa.error(i):console.warn(`[FileTree] cleanup pending create failed: ${i}`),r&&(D(null),Be());return}}catch(t){console.warn(`[FileTree] cleanup pending create failed:`,t),r&&Xa.error(`Network error - ${e.kind} "${e.createdPath}" still exists on disk`),r&&(D(null),Be());return}r&&(e.kind===`file`?o(e.createdPath):a([pe(e.createdPath)],{force:!0})),r&&x(t=>{let n=lM(t,e.kind===`file`?[e.createdPath]:[],e.kind===`folder`?e.createdPath:void 0);return He(n),n}),Kn([`files`,`backlinks`,`graph`]),i&&(window.location.hash=e.previousHash),r&&D(null)},t[40]=Je,t[41]=o,t[42]=a,t[43]=Be,t[44]=Ye):Ye=t[44];let Xe=Ye,Ze,Qe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>()=>{let e=W.current;e&&G.current(e,{restoreLocation:!1,updateUi:!1}).catch(YW)},Qe=[],t[45]=Ze,t[46]=Qe):(Ze=t[45],Qe=t[46]),(0,Q.useEffect)(Ze,Qe);let $e,et;t[47]===Symbol.for(`react.memo_cache_sentinel`)?($e=()=>{let e=!0,t=tW(async function(){try{let t=await Le(await fetch(`/api/documents`),`Failed to load documents`);if(!e)return;if(!t.ok)T(t.title);else{let e=Gn.safeParse(t.body);e.success?(x(e.data.documents),T(null)):T(`Documents response did not match expected shape.`)}}catch(t){let n=t;e&&T(`Could not reach server`),console.warn(`[FileTree] fetch failed:`,n)}e&&C(!1)});t.request();let n=()=>{document.visibilityState===`visible`&&t.request()};window.addEventListener(`focus`,n),window.addEventListener(`visibilitychange`,n);let r=_r(e=>{e.includes(`files`)&&t.request()});return()=>{e=!1,t.dispose(),window.removeEventListener(`focus`,n),window.removeEventListener(`visibilitychange`,n),r()}},et=[],t[47]=$e,t[48]=et):($e=t[47],et=t[48]),(0,Q.useEffect)($e,et);let tt,nt;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>{let e=!0;return fetch(`/api/workspace`).then(async t=>{let n=await t.json();if(!e||!t.ok)return;let r=M(On,n,`workspace`,null);r&&P({contentDir:r.contentDir,pathSeparator:r.pathSeparator})}).catch(JW),()=>{e=!1}},nt=[],t[49]=tt,t[50]=nt):(tt=t[49],nt=t[50]),(0,Q.useEffect)(tt,nt);let rt;t[51]!==Re||t[52]!==J||t[53]!==ke?(rt=()=>{if(K.current===ke){K.current=null;return}J.resetPaths(Ae.current,{initialExpandedPaths:Re()})},t[51]=Re,t[52]=J,t[53]=ke,t[54]=rt):rt=t[54];let it;t[55]!==J||t[56]!==ke?(it=[J,ke],t[55]=J,t[56]=ke,t[57]=it):it=t[57],(0,Q.useEffect)(rt,it),eW(J,de,Fe,ee);let ot,st;t[58]===J?(ot=t[59],st=t[60]):(ot=()=>J.subscribe(()=>{if(!J.isSearchOpen())for(let e of U.current){let t=QU(J.getItem(e));t&&!t.isExpanded()&&t.expand()}}),st=[J],t[58]=J,t[59]=ot,t[60]=st),(0,Q.useEffect)(ot,st);let ct,lt;t[61]===J?(ct=t[62],lt=t[63]):(ct=()=>J.onMutation(`remove`,e=>{let t=W.current;!t||e.path!==t.renamePath||G.current(t)}),lt=[J],t[61]=J,t[62]=ct,t[63]=lt),(0,Q.useEffect)(ct,lt);let ut;t[64]!==m||t[65]!==s||t[66]!==v||t[67]!==d?(ut=async(e,t,n)=>{let r=t===void 0?[]:t,i=n?.docName??R.current,a=uM(i,e),o=n?.folderPath??(se.current?.kind===`folder`?se.current.folderPath:null),c=o?at(o,r):null;await Promise.all(e.flatMap(e=>[s(e.fromDocName),s(e.toDocName)]));for(let t of e)m(t.toDocName);d(e,r),x(t=>{let n=cM(t,e,r);return He(n),n}),o&&c&&c!==o?v(c):a&&a!==i&&(window.location.hash=er(a)),Kn([`files`,`backlinks`,`graph`])},t[64]=m,t[65]=s,t[66]=v,t[67]=d,t[68]=ut):ut=t[68];let dt=ut;async function ft(e){let t=VU(e.sourcePath,e.isFolder),n=VU(e.destinationPath,e.isFolder);D(t),T(null);try{if(!e.isFolder&&Ge(t)){Xa.error(`Assets cannot be renamed from the sidebar`),Be(),Je(),D(null);return}let r=e.isFolder?{kind:`folder`,fromPath:jU(t),toPath:jU(n)}:{kind:`file`,fromPath:OU(t),toPath:OU(n)},i={docName:R.current,folderPath:se.current?.kind===`folder`?se.current.folderPath:null},a=await Le(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)}),`Failed to rename path`);if(!a.ok){Xa.error(a.title),T(a.title),Be();let e=W.current;e&&e.renamePath===t?await Xe(e):Je(),D(null);return}await dt(M(vn,a.body,`rename-path`,{renamed:[]}).renamed,e.isFolder?[{fromPath:jU(t),toPath:jU(n)}]:[],i),Je(),D(null)}catch(e){console.warn(`[FileTree] rename failed:`,e),Xa.error(`Network error — please try again`),T(`Network error — please try again`),Be();let n=W.current;n&&n.renamePath===t?await Xe(n):Je(),D(null)}}let pt;t[69]!==dt||t[70]!==Be?(pt=async function(e){let t=e.draggedPaths.map(t=>{let n=WU(t,e.target);return t===n?null:{sourcePath:t,destinationTreePath:n}}).filter(qW);if(t.length!==0){if(t.some(e=>Ge(e.sourcePath))){Xa.error(`Assets cannot be moved from the sidebar`),Be();return}D(t[0]?.sourcePath??null),T(null);try{let e=[],n=[],r={docName:R.current,folderPath:se.current?.kind===`folder`?se.current.folderPath:null};for(let r of t){let t=r.sourcePath.endsWith(`/`),i=t?{kind:`folder`,fromPath:jU(r.sourcePath),toPath:jU(r.destinationTreePath)}:{kind:`file`,fromPath:OU(r.sourcePath),toPath:OU(r.destinationTreePath)},a=await Le(await fetch(`/api/rename-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i)}),`Failed to move`);if(!a.ok){Xa.error(a.title),T(a.title),Be(),D(null);return}let o=M(vn,a.body,`rename-path:drop`,{renamed:[]});e=e.concat(o.renamed),t&&n.push({fromPath:jU(r.sourcePath),toPath:jU(r.destinationTreePath)})}await dt(e,n,r),D(null)}catch(e){console.warn(`[FileTree] move failed:`,e),Xa.error(`Network error — please try again`),Be(),D(null)}}},t[69]=dt,t[70]=Be,t[71]=pt):pt=t[71];let mt=pt,ht;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ht=function(e){j({parentDir:e})},t[72]=ht):ht=t[72];let gt=ht,_t;t[73]!==Xe||t[74]!==Je||t[75]!==J||t[76]!==v||t[77]!==g||t[78]!==Be||t[79]!==Oe?(_t=async function(e,t){if(te.current)return;let n=W.current;n&&Je(n);try{let n=HU(e,t,[...Oe,...Ne.current]);D(n.renamePath),te.current=n.renamePath;let r=window.location.hash,i;if(e===`file`){let e=UU(`file`,n.addPath),t=await Le(await fetch(`/api/create-page`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create file`);if(!t.ok){Xa.error(t.title),T(t.title),D(null),te.current=null;return}let r=OU(e),a=M(Er,t.body,`create-page`,{docName:r}).docName;i=a;let o=e.toLowerCase().endsWith(`.mdx`)?`.mdx`:`.md`;x(e=>{if(e.some(e=>Ar(e)&&e.docName===a))return e;let t=[...e,{kind:`document`,docName:a,docExt:o,modified:new Date().toISOString(),size:0}];return He(t),t}),Kn([`files`,`backlinks`,`graph`]),g(a)}else{let e=jU(n.addPath),t=await Le(await fetch(`/api/create-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})}),`Failed to create folder`);if(!t.ok){Xa.error(t.title),T(t.title),D(null),te.current=null;return}i=M(gr,t.body,`create-folder`,{path:e}).path,x(e=>{if(e.some(e=>Pr(e)&&e.path===i))return e;let t=[...e,{kind:`folder`,path:i,modified:new Date().toISOString(),size:0}];return He(t),t}),Kn([`files`]),v(i)}let a=!1,o=e=>{if(e.key!==`Enter`)return;let t=W.current;!t||t.renamePath!==n.renamePath||queueMicrotask(()=>Je(t))};document.addEventListener(`keydown`,o,!0),W.current={kind:e,renamePath:n.renamePath,createdPath:i,previousHash:r,disposeCommitListener:()=>{a||(a=!0,document.removeEventListener(`keydown`,o,!0))}},D(null),te.current=null,J.add(n.addPath),J.startRenaming(n.renamePath,{removeIfCanceled:!0})}catch(e){console.warn(`[FileTree] create placeholder failed:`,e),Xa.error(`Could not start creating a new item`);let t=W.current;t?await Xe(t):Je(),D(null),te.current=null,Be()}},t[73]=Xe,t[74]=Je,t[75]=J,t[76]=v,t[77]=g,t[78]=Be,t[79]=Oe,t[80]=_t):_t=t[80];let vt=_t,yt;t[81]===J?yt=t[82]:(yt=function(e){let t=MU(e);(0,Q.startTransition)(()=>{for(let e of Ne.current)if(e===t||e.startsWith(t)){let t=QU(J.getItem(e));t&&t.expand()}})},t[81]=J,t[82]=yt);let bt=yt,xt;t[83]===J?xt=t[84]:(xt=function(e){let t=MU(e),n=new Set(U.current);(0,Q.startTransition)(()=>{for(let e of[...Ne.current].reverse())if((e===t||e.startsWith(t))&&!n.has(e)){let t=QU(J.getItem(e));t&&t.collapse()}})},t[83]=J,t[84]=xt);let St=xt,Ct;t[85]!==L||t[86]!==Pe||t[87]!==r||t[88]!==i||t[89]!==B||t[90]!==E||t[91]!==Xe||t[92]!==b||t[93]!==Me||t[94]!==mt||t[95]!==ft||t[96]!==Ee||t[97]!==Ke||t[98]!==Oe?(Ct=()=>{F.current=b,R.current=r,se.current=i,V.current=B,te.current=E,Ae.current=Oe,Ne.current=Me,U.current=Pe,G.current=Xe,re.current=e=>{if(ee.current||e.length!==1)return;let t=e[0];t&&L(Ee(t),b)},ae.current=e=>{Ke(e)||Xa.error(e)},ie.current=ft,oe.current=mt},t[85]=L,t[86]=Pe,t[87]=r,t[88]=i,t[89]=B,t[90]=E,t[91]=Xe,t[92]=b,t[93]=Me,t[94]=mt,t[95]=ft,t[96]=Ee,t[97]=Ke,t[98]=Oe,t[99]=Ct):Ct=t[99],(0,Q.useLayoutEffect)(Ct);let wt,Tt;t[100]===J?(wt=t[101],Tt=t[102]):(wt=()=>{let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey||e.key.toLowerCase()!==`a`||LW(e.target))return;let t=ne.current,n=e.target,r=document.activeElement,i=n instanceof Node&&t?.contains(n),a=r instanceof Node&&t?.contains(r);if(!i&&!a)return;let o=new Set([...Ne.current,...Ae.current]);ee.current=!0;for(let e of o)!e||V.current.has(e)||J.getItem(e)?.select();queueMicrotask(()=>{ee.current=!1}),e.preventDefault(),e.stopPropagation()};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},Tt=[J],t[100]=J,t[101]=wt,t[102]=Tt),(0,Q.useEffect)(wt,Tt);let Et,Dt;t[103]!==b.length||t[104]!==S?(Et=()=>{if(S||b.length===0)return;let e=ne.current?.querySelector(bP)?.shadowRoot;if(!e)return;let t=KW,n=()=>{for(let n of e.querySelectorAll(`[data-item-path]`)){let e=n.dataset.itemPath;if(!e)continue;let r=t(e);n.title!==r&&(n.title=r)}let n=e.querySelector(`[data-type="context-menu-anchor"]`);if(n){let r=e.querySelector(`[data-item-context-hover="true"][data-item-path]`)?.dataset.itemPath,i=r?t(r):``;n.title!==i&&(n.title=i)}};n();let r=new MutationObserver(n);return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`data-item-path`,`data-item-context-hover`]}),()=>r.disconnect()},Dt=[S,b.length],t[103]=b.length,t[104]=S,t[105]=Et,t[106]=Dt):(Et=t[105],Dt=t[106]),(0,Q.useEffect)(Et,Dt);let Ot;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(Ot={folderCount:0,expandedCount:0},t[107]=Ot):Ot=t[107];let kt=(0,Q.useRef)(Ot),At=(0,Q.useRef)(vt),jt=(0,Q.useRef)(gt),Mt;t[108]===vt?Mt=t[109]:(Mt=()=>{At.current=vt,jt.current=gt},t[108]=vt,t[109]=Mt),(0,Q.useEffect)(Mt);let Nt,Pt;t[110]===J?(Nt=t[111],Pt=t[112]):(Nt=()=>({startCreating(e,t){At.current(e,t)},startCreatingFromTemplate(e){jt.current(e)},expandAll(){(0,Q.startTransition)(()=>{for(let e of Ne.current){let t=QU(J.getItem(e));t&&t.expand()}})},collapseAll(){let e=new Set(U.current);(0,Q.startTransition)(()=>{for(let t of[...Ne.current].reverse()){if(e.has(t))continue;let n=QU(J.getItem(t));n&&n.collapse()}})},getFolderState(){let e=Ne.current,t=0;for(let n of e)QU(J.getItem(n))?.isExpanded()&&t++;let n=e.length,r=kt.current;if(r.folderCount===n&&r.expandedCount===t)return r;let i={folderCount:n,expandedCount:t};return kt.current=i,i},subscribe(e){return J.subscribe(e)}}),Pt=[J],t[110]=J,t[111]=Nt,t[112]=Pt),(0,Q.useImperativeHandle)(n,Nt,Pt);let Ft;t[113]!==Je||t[114]!==s||t[115]!==a||t[116]!==J||t[117]!==Be?(Ft=async function(e){let t=e[0];if(t){D(t.path),k(null);try{let t=RW(e,F.current,Ne.current),n=[],r=[],i=[];for(let t of e){D(t.path);let e=await Le(await fetch(`/api/delete-path`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:t.kind,path:t.path})}),`Failed to delete path`);if(!e.ok){let t=RW(i,F.current,Ne.current),o=new Set([...t.docNames,...n]),c=new Set([...t.folderPaths,...r]);a([...[...o].map(GW),...[...c].map(WW)],{force:!0}),await Promise.all([...o].map(e=>s(e))),Xa.error(e.title),D(null),Be(),Kn([`files`,`backlinks`,`graph`]);return}let o=M(kr,e.body,`delete-path`,{deletedDocNames:[]});n.push(...o.deletedDocNames),t.kind===`folder`&&r.push(t.path),i.push(t)}let o=W.current;o&&e.some(e=>zW(e,o))&&(o.kind===`file`?t.docNames.add(o.createdPath):t.folderPaths.add(o.createdPath),Je(o));let c=new Set([...t.docNames,...n]),l=new Set([...t.folderPaths,...r]);a([...[...c].map(UW),...[...l].map(HW)],{force:!0}),await Promise.all([...c].map(e=>s(e)));for(let t of e){let e=t.kind===`folder`?MU(t.path):DU(t.path,t.docExt);J.getItem(e)&&J.remove(e,t.kind===`folder`?{recursive:!0}:void 0)}x(e=>{let t=lM(e,[...c]);for(let e of l)t=lM(t,[],e);return He(t),t}),Kn([`files`,`backlinks`,`graph`]),D(null)}catch(e){console.warn(`[FileTree] delete failed:`,e),Xa.error(`Network error — please try again`),D(null),Be()}}},t[113]=Je,t[114]=s,t[115]=a,t[116]=J,t[117]=Be,t[118]=Ft):Ft=t[118];let It=Ft,Lt;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=function(){let e=q.current;e&&gW(e),q.current=null},t[119]=Lt):Lt=t[119];let Rt=Lt,zt;t[120]===u?zt=t[121]:(zt=function(e){let t=rG(e.nativeEvent);if(!t||t.endsWith(`/`)){Rt();return}let n=OU(t),r=F.current.find(e=>kU(e)===t);if(r&&Fn(r)){Rt();return}q.current!==n&&(Rt(),q.current=n,hW(n,e=>u(e)))},t[120]=u,t[121]=zt);let Bt=zt,Vt;t[122]!==L||t[123]!==J||t[124]!==v?(Vt=function(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=iG(e.nativeEvent);if(!t||t.getAttribute(`aria-selected`)!==`true`)return;let n=t.dataset.itemPath;if(!n)return;let r=t.dataset.itemType===`folder`?MU(n):n;if(J.getSelectedPaths().length!==1)return;if(t.dataset.itemType===`folder`){let e=jU(r);if(window.location.hash===Ln(e))return;queueMicrotask(()=>v(e));return}let i=OU(r);window.location.hash!==er(i)&&queueMicrotask(()=>L(r))},t[122]=L,t[123]=J,t[124]=v,t[125]=Vt):Vt=t[125];let Ht=Vt;if(S){let e;return t[126]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(oG,{}),t[126]=e):e=t[126],e}if(b.length===0){if(w){let e;return t[127]===w?e=t[128]:(e=(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-8`,children:(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/50 text-sm`,children:w})}),t[127]=w,t[128]=e),e}let e;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`span`,{className:`select-none text-sidebar-foreground/30 text-sm`,children:`No files yet.`}),t[129]=e):e=t[129];let n;return t[130]===vt?n=t[131]:(n=(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 py-8`,children:[e,(0,Z.jsx)(X,{variant:`link`,size:`sm`,className:`font-mono uppercase`,onClick:()=>vt(`file`,``),children:`Create your first file`})]}),t[130]=vt,t[131]=n),n}let Ut=E!==null,Wt=O?.targets[0]??null,Gt;t[132]===w?Gt=t[133]:(Gt=w&&(0,Z.jsx)(`span`,{role:`alert`,className:`px-3 pb-1 text-destructive text-xs`,children:w}),t[132]=w,t[133]=Gt);let Kt;t[134]===p?Kt=t[135]:(Kt=kW(p),t[134]=p,t[135]=Kt);let qt;t[136]!==Ut||t[137]!==B||t[138]!==St||t[139]!==bt||t[140]!==ge||t[141]!==J||t[142]!==_e||t[143]!==vt||t[144]!==N?(qt=(e,t)=>(0,Z.jsx)(BW,{item:e,context:t,anyActionBusy:Ut,workspace:N,handoff:ge,model:J,okignoreBinding:_e,onStartCreating:vt,onStartCreatingFromTemplate:gt,onDelete:e=>k({targets:e}),onExpandSubtree:bt,onCollapseSubtree:St,isAsset:B.has(e.path),isAssetTreePath:Ge}),t[136]=Ut,t[137]=B,t[138]=St,t[139]=bt,t[140]=ge,t[141]=J,t[142]=_e,t[143]=vt,t[144]=N,t[145]=qt):qt=t[145];let Jt;t[146]!==Ht||t[147]!==Bt||t[148]!==J||t[149]!==Gt||t[150]!==Kt||t[151]!==qt?(Jt=(0,Z.jsx)(`div`,{ref:ne,className:`flex min-h-0 flex-1 flex-col`,children:(0,Z.jsx)(CU,{header:Gt,model:J,style:Kt,onClickCapture:Ht,onMouseMove:Bt,onMouseLeave:Rt,renderContextMenu:qt})}),t[146]=Ht,t[147]=Bt,t[148]=J,t[149]=Gt,t[150]=Kt,t[151]=qt,t[152]=Jt):Jt=t[152];let Yt=!!O,Xt;t[153]===E?Xt=t[154]:(Xt=e=>{!e&&!E&&k(null)},t[153]=E,t[154]=Xt);let Zt;t[155]!==E||t[156]!==O||t[157]!==It||t[158]!==Wt?(Zt=O&&Wt&&(0,Z.jsx)(Sa,{itemName:O.targets.length===1?`${Wt.name}${Wt.kind===`file`?Wt.docExt??`.md`:`/`}`:void 0,isSubmitting:E!==null,onDelete:()=>It(O.targets),customTitle:O.targets.length>1?`Delete selected items`:void 0,customDescription:O.targets.length>1?`Are you sure you want to delete ${O.targets.length} selected items? Folders and all files inside them will be deleted. This action cannot be undone.`:Wt.kind===`folder`?`Are you sure you want to delete ${Wt.name}/ and all files inside? This action cannot be undone.`:void 0}),t[155]=E,t[156]=O,t[157]=It,t[158]=Wt,t[159]=Zt):Zt=t[159];let Qt;t[160]!==Yt||t[161]!==Xt||t[162]!==Zt?(Qt=(0,Z.jsx)(Ja,{open:Yt,onOpenChange:Xt,children:Zt}),t[160]=Yt,t[161]=Xt,t[162]=Zt,t[163]=Qt):Qt=t[163];let $t=A!==null,en;t[164]===Symbol.for(`react.memo_cache_sentinel`)?(en=e=>{e||j(null)},t[164]=en):en=t[164];let tn=A?.parentDir??``,nn;t[165]!==$t||t[166]!==tn?(nn=(0,Z.jsx)(Pf,{open:$t,onOpenChange:en,kind:`file`,initialDir:tn}),t[165]=$t,t[166]=tn,t[167]=nn):nn=t[167];let rn;return t[168]!==Jt||t[169]!==Qt||t[170]!==nn?(rn=(0,Z.jsxs)(Z.Fragment,{children:[Jt,Qt,nn]}),t[168]=Jt,t[169]=Qt,t[170]=nn,t[171]=rn):rn=t[171],rn}function HW(e){return pe(e)}function UW(e){return nt(e)}function WW(e){return pe(e)}function GW(e){return nt(e)}function KW(e){return e.endsWith(`/`)?e.slice(0,-1):e}function qW(e){return!!e}function JW(e){console.warn(`[FileTree] /api/workspace fetch failed:`,e)}function YW(e){console.warn(`[FileTree] unmount cleanup failed:`,e)}function XW(e){Xa.error(e)}function ZW(){}function QW(e){return Xa.error(e)}function $W(){}function eG(){}async function tG(){}function nG(e){return kU(e)}function rG(e){return iG(e)?.dataset.itemPath??null}function iG(e){for(let t of e.composedPath())if(t instanceof HTMLElement&&t.dataset.itemPath)return t;return null}var aG=[`w-3/4`,`w-2/3`,`w-4/5`,`w-1/2`,`w-3/5`,`w-2/3`];function oG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`div`,{className:`flex flex-1 flex-col gap-1 px-2 py-2`,role:`status`,"aria-busy":`true`,"aria-label":`Loading files`,children:aG.map(sG)}),e[0]=t):t=e[0],t}function sG(e,t){return(0,Z.jsxs)(`div`,{className:`flex h-6 items-center gap-2`,children:[(0,Z.jsx)(Gi,{className:`h-3 w-3 shrink-0 rounded-sm`}),(0,Z.jsx)(Gi,{className:`h-3 ${e}`})]},t)}var cG=(e,t,n)=>wc(e,t,n,`ProjectSwitcher`);function lG(e){let t=(0,$.c)(59),{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)(!1),c;t[1]!==n.project||t[2]!==o?(c=()=>{if(!o)return;let e=!1;return cG(async()=>{let t=await n.project.listRecent();e||a(t)},`Failed to load recent projects.`),()=>{e=!0}},t[1]=n.project,t[2]=o,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==o?(l=[o,n],t[4]=n,t[5]=o,t[6]=l):l=t[6],(0,Q.useEffect)(c,l);let u;t[7]===n.project?u=t[8]:(u=e=>{s(!1),cG(()=>n.project.open({path:e,target:`new-window`,entryPoint:`recents`}),`Failed to open project.`)},t[7]=n.project,t[8]=u);let d=u,f;t[9]!==n.dialog||t[10]!==n.project?(f=()=>{s(!1),cG(async()=>{let e=await n.dialog.openFolder();e&&await n.project.open({path:e,target:`new-window`,entryPoint:`pick-existing`})},`Failed to open folder.`)},t[9]=n.dialog,t[10]=n.project,t[11]=f):f=t[11];let p=f,m;t[12]===n.navigator?m=t[13]:(m=()=>{s(!1),cG(()=>n.navigator.open(),`Failed to open Project Navigator.`)},t[12]=n.navigator,t[13]=m);let h=m,g=n.config.projectPath,_,v,y,b,x,S,C,w,T,E,D;if(t[14]!==n.config.projectName||t[15]!==g||t[16]!==o||t[17]!==d||t[18]!==i){let e;t[30]===g?e=t[31]:(e=e=>e.path!==g,t[30]=g,t[31]=e);let r=i.filter(e);v=Ei,S=o,C=s;let a;t[32]===n.config.projectName?a=t[33]:(a=(0,Z.jsx)(`span`,{className:`truncate`,children:n.config.projectName}),t[32]=n.config.projectName,t[33]=a);let c;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(us,{"aria-hidden":`true`,className:`opacity-60`}),t[34]=c):c=t[34],t[35]===a?w=t[36]:(w=(0,Z.jsx)(Ii,{asChild:!0,children:(0,Z.jsxs)(Lj,{className:`justify-between text-sidebar-foreground/70`,"data-testid":`project-switcher-trigger`,title:`Open project menu`,children:[a,c]})}),t[35]=a,t[36]=w),_=ki,T=`start`,E=`top`,D=`min-w-[260px]`,y=`project-switcher-menu`,t[37]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(xi,{className:`font-mono font-normal tracking-wide uppercase text-muted-foreground text-xs`,children:`Recent projects`}),t[37]=b):b=t[37],x=r.length===0?(0,Z.jsx)(xi,{className:`font-normal text-muted-foreground text-xs`,children:`No other recent projects.`}):r.slice(0,10).map(e=>(0,Z.jsxs)(vi,{disabled:e.missing,onSelect:()=>d(e.path),className:`flex flex-col items-start gap-0.5`,"data-testid":`project-switcher-recent-${e.path}`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-sm`,children:e.name}),(0,Z.jsxs)(`span`,{className:`max-w-[240px] truncate text-muted-foreground text-xs`,children:[e.path,e.missing?` (missing)`:``]})]},e.path)),t[14]=n.config.projectName,t[15]=g,t[16]=o,t[17]=d,t[18]=i,t[19]=_,t[20]=v,t[21]=y,t[22]=b,t[23]=x,t[24]=S,t[25]=C,t[26]=w,t[27]=T,t[28]=E,t[29]=D}else _=t[19],v=t[20],y=t[21],b=t[22],x=t[23],S=t[24],C=t[25],w=t[26],T=t[27],E=t[28],D=t[29];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Z.jsx)(Aa,{}),t[38]=O):O=t[38];let k;t[39]===p?k=t[40]:(k=(0,Z.jsx)(vi,{onSelect:p,"data-testid":`project-switcher-open-folder`,children:`Open folder`}),t[39]=p,t[40]=k);let A;t[41]===h?A=t[42]:(A=(0,Z.jsx)(vi,{onSelect:h,"data-testid":`project-switcher-switch-project`,children:`Switch Project`}),t[41]=h,t[42]=A);let j;t[43]!==_||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==k||t[48]!==A||t[49]!==T||t[50]!==E||t[51]!==D?(j=(0,Z.jsxs)(_,{align:T,side:E,className:D,"data-testid":y,children:[b,x,O,k,A]}),t[43]=_,t[44]=y,t[45]=b,t[46]=x,t[47]=k,t[48]=A,t[49]=T,t[50]=E,t[51]=D,t[52]=j):j=t[52];let M;return t[53]!==v||t[54]!==S||t[55]!==C||t[56]!==w||t[57]!==j?(M=(0,Z.jsxs)(v,{open:S,onOpenChange:C,children:[w,j]}),t[53]=v,t[54]=S,t[55]=C,t[56]=w,t[57]=j,t[58]=M):M=t[58],M}function uG(e,t){let n=e instanceof Error?e:Error(String(e));console.warn(JSON.stringify({event:`jsx-render-failure`,component:`sidebarSearchPill`,rawComponentName:`sidebarSearchPill`,error:String(n),stack:t.componentStack})),gn(`sidebarSearchPill`)}function dG(e){let t=(0,$.c)(8),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Y(`rounded-lg h-9 w-full justify-start gap-2 px-3 font-normal text-muted-foreground`,r),t[0]=r,t[1]=i);let a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Be,{"aria-hidden":`true`}),o=(0,Z.jsx)(`span`,{className:`flex-1 text-left text-sm`,children:`Search`}),t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`kbd`,{className:`rounded border bg-muted px-1.5 py-0.5 font-medium text-[10px] text-foreground/70`,children:Vr()?`⌘K`:`Ctrl\xA0K`}),t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==i?(c=(0,Z.jsxs)(X,{variant:`outline`,onClick:n,"data-telemetry-event":`ok.sidebar.search_pill.click`,className:i,children:[a,o,s]}),t[5]=n,t[6]=i,t[7]=c):c=t[7],c}function fG(e){let t=(0,$.c)(33),{notice:n,onDismiss:r}=e,i=n.variant===`error`?`border-destructive/60`:`border-sidebar-border`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(Fa,{"aria-hidden":`true`,className:`size-3`}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=(0,Z.jsx)(X,{variant:`ghost`,size:`icon`,className:`size-5 shrink-0 text-muted-foreground hover:text-sidebar-foreground`,"aria-label":`Dismiss notice`,onClick:r,children:a}),t[1]=r,t[2]=o);let s=o;if(n.secondaryAction){let e=`update-notice-${n.id}`,r=`flex flex-col gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-2 text-xs text-muted-foreground ${i}`,a;t[3]===n.body?a=t[4]:(a=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[3]=n.body,t[4]=a);let o;t[5]!==s||t[6]!==a?(o=(0,Z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,s]}),t[5]=s,t[6]=a,t[7]=o):o=t[7];let c;t[8]===n.action?c=t[9]:(c=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[8]=n.action,t[9]=c);let l;t[10]===n.secondaryAction?l=t[11]:(l=()=>{n.secondaryAction?.onClick()},t[10]=n.secondaryAction,t[11]=l);let u;t[12]!==n.secondaryAction.label||t[13]!==l?(u=(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:l,children:n.secondaryAction.label}),t[12]=n.secondaryAction.label,t[13]=l,t[14]=u):u=t[14];let d;t[15]!==c||t[16]!==u?(d=(0,Z.jsxs)(`div`,{className:`flex gap-3 pl-1`,children:[c,u]}),t[15]=c,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==d||t[19]!==e||t[20]!==r||t[21]!==o?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":e,className:r,children:[o,d]}),t[18]=d,t[19]=e,t[20]=r,t[21]=o,t[22]=f):f=t[22],f}let c=`update-notice-${n.id}`,l=`flex items-center gap-2 rounded-md border bg-sidebar-accent/30 px-2 py-1.5 text-xs text-muted-foreground ${i}`,u;t[23]===n.body?u=t[24]:(u=(0,Z.jsx)(`span`,{className:`flex-1 leading-snug`,children:n.body}),t[23]=n.body,t[24]=u);let d;t[25]===n.action?d=t[26]:(d=n.action?(0,Z.jsx)(`button`,{type:`button`,className:`shrink-0 text-xs font-medium underline underline-offset-2 decoration-muted-foreground/40 hover:text-sidebar-foreground hover:decoration-sidebar-foreground`,onClick:()=>{n.action?.onClick()},children:n.action.label}):null,t[25]=n.action,t[26]=d);let f;return t[27]!==s||t[28]!==c||t[29]!==l||t[30]!==u||t[31]!==d?(f=(0,Z.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"data-testid":c,className:l,children:[u,d,s]}),t[27]=s,t[28]=c,t[29]=l,t[30]=u,t[31]=d,t[32]=f):f=t[32],f}function pG(e){if(e.length===0)return null;let t=e[0];if(!t)return null;for(let n=1;n<e.length;n++){let r=e[n];r&&r.priority<t.priority&&(t=r)}return t}function mG(){let e=(0,$.c)(7),t=(0,Q.useSyncExternalStore)(Id,Fd,Fd),n;e[0]===t?n=e[1]:(n=pG(t),e[0]=t,e[1]=n);let r=n;if(!r)return null;let i;e[2]===r.id?i=e[3]:(i=()=>{Pd(r.id)},e[2]=r.id,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,Z.jsx)(`div`,{"data-testid":`update-notices-list`,children:(0,Z.jsx)(fG,{notice:r,onDismiss:i})}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}var hG={folderCount:0,expandedCount:0};function gG(e){let t=(0,$.c)(2),{onOpenSearch:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(st,{name:`file-sidebar`,children:(0,Z.jsx)(vG,{onOpenSearch:n})}),t[0]=n,t[1]=r),r}var _G=e=>{let t=(0,$.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:n,label:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,Z.jsx)(n,{"aria-hidden":`true`}),t[4]=n,t[5]=a);let o;t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(so,{asChild:!0,children:(0,Z.jsx)(X,{variant:`ghost`,size:`icon-sm`,"aria-label":r,...i,children:a})}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s;t[10]===r?s=t[11]:(s=(0,Z.jsx)(co,{children:r}),t[10]=r,t[11]=s);let c;return t[12]!==o||t[13]!==s?(c=(0,Z.jsxs)(uo,{children:[o,s]}),t[12]=o,t[13]=s,t[14]=c):c=t[14],c};function vG(e){let t=(0,$.c)(55),{onOpenSearch:n}=e,[r,i]=(0,Q.useState)(null),{activeDocName:a,activeTarget:o}=We(),s;t[0]!==a||t[1]!==o?(s=o?.kind===`folder`||o?.kind===`folder-index`?o.folderPath:Jn(a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c=s,l=typeof window<`u`&&window.okDesktop!=null,{state:u}=Cj(),d=u===`expanded`,f=l&&u===`collapsed`,[p,m]=(0,Q.useState)(hG),h,g;t[3]===r?(h=t[4],g=t[5]):(h=()=>{if(r!==null)return m(r.getFolderState()),r.subscribe(()=>{m(r.getFolderState())})},g=[r],t[3]=r,t[4]=h,t[5]=g),(0,Q.useEffect)(h,g);let _,v;t[6]===r?(_=t[7],v=t[8]):(_=()=>{if(r!==null)return ux(()=>{r.startCreating(`file`,``)})},v=[r],t[6]=r,t[7]=_,t[8]=v),(0,Q.useEffect)(_,v);let y=p.folderCount>0,x=y&&p.expandedCount===p.folderCount,S=p.expandedCount===0,C=f&&`opacity-0`,w;t[9]===C?w=t[10]:(w=Y(`flex-row h-12 items-center py-0 px-3`,l?`justify-end`:`justify-between`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,C,l&&`[-webkit-app-region:drag]`),t[9]=C,t[10]=w);let T;t[11]===d?T=t[12]:(T=d&&!l?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-sm uppercase tracking-wider text-sidebar-foreground/50`,children:`Files`}):null,t[11]=d,t[12]=T);let E;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=Y(`flex items-center gap-1`,l&&`[&>*]:[-webkit-app-region:no-drag]`),t[13]=E):E=t[13];let D;t[14]!==x||t[15]!==y||t[16]!==S||t[17]!==r?(D=y?(0,Z.jsxs)(Ei,{children:[(0,Z.jsx)(Ii,{asChild:!0,children:(0,Z.jsx)(_G,{icon:Bs,label:`Tree View Options`})}),(0,Z.jsxs)(ki,{align:`end`,children:[x?null:(0,Z.jsxs)(vi,{onSelect:()=>r?.expandAll(),children:[(0,Z.jsx)(_c,{"aria-hidden":`true`}),`Expand All`]}),S?null:(0,Z.jsxs)(vi,{onSelect:()=>r?.collapseAll(),children:[(0,Z.jsx)(Es,{"aria-hidden":`true`}),`Collapse All`]})]})]}):null,t[14]=x,t[15]=y,t[16]=S,t[17]=r,t[18]=D):D=t[18];let O;t[19]!==c||t[20]!==r?(O=(0,Z.jsx)(_G,{icon:cc,label:`New File`,onClick:()=>r?.startCreating(`file`,c)}),t[19]=c,t[20]=r,t[21]=O):O=t[21];let k;t[22]!==c||t[23]!==r?(k=(0,Z.jsx)(_G,{icon:Cs,label:`New from template`,onClick:()=>r?.startCreatingFromTemplate(c)}),t[22]=c,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==c||t[26]!==r?(A=(0,Z.jsx)(_G,{icon:Os,label:`New Folder`,onClick:()=>r?.startCreating(`folder`,c)}),t[25]=c,t[26]=r,t[27]=A):A=t[27];let j;t[28]!==D||t[29]!==O||t[30]!==k||t[31]!==A?(j=(0,Z.jsxs)(`div`,{className:E,children:[D,O,k,A]}),t[28]=D,t[29]=O,t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==j||t[34]!==w||t[35]!==T?(M=(0,Z.jsxs)(jj,{className:w,children:[T,j]}),t[33]=j,t[34]=w,t[35]=T,t[36]=M):M=t[36];let N=f&&`opacity-0`,P;t[37]===N?P=t[38]:(P=Y(`px-2 pb-2`,l&&`[-webkit-app-region:no-drag]`,l&&`motion-safe:transition-opacity motion-safe:duration-100 motion-safe:ease-out`,N),t[37]=N,t[38]=P);let F;t[39]===u?F=t[40]:(F=[u],t[39]=u,t[40]=F);let I;t[41]===n?I=t[42]:(I=(0,Z.jsx)(dG,{onClick:n}),t[41]=n,t[42]=I);let L;t[43]!==F||t[44]!==I?(L=(0,Z.jsx)(b,{fallbackRender:yG,onError:uG,resetKeys:F,children:I}),t[43]=F,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==P||t[47]!==L?(R=(0,Z.jsx)(`div`,{className:P,children:L}),t[46]=P,t[47]=L,t[48]=R):R=t[48];let z;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Z.jsx)(Nj,{children:(0,Z.jsx)(VW,{ref:i})}),t[49]=z):z=t[49];let B,V;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsxs)(Mj,{className:`px-0`,children:[typeof window<`u`&&window.okDesktop?(0,Z.jsx)(Pj,{children:(0,Z.jsx)(Fj,{children:(0,Z.jsx)(lG,{bridge:window.okDesktop})})}):null,(0,Z.jsx)(mG,{})]}),V=(0,Z.jsx)(kj,{enableToggle:!1}),t[50]=B,t[51]=V):(B=t[50],V=t[51]);let H;return t[52]!==M||t[53]!==R?(H=(0,Z.jsxs)(Dj,{variant:`inset`,children:[M,R,z,B,V]}),t[52]=M,t[53]=R,t[54]=H):H=t[54],H}function yG(){return null}function bG(){let e=(0,$.c)(17),t=qt(),{collabUrl:n,setSystemProvider:r,updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}=We(),l;e[0]!==o||e[1]!==s||e[2]!==a||e[3]!==c||e[4]!==i?(l={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c},e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=i,e[5]=l):l=e[5];let u=(0,Q.useRef)(l),d;e[6]!==o||e[7]!==s||e[8]!==a||e[9]!==c||e[10]!==i?(d=()=>{u.current={updateServerInstanceId:i,onBranchSwitched:a,observeBranch:o,observeDiskAck:s,refreshServerInfo:c}},e[6]=o,e[7]=s,e[8]=a,e[9]=c,e[10]=i,e[11]=d):d=e[11],(0,Q.useEffect)(d);let f,p;return e[12]!==n||e[13]!==t||e[14]!==r?(f=()=>{if(n===null)return;let e=new St,i=new Ke({url:n,name:dn,document:e,onStateless:e=>{let{payload:t}=e;vt(t,{onServerInfo:e=>{u.current.updateServerInstanceId(e.serverInstanceId),e.currentBranch!==void 0&&u.current.observeBranch(e.currentBranch)},onBranchSwitched:e=>{u.current.onBranchSwitched(e.branch)},onDiskAck:e=>{u.current.observeDiskAck(e.docName,e.sv)},onDerivedView:EG,onConfigValidationRejected:TG,onConfigIgnoreNestedError:wG,onUnknown:CG})},onClose:SG,onDisconnect:xG}),a=_r(e=>{(e.includes(`files`)||e.includes(`backlinks`))&&(t.invalidateQueries({queryKey:[`backlinks`]}),t.invalidateQueries({queryKey:[`forward-links`]})),(e.includes(`files`)||e.includes(`graph`))&&(t.invalidateQueries({queryKey:[`orphans`]}),t.invalidateQueries({queryKey:[`hubs`]}))}),o=K(()=>{u.current.refreshServerInfo()});i.on(`synced`,()=>{Kn([`files`,`backlinks`,`graph`]),o()});let s=new Set,c=()=>{if(i.awareness)for(let[e,t]of i.awareness.getStates().entries())s.has(e)||t.user?.type===`agent`&&(s.add(e),console.warn(`[agent-presence] observed stale AwarenessUser.type === 'agent' from clientID ${e} — probably a stale bundled client`))};return i.awareness?.on(`change`,c),r(i),()=>{a(),i.awareness?.off(`change`,c),r(null),i.destroy(),e.destroy()}},p=[t,n,r],e[12]=n,e[13]=t,e[14]=r,e[15]=f,e[16]=p):(f=e[15],p=e[16]),(0,Q.useEffect)(f,p),null}function xG(){console.warn(`[CC1] __system__ disconnected - derived views may be stale`)}function SG(e){let{event:t}=e;console.warn(`[CC1] __system__ connection closed:`,t.code,t.reason)}function CG(e){console.warn(`[CC1] Unparseable stateless payload, skipping:`,e.slice(0,100))}function wG(e){ga(e)}function TG(e){ya(e)}function EG(e){Kn([e.ch])}var DG=`#install-claude-desktop`;function OG(e){return e===`#settings`||e===DG}function kG(e,t,n){return[e,t,n].map(e=>[...e].sort().join(`\0`)).join(``)}function AG(){let e=(0,$.c)(20),{clearTarget:t,syncOpenTabsWithKnownTargets:n,tabSessionLoaded:r}=We(),{openTargetTransition:i}=et(),{assetPaths:a,folderPaths:o,loading:s,pages:c}=wr(),l=(0,Q.useRef)(null),u;e[0]!==a||e[1]!==o||e[2]!==c?(u=kG(c,o,a),e[0]=a,e[1]=o,e[2]=c,e[3]=u):u=e[3];let d=u,f,p;e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==n||e[9]!==r||e[10]!==d?(f=()=>{s||!r||l.current===d||(l.current=d,n({pages:c,folderPaths:o,assetPaths:a}))},p=[a,o,s,c,n,r,d],e[4]=a,e[5]=o,e[6]=s,e[7]=c,e[8]=n,e[9]=r,e[10]=d,e[11]=f,e[12]=p):(f=e[11],p=e[12]),(0,Q.useEffect)(f,p);let m,h;return e[13]!==t||e[14]!==o||e[15]!==s||e[16]!==i||e[17]!==c?(m=()=>{e();function e(){if(OG(window.location.hash))return;let e=Dr(window.location.hash);if(e){let t=ln(e.split(`.`).pop()??``);Ge(`ok/nav/hash-change`,{docName:null,kind:`asset`}),i({kind:`asset`,target:e,assetPath:e,mediaKind:t});return}let n=fr(window.location.hash);if(!n){Ge(`ok/nav/hash-change`,{docName:null,kind:`clear`}),t();return}if(s){Ge(`ok/nav/hash-change`,{docName:n,kind:`deferred-loading`});return}let r=sr(n,{pages:c,folderPaths:o});if(r.kind===`missing`&&/\/+$/.test(n.trim())){Ge(`ok/nav/hash-change`,{docName:n,kind:`deferred-missing-folder`});return}Ge(`ok/nav/hash-change`,{docName:n,kind:r.kind}),i(r)}return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},h=[t,o,s,i,c],e[13]=t,e[14]=o,e[15]=s,e[16]=i,e[17]=c,e[18]=m,e[19]=h):(m=e[18],h=e[19]),(0,Q.useEffect)(m,h),null}function jG(){let e=(0,$.c)(5),[t,n]=(0,Q.useState)(typeof window<`u`&&window.location.hash===DG),r,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){window.location.hash===DG&&n(!0)};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,Q.useEffect)(r,i);let a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=function(e){if(n(e),!e&&window.location.hash===DG){let{pathname:e,search:t}=window.location;window.history.replaceState(null,``,`${e}${t}`)}},e[2]=a):a=e[2];let o=a,s;return e[3]===t?s=e[4]:(s=(0,Z.jsx)(ta,{open:t,onOpenChange:o}),e[3]=t,e[4]=s),s}function MG(){let e=(0,$.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,Q.useEffect)(NG,t),null}function NG(){let e=function(e){let t=e.target;cp({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),window.location.hash!==`#settings`&&(window.location.hash=sp))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}function PG(){let e=(0,$.c)(8),{activeDocName:t,activeTarget:n}=We(),[r,i]=(0,Q.useState)(!1),a;e[0]!==t||e[1]!==n?(a=n?.kind===`folder`?n.folderPath:Jn(t),e[0]=t,e[1]=n,e[2]=a):a=e[2];let o=a,s,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=function(e){let t=e.target;Mf({target:t,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,key:e.key})&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},c=[],e[3]=s,e[4]=c):(s=e[3],c=e[4]),(0,Q.useEffect)(s,c);let l;return e[5]!==r||e[6]!==o?(l=(0,Z.jsx)(Pf,{open:r,onOpenChange:i,kind:`file`,initialDir:o}),e[5]=r,e[6]=o,e[7]=l):l=e[7],l}function FG(){let e=(0,$.c)(13),t=typeof window<`u`?window.okDesktop??null:null,[n,r]=(0,Q.useState)(!1),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Om,{}),e[0]=i):i=e[0];let a,o,s,c,l,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(bG,{}),o=(0,Z.jsx)(AG,{}),s=(0,Z.jsx)(PG,{}),c=(0,Z.jsx)(MG,{}),l=(0,Z.jsx)(jG,{}),u=(0,Z.jsx)(Au,{}),e[1]=a,e[2]=o,e[3]=s,e[4]=c,e[5]=l,e[6]=u):(a=e[1],o=e[2],s=e[3],c=e[4],l=e[5],u=e[6]);let d;e[7]===n?d=e[8]:(d=(0,Z.jsx)(xm,{bridge:t,open:n,onOpenChange:r}),e[7]=n,e[8]=d);let f;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Z.jsx)(gG,{onOpenSearch:()=>r(!0)}),e[9]=f):f=e[9];let p;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsxs)(wj,{className:`h-screen overflow-hidden`,children:[f,(0,Z.jsx)(Aj,{className:`overflow-hidden h-[calc(100vh-var(--layout-inset-offset))]`,children:(0,Z.jsx)(cN,{})})]}),e[10]=p):p=e[10];let m;return e[11]===d?m=e[12]:(m=(0,Z.jsx)(st,{name:`app`,children:(0,Z.jsx)(ot,{children:(0,Z.jsxs)(Si,{children:[i,(0,Z.jsxs)(mr,{children:[a,o,s,c,l,u,d,p]})]})})}),e[11]=d,e[12]=m),m}Bo(),typeof window<`u`&&window.okDesktop?.config.apiOrigin&&zu({apiOrigin:window.okDesktop.config.apiOrigin}),id()&&ud(),Ld(),typeof window<`u`&&Hu({bridge:window.okDesktop}),typeof window<`u`&&eo({bridge:window.okDesktop}),typeof window<`u`&&po({bridge:window.okDesktop}),typeof window<`u`&&Gu({bridge:window.okDesktop});var IG=new Yo({defaultOptions:{queries:{retry:1,staleTime:1e4}}}),LG=document.getElementById(`root`);if(!LG)throw Error(`Root element not found`);var RG=typeof window<`u`&&window.okDesktop?.config.mode===`navigator`;(0,as.createRoot)(LG).render((0,Z.jsx)(Q.StrictMode,{children:(0,Z.jsx)(Bt,{client:IG,children:(0,Z.jsxs)(mn,{attribute:`class`,defaultTheme:`system`,enableSystem:!0,disableTransitionOnChange:!0,storageKey:`ok-theme-v1`,children:[(0,Z.jsx)(lo,{children:RG&&window.okDesktop?(0,Z.jsx)(Pu,{bridge:window.okDesktop}):(0,Z.jsx)(FG,{})}),(0,Z.jsx)(Ru,{richColors:!0,closeButton:!0})]})})}));